Changeset 4903 for trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimeCam.cc
- Timestamp:
- 09/09/04 17:37:26 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimeCam.cc
r4885 r4903 27 27 // 28 28 // Fills the extracted relative arrival times of MArrivalTimeCam into 29 // the MH GausEvents-classes MHCalibrationRelTimePix for every:29 // the MHCalibrationPix-classes MHCalibrationRelTimePix for every: 30 30 // 31 31 // - Pixel, stored in the TObjArray's MHCalibrationCam::fHiGainArray … … 52 52 // the fit is declared valid. 53 53 // Otherwise, the fit is repeated within ranges of the previous mean 54 // +- MH GausEvents::fPickupLimit (default: 5) sigma (see MHGausEvents::RepeatFit())54 // +- MHCalibrationPix::fPickupLimit (default: 5) sigma (see MHCalibrationPix::RepeatFit()) 55 55 // In case this does not make the fit valid, the histogram means and RMS's are 56 // taken directly (see MH GausEvents::BypassFit()) and the following flags are set:56 // taken directly (see MHCalibrationPix::BypassFit()) and the following flags are set: 57 57 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kRelTimeNotFitted ) and 58 58 // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun ) 59 59 // 60 // Outliers of more than MH GausEvents::fPickupLimit (default: 5) sigmas61 // from the mean are counted as Pickup events (stored in MH GausEvents::fPickup)60 // Outliers of more than MHCalibrationPix::fPickupLimit (default: 5) sigmas 61 // from the mean are counted as Pickup events (stored in MHCalibrationPix::fPickup) 62 62 // 63 63 // The class also fills arrays with the signal vs. event number, creates a fourier … … 88 88 #include "MHCalibrationRelTimePix.h" 89 89 90 #include "MHCalibrationPix.h" 91 90 92 #include "MLog.h" 91 93 #include "MLogManip.h" … … 93 95 #include "MParList.h" 94 96 97 #include "MCalibrationIntensityRelTimeCam.h" 98 95 99 #include "MCalibrationRelTimeCam.h" 100 #include "MCalibrationRelTimePix.h" 96 101 #include "MCalibrationPix.h" 97 102 … … 104 109 #include "MBadPixelsCam.h" 105 110 #include "MBadPixelsPix.h" 106 107 #include "MHGausEvents.h"108 111 109 112 ClassImp(MHCalibrationRelTimeCam); … … 163 166 { 164 167 165 166 fCam = (MCalibrationCam*)pList->FindObject("MCalibrationRelTimeCam"); 167 if (!fCam) 168 { 169 fCam = (MCalibrationCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationRelTimeCam")); 168 fIntensCam = (MCalibrationIntensityCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityRelTimeCam")); 169 if (fIntensCam) 170 *fLog << inf << "Found MCalibrationIntensityRelTimeCam ... " << endl; 171 else 172 { 173 fCam = (MCalibrationCam*)pList->FindObject(AddSerialNumber("MCalibrationRelTimeCam")); 170 174 if (!fCam) 171 175 { 172 gLog << err << "Cannot find nor create MCalibrationRelTimeCam ... abort." << endl; 173 return kFALSE; 174 } 175 else 176 fCam->Init(*fGeom); 177 } 178 176 fCam = (MCalibrationCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationRelTimeCam")); 177 if (!fCam) 178 { 179 *fLog << err << "Cannot find nor create MCalibrationRelTimeCam ... abort." << endl; 180 return kFALSE; 181 } 182 fCam->Init(*fGeom); 183 } 184 } 179 185 180 186 MArrivalTimeCam *signal = (MArrivalTimeCam*)pList->FindObject("MArrivalTimeCam"); … … 219 225 { 220 226 (*fAverageHiGainAreas)[j] = 221 new MHCalibrationRelTimePix(" MHCalibrationRelTimeAverageAreaHiGain",227 new MHCalibrationRelTimePix("RelTimeAverageHiGainArea", 222 228 "Average Rel. Arr. Times Hi-Gain Area Idx "); 223 229 224 GetAverageHiGainArea(j).GetHGausHist()->SetTitle("Rel. Arr. Times HiGain Area Idx "); 225 GetAverageHiGainArea(j).SetNbins(fAverageNbins); 226 227 InitHists(GetAverageHiGainArea(j),fCam->GetAverageBadArea(j),j); 230 MHCalibrationRelTimePix &hist = (MHCalibrationRelTimePix&)GetAverageHiGainArea(j); 231 232 hist.SetNbins(fAverageNbins); 233 hist.GetHGausHist()->SetTitle("Rel. Arr. Times average HiGain Area Idx "); 234 235 if (fGeom->InheritsFrom("MGeomCamMagic")) 236 { 237 hist.GetHGausHist()->SetTitle(Form("%s%s%s","Signal averaged on event-by-event basis ", 238 j==0 ? "Inner Pixels " : "Outer Pixels ","High Gain Runs: ")); 239 hist.InitBins(); 240 hist.SetEventFrequency(fPulserFrequency); 241 } 242 else 243 { 244 hist.GetHGausHist()->SetTitle("Signal averaged on event-by-event basis High Gain Area Idx "); 245 InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 246 } 228 247 } 229 248 } … … 236 255 { 237 256 (*fAverageLoGainAreas)[j] = 238 new MHCalibrationRelTimePix(" MHCalibrationRelTimeAverageAreaLoGain",257 new MHCalibrationRelTimePix("RelTimeAverageAreaLoGain", 239 258 "Average Rel. Arr. Times Lo-Gain Area Idx "); 240 259 241 GetAverageLoGainArea(j).GetHGausHist()->SetTitle("Rel. Arr. Times LoGain Area Idx "); 242 GetAverageLoGainArea(j).SetNbins(fAverageNbins); 243 244 InitHists(GetAverageLoGainArea(j),fCam->GetAverageBadArea(j),j); 260 MHCalibrationRelTimePix &hist = (MHCalibrationRelTimePix&)GetAverageLoGainArea(j); 261 hist.SetNbins(fAverageNbins); 262 263 if (fGeom->InheritsFrom("MGeomCamMagic")) 264 { 265 hist.GetHGausHist()->SetTitle(Form("%s%s%s","Rel. Arr. Times averaged on event-by-event basis ", 266 j==0 ? "Inner Pixels " : "Outer Pixels ","Low Gain Runs: ")); 267 hist.InitBins(); 268 hist.SetEventFrequency(fPulserFrequency); 269 } 270 else 271 { 272 hist.GetHGausHist()->SetTitle("Rel. Arr. Times averaged on event-by-event basis Low Gain Area Idx "); 273 InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 274 } 245 275 } 246 276 } … … 253 283 { 254 284 (*fAverageHiGainSectors)[j] = 255 new MHCalibrationRelTimePix(" MHCalibrationRelTimeAverageSectorHiGain",256 "Average Rel. Arr. Times Hi-GainSector ");285 new MHCalibrationRelTimePix("RelTimeAverageSectorHiGain", 286 "Average HiGain Rel. Arr. Times Sector "); 257 287 258 GetAverageHiGainSector(j).GetHGausHist()->SetTitle("Rel. Arr. Times HiGain Sector "); 259 GetAverageHiGainSector(j).SetNbins(fAverageNbins); 288 MHCalibrationRelTimePix &hist = (MHCalibrationRelTimePix&)GetAverageHiGainSector(j); 289 290 hist.GetHGausHist()->SetTitle("Rel. Arr. Times averaged on event-by-event basis HiGain Sector "); 291 hist.SetNbins(fAverageNbins); 260 292 261 InitHists( GetAverageHiGainSector(j),fCam->GetAverageBadSector(j),j);293 InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j); 262 294 } 263 295 } … … 270 302 { 271 303 (*fAverageLoGainSectors)[j] = 272 new MHCalibrationRelTimePix(" MHCalibrationRelTimeAverageSectorLoGain",273 "Average Rel. Arr. Times Lo-GainSector ");304 new MHCalibrationRelTimePix("RelTimeAverageSectorLoGain", 305 "Average LoGain Rel. Arr. Times Sector "); 274 306 275 GetAverageLoGainSector(j).GetHGausHist()->SetTitle("Rel. Arr. Times LoGain Sector "); 276 GetAverageLoGainSector(j).SetNbins(fAverageNbins); 307 MHCalibrationRelTimePix &hist = (MHCalibrationRelTimePix&)GetAverageLoGainSector(j); 308 309 hist.GetHGausHist()->SetTitle("Rel. Arr. Times averaged on event-by-event basis LoGain Sector "); 310 hist.SetNbins(fAverageNbins); 277 311 278 InitHists(GetAverageLoGainSector(j),fCam->GetAverageBadSector(j),j); 279 312 InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j); 280 313 } 281 314 } … … 338 371 { 339 372 340 MH GausEvents&histhi = (*this)[i];341 MH GausEvents&histlo = (*this)(i);373 MHCalibrationPix &histhi = (*this)[i]; 374 MHCalibrationPix &histlo = (*this)(i); 342 375 343 376 if (histhi.IsExcluded()) … … 372 405 for (Int_t j=0; j<nareas; j++) 373 406 { 374 MH GausEvents&histhi = GetAverageHiGainArea(j);407 MHCalibrationPix &histhi = GetAverageHiGainArea(j); 375 408 histhi.FillHistAndArray(fNumareahi[j] == 0 ? 0. : fSumareahi[j]/fNumareahi[j]); 376 409 377 410 if (fLoGain) 378 411 { 379 MH GausEvents&histlo = GetAverageLoGainArea(j);412 MHCalibrationPix &histlo = GetAverageLoGainArea(j); 380 413 histlo.FillHistAndArray(fNumarealo[j] == 0 ? 0. : fSumarealo[j]/fNumarealo[j]); 381 414 } … … 384 417 for (Int_t j=0; j<nsectors; j++) 385 418 { 386 MH GausEvents&histhi = GetAverageHiGainSector(j);419 MHCalibrationPix &histhi = GetAverageHiGainSector(j); 387 420 histhi.FillHistAndArray(fNumsectorhi[j] == 0 ? 0. : fSumsectorhi[j]/fNumsectorhi[j]); 388 421 389 422 if (fLoGain) 390 423 { 391 MH GausEvents&histlo = GetAverageLoGainSector(j);424 MHCalibrationPix &histlo = GetAverageLoGainSector(j); 392 425 histlo.FillHistAndArray(fNumsectorlo[j] == 0 ? 0. : fSumsectorlo[j]/fNumsectorlo[j]); 393 426 } … … 415 448 continue; 416 449 450 MCalibrationRelTimePix &pix = fIntensCam 451 ? (MCalibrationRelTimePix&)(*fIntensCam)[i] 452 : (MCalibrationRelTimePix&)(*fCam)[i]; 453 417 454 if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries()) 418 455 { 419 (*fCam)[i].SetHiGainSaturation();456 pix.SetHiGainSaturation(); 420 457 histhi.SetExcluded(); 421 458 } … … 423 460 if (fLoGain) 424 461 (*this)(i).SetExcluded(); 425 426 } 427 462 463 Stat_t overflow = histhi.GetHGausHist()->GetBinContent(histhi.GetHGausHist()->GetNbinsX()+1); 464 if (overflow > 0.1) 465 { 466 *fLog << warn << GetDescriptor() 467 << ": HiGain Histogram Overflow occurred " << overflow 468 << " times in pixel: " << i << " (without saturation!) " << endl; 469 // bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow ); 470 } 471 472 overflow = histhi.GetHGausHist()->GetBinContent(0); 473 if (overflow > 0.1) 474 { 475 *fLog << warn << GetDescriptor() 476 << ": HiGain Histogram Underflow occurred " << overflow 477 << " times in pixel: " << i << " (without saturation!) " << endl; 478 // bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow ); 479 } 480 } 428 481 429 482 for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++) … … 434 487 if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries()) 435 488 { 436 fCam->GetAverageArea(j).SetHiGainSaturation(); 489 MCalibrationRelTimePix &pix = fIntensCam 490 ? (MCalibrationRelTimePix&)fIntensCam->GetAverageArea(j) 491 : (MCalibrationRelTimePix&)fCam->GetAverageArea(j); 492 pix.SetHiGainSaturation(); 437 493 histhi.SetExcluded(); 438 494 } … … 447 503 448 504 MHCalibrationRelTimePix &histhi = (MHCalibrationRelTimePix&)GetAverageHiGainSector(j); 505 MCalibrationRelTimePix &pix = fIntensCam 506 ? (MCalibrationRelTimePix&)fIntensCam->GetAverageSector(j) 507 : (MCalibrationRelTimePix&)fCam->GetAverageSector(j); 449 508 450 509 if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries()) 451 510 { 452 fCam->GetAverageSector(j).SetHiGainSaturation();511 pix.SetHiGainSaturation(); 453 512 histhi.SetExcluded(); 454 513 } … … 458 517 } 459 518 460 FitHiGainArrays((*fCam),*fBadPixels, 519 FitHiGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam), 520 *fBadPixels, 461 521 MBadPixelsPix::kRelTimeNotFitted, 462 522 MBadPixelsPix::kRelTimeOscillating); 463 523 464 524 if (fLoGain) 465 FitLoGainArrays((*fCam),*fBadPixels, 525 FitLoGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam), 526 *fBadPixels, 466 527 MBadPixelsPix::kRelTimeNotFitted, 467 528 MBadPixelsPix::kRelTimeOscillating); … … 557 618 // -------------------------------------------------------------------------- 558 619 // 559 // Calls MH GausEvents::DrawClone() for pixel idx620 // Calls MHCalibrationPix::DrawClone() for pixel idx 560 621 // 561 622 void MHCalibrationRelTimeCam::DrawPixelContent(Int_t idx) const
Note:
See TracChangeset
for help on using the changeset viewer.