Changeset 5856 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 01/16/05 17:11:31 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.cc
r5799 r5856 29 29 // 30 30 // Input Containers: 31 // MRawEvtHeader32 31 // MParList 33 32 // MCalibrationIntensityChargeCam … … 61 60 #include "MCalibrationChargeCalc.h" 62 61 #include "MCalibrationRelTimeCalc.h" 62 #include "MCalibrateData.h" 63 63 64 64 #include "MRawRunHeader.h" 65 #include "MRawEvtHeader.h"66 65 67 66 #include "MGeomCam.h" … … 71 70 using namespace std; 72 71 72 const UInt_t MCalibCalcFromPast::fgNumEventsDump = 1000; 73 73 // -------------------------------------------------------------------------- 74 74 // 75 75 // Default constructor. 76 76 // 77 // Sets: 78 // - fNumEventsDump to fgNumEventsDump 79 // 77 80 MCalibCalcFromPast::MCalibCalcFromPast(const char *name, const char *title) 78 : f Header(NULL), fGeom(NULL), fParList(NULL),81 : fRunHeader(NULL), fGeom(NULL), fParList(NULL), 79 82 fIntensCharge(NULL), fIntensRelTime(NULL), fIntensBad(NULL), 80 fChargeCalc(NULL), fRelTimeCalc(NULL), 81 f Pattern(0)83 fChargeCalc(NULL), fRelTimeCalc(NULL), fCalibrate(NULL), 84 fNumEvents(0), fNumCam(0) 82 85 { 83 86 … … 85 88 fTitle = title ? title : "Task to steer the processing of interlaced calibration events"; 86 89 90 SetNumEventsDump(); 87 91 } 88 92 … … 90 94 // 91 95 // The following container are searched for and execution aborted if not in MParList: 92 // - MRawEvtHeader93 96 // - MTaskList 94 97 // … … 96 99 { 97 100 98 fHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader"); 99 if (!fHeader) 100 { 101 *fLog << err << "MRawEvtHeader not found... abort." << endl; 102 return kFALSE; 103 } 101 /* 102 fTrigPattern = (MTriggerPattern*)pList->FindObject("MTriggerPattern"); 103 if (!fTrigPattern) 104 { 105 *fLog << err << "MTriggerPattern not found... abort." << endl; 106 return kFALSE; 107 } 108 */ 104 109 105 110 fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader"); 106 if (!f Header)111 if (!fRunHeader) 107 112 { 108 113 *fLog << err << "MRawRunHeader not found... abort." << endl; … … 159 164 fIntensQE = (MCalibrationIntensityQECam*) pList->FindCreateObj("MCalibrationIntensityQECam"); 160 165 161 fChargeCalc = (MCalibrationChargeCalc*)tlist->FindObject("MCalibrationChargeCalc"); 162 166 if (!fChargeCalc) 167 fChargeCalc = (MCalibrationChargeCalc*)tlist->FindObject("MCalibrationChargeCalc"); 168 169 if (!fCalibrate) 170 fCalibrate = (MCalibrateData*)tlist->FindObject("MCalibrateData"); 171 163 172 *fLog << inf << "Found MHCalibrationChargeCam ... " << flush; 173 *fLog << err << fCalibrate << flush; 164 174 165 175 if (!fIntensCharge) … … 180 190 return kFALSE; 181 191 } 192 193 if (!fCalibrate) 194 { 195 *fLog << err << "Could not find MCalibrateData abort... " << endl; 196 return kFALSE; 197 } 182 198 } 183 199 … … 190 206 191 207 fIntensRelTime = (MCalibrationIntensityRelTimeCam*)pList->FindCreateObj("MCalibrationIntensityRelTimeCam"); 192 fRelTimeCalc = (MCalibrationRelTimeCalc*)tlist->FindObject(AddSerialNumber("MCalibrationRelTimeCalc")); 208 if (!fRelTimeCalc) 209 fRelTimeCalc = (MCalibrationRelTimeCalc*)tlist->FindObject(AddSerialNumber("MCalibrationRelTimeCalc")); 193 210 194 211 *fLog << inf << "Found MHCalibrationRelTimeCam ... " << flush; … … 225 242 } 226 243 244 245 fNumCam = 0; 246 fNumEvents = 0; 247 227 248 return kTRUE; 228 249 } … … 230 251 // -------------------------------------------------------------------------- 231 252 // 232 // Reads the pattern from MRawEvtHeader and initializes new containers in the233 // Intensity Cams, if the pattern has changed. Executes CallPostProcess of the234 // MCalibration*Calc classes in that case.253 // Initializes new containers in the 254 // Intensity Cams, if the number of calibration events has reach fNumEventsDump. 255 // Executes CallPostProcess of the MCalibration*Calc classes in that case. 235 256 // 236 257 Int_t MCalibCalcFromPast::Process() 237 258 { 238 259 239 const UInt_t pattern = fHeader->GetCalibrationPattern(); 240 241 if (pattern == fPattern) 260 /* 261 if (!(fTrigPattern->GetPrescaled() & MTriggerPattern::kCalibration)) 242 262 return kTRUE; 243 244 if (fPattern == 0) 245 { 246 fPattern = pattern; 247 return kTRUE; 248 } 249 250 fPattern = pattern; 251 263 */ 264 265 if (fNumEvents++ < fNumEventsDump) 266 return kTRUE; 267 268 fNumEvents = 0; 252 269 // 253 270 // Finalize Possible calibration histogram classes... … … 265 282 *fLog << inf << GetDescriptor() << " : Finalize calibration calculations..." << flush; 266 283 if (fChargeCalc) 267 fChargeCalc-> CallPostProcess();284 fChargeCalc->Finalize(); 268 285 if (fRelTimeCalc) 269 fRelTimeCalc->CallPostProcess(); 286 fRelTimeCalc->Finalize(); 287 if (fCalibrate) 288 { 289 fCalibrate->SetCalibUpdate((MCalibrationChargeCam*)fIntensCharge->GetCam()); 290 fCalibrate->UpdateConversionFactors(); 291 } 270 292 271 293 ReInitialize(); … … 307 329 *fLog << endl; 308 330 331 fNumCam++; 332 309 333 if (fIntensBad) 310 334 { 311 fIntensBad->AddToList(Form("MBadPixelsCam%s",GetNamePattern()),*fGeom); 312 *fLog << inf << "New MBadPixelsCam with " << GetNamePattern() << endl; 313 } 335 fIntensBad->AddToList(Form("MBadPixelsCam%04d",fNumCam),*fGeom); 336 *fLog << inf << "New MBadPixelsCam Nr. " << fNumCam << endl; 337 } 338 314 339 if (fIntensCharge) 315 340 { 316 fIntensCharge->AddToList(Form("MCalibrationChargeCam% s",GetNamePattern()),*fGeom);317 *fLog << inf << "New MCalibrationChargeCam with " << GetNamePattern()<< endl;341 fIntensCharge->AddToList(Form("MCalibrationChargeCam%04d",fNumCam),*fGeom); 342 *fLog << inf << "New MCalibrationChargeCam Nr. " << fNumCam << endl; 318 343 } 319 344 if (fIntensQE) 320 345 { 321 fIntensQE->AddToList(Form("MCalibrationQECam% s",GetNamePattern()),*fGeom);322 *fLog << inf << "New MCalibrationQECam with " << GetNamePattern()<< endl;346 fIntensQE->AddToList(Form("MCalibrationQECam%04d",fNumCam),*fGeom); 347 *fLog << inf << "New MCalibrationQECam Nr. " << fNumCam << endl; 323 348 } 324 349 if (fIntensBlind) 325 350 { 326 fIntensBlind->AddToList(Form("MCalibrationBlindCam% s",GetNamePattern()),*fGeom);327 *fLog << inf << "New MCalibrationBlindCam with " << GetNamePattern()<< endl;351 fIntensBlind->AddToList(Form("MCalibrationBlindCam%04d",fNumCam),*fGeom); 352 *fLog << inf << "New MCalibrationBlindCam Nr. " << fNumCam << endl; 328 353 } 329 354 … … 332 357 } 333 358 334 const char* MCalibCalcFromPast::GetNamePattern() 335 { 336 337 Float_t number[MCalibrationCam::gkNumPulserColors]; 338 memset(number,0,MCalibrationCam::gkNumPulserColors*sizeof(Float_t)); 339 340 enum ColorCode_t 341 { 342 k5LedGreen = BIT(0 ), 343 k2LedGreen = BIT(1 ), 344 k5LedBlue2 = BIT(2 ), 345 k1LedUV = BIT(3 ), 346 k2LedUV = BIT(4 ), 347 k5LedBlue3 = BIT(5 ), 348 k5LedBlue4 = BIT(6 ), 349 k2LedBlue = BIT(7 ), 350 k01LedBlue = BIT(8 ), 351 k1LedBlue = BIT(10), 352 k5LedUV1 = BIT(11), 353 k5LedUV2 = BIT(12), 354 k5LedBlue1 = BIT(13), 355 k1LedGreen = BIT(14), 356 k01LedGreen = BIT(15), 357 kCT1Pulser = BIT(16) 358 }; 359 360 if (fPattern & k5LedGreen) 361 number[MCalibrationCam::kGREEN] += 5; 362 if (fPattern & k2LedGreen) 363 number[MCalibrationCam::kGREEN] += 2; 364 if (fPattern & k5LedBlue2) 365 number[MCalibrationCam::kBLUE] += 2; 366 if (fPattern & k1LedUV) 367 number[MCalibrationCam::kUV] += 1; 368 if (fPattern & k2LedUV) 369 number[MCalibrationCam::kUV] += 2; 370 if (fPattern & k5LedBlue3) 371 number[MCalibrationCam::kBLUE] += 5; 372 if (fPattern & k5LedBlue4) 373 number[MCalibrationCam::kBLUE] += 5; 374 if (fPattern & k2LedBlue) 375 number[MCalibrationCam::kBLUE] += 2; 376 if (fPattern & k01LedBlue) 377 number[MCalibrationCam::kBLUE] += 0.5; 378 if (fPattern & k1LedBlue) 379 number[MCalibrationCam::kBLUE] += 1; 380 if (fPattern & k5LedUV1) 381 number[MCalibrationCam::kUV] += 5; 382 if (fPattern & k5LedUV2) 383 number[MCalibrationCam::kUV] += 5; 384 if (fPattern & k5LedBlue1) 385 number[MCalibrationCam::kBLUE] += 5; 386 if (fPattern & k1LedGreen) 387 number[MCalibrationCam::kGREEN] += 1; 388 if (fPattern & k01LedGreen) 389 number[MCalibrationCam::kGREEN] += 0.5; 390 if (fPattern & kCT1Pulser) 391 number[MCalibrationCam::kCT1] += 1; 392 393 TString result; 394 395 for (Int_t i=0; i<MCalibrationCam::gkNumPulserColors; i++) 396 { 397 switch (i) 398 { 399 case MCalibrationCam::kGREEN: 400 if (number[i] > 0.1) 401 result = Form("%2.1f%s",number[i],"GREEN"); 402 break; 403 case MCalibrationCam::kBLUE: 404 if (number[i] > 0.1) 405 result = Form("%2.1f%s",number[i],"BLUE"); 406 break; 407 case MCalibrationCam::kUV: 408 if (number[i] > 0.1) 409 result = Form("%2.1f%s",number[i],"UV"); 410 break; 411 case MCalibrationCam::kCT1: 412 if (number[i] > 0.1) 413 result = Form("%2.1f%s",number[i],"CT1"); 414 break; 415 } 416 } 417 return result.Data(); 418 } 359 Int_t MCalibCalcFromPast::PostProcess() 360 { 361 *fLog << inf << GetDescriptor() 362 << ": Number of Calibration Cams: " << fNumCam << endl; 363 return kTRUE; 364 365 } -
trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.h
r5799 r5856 8 8 class MParList; 9 9 class MGeomCam; 10 class MRawEvtHeader;11 10 class MRawRunHeader; 12 11 class MPedCalcFromLoGain; 13 12 class MCalibrationChargeCalc; 14 13 class MCalibrationRelTimeCalc; 14 class MCalibrateData; 15 15 class MCalibrationIntensityChargeCam; 16 16 class MCalibrationIntensityBlindCam; … … 23 23 private: 24 24 25 static const UInt_t fgNumEventsDump; 25 static const UInt_t fgNumEventsDump; //! Default for fNumEventsDump 26 26 27 MRawEvtHeader *fHeader; //! 28 MRawRunHeader *fRunHeader; //! 29 MGeomCam *fGeom; //! 30 MParList *fParList; //! 31 MCalibrationIntensityChargeCam *fIntensCharge; //! 32 MCalibrationIntensityBlindCam *fIntensBlind; //! 33 MCalibrationIntensityQECam *fIntensQE; //! 34 MCalibrationIntensityRelTimeCam *fIntensRelTime; //! 35 MCalibrationIntensityHiLoCam *fIntensHiLo; //! 36 MBadPixelsIntensityCam *fIntensBad; //! 27 MRawRunHeader *fRunHeader; //! Run Header 28 MGeomCam *fGeom; //! Camera Geometry 29 MParList *fParList; //! Parameter List 30 MCalibrationIntensityChargeCam *fIntensCharge; //! Intensity Charge Cam (to be created) 31 MCalibrationIntensityBlindCam *fIntensBlind; //! Intensity Blind Cam (to be created) 32 MCalibrationIntensityQECam *fIntensQE; //! Intensity QE Cam (to be created) 33 MCalibrationIntensityRelTimeCam *fIntensRelTime; //! Intensity Rel. Time Cam (to be created) 34 MCalibrationIntensityHiLoCam *fIntensHiLo; //! Intensity High-Vs.Low Cam (to be created) 35 MBadPixelsIntensityCam *fIntensBad; //! Intensity Bad Pixels Cam (to be created) 37 36 38 MCalibrationChargeCalc *fChargeCalc; //! 39 MCalibrationRelTimeCalc *fRelTimeCalc; //! 37 MCalibrationChargeCalc *fChargeCalc; //! Charge Calibration Task 38 MCalibrationRelTimeCalc *fRelTimeCalc; //! Rel. Times Calibratio Task 39 MCalibrateData *fCalibrate; //! Data Calibration Task 40 40 41 41 UInt_t fNumEventsDump; // Number of event after which the MCalibrationCams gets updated 42 UInt_t fPattern; // Calibration bit pattern from digital modules 42 UInt_t fNumEvents; //! Event counter only for calibration events 43 UInt_t fNumCam; //! Number of currently used Calibration Cam 43 44 44 45 Int_t PreProcess(MParList *pList); 45 46 Int_t Process(); 46 47 Int_t PostProcess(); 48 47 49 Bool_t ReInitialize(); 48 50 Bool_t Finalize(const char* name); 49 const char* GetNamePattern(); 50 51 51 52 public: 52 53 53 MCalibCalcFromPast(const char *name=NULL, const char *title=NULL); 54 ~MCalibCalcFromPast() {} 54 MCalibCalcFromPast(const char *name=NULL, const char *title=NULL); 55 ~MCalibCalcFromPast() {} 56 57 UInt_t GetNumEventsDump() const { return fNumEventsDump; } 58 59 void SetNumEventsDump( const UInt_t i=fgNumEventsDump ) { fNumEventsDump = i; } 60 61 void SetCalibrate ( MCalibrateData *c ) { fCalibrate = c; } 62 void SetChargeCalc ( MCalibrationChargeCalc *c ) { fChargeCalc = c; } 63 void SetRelTimeCalc ( MCalibrationRelTimeCalc *c ) { fRelTimeCalc = c; } 64 65 ClassDef(MCalibCalcFromPast, 1) // Task to steer the processing of interlace calibration events 66 }; 55 67 56 UInt_t GetNumEventsDump() const { return fNumEventsDump; }57 58 void SetNumEventsDump( const UInt_t i=fgNumEventsDump ) { fNumEventsDump = i; }59 60 ClassDef(MCalibCalcFromPast, 1) // Task to steer the processing of interlace calibration events61 };62 63 68 #endif 64 69
Note:
See TracChangeset
for help on using the changeset viewer.