Changeset 9317 for trunk


Ignore:
Timestamp:
02/11/09 12:36:28 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r9313 r9317  
    5555     - added Print
    5656     - added a circle around the mirror showing fMaxR
     57
     58   * mastro/MAstro.cc:
     59     - updated some typos in comments
     60
     61   * mbase/MEnv.cc:
     62     - replaced Form by MString::Format
     63
     64   * mbase/MTask.cc:
     65     - made the total number of executions really count the total
     66       number
     67
     68   * mcalib/MCalibrationPatternDecode.cc:
     69     - some cosmetics
     70     - corrected the use of a wrong FindCreateObj
     71
     72   * mcorsika/MCorsikaRead.cc:
     73     - added a comment
     74
     75   * mfileio/MWriteRootFile.cc:
     76     - improved output
     77     - improved the copy of a tree (now done without unpacking)
     78     - made sure that copied trees are shown in the summary
     79     - made sure that the copied trees are nevertheless deleted
     80
     81   * mfilter/MFDeltaT.cc:
     82     - adapted to change in GetNumExecutions
     83
     84   * mhbase/MFillH.cc:
     85     - set the number of executions (as it is in MTask) before the
     86       execution
     87
     88   * mhbase/MH.cc:
     89     - improved the statistics output
     90
     91   * mhist/MHCamera.[h,cc]:
     92     - don't create an own pad anymore
     93     - removed SetRange
     94     - SetRange now done via MH::SetPadRange
     95     - some sanity checks if fGeomCam is set
     96     - some adaptions to the new layout scheme without
     97       an own pad
     98     - Changed DrawProjection to a more commonly usable scheme
     99     - Removed all dependencies from MGeomCamMagic
     100     - start the gaus fit with the maximum not the integral
     101
     102   * mjobs/MJCalibrateSignal.cc:
     103     - If the input files contain an OriginalMC tree
     104       copy it
     105     - consequently we make the MMcEvtBasic from the
     106       parameter-list optional
     107     - fixed the rule (MC files with .root as extension could not
     108       be processed)
     109
     110   * mjobs/MJCalibration.[h,cc], mjobs/MJPedestal.[h,cc]:
     111     - Use MHCamera::CamDraw more extensively
     112     - replace use of Form by MString::Format
     113
     114   * mjobs/MJSimulation.cc:
     115     - added an option to switch the cmaera electronics off
     116     - write some more containers to output file (for easy access)
     117     - set the MC bit in the header
     118     - now use MSimMMCS to "fake" the correct file structure
     119     - added three new writers to write the MMcEvtBasic information
     120     - added a display of the most important things
     121
     122   * mmain/MEventDisplay.cc:
     123     - don't change into the not more existing pad of a MHCamera
     124
     125   * msimcamera/MSimCalibrationSignal.cc:
     126     - adapted GetNumExecution
     127     - SetReadyToSave for the run header
     128     - jitter the number of emitted photons
     129     - corrected the emitted trigger positon
     130     - (re)set calibration pattern
    57131
    58132
  • trunk/MagicSoft/Mars/NEWS

    r9308 r9317  
    4141
    4242   * The daq event number now represents the readout number
     43
     44   * The camera ''electronics'' can now be ''switched off''
     45
     46   * A new tab ''info'' now display basic things like the reflector
     47     layout
    4348
    4449
  • trunk/MagicSoft/Mars/mhist/MHCamera.cc

    r9316 r9317  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MHCamera.cc,v 1.115 2009-02-11 12:17:43 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MHCamera.cc,v 1.116 2009-02-11 12:25:42 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    23252325    }
    23262326}
    2327 /*
     2327
    23282328// --------------------------------------------------------------------------
    23292329//
     
    23392339    obj2->Draw();
    23402340    obj2->SetBit(kCanDelete);
    2341 
     2341/*
    23422342    if (GetGeomCam().InheritsFrom("MGeomCamMagic"))
    23432343    {
     
    23752375        }
    23762376    }
     2377*/
    23772378}
    23782379
     
    23922393    obj2->Fit("pol0","Q","");
    23932394    obj2->GetFunction("pol0")->SetLineWidth(1);
    2394 
     2395/*
    23952396    if (GetGeomCam().InheritsFrom("MGeomCamMagic"))
    23962397    {
     
    24152416        }
    24162417    }
    2417 }
    24182418*/
     2419}
     2420
    24192421// --------------------------------------------------------------------------
    24202422//
     
    24352437//
    24362438void MHCamera::CamDraw(TCanvas &c, const Int_t x, const Int_t y,
    2437                        const Int_t fit, /*const Int_t rad, const Int_t azi,*/
     2439                       const Int_t fit, const Int_t rad, const Int_t azi,
    24382440                       TObject *notify)
    24392441{
     
    24552457
    24562458    Int_t cnt = 2;
    2457 /*
     2459
    24582460    if (rad)
    24592461    {
     
    24732475        cnt++;
    24742476    }
    2475   */
     2477
    24762478    if (fit<0)
    24772479        return;
  • trunk/MagicSoft/Mars/mhist/MHCamera.h

    r9316 r9317  
    11/* ======================================================================== *\
    2 !  $Name: not supported by cvs2svn $:$Id: MHCamera.h,v 1.68 2009-02-11 12:17:43 tbretz Exp $
     2!  $Name: not supported by cvs2svn $:$Id: MHCamera.h,v 1.69 2009-02-11 12:25:42 tbretz Exp $
    33\* ======================================================================== */
    44#ifndef MARS_MHCamera
     
    230230    TObject *DrawClone(Option_t *option="") const;
    231231    void     DrawProjection (Int_t fit=0) const;
    232 //    void     DrawRadialProfile()           const;
    233 //    void     DrawAzimuthProfile()          const;
     232    void     DrawRadialProfile()           const;
     233    void     DrawAzimuthProfile()          const;
    234234
    235235    void     SavePrimitive(ostream &out, Option_t *);
     
    319319   
    320320    void CamDraw(TCanvas &c, const Int_t x, const Int_t y,
    321                  const Int_t fit, /*const Int_t rad=0, const Int_t azi=0,*/
     321                 const Int_t fit, const Int_t rad=0, const Int_t azi=0,
    322322                 TObject *notify=NULL);             
    323323   
  • trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc

    r9294 r9317  
    380380    read->AddFiles(iter);
    381381
    382     const TString fname(Form("s/([0-9]+(_M[12])?_[0-9.]+)_D_(.*[.])(raw([.]gz)?)$/%s\\/$1_Y_$3root/",
     382    const TString fname(Form("s/([0-9]+(_M[12])?_[0-9.]+)_D_(.*[.])(raw|raw[.]gz|root)$/%s\\/$1_Y_$3root/",
    383383                             Esc(fPathOut).Data()));
    384384
     
    758758    MWriteRootFile writemc(2, fname, fOverwrite?"RECREATE":"NEW", "Calibrated Data");
    759759    writemc.SetName("WriteMC");
    760     writemc.AddContainer("MMcEvtBasic", "OriginalMC");
     760    writemc.AddContainer("MMcEvtBasic", "OriginalMC", kFALSE);
     761    if (fSequence.IsMonteCarlo())
     762        writemc.AddCopySource("OriginalMC");
    761763
    762764    // Write the special calib tree
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.cc

    r9017 r9317  
    1919!   Author(s): Markus Gaug, 02/2004 <mailto:markus@ifae.es>
    2020!
    21 !   Copyright: MAGIC Software Development, 2000-2008
     21!   Copyright: MAGIC Software Development, 2000-2009
    2222!
    2323!
     
    105105
    106106#include "MEnv.h"
     107#include "MString.h"
    107108#include "MDirIter.h"
    108109#include "MSequence.h"
     
    551552    if (fDisplayType == kDataCheckDisplay)
    552553    {
     554      // -------------------- FitCharge -------------------
    553555
    554556      TCanvas &c1 = fDisplay->AddTab("FitCharge");
    555557      c1.Divide(3, 3);
    556558
    557       //
    558       // MEAN CHARGES
    559       //
    560       c1.cd(1);
    561       gPad->SetBorderMode(0);
    562       gPad->SetTicks();
    563       MHCamera *obj1=(MHCamera*)disp1.DrawCopy("hist");
    564       FixDataCheckHist(*obj1/*, fChargeMin, fChargeMax*/);
    565       // DisplayReferenceLines(obj1,0);
    566 
    567       c1.cd(4);
    568       gPad->SetBorderMode(0);
    569       obj1->SetPrettyPalette();
    570       obj1->Draw();
    571 
    572       c1.cd(7);
    573       gPad->SetBorderMode(0);
    574       gPad->SetTicks();
    575       TH1D *obj2 = (TH1D*)obj1->Projection();
    576       obj2->SetBit(kCanDelete);
    577       obj2->Draw();
    578       FixDataCheckHist(*obj2);
    579       //obj2->SetStats(1);
    580 
    581       //
    582       // RMS per Charge
    583       //
    584       c1.cd(2);
    585       gPad->SetBorderMode(0);
    586       gPad->SetTicks();
    587       MHCamera *obj3=(MHCamera*)disp36.DrawCopy("hist");
    588       FixDataCheckHist(*obj3/*, 0, fChargeMax*/);
    589       //  DisplayReferenceLines(obj3,0);
    590 
    591       c1.cd(5);
    592       gPad->SetBorderMode(0);
    593       obj3->SetPrettyPalette();
    594       obj3->Draw();
    595 
    596       c1.cd(8);
    597       gPad->SetBorderMode(0);
    598       if (geomcam.InheritsFrom("MGeomCamMagic"))
    599           DisplayDoubleProject(disp36/*, "dead", "noisy"*/);
    600 
    601       //
    602       // PHOTO ELECTRONS
    603       //
    604       c1.cd(3);
    605       gPad->SetBorderMode(0);
    606       gPad->SetTicks();
    607       MHCamera *obj4=(MHCamera*)disp5.DrawCopy("hist");
    608       FixDataCheckHist(*obj4/*, fChargeMin, fChargeMax*/);
    609       // DisplayReferenceLines(obj3,0);
    610 
    611       c1.cd(6);
    612       gPad->SetBorderMode(0);
    613       obj4->SetPrettyPalette();
    614       obj4->Draw();
    615 
    616       c1.cd(9);
    617       gPad->SetBorderMode(0);
    618       if (geomcam.InheritsFrom("MGeomCamMagic"))
    619           DisplayDoubleProject(disp5/*, "dead", "noisy"*/);
    620 
    621       //
    622       // CONVERSION FACTORS
    623       //
     559      disp1.CamDraw( c1, 1, 3, 6);   // MEAN CHARGES
     560      disp36.CamDraw(c1, 2, 3, 6);   // RMS per Charge
     561      disp5.CamDraw( c1, 3, 3, 6);   // PHOTO ELECTRONS
     562
     563      // -------------------- Conversion -------------------
     564
    624565      TCanvas &c2 = fDisplay->AddTab("Conversion");
    625566      c2.Divide(3,3);
    626567
     568      disp6.SetMinMax(fConvFADC2PheMin, fConvFADC2PheMax);
     569      disp8.SetMinMax(fQEMin, fQEMax);
     570      disp37.SetMinMax(fConvFADC2PheMin, fConvFADC2PheMax);
     571
     572      disp6.CamDraw( c2, 1, 3, 6);   // CONVERSION FACTORS
     573      disp8.CamDraw( c2, 2, 3, 6);   // QUANTUM EFFICIENCY
     574      disp37.CamDraw(c2, 3, 3, 6);   // CONVERSION FADC TO PHOTONS
     575
    627576      c2.cd(1);
    628       gPad->SetBorderMode(0);
    629       gPad->SetTicks();
    630       MHCamera *obj5=(MHCamera*)disp6.DrawCopy("hist");
    631       FixDataCheckHist(*obj5, fConvFADC2PheMin, fConvFADC2PheMax);
    632       DisplayReferenceLines(obj5,2);
    633 
    634       c2.cd(4);
    635       gPad->SetBorderMode(0);
    636       obj5->SetPrettyPalette();
    637       obj5->Draw();
    638 
    639       c2.cd(7);
    640       gPad->SetBorderMode(0);
    641       if (geomcam.InheritsFrom("MGeomCamMagic"))
    642           DisplayDoubleProject(disp6/*, "noisy", "dead"*/);
    643 
    644       //
    645       // QUANTUM EFFICIENCY
    646       //
     577      DisplayReferenceLines(disp6, 2);
     578
    647579      c2.cd(2);
    648       gPad->SetBorderMode(0);
    649       gPad->SetTicks();
    650       MHCamera *obj6=(MHCamera*)disp8.DrawCopy("hist");
    651       FixDataCheckHist(*obj6, fQEMin, fQEMax);
    652       DisplayReferenceLines(obj6,0);
    653 
    654       c2.cd(5);
    655       gPad->SetBorderMode(0);
    656       obj6->SetPrettyPalette();
    657       obj6->Draw();
    658 
    659       c2.cd(8);
    660       gPad->SetBorderMode(0);
    661       if (geomcam.InheritsFrom("MGeomCamMagic"))
    662           DisplayDoubleProject(disp8/*, "noisy", "dead"*/);
    663 
    664       //
    665       // CONVERSION FADC TO PHOTONS
    666       //
     580      DisplayReferenceLines(disp8, 0);
     581
    667582      c2.cd(3);
    668       gPad->SetBorderMode(0);
    669       gPad->SetTicks();
    670       MHCamera *obj7=(MHCamera*)disp37.DrawCopy("hist");
    671       FixDataCheckHist(*obj7, fConvFADC2PheMin, fConvFADC2PheMax);
    672       DisplayReferenceLines(obj7,1);
    673 
    674       c2.cd(6);
    675       gPad->SetBorderMode(0);
    676       obj7->SetPrettyPalette();
    677       obj7->Draw();
    678       c2.cd(9);
    679       gPad->SetBorderMode(0);
    680       if (geomcam.InheritsFrom("MGeomCamMagic"))
    681           DisplayDoubleProject(disp37/*, "noisy", "dead"*/);
    682 
    683       //
    684       // ARRIVAL TIMES
    685       //
     583      DisplayReferenceLines(disp37, 1);
     584
     585      // -------------------- AbsTimes -------------------
     586
    686587      TCanvas &c3 = fDisplay->AddTab("AbsTimes");
    687588      c3.Divide(2,3);
    688589
     590      disp28.SetMinMax(fArrivalTimeMin, fArrivalTimeMax);
     591
     592      disp28.CamDraw(c3, 1, 2, 6);  // Arrival times
     593      disp29.CamDraw(c3, 2, 2, 6);  // Arrival times rms
     594
    689595      c3.cd(1);
    690       gPad->SetBorderMode(0);
    691       gPad->SetTicks();
    692       MHCamera *obj10=(MHCamera*)disp28.DrawCopy("hist");
    693       FixDataCheckHist(*obj10, fArrivalTimeMin, fArrivalTimeMax);
    694       DisplayReferenceLines(obj10,3);
    695 
    696       c3.cd(3);
    697       gPad->SetBorderMode(0);
    698       obj10->SetPrettyPalette();
    699       obj10->Draw();
    700 
    701       c3.cd(5);
    702       gPad->SetBorderMode(0);
    703       if (geomcam.InheritsFrom("MGeomCamMagic"))
    704           DisplayDoubleProject(disp28/*, "early", "late"*/);
    705 
    706       //
    707       // ARRIVAL TIMES JITTER
    708       //
     596      DisplayReferenceLines(disp28, 3);
     597
    709598      c3.cd(2);
    710       gPad->SetBorderMode(0);
    711       gPad->SetTicks();
    712       MHCamera *obj11=(MHCamera*)disp29.DrawCopy("hist");
    713       FixDataCheckHist(*obj11/*, fArrivalTimeMin, fArrivalTimeMax*/);
    714       DisplayReferenceLines(obj11,4);
    715 
    716       c3.cd(4);
    717       gPad->SetBorderMode(0);
    718       obj11->SetPrettyPalette();
    719       obj11->Draw();
    720 
    721       c3.cd(6);
    722       gPad->SetBorderMode(0);
    723       if (geomcam.InheritsFrom("MGeomCamMagic"))
    724           DisplayDoubleProject(disp29/*, "", "jittering"*/);
     599      DisplayReferenceLines(disp29, 4);
     600
     601      if (IsRelTimes())
     602      {
     603          // -------------------- RelTimes -------------------
     604
     605          TCanvas &c5 = fDisplay->AddTab("RelTimes");
     606          c5.Divide(2,3);
     607
     608          disp30.SetMinMax(fTimeOffsetMin, fTimeOffsetMax);
     609          disp31.SetMinMax(fTimeResolutionMin, fTimeResolutionMax);
     610
     611          disp30.CamDraw(c5, 1, 2, 6); // MEAN REL. ARR. TIMES
     612          disp31.CamDraw(c5, 2, 2, 6); // JITTER Rel. Arr. Times
     613
     614          c5.cd(1);
     615          DisplayReferenceLines(disp30, 5);
     616
     617          c5.cd(2);
     618          DisplayReferenceLines(disp31, 6);
     619      }
     620
     621      // -------------------- Unsuitable -------------------
    725622
    726623      //
     
    754651      obj9->SetPrettyPalette();
    755652      obj9->Draw();
    756 
    757       if (IsRelTimes())
    758         {
    759           TCanvas &c5 = fDisplay->AddTab("RelTimes");
    760           c5.Divide(2,3);
    761 
    762           //
    763           // MEAN REL. ARR. TIMES
    764           //
    765           c5.cd(1);
    766           gPad->SetBorderMode(0);
    767           gPad->SetTicks();
    768           MHCamera *obj12=(MHCamera*)disp30.DrawCopy("hist");
    769           FixDataCheckHist(*obj12, fTimeOffsetMin, fTimeOffsetMax);
    770           DisplayReferenceLines(obj12,5);
    771 
    772           c5.cd(3);
    773           gPad->SetBorderMode(0);
    774           obj10->SetPrettyPalette();
    775           obj10->Draw();
    776 
    777           c5.cd(5);
    778           gPad->SetBorderMode(0);
    779           if (geomcam.InheritsFrom("MGeomCamMagic"))
    780               DisplayDoubleProject(disp30/*, "early", "late"*/);
    781 
    782           //
    783           // JITTER Rel. Arr. Times
    784           //
    785           c5.cd(2);
    786           gPad->SetBorderMode(0);
    787           gPad->SetTicks();
    788           MHCamera *obj13=(MHCamera*)disp31.DrawCopy("hist");
    789           FixDataCheckHist(*obj13, fTimeResolutionMin, fTimeResolutionMax);
    790           DisplayReferenceLines(obj13,6);
    791 
    792           c5.cd(4);
    793           gPad->SetBorderMode(0);
    794           obj13->SetPrettyPalette();
    795           obj13->Draw();
    796 
    797           c5.cd(6);
    798           gPad->SetBorderMode(0);
    799           if (geomcam.InheritsFrom("MGeomCamMagic"))
    800               DisplayDoubleProject(disp31/*, "too stable", "jittering"*/);
    801 
    802         }
    803653      return;
    804654    }
     
    989839    }
    990840}
    991    
    992 
    993 void  MJCalibration::DisplayReferenceLines(const MHCamera *cam, const Int_t what) const
     841
     842void  MJCalibration::DisplayReferenceLines(const MHCamera &hist, const Int_t what) const
    994843{
     844    MHCamera *cam = dynamic_cast<MHCamera*>(gPad->FindObject(hist.GetName()));
     845    if (!cam)
     846        return;
    995847
    996848  const MGeomCam *geom = cam->GetGeometry();
    997849
    998   Double_t x = geom->InheritsFrom("MGeomCamMagic") ? 397 : cam->GetNbinsX() ;
     850  const Double_t x = geom->InheritsFrom("MGeomCamMagic") ? 397 : cam->GetNbinsX() ;
    999851
    1000852  TLine line;
     
    17281580        SetUsePINDiode(kFALSE);
    17291581
     1582    // Only display result if PreProcessing was successfull
    17301583    const Int_t numexec = !fSequence.IsMonteCarlo() ? rawread.GetNumExecutions() : read.GetNumExecutions();
    17311584    if (numexec>0)
     
    18771730}
    18781731
     1732
    18791733void MJCalibration::DisplayDoubleProject(const MHCamera &cam)
    18801734{
     1735    const UInt_t n = cam.GetGeometry()->GetNumAreas();
     1736
    18811737    TVirtualPad *pad = gPad;
    1882     pad->Divide(2, 1, 1e-5, 1e-5);;
    1883 
    1884     for (int i=0; i<2; i++)
     1738    pad->Divide(n, 1, 1e-5, 1e-5);;
     1739
     1740    for (UInt_t i=0; i<n; i++)
    18851741    {
    18861742        pad->cd(i+1);
     
    18881744        gPad->SetTicks();
    18891745
    1890         TH1D &h = *cam.ProjectionS(TArrayI(), TArrayI(1, &i), Form("%s_%s", cam.GetName(), i==0?"Inner":"Outer"));
     1746        TH1D &h = *cam.ProjectionS(TArrayI(), TArrayI(1, (Int_t*)&i), MString::Format("%s_%d", cam.GetName(), i));
    18911747        FixDataCheckHist(h);
    1892         h.SetTitle(Form("%s %s",cam.GetTitle(), i==0?"Inner":"Outer"));
     1748        h.SetTitle(MString::Format("%s %d",cam.GetTitle(), i));
    18931749        h.SetDirectory(NULL);
    18941750        h.SetBit(kCanDelete);
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.h

    r8990 r9317  
    122122 
    123123  void DisplayResult(MParList &plist);
    124   void DisplayReferenceLines(const MHCamera *cam, const Int_t what) const;
     124  void DisplayReferenceLines(const MHCamera &hist, const Int_t what) const;
    125125  //void   DisplayOutliers      ( TH1D     *hist, const char* whatsmall, const char* whatbig ) const;
    126126
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.cc

    r9157 r9317  
    9393#include "MFDataMember.h"
    9494
    95 // Display helpers
    96 #include "MJCalibration.h"
    97 
    9895ClassImp(MJPedestal);
    9996
     
    365362*/
    366363    if (fDisplayType == kDisplayDataCheck)
    367       {
     364    {
    368365
    369366        TCanvas &c3 = fDisplay->AddTab(fExtractionType!=kFundamental/*fExtractorResolution*/ ? "PedExtrd" : "Ped");
    370367        c3.Divide(2,3);
    371368
     369        if (fExtractionType==kFundamental)
     370            disp0.SetMinMax(fPedestalMin, fPedestalMax);
     371        disp1.SetMinMax(fPedRmsMin, fPedRmsMax);
     372
     373        disp0.CamDraw(c3, 1, 2, 0);  // Don't devide, don't fit
     374        disp1.CamDraw(c3, 2, 2, 6);  // Divide, fit
     375
    372376        c3.cd(1);
    373         gPad->SetBorderMode(0);
    374         gPad->SetTicks();
    375         MHCamera *obj1=(MHCamera*)disp0.DrawCopy("hist");
    376         //
    377         // for the datacheck, fix the ranges!!
    378         //
    379         if (fExtractionType==kFundamental/*!fExtractorResolution*/)
    380           {
    381             obj1->SetMinimum(fPedestalMin);
    382             obj1->SetMaximum(fPedestalMax);
    383           }
    384         //
    385         // Set the datacheck sizes:
    386         //
    387         FixDataCheckHist((TH1D*)obj1);
    388         //
    389         // set reference lines
    390         //
    391         DisplayReferenceLines(obj1,0);
    392         //
    393         // end reference lines
    394         //
    395         c3.cd(3);
    396         gPad->SetBorderMode(0);
    397         obj1->SetPrettyPalette();
    398         obj1->Draw();
    399 
    400         c3.cd(5);
    401         gPad->SetBorderMode(0);
    402         gPad->SetTicks();
    403         TH1D *obj2 = (TH1D*)obj1->Projection();
    404         obj2->Draw();
    405         obj2->SetBit(kCanDelete);
    406         obj2->Fit("gaus","Q");
    407         obj2->GetFunction("gaus")->SetLineColor(kYellow);
    408         //
    409         // Set the datacheck sizes:
    410         //
    411         FixDataCheckHist(obj2);
    412         obj2->SetStats(1);
     377        if (fExtractionType==kFundamental)
     378            DisplayReferenceLines(disp0, 0);
    413379
    414380        c3.cd(2);
    415         gPad->SetBorderMode(0);
    416         gPad->SetTicks();
    417         MHCamera *obj3=(MHCamera*)disp1.DrawCopy("hist");
    418         //
    419         // for the datacheck, fix the ranges!!
    420         //
    421         obj3->SetMinimum(fPedRmsMin);
    422         obj3->SetMaximum(fPedRmsMax);
    423         //
    424         // Set the datacheck sizes:
    425         //
    426         FixDataCheckHist((TH1D*)obj3);
    427         //
    428         // set reference lines
    429         //
    430         DisplayReferenceLines(obj3,1);
    431 
    432         c3.cd(4);
    433         gPad->SetBorderMode(0);
    434         obj3->SetPrettyPalette();
    435         obj3->Draw();
    436 
    437         c3.cd(6);
    438         gPad->SetBorderMode(0);
    439 
    440         if (geomcam.InheritsFrom("MGeomCamMagic"))
    441         {
    442             MJCalibration::DisplayDoubleProject(disp1);
    443             return;
    444         }
    445       }
     381        DisplayReferenceLines(disp1, 1);
     382
     383        return;
     384    }
    446385
    447386    if (fExtractionType!=kFundamental/*fExtractorResolution*/)
    448       {
     387    {
    449388
    450389          TCanvas &c3 = fDisplay->AddTab(fExtractionType==kWithExtractor?"PedExtrd":"PedRndm");
    451390          c3.Divide(2,3);
    452391
    453           disp0.CamDraw(c3, 1, 2, 1);
    454           disp1.CamDraw(c3, 2, 2, 6);
     392          disp0.CamDraw(c3, 1, 2, 1);  // Don't divide, fit
     393          disp1.CamDraw(c3, 2, 2, 6);  // Divide, fit
    455394
    456395          TCanvas &c13 = fDisplay->AddTab(fExtractionType==kWithExtractor?"DiffExtrd":"DiffRndm");
    457396          c13.Divide(2,3);
    458397
    459           disp9.CamDraw(c13, 1, 2, 5);
    460           disp10.CamDraw(c13, 2, 2, 5);
    461           return;
    462       }
    463 }
    464 
    465 void  MJPedestal::DisplayReferenceLines(MHCamera *cam, const Int_t what) const
    466 {
    467 
    468   Double_t x = cam->GetNbinsX();
    469  
     398          disp9.CamDraw(c13,  1, 2, 1);
     399          disp10.CamDraw(c13, 2, 2, 1);
     400    }
     401}
     402
     403void  MJPedestal::DisplayReferenceLines(const MHCamera &hist, const Int_t what) const
     404{
     405    MHCamera *cam = dynamic_cast<MHCamera*>(gPad->FindObject(hist.GetName()));
     406    if (!cam)
     407        return;
     408
    470409  const MGeomCam *geom = cam->GetGeometry();
    471410
    472   if (geom->InheritsFrom("MGeomCamMagic"))
    473     x = what ? 397 : cam->GetNbinsX();
     411  const Double_t x = geom->InheritsFrom("MGeomCamMagic") && what ? 397 : cam->GetNbinsX() ;
    474412
    475413  TLine line;
     
    478416  line.SetLineColor(kBlue);
    479417 
    480   TLegend *leg = new TLegend(0.6,0.75,0.9,0.99);
     418  TLegend *leg = new TLegend(0.75,0.75,0.999,0.99);
    481419  leg->SetBit(kCanDelete);
    482420
     
    522460 
    523461   
    524   leg->AddEntry(l1, "Galactic Source","l");
    525   leg->AddEntry(l2, "Extra-Galactic Source","l");
     462  leg->AddEntry(l1, "Galactic","l");
     463  leg->AddEntry(l2, "Extra-Galactic","l");
    526464  leg->AddEntry(l3, "Closed Lids","l");
    527465  leg->Draw();
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.h

    r9157 r9317  
    8787
    8888    void   DisplayResult(const MParList &plist);
    89     void   DisplayReferenceLines(MHCamera *cam, const Int_t what) const;
     89    void   DisplayReferenceLines(const MHCamera &hist, const Int_t what) const;
    9090    //void   DisplayOutliers(TH1D *hist) const;
    9191    void   FixDataCheckHist(TH1D *hist) const;
  • trunk/MagicSoft/Mars/mjobs/MJSimulation.cc

    r9309 r9317  
    3434//
    3535//
     36// To switch off the simulation of the camera electronics, use:
     37//
     38//    Camera: Off
     39//
     40// Note, that the border of the camera and the propertied of the cones
     41// are still simulated (simply because it is fast). Furthermore, this
     42// switches off the trigger for the output, i.e. all data which deposits
     43// at least one photon in at least one pixel is written to the output file.
     44//
     45//
    3646// In case of a pedestal or calibration run the artificial trigger can
    3747// be "switched off" and the cosmics trrigger "switched on" by setting
     
    4555
    4656#include <TEnv.h>
     57#include <TCanvas.h>
    4758
    4859// Core
     
    8697
    8798#include "MHn.h"
     99#include "MHCamera.h"
    88100#include "MHCamEvent.h"
    89101#include "MHPhotonEvent.h"
     
    95107#include "MParEnv.h"
    96108#include "MPulseShape.h"
     109#include "MGeomCam.h"
    97110
    98111#include "MPedestalCam.h"
     
    110123//
    111124MJSimulation::MJSimulation(const char *name, const char *title)
    112     : fForceMode(kFALSE), fForceTrigger(kFALSE)
     125    : fForceMode(kFALSE), fCamera(kTRUE) ,fForceTrigger(kFALSE)
    113126{
    114127    fName  = name  ? name  : "MJSimulation";
     
    120133    fForceMode    = GetEnv("ForceMode",    fForceMode);
    121134    fForceTrigger = GetEnv("ForceTrigger", fForceTrigger);
     135    fCamera       = GetEnv("Camera",       fCamera);
    122136
    123137    return kTRUE;
    124138}
    125139
    126 Bool_t MJSimulation::WriteResult()
     140Bool_t MJSimulation::WriteResult(const MParList &plist)
    127141{
    128142    if (fPathOut.IsNull())
     
    135149    cont.Add(const_cast<TEnv*>(GetEnv()));
    136150    //cont.Add(const_cast<MSequence*>(&fSequence));
     151
     152    cont.Add(plist.FindObject("MPulseShape"));
     153    cont.Add(plist.FindObject("MReflector"));
     154    cont.Add(plist.FindObject("MGeomCam"));
     155    cont.Add(plist.FindObject("GeomAPDs"));
    137156
    138157    if (fDisplay)
     
    246265    plist.AddToList(&shape);
    247266
     267    // *** FIXME *** FIXME *** FIXME ***
     268    plist.FindCreateObj("MMcRunHeader");
     269
    248270    MRawRunHeader header;
    249271    header.SetValidMagicNumber();
    250272    //header.InitFadcType(3);
    251273
    252     header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTData,        1, 1);
     274    header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTData);
    253275    if (args.GetNumArguments()==1)
    254276    {
    255277        if (!args.GetArgumentStr(0).CompareTo("pedestal", TString::kIgnoreCase))
    256278        {
    257             header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTPedestal,    1, 1);
     279            header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTPedestal);
    258280            header.SetSourceInfo("Pedestal");
    259281        }
    260282        if (!args.GetArgumentStr(0).CompareTo("calibration", TString::kIgnoreCase))
    261283        {
    262             header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTCalibration,    1, 1);
     284            header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTCalibration);
    263285            header.SetSourceInfo("Calibration");
    264286        }
    265287        if (!args.GetArgumentStr(0).CompareTo("pointrun", TString::kIgnoreCase))
    266             header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTPointRun,    1, 1);
     288            header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTPointRun);
    267289    }
    268290
    269291    // FIXME: Move to MSimPointingPos, MSimCalibrationSignal
     292    //        Can we use this as input for MSimPointingPos?
    270293    header.SetObservation("On", "MonteCarlo");
    271294    plist.AddToList(&header);
     
    287310    for (int i=0; i<args.GetNumArguments();i ++)
    288311        read.AddFile(args.GetArgumentStr(i));
     312
     313    MSimMMCS simmmcs;
    289314
    290315    MSimAbsorption absapd("AbsorptionAPDs");
     
    385410    const TString rule3(Form("s/cer([0-9]+)/%s\\/cam$1.root/", Esc(fPathOut).Data()));
    386411
    387     MWriteRootFile write1( 2, rule1, fOverwrite?"RECREATE":"NEW", "Reflector file");
    388     MWriteRootFile write2( 2, rule2, fOverwrite?"RECREATE":"NEW", "Signal file");
    389     MWriteRootFile write3( 2, rule3, fOverwrite?"RECREATE":"NEW", "Camera file");
    390 
    391     write1.SetName("WriteRef");
    392     write2.SetName("WriteSig");
    393     write3.SetName("WriteCam");
    394 
    395     write1.AddContainer("MCorsikaEvtHeader", "Events", kFALSE);
    396     write1.AddContainer("MPhotonEvent",      "Events");
    397 
    398     write2.AddContainer("MRawRunHeader",             "RunHeaders");
    399     write2.AddContainer("MGeomCam",                  "RunHeaders");
    400     write2.AddContainer("MSignalCam",                "Events");
    401     write2.AddContainer("MRawEvtHeader",             "Events");
    402     write2.AddContainer("MPedPhotFromExtractorRndm", "RunHeaders");
     412    MWriteRootFile write3a( 2, rule3, fOverwrite?"RECREATE":"NEW", "Camera file");
     413    MWriteRootFile write3b( 2, rule3, fOverwrite?"RECREATE":"NEW", "Camera file");
     414    MWriteRootFile write2a( 2, rule2, fOverwrite?"RECREATE":"NEW", "Signal file");
     415    MWriteRootFile write2b( 2, rule2, fOverwrite?"RECREATE":"NEW", "Signal file");
     416    MWriteRootFile write1a( 2, rule1, fOverwrite?"RECREATE":"NEW", "Reflector file");
     417    MWriteRootFile write1b( 2, rule1, fOverwrite?"RECREATE":"NEW", "Reflector file");
     418
     419    write1a.SetName("WriteRefData");
     420    write1b.SetName("WriteRefMC");
     421    write2a.SetName("WriteSigData");
     422    write2b.SetName("WriteSigMC");
     423    write3a.SetName("WriteCamData");
     424    write3b.SetName("WriteCamMC");
     425
     426    write1a.AddContainer("MCorsikaEvtHeader", "Events", kFALSE);
     427    write1a.AddContainer("MPhotonEvent",      "Events");
     428
     429    write2a.AddContainer("MCorsikaRunHeader", "RunHeaders", kFALSE);
     430    write2a.AddContainer("MRawRunHeader",     "RunHeaders");
     431    write2a.AddContainer("MGeomCam",          "RunHeaders");
     432    write2a.AddContainer("MSignalCam",        "Events");
     433    write2a.AddContainer("MRawEvtHeader",     "Events",    kFALSE);
     434    write2a.AddContainer("MPedPhotFromExtractorRndm", "RunHeaders"); // FIXME: Needed for the signal files to be display in MARS
     435    write2a.AddContainer("MMcRunHeader",       "RunHeaders");
    403436    /* Monte Carlo Headers
    404437    write.AddContainer("MMcRunHeader",              "RunHeaders", kFALSE);
     
    417450    //write.AddContainer("MTriggerPattern",           "Events");
    418451
    419     write3.AddContainer("MRawEvtData",   "Events");
    420     write3.AddContainer("MRawRunHeader", "RunHeaders");
    421     write3.AddContainer("MGeomCam",      "RunHeaders");
    422     write3.AddContainer("MRawEvtHeader", "Events");
    423     write3.AddContainer("MPedestalCam",  "RunHeaders", kFALSE);
     452    write3a.AddContainer("MRawEvtData",         "Events");
     453    write3a.AddContainer("MRawRunHeader",       "RunHeaders");
     454    write3a.AddContainer("MGeomCam",            "RunHeaders");
     455    write3a.AddContainer("MRawEvtHeader",       "Events",     kFALSE);
     456    //write3.AddContainer("MPedestalCam",  "RunHeaders", kFALSE);
     457    write3a.AddContainer("MMcRunHeader",        "RunHeaders");
     458    write3a.AddContainer("MMcCorsikaRunHeader", "RunHeaders", kFALSE);
     459    write3a.AddContainer("MMcEvt",              "Events",     kFALSE);
     460
     461    write1b.AddContainer("MMcEvtBasic",         "OriginalMC");
     462    write2b.AddContainer("MMcEvtBasic",         "OriginalMC");
     463    write3b.AddContainer("MMcEvtBasic",         "OriginalMC");
    424464
    425465    // -------------------------------------------------------------------
     
    500540        tasks.AddToList(&read);
    501541        tasks.AddToList(&pointing);
     542        tasks.AddToList(&simmmcs);
     543        if (!fPathOut.IsNull() && !HasNullOut())
     544        {
     545            tasks.AddToList(&write1b);
     546            tasks.AddToList(&write2b);
     547            if (fCamera)
     548                tasks.AddToList(&write3b);
     549        }
    502550        //    if (header.IsPointRun())
    503551        //        tasks.AddToList(&stars);
     
    536584        tasks.AddToList(&cont2);
    537585    }
    538     if (header.IsPedestalRun() || header.IsCalibrationRun())
    539         tasks.AddToList(&simcal);
    540     tasks.AddToList(&simnsb);
    541     tasks.AddToList(&simapd);
    542     tasks.AddToList(&simexcnoise);
     586    if (fCamera)
     587    {
     588        if (header.IsPedestalRun() || header.IsCalibrationRun())
     589            tasks.AddToList(&simcal);
     590        tasks.AddToList(&simnsb);
     591        tasks.AddToList(&simapd);
     592        tasks.AddToList(&simexcnoise);
     593    }
    543594    tasks.AddToList(&simsum);
    544     tasks.AddToList(&simcam);
    545     if (header.IsDataRun() || fForceTrigger)
    546         tasks.AddToList(&simtrig);
    547     tasks.AddToList(&conttrig);
     595    if (fCamera)
     596    {
     597        tasks.AddToList(&simcam);
     598        if (header.IsDataRun() || fForceTrigger)
     599            tasks.AddToList(&simtrig);
     600        tasks.AddToList(&conttrig);
     601        tasks.AddToList(&simdaq);
     602    }
    548603    tasks.AddToList(&simsignal);  // What do we do if signal<0?
    549     tasks.AddToList(&simdaq);
    550604    if (!fPathOut.IsNull() && !HasNullOut())
    551605    {
    552         tasks.AddToList(&write1);
     606        tasks.AddToList(&write1a);
    553607        if (!header.IsPedestalRun())
    554             tasks.AddToList(&write2);
    555         tasks.AddToList(&write3);
     608            tasks.AddToList(&write2a);
     609        if (fCamera)
     610            tasks.AddToList(&write3a);
    556611    }
    557612    // -------------------------------
    558     if (header.IsDataRun())
    559         tasks.AddToList(&fillh3);
    560     tasks.AddToList(&filltp);
     613    if (fCamera)
     614    {
     615        if (header.IsDataRun())
     616            tasks.AddToList(&fillh3);
     617        tasks.AddToList(&filltp);
     618    }
    561619    if (header.IsDataRun())
    562620        tasks.AddToList(&fillew);
     
    574632        //tasks.AddToList(&fillx5);
    575633    }
    576 
    577634    //-------------------------------------------
    578635
     
    587644        return kFALSE;
    588645
     646    //-------------------------------------------
     647
    589648    if (binstr.IsDefault())
    590649        binstr.SetEdgesLin(150, -shape.GetPulseWidth(),
     
    592651
    593652    header.Print();
     653
     654    if (fDisplay)
     655    {
     656        TCanvas &c = fDisplay->AddTab("Info");
     657        c.Divide(2,2);
     658
     659        c.cd(1);
     660        gPad->SetBorderMode(0);
     661        gPad->SetFrameBorderMode(0);
     662        gPad->SetGridx();
     663        gPad->SetGridy();
     664        gROOT->SetSelectedPad(0);
     665        shape.DrawClone()->SetBit(kCanDelete);
     666
     667        if (header.IsDataRun() || header.IsPointRun())
     668        {
     669            c.cd(3);
     670            gPad->SetBorderMode(0);
     671            gPad->SetFrameBorderMode(0);
     672            gPad->SetGridx();
     673            gPad->SetGridy();
     674            gROOT->SetSelectedPad(0);
     675            reflector.DrawClone("line")->SetBit(kCanDelete);
     676
     677        }
     678
     679        if (fCamera)
     680        {
     681            if (dynamic_cast<MGeomCam*>(env1.GetCont()))
     682            {
     683                c.cd(2);
     684                gPad->SetBorderMode(0);
     685                gPad->SetFrameBorderMode(0);
     686                gPad->SetGridx();
     687                gPad->SetGridy();
     688                gROOT->SetSelectedPad(0);
     689                MHCamera *c = new MHCamera(static_cast<MGeomCam&>(*env1.GetCont()));
     690                c->SetStats(kFALSE);
     691                c->SetBit(MHCamera::kNoLegend);
     692                c->SetBit(kCanDelete);
     693                c->Draw();
     694
     695            }
     696
     697            if (dynamic_cast<MGeomCam*>(env2.GetCont()))
     698            {
     699                c.cd(4);
     700                gPad->SetBorderMode(0);
     701                gPad->SetFrameBorderMode(0);
     702                gPad->SetGridx();
     703                gPad->SetGridy();
     704                gROOT->SetSelectedPad(0);
     705                MHCamera *c = new MHCamera(static_cast<MGeomCam&>(*env2.GetCont()));
     706                c->SetStats(kFALSE);
     707                c->SetBit(MHCamera::kNoLegend);
     708                c->SetBit(kCanDelete);
     709                c->Draw();
     710            }
     711        }
     712    }
     713
     714    //-------------------------------------------
    594715
    595716    // Execute first analysis
     
    607728    //-------------------------------------------
    608729
    609     if (!WriteResult())
     730    if (!WriteResult(plist))
    610731        return kFALSE;
    611732
  • trunk/MagicSoft/Mars/mjobs/MJSimulation.h

    r9309 r9317  
    88class MHn;
    99class MArgs;
     10class MParList;
    1011
    1112class MJSimulation : public MJob
    1213{
    1314private:
    14     Bool_t fForceMode;      // Force execution even if RUNE-section was not found
     15    Bool_t fForceMode;      // Force execution even if RUNE-section was not foundm
    1516
     17    Bool_t fCamera;         // Switch on/off camera (for fast reflector processing)
    1618    Bool_t fForceTrigger;   // Force the use of the trigger "electronics"
    1719
    18     Bool_t WriteResult();
     20    Bool_t WriteResult(const MParList &plist);
    1921    Bool_t CheckEnvLocal();
    2022
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.cc

    r9303 r9317  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.67 2009-02-07 20:47:44 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.68 2009-02-11 12:31:47 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    717717    {
    718718        TCanvas *c = GetCanvas(i);
    719         c->GetPad(1)->cd(1);
     719        c->cd(1);
    720720
    721721        TList *list = gPad->GetListOfPrimitives();
     
    839839                if (!o)
    840840                    break;
    841                 fCanvas->SetName(MString::Format("%p;%p;PixelContent", o->GetHist(), c->GetPad(1)->GetPad(1)));
     841                fCanvas->SetName(MString::Format("%p;%p;PixelContent", o->GetHist(), c->GetPad(1)));
    842842            }
    843843            break;
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.h

    r9309 r9317  
    105105    void InitCamera(UShort_t type, UShort_t pix=0);
    106106    void InitPixels(UShort_t pix) { InitCamera((UShort_t)-1, pix); }
    107     void SetRunInfo(UShort_t type, UShort_t tel, UInt_t run, UInt_t file=0);
    108     void SetSourceInfo(const char src[80], char epoch='J', UShort_t date=2000);
     107    void SetRunType(UShort_t type) { fRunType=type; }
     108    void SetRunInfo(UShort_t tel, UInt_t run, UInt_t file=0);
     109    void SetSourceInfo(const TString src, char epoch='J', UShort_t date=2000);
    109110    void SetRunTime(const MTime &start, const MTime &end);
    110111    void SetRunTimeMjd(Float_t start, Float_t stop) { fRunStart.SetMjd(start); fRunStop.SetMjd(stop); }
    111     void SetObservation(const char mode[60], const char proj[100]);
     112    void SetObservation(const TString mode, const TString proj);
    112113    void SetNumEvents(UInt_t num);
    113114    void SetValidMagicNumber() { fMagicNumber=kMagicNumber; }
  • trunk/MagicSoft/Mars/msimcamera/MSimCalibrationSignal.cc

    r9306 r9317  
    160160Bool_t MSimCalibrationSignal::CallReInit()
    161161{
    162     if (GetNumExecutions()>0)
     162    if (GetNumExecutions()!=1)
    163163        return kTRUE;
    164164
     
    170170    }
    171171
     172    fRunHeader->SetReadyToSave();
     173
    172174    return tlist->ReInit(fParList);
    173175}
     
    190192        for (UInt_t idx=0; idx<fGeom->GetNumPixels(); idx++)
    191193        {
     194            const Int_t num = TMath::Nint(gRandom->Gaus(fNumPhotons, fNumPhotons/10));
     195
    192196            // FIXME: How does the distribution look like? Poissonian?
    193             for (UInt_t i=0; i<fNumPhotons; i++)
     197            for (Int_t i=0; i<num; i++)
    194198            {
    195199                MPhotonData &ph = fEvt->Add(cnt++);
     
    212216    // -------------------- MSimGeomCam ---------------------
    213217
     218    // =====> Move to MSimReadoutWindow ?
     219
    214220    const Double_t freq = fRunHeader->GetFreqSampling()/1000.;
    215221
     
    230236
    231237    // FIXME: Jitter! (Own class?)
    232     fTrigger->SetVal(pp*freq);
     238    fTrigger->SetVal((pp+pw)*freq);
    233239    fTrigger->SetReadyToSave();
    234240
     
    236242    const UInt_t p = fRunHeader->IsCalibrationRun() ? MTriggerPattern::kCalibration : MTriggerPattern::kPedestal;
    237243    fEvtHeader->SetTriggerPattern(~(p | (p<<8)));
     244    fEvtHeader->SetCalibrationPattern(0/*BIT(16)<<16*/); // CT1 Pulser, see MCalibrationPatternDecode
    238245    fEvtHeader->SetReadyToSave();
    239246
Note: See TracChangeset for help on using the changeset viewer.