Changeset 3852


Ignore:
Timestamp:
04/27/04 18:44:34 (21 years ago)
Author:
moralejo
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3851 r3852  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20 2004/04/27: Abelardo Moralejo
     21
     22   * mcalib/MMcCalibrationCalc.[h,cc]
     23     - added histogram which stores the conversion of photons before
     24       the plexiglas to photoelectrons hitting first dynode.
     25
     26   * macros/mccalibrate.C
     27     - added MPointingPosCalc to the tasklist to create and fill an
     28       MPointingPos object, and later write it to the Events tree of
     29       the calibrated MC files. Added some comments and simplified
     30       some lines. One more histogram from MMcCalibrationCalc (see
     31       above) is now written to the output.
     32
     33   * macros/starmc2.C
     34     - added the writing of MPointingPos to output star file.
     35
    2036
    2137 2004/04/27: Markus Gaug
     
    3349
    3450
    35  2004/04/26: Abelardo Moralejo
     51 2004/04/27: Abelardo Moralejo
    3652
    3753   * mhistmc/MHMcCollectionArea.[h,cc]
  • trunk/MagicSoft/Mars/macros/mccalibrate.C

    r3768 r3852  
    2828//  MMCALIBRATE - Calibration of MC data
    2929//
    30 //  This macro is a version of the standard procedure to convert raw MC data
    31 //  into calibrated data (photons per pixel)
     30//  This macro converts raw MC data into calibrated data (photons per pixel)
    3231//
    3332/////////////////////////////////////////////////////////////////////////////
     
    4342  //
    4443
    45 
    4644  // ------------- user change -----------------
    4745  TString* CalibrationFilename;
    48   CalibrationFilename = new TString("../../gammas_nonoise/Gamma_zbin0_0*.root");
    49   // File to be used for the calibration (must be a camera file without added noise)
    50 
    51   Char_t* AnalysisFilename = "Gamma_zbin0*.root";  // File to be analyzed
    52 
    53   Char_t* OutFilename      = "calibrated_data.root";       // Output file name
    54 
    55 
    56   Int_t BinsHigh[2] = {5, 10}; // First and last FADC bin of the range to be integrated,
    57   Int_t BinsLow[2]  = {5, 10}; // for high and low gain respectively.
    58 
    59   // -------------------------------------------
    60 
     46  CalibrationFilename = new TString("../../gammas_nonoise/Gamma_zbin0_0*.root");  // File to be used for the calibration (must be a camera file without added noise)
     47
     48  Char_t* AnalysisFilename = "Proton_zbin0_0*.root";  // File to be analyzed
     49
     50  Char_t* OutFilename      = "calibrated_data.root";  // Output file name
     51
     52
     53  MExtractSignal    sigextract; 
     54  // (other extraction methods can be used)
     55
     56  sigextract.SetSaturationLimit(240);
     57  // Defines when to switch to low gain
     58
     59  // Define FADC slices to be integrated in high and low gain:
     60  sigextract.SetRange(5, 10, 5, 10);
     61
     62  // ---------------------------------------------------------------------
    6163  //
    6264  // Create a empty Parameter List and an empty Task List
     
    7476
    7577  MBadPixelsCam badpix;
    76   plist.AddToList(&badpix);
    77  
    78 
     78  plist.AddToList(&badpix);  // Not used for now.
     79 
    7980  //
    8081  // Now setup the tasks and tasklist:
     
    8889  read.DisableAutoScheme();
    8990
    90   MGeomApply geom; // Reads in geometry from MC file and sets the right sizes for
     91  MGeomApply geom;
     92  // Reads in geometry from MC file and sets the right sizes for
    9193  // several parameter containers.
    9294
    9395  MMcPedestalCopy   pcopy;
    94   // Copies pedestal data from the MC file run fadc header to the MPedestalCam container.
    95 
    96   MExtractSignal    sigextract;
    97   sigextract.SetSaturationLimit(240);
    98 
    99   // Define ADC slices to be integrated in high and low gain:
    100   sigextract.SetRange(BinsHigh[0], BinsHigh[1], BinsLow[0], BinsLow[1]);
     96  // Copies pedestal data from the MC file run fadc header to the
     97  // MPedestalCam container.
     98
     99  MPointingPosCalc pointcalc;
     100  // Creates MPointingPos object and fill it with the telescope orientation
     101  // information taken from MMcEvt.
    101102
    102103  MMcCalibrationUpdate  mccalibupdate;
    103104
    104   MCalibrate calib; // Transforms signals from ADC counts into photons.
     105  MCalibrate calib;
     106  // MCalibrate transforms signals from ADC counts into photons. In the first
     107  // loop it applies a "dummy" calibration supplied by MMcCalibrationUpdate, just
     108  // to equalize inner and outer pixels. At the end of the first loop, in the
     109  // PostProcess of MMcCalibrationCalc (see below) the true calibration constants
     110  // are calculated.
     111
    105112  calib.SetCalibrationMode(MCalibrate::kFfactor);
    106113
    107   //    MBlindPixelCalc   blind;
    108   //    blind.SetUseInterpolation();
    109 
     114  MImgCleanStd clean;
    110115  //
    111116  // Applies tail cuts to image. Since the calibration is performed on
     
    114119  // be rejected).
    115120  //
    116   MImgCleanStd      clean;
    117 
    118 
    119   MHillasCalc       hcalc; // Calculates Hillas parameters not dependent on source position.
    120 
    121   MMcCalibrationCalc mccalibcalc;
     121
     122  MHillasCalc hcalc; // Calculates Hillas parameters not dependent on source position.
     123
     124  MMcCalibrationCalc mccalibcalc;
     125  // Calculates calibration constants to convert from ADC counts to photons.
     126 
    122127
    123128  tlist.AddToList(&read);
    124129  tlist.AddToList(&geom);
    125130  tlist.AddToList(&pcopy);
    126 
     131  tlist.AddToList(&pointcalc);
    127132  tlist.AddToList(&sigextract);
    128133  tlist.AddToList(&mccalibupdate);
    129134  tlist.AddToList(&calib);
    130135  tlist.AddToList(&clean);
    131   //    tlist.AddToList(&blind);
    132136  tlist.AddToList(&hcalc);
    133137
     
    150154  write.AddContainer("MMcEvt",        "Events");
    151155  write.AddContainer("MMcTrig",       "Events");
     156  write.AddContainer("MPointingPos",  "Events");
    152157  write.AddContainer("MRawEvtHeader", "Events");
    153158  write.AddContainer("MCerPhotEvt",   "Events");
     
    169174      if (!evtloop.Eventloop())
    170175        return;
    171       mccalibcalc->GetHist()->Write();
     176      mccalibcalc->GetHistADC2PhotEl()->Write();
     177      mccalibcalc->GetHistPhot2PhotEl()->Write();
     178      // Writes out the histograms used for calibration.
    172179    }
    173180
    174181  //
    175   // Second loop: analysis loop
     182  // Second loop: apply calibration factors to MC events in the
     183  // file to be anlyzed:
    176184  //
    177185
  • trunk/MagicSoft/Mars/macros/starmc2.C

    r3024 r3852  
    3838void starmc2()
    3939{
    40   Char_t* AnalysisFilename = "Calibrated_run.root"; // File to be analyzed
     40  Char_t* AnalysisFilename = "calibrated_data.root"; // File to be analyzed
    4141  Char_t* OutFilename      = "star.root";        // Output file name
    4242
     
    7777  tlist.AddToList(&read);
    7878  tlist.AddToList(&clean);
    79   //    tlist.AddToList(&blind);
    8079  tlist.AddToList(&hcalc);
    8180  tlist.AddToList(&scalc); // Calculates Source-dependent Hillas parameters
     
    8988  write.AddContainer("MSrcPosCam",    "RunHeaders");
    9089  write.AddContainer("MMcEvt",        "Events", kFALSE);
     90  write.AddContainer("MPointingPos",  "Events");
    9191  write.AddContainer("MHillas",       "Events");
    9292  write.AddContainer("MHillasExt",    "Events");
  • trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc

    r3768 r3852  
    7373    fTitle = title ? title : "Calculate and write conversion factors into MCalibrationChargeCam and MCalibrationQECam containers";
    7474
    75     fHistRatio = new TH1F(AddSerialNumber("HistRatio"), "log10(fPhotElfromShower/fSize)", 1500, -3., 3.);
    76     fHistRatio->SetXTitle("log_{10}(fPhotElfromShower / fSize) [photel/ADC count]");
     75    fHistADC2PhotEl = new TH1F(AddSerialNumber("ADC2PhotEl"), "log10(fPhotElfromShower/fSize)", 1500, -3., 3.);
     76    fHistADC2PhotEl->SetXTitle("log_{10}(fPhotElfromShower / fSize) [photel/ADC count]");
     77
     78
     79    fHistPhot2PhotEl = new TH1F(AddSerialNumber("Phot2PhotEl"), "Photon conversion efficiency", 1000, 0., 1.);
     80    fHistPhot2PhotEl->SetXTitle("Overall photon conversion efficiency [photoelectron/photon]");
     81
    7782}
    7883
     
    101106Int_t MMcCalibrationCalc::PreProcess(MParList *pList)
    102107{
    103     fHistRatio->Reset();
     108    fHistADC2PhotEl->Reset();
     109    fHistPhot2PhotEl->Reset();
     110
    104111    fADC2PhotEl = 0;
    105112    fPhot2PhotEl = 0;
     
    215222        return kTRUE;
    216223
    217     fPhot2PhotEl += (Float_t) fMcEvt->GetPhotElfromShower() /
    218       (Float_t) fMcEvt->GetPassPhotCone();
    219 
    220     fHistRatio->Fill(TMath::Log10(fMcEvt->GetPhotElfromShower()/size));
     224    fHistADC2PhotEl->Fill(TMath::Log10(fMcEvt->GetPhotElfromShower()/size));
     225    fHistPhot2PhotEl->Fill( (Float_t) fMcEvt->GetPhotElfromShower() /
     226                        (Float_t) fMcEvt->GetPassPhotCone() );
    221227
    222228    return kTRUE;
     
    229235Int_t MMcCalibrationCalc::PostProcess()
    230236{
    231     const Stat_t n = fHistRatio->GetEntries();
     237    const Stat_t n = fHistADC2PhotEl->GetEntries();
    232238    if (n<1)
    233239    {
     
    236242    }
    237243
    238     fPhot2PhotEl /= n;   // Average quantum efficiency
     244    fPhot2PhotEl = fHistPhot2PhotEl->GetMean();   // Average quantum efficiency
    239245
    240246    //
     
    244250    Stat_t summax = 0;
    245251    Int_t  mode   = 0;
    246     for (Int_t ibin = 1+reach; ibin <= fHistRatio->GetNbinsX()-reach; ibin++)
    247     {
    248         const Stat_t sum = fHistRatio->Integral(ibin-reach, ibin+reach);
     252    for (Int_t ibin = 1+reach; ibin <= fHistADC2PhotEl->GetNbinsX()-reach; ibin++)
     253    {
     254        const Stat_t sum = fHistADC2PhotEl->Integral(ibin-reach, ibin+reach);
    249255
    250256        if (sum <= summax)
     
    255261    }
    256262
    257     fADC2PhotEl = TMath::Power(10, fHistRatio->GetBinCenter(mode));
     263    fADC2PhotEl = TMath::Power(10, fHistADC2PhotEl->GetBinCenter(mode));
    258264
    259265    const Int_t num = fCalCam->GetSize();
     
    270276        // average QE for a spectrum like that of Cherenkov light (see the documentration
    271277        // of MCalibrationQEPix).
    272         // Here we obtain average QE using already a Cherenkov spectrum so AvNormFFacto 
     278        // Here we obtain average QE using already a Cherenkov spectrum so AvNormFFactor
    273279        // must be 1.
    274280
  • trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.h

    r3768 r3852  
    3131    Long_t  fEvents;
    3232
    33     TH1F*   fHistRatio; // Histogram for monitoring the calibration.
     33    TH1F*   fHistADC2PhotEl;
     34    TH1F*   fHistPhot2PhotEl; // Histograms for monitoring the calibration.
    3435
    3536    Bool_t CheckRunType(MParList *pList) const;
     
    4243    MMcCalibrationCalc(const char *name=NULL, const char *title=NULL);
    4344
    44     TH1F*   GetHist() { return fHistRatio; }
     45    TH1F*   GetHistADC2PhotEl() { return fHistADC2PhotEl; }
     46    TH1F*   GetHistPhot2PhotEl() { return fHistPhot2PhotEl; }
    4547
    4648    ClassDef(MMcCalibrationCalc, 0)   // Task which obtains, for MC files, the calibration factor from ADC counts to photons.
Note: See TracChangeset for help on using the changeset viewer.