Changeset 4959 for trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.cc
- Timestamp:
- 09/12/04 21:47:54 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.cc
r4949 r4959 131 131 } 132 132 133 // -------------------------------------------------------------------------- 134 // 135 // Returns size of fHiGainArray 136 // 133 137 const Int_t MHCalibrationCam::GetSize() const 134 138 { … … 156 160 } 157 161 162 // -------------------------------------------------------------------------- 163 // 164 // Calls Reset() for each entry in: 165 // - fHiGainArray, fLoGainArray 166 // - fAverageHiGainAreas, fAverageLoGainAreas 167 // - fAverageHiGainSectors, fAverageLoGainSectors 168 // 158 169 void MHCalibrationCam::ResetHists() 159 170 { … … 161 172 if (fHiGainArray) 162 173 { fHiGainArray->ForEach(MHCalibrationPix,Reset)(); } 174 if (fAverageHiGainAreas) 175 { fAverageHiGainAreas->ForEach(MHCalibrationPix,Reset)(); } 176 if (fAverageHiGainSectors) 177 { fAverageHiGainSectors->ForEach(MHCalibrationPix,Reset)(); } 178 179 if (!IsLoGain()) 180 return; 181 163 182 if (fLoGainArray) 164 183 { fLoGainArray->ForEach(MHCalibrationPix,Reset)(); } 165 166 if (fAverageHiGainAreas)167 { fAverageHiGainAreas->ForEach(MHCalibrationPix,Reset)(); }168 184 if (fAverageLoGainAreas) 169 185 { fAverageLoGainAreas->ForEach(MHCalibrationPix,Reset)(); } 170 if (fAverageHiGainSectors)171 { fAverageHiGainSectors->ForEach(MHCalibrationPix,Reset)(); }172 186 if (fAverageLoGainSectors) 173 187 { fAverageLoGainSectors->ForEach(MHCalibrationPix,Reset)(); } … … 175 189 } 176 190 177 178 179 191 // -------------------------------------------------------------------------- 180 192 // … … 308 320 // -------------------------------------------------------------------------- 309 321 // 310 // Our own clone function is necessary since root 3.01/06 or Mars 0.4 311 // I don't know the reason. 312 // 313 // Creates new MHCalibrationCam 314 // Deletes the TObjArray's and Clones them individually 315 // Copies the TArray's 316 // Copies the fPulserFrequency 322 // Creates new MHCalibrationCam only for the averaged areas: 323 // the rest has to be retrieved directly, e.g. via: 324 // MHCalibrationCam *cam = MParList::FindObject("MHCalibrationCam"); 325 // - cam->GetAverageSector(5).DrawClone(); 326 // - (*cam)[100].DrawClone() 317 327 // 318 328 TObject *MHCalibrationCam::Clone(const char *) const … … 322 332 // const Int_t nlo = fLoGainArray->GetEntries(); 323 333 const Int_t navhi = fAverageHiGainAreas->GetEntries(); 324 const Int_t navlo = fAverageLoGainAreas->GetEntries(); 325 const Int_t nsehi = fAverageHiGainSectors->GetEntries(); 326 const Int_t nselo = fAverageLoGainSectors->GetEntries(); 334 // const Int_t nsehi = fAverageHiGainSectors->GetEntries(); 327 335 328 336 // … … 335 343 cam->fAverageHiGainAreas->Expand(navhi); 336 344 cam->fAverageLoGainAreas->Expand(navlo); 337 cam->fAverageHiGainSectors->Expand(nsehi);338 cam->fAverageLoGainSectors->Expand(nselo);345 // cam->fAverageHiGainSectors->Expand(nsehi); 346 // cam->fAverageLoGainSectors->Expand(nselo); 339 347 340 348 /* … … 352 360 353 361 for (int i=0; i<navhi; i++) 354 { 355 // delete (*cam->fAverageHiGainAreas)[i]; 356 (*cam->fAverageHiGainAreas)[i] = (*fAverageHiGainAreas)[i]->Clone(); 357 } 358 for (int i=0; i<navlo; i++) 359 { 360 // delete (*cam->fAverageLoGainAreas)[i]; 361 (*cam->fAverageLoGainAreas)[i] = (*fAverageLoGainAreas)[i]->Clone(); 362 } 363 for (int i=0; i<nsehi; i++) 364 { 365 // delete (*cam->fAverageHiGainSectors)[i]; 366 (*cam->fAverageHiGainSectors)[i] = (*fAverageHiGainSectors)[i]->Clone(); 367 } 368 for (int i=0; i<nselo; i++) 369 { 370 // delete (*cam->fAverageLoGainSectors)[i]; 371 (*cam->fAverageLoGainSectors)[i] = (*fAverageLoGainSectors)[i]->Clone(); 362 (*cam->fAverageHiGainAreas)[i] = (*fAverageHiGainAreas)[i]->Clone(); 363 364 // for (int i=0; i<nsehi; i++) 365 // (*cam->fAverageHiGainSectors)[i] = (*fAverageHiGainSectors)[i]->Clone(); 366 367 if (IsLoGain()) 368 { 369 370 const Int_t navlo = fAverageLoGainAreas->GetEntries(); 371 372 cam->fAverageLoGainAreas->Expand(navlo); 373 // cam->fAverageLoGainSectors->Expand(nselo); 374 // const Int_t nselo = fAverageLoGainSectors->GetEntries(); 375 376 for (int i=0; i<navlo; i++) 377 (*cam->fAverageLoGainAreas)[i] = (*fAverageLoGainAreas)[i]->Clone(); 378 379 // for (int i=0; i<nselo; i++) 380 // (*cam->fAverageLoGainSectors)[i] = (*fAverageLoGainSectors)[i]->Clone(); 372 381 } 373 382 … … 575 584 // 576 585 // - For every entry in the expanded arrays: 577 // * call new MHCalibrationPix(fHistName,fHistTitle)578 // * Set Nbins(fNbins), SetFirst(fFirst), SetLast(fLast)579 // * Set fHistName and fHistTitle in the Histogram of MHCalibrationPix586 // * Initialize an MHCalibrationPix 587 // * Set Binning from fNbins, fFirst and fLast 588 // * Set Histgram names and titles from fHistName and fHistTitle 580 589 // * Set X-axis and Y-axis titles with fHistXTitle and fHistYTitle 581 590 // * Call InitHists … … 681 690 // 682 691 // - For every entry in the expanded arrays: 683 // * call new MHCalibrationPix(fHistName,fHistTitle)684 // * Set Bins(fNbins), SetFirst(fFirst), SetLast(fLast)685 // * Set fHistName and fHistTitle in the Histogram of MHCalibrationPix692 // * Initialize an MHCalibrationPix 693 // * Set Binning from fNbins, fFirst and fLast 694 // * Set Histgram names and titles from fHistName and fHistTitle 686 695 // * Set X-axis and Y-axis titles with fHistXTitle and fHistYTitle 687 696 // * Call InitHists … … 779 788 } 780 789 781 782 783 790 //-------------------------------------------------------------------------------- 784 791 // … … 788 795 // - number of sectors 789 796 // 790 // For all TObjArray's (including the averaged ones), the following steps are performed: 791 // 792 // 1) Test size and return kFALSE if not matching 793 // 2) 797 // Return kFALSE, if sizes of the TObjArrays do not match npixels, nareas or nsectors 798 // 799 // Call FillHists() 794 800 // 795 801 Bool_t MHCalibrationCam::Fill(const MParContainer *par, const Stat_t w) … … 800 806 const Int_t nsectors = fGeom->GetNumSectors(); 801 807 808 // 809 // Hi-Gain ObjArrays 810 // 802 811 if (fHiGainArray->GetEntries() != npixels) 803 812 { 804 *fLog << err << "ERROR - Size mismatch ... abort." << endl;813 *fLog << err << "ERROR - Size mismatch in number of pixels... abort." << endl; 805 814 return kFALSE; 806 815 } 807 808 if (IsLoGain())809 if (fLoGainArray->GetEntries() != npixels)810 {811 *fLog << err << "ERROR - Size mismatch... abort." << endl;812 return kFALSE;813 }814 816 815 817 if (fAverageHiGainAreas->GetEntries() != nareas) … … 819 821 } 820 822 821 if (IsLoGain())822 if (fAverageLoGainAreas->GetEntries() != nareas)823 {824 *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;825 return kFALSE;826 }827 828 823 if (fAverageHiGainSectors->GetEntries() != nsectors) 829 824 { … … 833 828 834 829 if (IsLoGain()) 835 if (fAverageLoGainSectors->GetEntries() != nsectors) 836 { 837 *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl; 838 return kFALSE; 839 } 830 { 831 if (fLoGainArray->GetEntries() != npixels) 832 { 833 *fLog << err << "ERROR - Size mismatch in number of pixels... abort." << endl; 834 return kFALSE; 835 } 836 837 if (fAverageLoGainAreas->GetEntries() != nareas) 838 { 839 *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl; 840 return kFALSE; 841 } 842 843 if (fAverageLoGainSectors->GetEntries() != nsectors) 844 { 845 *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl; 846 return kFALSE; 847 } 848 } 840 849 841 850 return FillHists(par, w); 842 }843 844 Bool_t MHCalibrationCam::FillHists(const MParContainer *par, const Stat_t w)845 {846 *fLog << warn << GetDescriptor() << "FillHists not overloaded! Can't be used!" << endl;847 return kFALSE;848 851 } 849 852 … … 874 877 return kTRUE; 875 878 } 876 877 Bool_t MHCalibrationCam::FinalizeHists()878 {879 return kTRUE;880 }881 882 void MHCalibrationCam::FinalizeBadPixels()883 {884 }885 886 879 887 880 // ------------------------------------------------------------- … … 909 902 } 910 903 904 // -------------------------------------------------------------------------- 905 // 906 // Calls FitHiGainHists for every entry in: 907 // - fHiGainArray 908 // - fAverageHiGainAreas 909 // - fAverageHiGainSectors 910 // 911 911 void MHCalibrationCam::FitHiGainArrays(MCalibrationCam &calcam, MBadPixelsCam &badcam, 912 912 MBadPixelsPix::UncalibratedType_t fittyp, … … 952 952 } 953 953 954 // -------------------------------------------------------------------------- 955 // 956 // Calls FitLoGainHists for every entry in: 957 // - fLoGainArray 958 // - fAverageLoGainAreas 959 // - fAverageLoGainSectors 960 // 954 961 void MHCalibrationCam::FitLoGainArrays(MCalibrationCam &calcam, MBadPixelsCam &badcam, 955 962 MBadPixelsPix::UncalibratedType_t fittyp, … … 957 964 { 958 965 966 if (!IsLoGain()) 967 return; 968 959 969 for (Int_t i=0; i<fLoGainArray->GetSize(); i++) 960 970 { … … 1290 1300 Int_t MHCalibrationCam::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 1291 1301 { 1292 Bool_t rc = kFALSE; 1293 if (IsEnvDefined(env, prefix, "Debug", print)) 1294 { 1295 SetDebug(GetEnvValue(env, prefix, "Debug", IsDebug())); 1296 rc = kTRUE; 1297 } 1298 if (IsEnvDefined(env, prefix, "LoGain", print)) 1299 { 1300 SetDebug(GetEnvValue(env, prefix, "LoGain", IsLoGain())); 1301 rc = kTRUE; 1302 } 1303 if (IsEnvDefined(env, prefix, "Oscillations", print)) 1304 { 1305 SetOscillations(GetEnvValue(env, prefix, "Oscillations", IsOscillations())); 1306 rc = kTRUE; 1307 } 1308 1309 if (IsEnvDefined(env, prefix, "Nbins", print)) 1310 { 1311 SetNbins(GetEnvValue(env, prefix, "Nbins", fNbins)); 1312 rc = kTRUE; 1313 } 1314 if (IsEnvDefined(env, prefix, "First", print)) 1315 { 1316 SetFirst(GetEnvValue(env, prefix, "First", fFirst)); 1317 rc = kTRUE; 1318 } 1319 if (IsEnvDefined(env, prefix, "Last", print)) 1320 { 1321 SetLast(GetEnvValue(env, prefix, "Last", fLast)); 1322 rc = kTRUE; 1323 } 1324 1325 return rc; 1326 } 1302 1303 Bool_t rc = kFALSE; 1304 if (IsEnvDefined(env, prefix, "Debug", print)) 1305 { 1306 SetDebug(GetEnvValue(env, prefix, "Debug", IsDebug())); 1307 rc = kTRUE; 1308 } 1309 if (IsEnvDefined(env, prefix, "LoGain", print)) 1310 { 1311 SetDebug(GetEnvValue(env, prefix, "LoGain", IsLoGain())); 1312 rc = kTRUE; 1313 } 1314 if (IsEnvDefined(env, prefix, "Oscillations", print)) 1315 { 1316 SetOscillations(GetEnvValue(env, prefix, "Oscillations", IsOscillations())); 1317 rc = kTRUE; 1318 } 1319 1320 if (IsEnvDefined(env, prefix, "Nbins", print)) 1321 { 1322 SetNbins(GetEnvValue(env, prefix, "Nbins", fNbins)); 1323 rc = kTRUE; 1324 } 1325 if (IsEnvDefined(env, prefix, "First", print)) 1326 { 1327 SetFirst(GetEnvValue(env, prefix, "First", fFirst)); 1328 rc = kTRUE; 1329 } 1330 if (IsEnvDefined(env, prefix, "Last", print)) 1331 { 1332 SetLast(GetEnvValue(env, prefix, "Last", fLast)); 1333 rc = kTRUE; 1334 } 1335 1336 return rc; 1337 }
Note:
See TracChangeset
for help on using the changeset viewer.