Changeset 4579 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 08/11/04 14:32:49 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc
r3807 r4579 20 20 ! Author(s): Wolfgang Wittek 02/2004 <mailto:wittek@mppmu.mpg.de> 21 21 ! Author(s): Markus Gaug 04/2004 <mailto:markus@ifae.es> 22 ! Author(s): Hendrik Bartko 08/2004 <mailto:hbartko@mppmu.mpg.de> 22 23 ! 23 24 ! Copyright: MAGIC Software Development, 2000-2004 … … 88 89 MCalibrateData::MCalibrateData(CalibrationMode_t calmode,const char *name, const char *title) 89 90 : fCam(NULL), fPedestal(NULL), fBadPixels(NULL), fCalibrations(NULL), fSignals(NULL), 90 fPedPhot(NULL), fCerPhotEvt(NULL), fCalibrationMode(calmode) 91 fPedPhot(NULL), fCerPhotEvt(NULL), fCalibrationMode(calmode), fFlags(kRun), fNamePedADCRunContainer("MPedestalCam"), fNamePedADCEventContainer("MPedestalCamFromData"), fNamePedPhotRunContainer("MPedPhotCam"), fNamePedPhotEventContainer("MPedPhotCamFromData") 91 92 { 92 93 fName = name ? name : "MCalibrateData"; … … 111 112 Int_t MCalibrateData::PreProcess(MParList *pList) 112 113 { 113 fPedestal = (MPedestalCam*)pList->FindObject(AddSerialNumber("MPedestalCam")); 114 115 // input containers 116 117 118 if (TestFlag(kRun)) 119 { 120 fPedestal = (MPedestalCam*)pList->FindObject(fNamePedADCRunContainer, AddSerialNumber("MPedestalCam")); 114 121 if (!fPedestal) 115 { 116 *fLog << err << AddSerialNumber("MPedestalCam") << " not found ... aborting" << endl; 117 return kFALSE; 118 } 122 { 123 *fLog << err << "container 'MPedestalCam'" 124 << " not found ... aborting" << endl; 125 return kFALSE; 126 } 127 } 128 129 130 if (TestFlag(kEvent)) 131 { 132 fPedestalFromData = (MPedestalCam*)pList->FindObject(fNamePedADCEventContainer, AddSerialNumber("MPedestalCam")); 133 if (!fPedestalFromData) 134 { 135 *fLog << err << "container 'MPedestalCamFromData'" 136 << " not found ... aborting" << endl; 137 return kFALSE; 138 } 139 } 119 140 120 141 … … 150 171 } 151 172 152 fPedPhot = (MPedPhotCam*)pList->FindCreateObj(AddSerialNumber("MPedPhotCam")); 153 if (!fPedPhot) 154 return kFALSE; 173 // output containers 174 175 if (TestFlag(kRun)) 176 { 177 fPedPhot = (MPedPhotCam*)pList->FindCreateObj(AddSerialNumber("MPedPhotCam"), fNamePedPhotRunContainer); 178 if (!fPedPhot) 179 { 180 *fLog << err << "container 'MPedPhotCam'" 181 << " not found ... aborting" << endl; 182 return kFALSE; 183 } 184 } 185 186 187 if (TestFlag(kEvent)) 188 { 189 fPedPhotFromData = (MPedPhotCam*)pList->FindCreateObj(AddSerialNumber("MPedPhotCam"), fNamePedPhotEventContainer); 190 if (!fPedPhotFromData) 191 { 192 *fLog << err << "container 'MPedPhotCamFromData'" 193 << " not found ... aborting" << endl; 194 return kFALSE; 195 } 196 } 155 197 156 198 fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj(AddSerialNumber("MCerPhotEvt")); … … 185 227 } 186 228 229 230 if (TestFlag(kRun)) 231 { 187 232 //--------------------------------------------- 188 233 // fill MPedPhot container using the informations from … … 240 285 241 286 fPedPhot->SetReadyToSave(); 287 } 242 288 243 289 return kTRUE; … … 376 422 fCerPhotEvt->SetReadyToSave(); 377 423 424 425 426 if(TestFlag(kEvent)) 427 { 428 429 //--------------------------------------------- 430 // fill MPedPhot(FromData) container using the informations from 431 // MPedestalCam, MExtractedSignalCam and MCalibrationCam 432 433 fNumUsedHiGainFADCSlices = fSignals->GetNumUsedHiGainFADCSlices(); 434 435 // is pixid equal to pixidx ? 436 if ( (Int_t)(fPedestal->GetSize()) != fSignals->GetSize()) 437 { 438 *fLog << err << "MCalibrateData::ReInit(); sizes of MPedestalCam and MCalibrationCam are different" 439 << endl; 440 } 441 442 /* 443 *fLog << all << "MCalibrateData::ReInit(); fill MPedPhotCam container" 444 << endl; 445 *fLog << all << " fNumUsedHiGainADCSlices = " 446 << fNumUsedHiGainFADCSlices << endl; 447 *fLog << all << " pixid, calibrationConversionFactor, ped, pedRMS, pedphot, pedphotRMS :" 448 << endl; 449 */ 450 for (Int_t pixid=0; pixid<fPedestalFromData->GetSize(); pixid++) 451 { 452 const MPedestalPix &ped = (*fPedestalFromData)[pixid]; 453 454 // pedestals/(used FADC slices) in [ADC] counts 455 Float_t pedes = ped.GetPedestal() * fNumUsedHiGainFADCSlices; 456 Float_t pedrms = ped.GetPedestalRms() * sqrt(fNumUsedHiGainFADCSlices); 457 458 //---------------------------------- 459 // get phe/ADC conversion factor 460 461 Float_t hiloconv; 462 Float_t hiloconverr; 463 Float_t calibConv; 464 Float_t calibFFactor; 465 466 if ( !GetConversionFactor(pixid, hiloconv, hiloconverr, 467 calibConv, calibFFactor )) 468 continue; 469 470 //---------------------------------- 471 472 // pedestals/(used FADC slices) in [number of photons] 473 Float_t pedphot = pedes * calibConv; 474 Float_t pedphotrms = pedrms * calibConv; 475 476 (*fPedPhotFromData)[pixid].Set(pedphot, pedphotrms); 477 478 // *fLog << all << pixid << ", " << calibConv << ", " 479 // << ped.GetPedestal() << ", " << ped.GetPedestalRms() << ", " 480 // << pedphot << ", " << pedphotrms << endl; 481 } 482 483 //--------------------------------------------- 484 485 fPedPhotFromData->SetReadyToSave(); 486 487 } 488 489 378 490 return kTRUE; 379 491 } -
trunk/MagicSoft/Mars/mcalib/MCalibrateData.h
r3687 r4579 37 37 MGeomCam *fCam; 38 38 MPedestalCam *fPedestal; // Pedestals/slice [ADC counts] 39 MPedestalCam *fPedestalFromData; // Pedestals/slice [ADC counts] 39 40 MBadPixelsCam *fBadPixels; // Bad Pixels information 40 41 MCalibrationChargeCam *fCalibrations; // Calibration constants … … 43 44 44 45 MPedPhotCam *fPedPhot; // Pedestals/(used slices) [photons] 46 MPedPhotCam *fPedPhotFromData;// Pedestals/(used slices) [photons] 45 47 MCerPhotEvt *fCerPhotEvt; // Cerenkov Photon Event used for calculation 46 48 … … 50 52 Float_t fConversionHiLo; 51 53 UShort_t fCalibrationMode; 54 55 Int_t fFlags; // Flags defining to calibrate the pedestal each event or each run 56 57 TString fNamePedADCRunContainer; // name of the 'MPedestalCam' container 58 TString fNamePedADCEventContainer; // name of the 'MPedestalCam' container 59 TString fNamePedPhotRunContainer; // name of the 'MPedestalCam' container 60 TString fNamePedPhotEventContainer; // name of the 'MPedestalCam' container 61 52 62 53 63 Bool_t GetConversionFactor(UInt_t, … … 63 73 static const CalibrationMode_t kDefault = kBlindPixel; 64 74 75 enum PedestalType_t{ 76 kRun = BIT(0), 77 kEvent = BIT(1) 78 }; 79 80 81 65 82 MCalibrateData(CalibrationMode_t calmode = kDefault,const char *name=NULL, const char *title=NULL); 66 83 67 84 void SetConversionHiLo(Float_t conv) { fConversionHiLo = conv; }; 68 85 void SetCalibrationMode(CalibrationMode_t calmode=kDefault){ fCalibrationMode=calmode;}; 86 87 void SetPedestalType(PedestalType_t i) { fFlags = i; } // Int_t f 88 void EnablePedestalType(PedestalType_t i) { fFlags |= i; } // Int_t f 89 void DisablePedestalType(PedestalType_t i) { fFlags &= ~i; } // Int_t f 90 Bool_t TestFlag(PedestalType_t i) const { return fFlags&i; } 91 92 93 void SetNamePedADCRunContainer(const char *name) { fNamePedADCRunContainer = name; } 94 void SetNamePedADCEventContainer(const char *name) { fNamePedADCEventContainer = name; } 95 96 void SetNamePedPhotRunContainer(const char *name) { fNamePedPhotRunContainer = name; } 97 void SetNamePedPhotEventContainer(const char *name) { fNamePedPhotEventContainer = name; } 98 69 99 70 100 ClassDef(MCalibrateData, 0) // Task to calculate cerenkov photons using calibration constants
Note:
See TracChangeset
for help on using the changeset viewer.