Changeset 4974 for trunk/MagicSoft/Mars/mhcalib
- Timestamp:
- 09/13/04 13:14:17 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mhcalib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.cc
r4960 r4974 42 42 // 43 43 // The following flag can be set: 44 // - SetDebug() for debug output. 45 // - SetLoGain() for the case that low-gain slices are available, but 46 // MRawRunHeader::GetNumLoGainSlices() gives still 0. 44 // - SetAverageging() for calculating the event-by-event averages. 45 // - SetDebug() for debug output. 46 // - SetLoGain() for the case that low-gain slices are available, but 47 // MRawRunHeader::GetNumLoGainSlices() gives still 0. 47 48 // 48 49 // The flag fLoGain steers if low-gain signal is treated at all or not. … … 99 100 // - fPulserFrequency to fgPulserFrequency 100 101 // 102 // - SetAveregeing (kTRUE); 103 // - SetDebug (kFALSE); 104 // - SetLoGain (kTRUE); 105 //- SetOscillations(kTRUE); 106 //- SetSizeCheck (kTRUE); 107 // 101 108 MHCalibrationCam::MHCalibrationCam(const char *name, const char *title) 102 109 : fHistName(gsHistName),fHistTitle(gsHistTitle), … … 126 133 SetPulserFrequency(); 127 134 135 SetAverageing (kTRUE); 128 136 SetDebug (kFALSE); 129 137 SetLoGain (kTRUE); 130 138 SetOscillations(kTRUE); 139 SetSizeCheck (kTRUE); 131 140 } 132 141 … … 172 181 if (fHiGainArray) 173 182 { fHiGainArray->ForEach(MHCalibrationPix,Reset)(); } 174 if (fAverageHiGainAreas) 175 { fAverageHiGainAreas->ForEach(MHCalibrationPix,Reset)(); } 176 if (fAverageHiGainSectors) 177 { fAverageHiGainSectors->ForEach(MHCalibrationPix,Reset)(); } 178 183 if (IsAverageing()) 184 { 185 if (fAverageHiGainAreas) 186 { fAverageHiGainAreas->ForEach(MHCalibrationPix,Reset)(); } 187 if (fAverageHiGainSectors) 188 { fAverageHiGainSectors->ForEach(MHCalibrationPix,Reset)(); } 189 } 190 179 191 if (!IsLoGain()) 180 192 return; … … 182 194 if (fLoGainArray) 183 195 { fLoGainArray->ForEach(MHCalibrationPix,Reset)(); } 184 if (fAverageLoGainAreas) 185 { fAverageLoGainAreas->ForEach(MHCalibrationPix,Reset)(); } 186 if (fAverageLoGainSectors) 187 { fAverageLoGainSectors->ForEach(MHCalibrationPix,Reset)(); } 188 196 if (IsAverageing()) 197 { 198 if (fAverageLoGainAreas) 199 { fAverageLoGainAreas->ForEach(MHCalibrationPix,Reset)(); } 200 if (fAverageLoGainSectors) 201 { fAverageLoGainSectors->ForEach(MHCalibrationPix,Reset)(); } 202 } 189 203 } 190 204 … … 329 343 { 330 344 345 // 346 // FIXME, this might be done faster and more elegant, by direct copy. 347 // 348 MHCalibrationCam *cam = new MHCalibrationCam(); 349 350 cam->fRunNumbers = fRunNumbers; 351 cam->fPulserFrequency = fPulserFrequency; 352 cam->fFlags = fFlags; 353 354 if (!IsAverageing()) 355 return cam; 356 331 357 // const Int_t nhi = fHiGainArray->GetEntries(); 332 358 // const Int_t nlo = fLoGainArray->GetEntries(); … … 334 360 // const Int_t nsehi = fAverageHiGainSectors->GetEntries(); 335 361 336 //337 // FIXME, this might be done faster and more elegant, by direct copy.338 //339 MHCalibrationCam *cam = new MHCalibrationCam();340 341 362 // cam->fHiGainArray->Expand(nhi); 342 363 // cam->fLoGainArray->Expand(nlo); … … 387 408 cam->fAverageAreaRelSigmaVar = fAverageAreaRelSigmaVar; 388 409 cam->fAverageSectorNum = fAverageSectorNum; 389 cam->fRunNumbers = fRunNumbers;390 391 cam->fPulserFrequency = fPulserFrequency;392 410 393 411 return cam; … … 424 442 } 425 443 444 /* not needed -> Class is never used twice 426 445 fHiGainArray->Delete(); 427 446 fLoGainArray->Delete(); … … 432 451 fAverageHiGainSectors->Delete(); 433 452 fAverageLoGainSectors->Delete(); 453 */ 434 454 435 455 return SetupHists(pList); … … 491 511 } 492 512 493 // 494 // The function TArrayF::Set() already sets all entries to 0. 495 // 496 fAverageAreaNum. Set(nareas); 497 fAverageAreaSat. Set(nareas); 498 fAverageAreaSigma. Set(nareas); 499 fAverageAreaSigmaVar. Set(nareas); 500 fAverageAreaRelSigma. Set(nareas); 501 fAverageAreaRelSigmaVar.Set(nareas); 502 fAverageSectorNum. Set(nsectors); 503 fRunNumbers. Set(fRunNumbers.GetSize()+1); 504 505 for (Int_t aidx=0; aidx<nareas; aidx++) 506 fAverageAreaNum[aidx] = 0; 507 508 for (Int_t sector=0; sector<nsectors; sector++) 509 fAverageSectorNum[sector] = 0; 510 511 for (Int_t i=0; i<npixels; i++) 512 { 513 514 if ((*fBadPixels)[i].IsBad()) 515 continue; 516 517 fAverageAreaNum [(*fGeom)[i].GetAidx() ]++; 518 fAverageSectorNum[(*fGeom)[i].GetSector()]++; 513 if (IsAverageing()) 514 { 515 // 516 // The function TArrayF::Set() already sets all entries to 0. 517 // 518 fAverageAreaNum. Set(nareas); 519 fAverageAreaSat. Set(nareas); 520 fAverageAreaSigma. Set(nareas); 521 fAverageAreaSigmaVar. Set(nareas); 522 fAverageAreaRelSigma. Set(nareas); 523 fAverageAreaRelSigmaVar.Set(nareas); 524 fAverageSectorNum. Set(nsectors); 525 fRunNumbers. Set(fRunNumbers.GetSize()+1); 526 527 for (Int_t aidx=0; aidx<nareas; aidx++) 528 fAverageAreaNum[aidx] = 0; 529 530 for (Int_t sector=0; sector<nsectors; sector++) 531 fAverageSectorNum[sector] = 0; 532 533 for (Int_t i=0; i<npixels; i++) 534 { 535 if ((*fBadPixels)[i].IsBad()) 536 continue; 537 538 fAverageAreaNum [(*fGeom)[i].GetAidx() ]++; 539 fAverageSectorNum[(*fGeom)[i].GetSector()]++; 540 } 519 541 } 520 542 … … 544 566 h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," ")); 545 567 } 568 569 if (!IsAverageing()) 570 return kTRUE; 546 571 547 572 for (Int_t j=0; j<nareas; j++) … … 616 641 } 617 642 643 if (!IsAverageing()) 644 return; 645 618 646 if (fAverageHiGainAreas->GetEntries()==0) 619 647 { … … 725 753 } 726 754 755 if (!IsAverageing()) 756 return; 757 727 758 if (fAverageLoGainAreas->GetEntries()==0) 728 759 { … … 801 832 { 802 833 834 if (!IsSizeCheck()) 835 return FillHists(par,w); 836 803 837 const Int_t npixels = fGeom->GetNumPixels(); 804 838 const Int_t nareas = fGeom->GetNumAreas(); … … 814 848 } 815 849 816 if (fAverageHiGainAreas->GetEntries() != nareas)817 {818 *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;819 return kFALSE;820 }821 822 if (fAverageHiGainSectors->GetEntries() != nsectors)823 {824 *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl;825 return kFALSE;826 }827 828 850 if (IsLoGain()) 829 851 { … … 833 855 return kFALSE; 834 856 } 857 } 858 859 if (!IsAverageing()) 860 return FillHists(par,w); 861 862 if (fAverageHiGainAreas->GetEntries() != nareas) 863 { 864 *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl; 865 return kFALSE; 866 } 867 868 if (fAverageHiGainSectors->GetEntries() != nsectors) 869 { 870 *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl; 871 return kFALSE; 872 } 873 874 if (IsLoGain()) 875 { 835 876 836 877 if (fAverageLoGainAreas->GetEntries() != nareas) … … 928 969 } 929 970 971 if (!IsAverageing()) 972 return; 973 930 974 for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++) 931 975 { … … 981 1025 } 982 1026 1027 if (!IsAverageing()) 1028 return; 1029 983 1030 for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++) 984 1031 { … … 1012 1059 1013 1060 if (!fCam) 1061 return; 1062 1063 if (!IsAverageing()) 1014 1064 return; 1015 1065 … … 1197 1247 1198 1248 1199 // --------------------------------------------------------------------------1200 //1201 // Dummy, needed by MCamEvent1202 //1203 Bool_t MHCalibrationCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const1204 {1205 return kTRUE;1206 }1207 1208 // --------------------------------------------------------------------------1209 //1210 // What MHCamera needs in order to draw an individual pixel in the camera1211 //1212 void MHCalibrationCam::DrawPixelContent(Int_t idx) const1213 {1214 }1215 1216 1249 // ----------------------------------------------------------------------------- 1217 1250 // … … 1224 1257 void MHCalibrationCam::Draw(const Option_t *opt) 1225 1258 { 1259 1260 if (!IsAverageing()) 1261 return; 1226 1262 1227 1263 const Int_t nareas = fAverageHiGainAreas->GetEntries(); … … 1316 1352 rc = kTRUE; 1317 1353 } 1354 if (IsEnvDefined(env, prefix, "SizeCheck", print)) 1355 { 1356 SetSizeCheck(GetEnvValue(env, prefix, "SizeCheck", IsSizeCheck())); 1357 rc = kTRUE; 1358 } 1359 if (IsEnvDefined(env, prefix, "Averageing", print)) 1360 { 1361 SetAverageing(GetEnvValue(env, prefix, "Averageing", IsAverageing())); 1362 rc = kTRUE; 1363 } 1318 1364 1319 1365 if (IsEnvDefined(env, prefix, "Nbins", print)) -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.h
r4969 r4974 90 90 Int_t fPulserFrequency; // Light pulser frequency 91 91 92 enum { kDebug, kLoGain, kOscillations }; // Possible flags 92 enum { kDebug, kLoGain, kAverageing, 93 kOscillations, kSizeCheck }; // Possible flags 93 94 94 95 Byte_t fFlags; // Bit-field to hold the flags … … 132 133 void InitHists ( MHCalibrationPix &hist, MBadPixelsPix &bad, const Int_t i); 133 134 134 Bool_t IsDebug () const { return TESTBIT(fFlags,kDebug); } 135 Bool_t IsAverageing () const { return TESTBIT(fFlags,kAverageing); } 136 Bool_t IsDebug () const { return TESTBIT(fFlags,kDebug); } 137 Bool_t IsLoGain () const { return TESTBIT(fFlags,kLoGain); } 135 138 Bool_t IsOscillations() const { return TESTBIT(fFlags,kOscillations); } 136 Bool_t Is LoGain () const { return TESTBIT(fFlags,kLoGain);}139 Bool_t IsSizeCheck () const { return TESTBIT(fFlags,kSizeCheck); } 137 140 138 141 Int_t ReadEnv ( const TEnv &env, TString prefix, Bool_t print); … … 156 159 void Draw(const Option_t *opt); 157 160 158 Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const ;159 void DrawPixelContent( Int_t num ) const ;161 Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const { return kTRUE; } 162 void DrawPixelContent( Int_t num ) const {} 160 163 161 164 const Int_t GetAverageAreas () const; … … 181 184 182 185 void SetColor ( const MCalibrationCam::PulserColor_t color) { fColor = color; } 186 void SetAverageing ( const Bool_t b=kTRUE ) { b 187 ? SETBIT(fFlags,kAverageing) 188 : CLRBIT(fFlags,kAverageing); } 183 189 void SetDebug ( const Bool_t b=kTRUE ) { b 184 190 ? SETBIT(fFlags,kDebug) … … 190 196 ? SETBIT(fFlags,kOscillations) 191 197 : CLRBIT(fFlags,kOscillations); } 198 void SetSizeCheck ( const Bool_t b=kTRUE ) { b 199 ? SETBIT(fFlags,kSizeCheck) 200 : CLRBIT(fFlags,kSizeCheck); } 192 201 void SetHistName ( const char *name ) { fHistName = name; } 193 202 void SetHistTitle ( const char *name ) { fHistTitle = name; }
Note:
See TracChangeset
for help on using the changeset viewer.