Changeset 3852
- Timestamp:
- 04/27/04 18:44:34 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3851 r3852 18 18 19 19 -*-*- 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 20 36 21 37 2004/04/27: Markus Gaug … … 33 49 34 50 35 2004/04/2 6: Abelardo Moralejo51 2004/04/27: Abelardo Moralejo 36 52 37 53 * mhistmc/MHMcCollectionArea.[h,cc] -
trunk/MagicSoft/Mars/macros/mccalibrate.C
r3768 r3852 28 28 // MMCALIBRATE - Calibration of MC data 29 29 // 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) 32 31 // 33 32 ///////////////////////////////////////////////////////////////////////////// … … 43 42 // 44 43 45 46 44 // ------------- user change ----------------- 47 45 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 // --------------------------------------------------------------------- 61 63 // 62 64 // Create a empty Parameter List and an empty Task List … … 74 76 75 77 MBadPixelsCam badpix; 76 plist.AddToList(&badpix); 77 78 78 plist.AddToList(&badpix); // Not used for now. 79 79 80 // 80 81 // Now setup the tasks and tasklist: … … 88 89 read.DisableAutoScheme(); 89 90 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 91 93 // several parameter containers. 92 94 93 95 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. 101 102 102 103 MMcCalibrationUpdate mccalibupdate; 103 104 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 105 112 calib.SetCalibrationMode(MCalibrate::kFfactor); 106 113 107 // MBlindPixelCalc blind; 108 // blind.SetUseInterpolation(); 109 114 MImgCleanStd clean; 110 115 // 111 116 // Applies tail cuts to image. Since the calibration is performed on … … 114 119 // be rejected). 115 120 // 116 MImgCleanStd clean; 117 118 119 M HillasCalc 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 122 127 123 128 tlist.AddToList(&read); 124 129 tlist.AddToList(&geom); 125 130 tlist.AddToList(&pcopy); 126 131 tlist.AddToList(&pointcalc); 127 132 tlist.AddToList(&sigextract); 128 133 tlist.AddToList(&mccalibupdate); 129 134 tlist.AddToList(&calib); 130 135 tlist.AddToList(&clean); 131 // tlist.AddToList(&blind);132 136 tlist.AddToList(&hcalc); 133 137 … … 150 154 write.AddContainer("MMcEvt", "Events"); 151 155 write.AddContainer("MMcTrig", "Events"); 156 write.AddContainer("MPointingPos", "Events"); 152 157 write.AddContainer("MRawEvtHeader", "Events"); 153 158 write.AddContainer("MCerPhotEvt", "Events"); … … 169 174 if (!evtloop.Eventloop()) 170 175 return; 171 mccalibcalc->GetHist()->Write(); 176 mccalibcalc->GetHistADC2PhotEl()->Write(); 177 mccalibcalc->GetHistPhot2PhotEl()->Write(); 178 // Writes out the histograms used for calibration. 172 179 } 173 180 174 181 // 175 // Second loop: analysis loop 182 // Second loop: apply calibration factors to MC events in the 183 // file to be anlyzed: 176 184 // 177 185 -
trunk/MagicSoft/Mars/macros/starmc2.C
r3024 r3852 38 38 void starmc2() 39 39 { 40 Char_t* AnalysisFilename = " Calibrated_run.root"; // File to be analyzed40 Char_t* AnalysisFilename = "calibrated_data.root"; // File to be analyzed 41 41 Char_t* OutFilename = "star.root"; // Output file name 42 42 … … 77 77 tlist.AddToList(&read); 78 78 tlist.AddToList(&clean); 79 // tlist.AddToList(&blind);80 79 tlist.AddToList(&hcalc); 81 80 tlist.AddToList(&scalc); // Calculates Source-dependent Hillas parameters … … 89 88 write.AddContainer("MSrcPosCam", "RunHeaders"); 90 89 write.AddContainer("MMcEvt", "Events", kFALSE); 90 write.AddContainer("MPointingPos", "Events"); 91 91 write.AddContainer("MHillas", "Events"); 92 92 write.AddContainer("MHillasExt", "Events"); -
trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc
r3768 r3852 73 73 fTitle = title ? title : "Calculate and write conversion factors into MCalibrationChargeCam and MCalibrationQECam containers"; 74 74 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 77 82 } 78 83 … … 101 106 Int_t MMcCalibrationCalc::PreProcess(MParList *pList) 102 107 { 103 fHistRatio->Reset(); 108 fHistADC2PhotEl->Reset(); 109 fHistPhot2PhotEl->Reset(); 110 104 111 fADC2PhotEl = 0; 105 112 fPhot2PhotEl = 0; … … 215 222 return kTRUE; 216 223 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() ); 221 227 222 228 return kTRUE; … … 229 235 Int_t MMcCalibrationCalc::PostProcess() 230 236 { 231 const Stat_t n = fHist Ratio->GetEntries();237 const Stat_t n = fHistADC2PhotEl->GetEntries(); 232 238 if (n<1) 233 239 { … … 236 242 } 237 243 238 fPhot2PhotEl /= n; // Average quantum efficiency244 fPhot2PhotEl = fHistPhot2PhotEl->GetMean(); // Average quantum efficiency 239 245 240 246 // … … 244 250 Stat_t summax = 0; 245 251 Int_t mode = 0; 246 for (Int_t ibin = 1+reach; ibin <= fHist Ratio->GetNbinsX()-reach; ibin++)247 { 248 const Stat_t sum = fHist Ratio->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); 249 255 250 256 if (sum <= summax) … … 255 261 } 256 262 257 fADC2PhotEl = TMath::Power(10, fHist Ratio->GetBinCenter(mode));263 fADC2PhotEl = TMath::Power(10, fHistADC2PhotEl->GetBinCenter(mode)); 258 264 259 265 const Int_t num = fCalCam->GetSize(); … … 270 276 // average QE for a spectrum like that of Cherenkov light (see the documentration 271 277 // 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 273 279 // must be 1. 274 280 -
trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.h
r3768 r3852 31 31 Long_t fEvents; 32 32 33 TH1F* fHistRatio; // Histogram for monitoring the calibration. 33 TH1F* fHistADC2PhotEl; 34 TH1F* fHistPhot2PhotEl; // Histograms for monitoring the calibration. 34 35 35 36 Bool_t CheckRunType(MParList *pList) const; … … 42 43 MMcCalibrationCalc(const char *name=NULL, const char *title=NULL); 43 44 44 TH1F* GetHist() { return fHistRatio; } 45 TH1F* GetHistADC2PhotEl() { return fHistADC2PhotEl; } 46 TH1F* GetHistPhot2PhotEl() { return fHistPhot2PhotEl; } 45 47 46 48 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.