Changeset 3626 for trunk/MagicSoft/Mars
- Timestamp:
- 04/01/04 20:59:25 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3625 r3626 33 33 - moved BypassFit() function to MHGausEvents 34 34 35 * mcalib/MHCalibrationChargeCam.[h,cc] 36 - updated and enlarged documentation 35 37 36 38 2004/03/31: Markus Gaug -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r3624 r3626 717 717 fCam->SetReadyToSave(); 718 718 719 *fLog << err << "Sectors: " << fGeom->GetNumSectors() << endl;720 721 719 *fLog << inf << endl; 722 720 *fLog << GetDescriptor() << ": Calibration statistics:" << endl; -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.h
r3602 r3626 93 93 Float_t fLoGainNumPickup; 94 94 95 enum { kHiGainSaturation, kLoGainSaturation, 96 kExcluded, 95 enum { kHiGainSaturation, kExcluded, 97 96 kBlindPixelMethodValid, kFFactorMethodValid, 98 97 kPINDiodeMethodValid, kCombinedMethodValid }; … … 156 155 // Bit Setters 157 156 void SetHiGainSaturation ( const Bool_t b = kTRUE ); 158 void SetLoGainSaturation ( const Bool_t b = kTRUE );159 157 void SetExcluded ( const Bool_t b = kTRUE ); 160 158 void SetBlindPixelMethodValid( const Bool_t b = kTRUE ); … … 235 233 Bool_t IsExcluded() const; 236 234 Bool_t IsHiGainSaturation() const; 237 Bool_t IsLoGainSaturation() const;238 235 Bool_t IsBlindPixelMethodValid() const; 239 236 Bool_t IsPINDiodeMethodValid() const; -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc
r3625 r3626 22 22 ! 23 23 \* ======================================================================== */ 24 25 24 ///////////////////////////////////////////////////////////////////////////// 26 25 // 27 26 // MHCalibrationChargeCam 28 27 // 29 // Fills the extracted signals of MExtractedSignalCam into the MH-classes: 30 // 31 // MHCalibrationChargeHiGainPix, MHCalibrationChargeLoGainPix for each pixel 32 // and additionally for an average of the inner and the outer pixels, respectively. 28 // Fills the extracted signals of MExtractedSignalCam into the MHGausEvents-classes 29 // MHCalibrationChargeHiGainPix and MHCalibrationChargeLoGainPix for every: 30 // 31 // - pixel, stored in the TObjArray's fHiGainArray and fLoGainArray 32 // 33 // - average pixel per area index (e.g. inner and outer for the MAGIC camera), 34 // stored in the TObjArray's fAverageHiGainAreas and fAverageLoGainAreas 35 // 36 // - average pixel per camera sector (e.g. sectors 1-6 for the MAGIC camera), 37 // stored in the TObjArray's fAverageHiGainSectors and fAverageLoGainSectors 33 38 // 34 // By default, subsequently the hi-gain classes are treated unless 35 // more than fNumHiGainSaturationLimit (default: 1%) of the overall FADC 36 // slices show saturation. In that case, the low-gain classes are treated. 39 // Every signal is filled into a Charge histogram and an array, in order to perform 40 // a Fourier analysis (see MHGausEvents). The signals are moreover averaged on an 41 // event-by-event basis and written into the TObjArray's fAverageHiGainAreas, 42 // fAverageLoGainAreas, fAverageHiGainSectors and fAverageLoGainSectors. 43 // 44 // Additionally, the (FADC slice) position of the maximum is stored in an Absolute 45 // Arrival Time histogram. This histogram serves for a rough cross-check if the 46 // signal does not lie at or outside the edges of the extraction window. 47 // 48 // The Charge histograms are fitted to a Gaussian, mean and sigma with its errors 49 // and the fit probability are extracted. If none of these values are NaN's and 50 // if the probability is bigger than fProbLimit (default: 0.5%), the fit is valid. 51 // Otherwise, the fit is repeated within ranges of the previous mean +- 5 sigma. 52 // In case this does not make the fit valid, the histogram means and RMS's are 53 // taken directly and the following flags are set: 54 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted ) or 55 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted ) and 56 // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun ) 57 // 58 // Outliers of more than MHCalibrationChargePix::fPickupLimit (default: 5) sigmas 59 // from the mean are counted as PickUp events (stored in MHCalibrationChargePix::fPickup) 60 // 61 // Unless more than fNumHiGainSaturationLimit (default: 1%) of the overall FADC 62 // slices show saturation, the following flag is set: 63 // - MCalibrationChargePix::SetHiGainSaturation(); 64 // In that case, the calibration constants are derived from the low-gain results. 65 // 37 66 // If more than fNumLoGainSaturationLimit (default: 1%) of the overall 38 // low-gain FADC slices saturate, the pixel is declared not valid and no further 39 // treatment is pursued. 67 // low-gain FADC slices saturate, the following flags are set: 68 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainSaturation ) and 69 // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnsuitableRun ) 40 70 // 41 // The filled histograms are fitted to a Gaussian and the mean and sigma with42 // its errors and the fit probability are extracted. If none of these values are43 // NaN's and if the probability is bigger than fProbLimit (default: 0.5%), the fit44 // is declared valid. Otherwise, the fit is repeated within ranges of the previous mean45 // +- 5 sigma. In case that this does not help, the histogram means and RMS's are taken directly,46 // but the flag kFitValid is set to FALSE. Outliers of more than fPickUpLimit (default: 5) sigmas47 // from the mean are counted as PickUp events.48 //49 // Additionally, the slice number with the highest value is stored and a corresponding50 // histogram is filled. This histogram serves only for a rough cross-check if the51 // signal does not lie at the edges of chose extraction window.52 //53 71 // The class also fills arrays with the signal vs. event number, creates a fourier 54 // spectrum out of it and investigates if the projected frequencies follow an exponential72 // spectrum and investigates if the projected fourier components follow an exponential 55 73 // distribution. In case that the probability of the exponential fit is less than 56 // fProbLimit, the pixel is declared HiGainOscillating or LoGainOscillating, respectively. 74 // fProbLimit (default: 0.5%), the following flags are set: 75 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainOscillating ) or 76 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainOscillating ) and 77 // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun ) 57 78 // 58 // The results are written into MCalibrationChargeCam. 59 // 79 // This same procedure is performed for the average pixels. 80 // 81 // The following results are written into MCalibrationChargeCam: 82 // 83 // - MCalibrationChargePix::SetHiGainSaturation(Bool_t b) 84 // - MCalibrationChargePix::SetHiGainMeanCharge() 85 // - MCalibrationChargePix::SetHiGainMeanChargeErr() 86 // - MCalibrationChargePix::SetHiGainSigmaCharge() 87 // - MCalibrationChargePix::SetHiGainSigmaChargeErr() 88 // - MCalibrationChargePix::SetHiGainChargeProb() 89 // - MCalibrationChargePix::SetHiGainNumPickup() 90 // 91 // - MCalibrationChargePix::SetLoGainMeanCharge() 92 // - MCalibrationChargePix::SetLoGainMeanChargeErr() 93 // - MCalibrationChargePix::SetLoGainSigmaCharge() 94 // - MCalibrationChargePix::SetLoGainSigmaChargeErr() 95 // - MCalibrationChargePix::SetLoGainChargeProb() 96 // - MCalibrationChargePix::SetLoGainNumPickup() 97 // 98 // - MCalibrationChargePix::SetAbsTimeMean() 99 // - MCalibrationChargePix::SetAbsTimeRms() 100 // 101 // The last two items are filled with the Hi-Gain or Lo-Gain result, depending on 102 // the saturation status. 103 // 104 // For all averaged areas, the fitted sigma is multiplied with the square root of 105 // the number involved pixels in order to be able to compare it to the average of 106 // sigmas in the camera. 107 // 60 108 ///////////////////////////////////////////////////////////////////////////// 61 109 #include "MHCalibrationChargeCam.h" … … 95 143 using namespace std; 96 144 145 const Int_t MHCalibrationChargeCam::fgAverageNbins = 4000; 97 146 const Float_t MHCalibrationChargeCam::fgNumHiGainSaturationLimit = 0.01; 98 147 const Float_t MHCalibrationChargeCam::fgNumLoGainSaturationLimit = 0.005; 99 148 const Int_t MHCalibrationChargeCam::fgPulserFrequency = 500; 100 // 149 // -------------------------------------------------------------------------- 150 // 151 // Default Constructor. 152 // 153 // Sets: 154 // - all pointers to NULL 155 // 156 // Initializes and sets owner of: 157 // - fHiGainArray, fLoGainArray 158 // - fAverageHiGainAreas, fAverageLoGainAreas 159 // - fAverageHiGainSectors, fAverageLoGainSectors 160 // 161 // Initializes: 162 // - fNumHiGainSaturationLimit to fgNumHiGainSaturationLimit 163 // - fNumLoGainSaturationLimit to fgNumLoGainSaturationLimit 164 // - fPulserFrequency to fgPulserFrequency 101 165 // 102 166 MHCalibrationChargeCam::MHCalibrationChargeCam(const char *name, const char *title) 103 : f RawEvt(NULL), fGeom(NULL), fBadPixels(NULL)167 : fCam(NULL), fRawEvt(NULL), fGeom(NULL), fBadPixels(NULL) 104 168 { 105 169 fName = name ? name : "MHCalibrationChargeCam"; … … 131 195 // -------------------------------------------------------------------------- 132 196 // 133 // Delete the TClonesArray of MHCalibrationChargePix containers 134 // Delete the average pixels 197 // Deletes the TClonesArray of: 198 // - fHiGainArray, fLoGainArray 199 // - fAverageHiGainAreas, fAverageLoGainAreas 200 // - fAverageHiGainSectors, fAverageLoGainSectors 135 201 // 136 202 MHCalibrationChargeCam::~MHCalibrationChargeCam() … … 148 214 // -------------------------------------------------------------------------- 149 215 // 150 // Get i-th pixel (pixel number)216 // Get i-th High Gain pixel (pixel number) 151 217 // 152 218 MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::operator[](UInt_t i) … … 157 223 // -------------------------------------------------------------------------- 158 224 // 159 // Get i-th pixel (pixel number)225 // Get i-th High Gain pixel (pixel number) 160 226 // 161 227 const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::operator[](UInt_t i) const … … 166 232 // -------------------------------------------------------------------------- 167 233 // 168 // Get i-th pixel (pixel number)234 // Get i-th Low Gain pixel (pixel number) 169 235 // 170 236 MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::operator()(UInt_t i) … … 175 241 // -------------------------------------------------------------------------- 176 242 // 177 // Get i-th pixel (pixel number)243 // Get i-th Low Gain pixel (pixel number) 178 244 // 179 245 const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::operator()(UInt_t i) const … … 184 250 // -------------------------------------------------------------------------- 185 251 // 186 // Get i-th pixel (pixelnumber)252 // Get i-th High Gain pixel Area (area number) 187 253 // 188 254 MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainArea(UInt_t i) … … 193 259 // -------------------------------------------------------------------------- 194 260 // 195 // Get i-th pixel (pixelnumber)261 // Get i-th High Gain pixel Area (area number) 196 262 // 197 263 const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainArea(UInt_t i) const … … 202 268 // -------------------------------------------------------------------------- 203 269 // 204 // Get i-th pixel (pixelnumber)270 // Get i-th Low Gain pixel Area (area number) 205 271 // 206 272 MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainArea(UInt_t i) … … 211 277 // -------------------------------------------------------------------------- 212 278 // 213 // Get i-th pixel (pixelnumber)279 // Get i-th Low Gain pixel Area (area number) 214 280 // 215 281 const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainArea(UInt_t i) const … … 220 286 // -------------------------------------------------------------------------- 221 287 // 222 // Get i-th pixel (pixelnumber)288 // Get i-th High Gain Sector (sector number) 223 289 // 224 290 MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainSector(UInt_t i) … … 229 295 // -------------------------------------------------------------------------- 230 296 // 231 // Get i-th pixel (pixelnumber)297 // Get i-th High Gain Sector (sector number) 232 298 // 233 299 const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainSector(UInt_t i) const … … 238 304 // -------------------------------------------------------------------------- 239 305 // 240 // Get i-th pixel (pixelnumber)306 // Get i-th Low Gain Sector (sector number) 241 307 // 242 308 MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainSector(UInt_t i) … … 247 313 // -------------------------------------------------------------------------- 248 314 // 249 // Get i-th pixel (pixelnumber)315 // Get i-th Low Gain Sector (sector number) 250 316 // 251 317 const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainSector(UInt_t i) const … … 257 323 // 258 324 // Our own clone function is necessary since root 3.01/06 or Mars 0.4 259 // I don't know the reason 325 // I don't know the reason. 326 // 327 // Creates new MHCalibrationChargeCam 328 // Deletes the TObjArray's and Clones them individually 329 // Copies the TArray's 260 330 // 261 331 TObject *MHCalibrationChargeCam::Clone(const char *) const … … 312 382 } 313 383 314 cam->fAverageAreaSat = fAverageAreaSat; 384 cam->fAverageAreaNum = fAverageAreaNum; 385 cam->fAverageAreaSat = fAverageAreaSat; 315 386 cam->fAverageAreaSigma = fAverageAreaSigma; 316 387 cam->fAverageAreaSigmaErr = fAverageAreaSigmaErr; 317 388 cam->fAverageAreaRelSigma = fAverageAreaRelSigma; 318 389 cam->fAverageAreaRelSigmaErr = fAverageAreaRelSigmaErr; 390 cam->fAverageSectorNum = fAverageSectorNum; 319 391 320 392 return cam; … … 323 395 // -------------------------------------------------------------------------- 324 396 // 325 // To setup the object we get the number of pixels from a MGeomCam object 326 // in the Parameter list. 397 // Gets the pointers to: 398 // - MRawEvtData 399 // - MGeomCam 400 // 401 // Calls Delete-Function of: 402 // - fHiGainArray, fLoGainArray 403 // - fAverageHiGainAreas, fAverageLoGainAreas 404 // - fAverageHiGainSectors, fAverageLoGainSectors 327 405 // 328 406 Bool_t MHCalibrationChargeCam::SetupFill(const MParList *pList) … … 355 433 } 356 434 435 // -------------------------------------------------------------------------- 436 // 437 // Gets or creates the pointers to: 438 // - MBadPixelsCam 439 // - MCalibrationChargeCam 440 // 441 // Searches pointer to: 442 // - MExtractedSignalCam 443 // 444 // Initializes, if empty to MExtractedSignalCam::GetSize() for: 445 // - fHiGainArray, fLoGainArray 446 // 447 // Initializes, if empty to MGeomCam::GetNumAreas() for: 448 // - fAverageHiGainAreas, fAverageLoGainAreas 449 // 450 // Initializes, if empty to MGeomCam::GetNumSectors() for: 451 // - fAverageHiGainSectors, fAverageLoGainSectors 452 // 453 // Initializes TArrays to MGeomCam::GetNumAreas and MGeomCam::GetNumSectors, respectively 454 // Fills with number of valid pixels (if !MBadPixelsPix::IsBad()): 455 // - fAverageAreaNum[area index] 456 // - fAverageSectorNum[area index] 457 // 458 // Calls InitializeHiGainHists() and InitializeLoGainHists() for every entry in: 459 // - fHiGainArray, fLoGainArray 460 // - fAverageHiGainAreas, fAverageLoGainAreas 461 // - fAverageHiGainSectors, fAverageLoGainSectors 462 // 463 // Sets Titles and Names for the Charge Histograms and 464 // Sets number of bins to fAverageNbins for: 465 // - fAverageHiGainAreas, fAverageLoGainAreas 466 // - fAverageHiGainSectors, fAverageLoGainSectors 467 // 357 468 Bool_t MHCalibrationChargeCam::ReInit(MParList *pList) 358 469 { … … 374 485 } 375 486 376 const Int_t n = signal->GetSize(); 377 378 if (fHiGainArray->GetEntries()==0) 379 { 380 fHiGainArray->Expand(n); 381 382 for (Int_t i=0; i<n; i++) 383 { 384 // 385 // Oscillating pixels 386 // 387 (*fHiGainArray)[i] = new MHCalibrationChargeHiGainPix; 388 MHCalibrationChargeHiGainPix &hist = (*this)[i]; 389 390 if ((*fBadPixels)[i].IsBad()) 391 { 392 *fLog << warn << "Excluded pixel: " << i << " from calibration " << endl; 393 hist.SetExcluded(); 394 } 395 hist.Init(); 396 hist.ChangeHistId(i); 397 hist.SetEventFrequency(fPulserFrequency); 398 } 399 } 400 401 402 if (fLoGainArray->GetEntries()==0) 403 { 404 fLoGainArray->Expand(n); 405 406 for (Int_t i=0; i<n; i++) 407 { 408 (*fLoGainArray)[i] = new MHCalibrationChargeLoGainPix; 409 MHCalibrationChargeLoGainPix &hist = (*this)(i); 410 // 411 // Pixels with non-valid behavior 412 // 413 if ((*fBadPixels)[i].IsBad()) 414 hist.SetExcluded(); 415 416 hist.Init(); 417 hist.ChangeHistId(i); 418 hist.SetEventFrequency(fPulserFrequency); 419 } 420 421 } 422 423 const Int_t nareas = fGeom->GetNumAreas(); 424 425 if (fAverageHiGainAreas->GetEntries()==0) 426 { 427 fAverageHiGainAreas->Expand(nareas); 428 429 for (Int_t j=0; j<nareas; j++) 430 { 431 // 432 // Oscillating pixels 433 // 434 (*fAverageHiGainAreas)[j] = 435 new MHCalibrationChargeHiGainPix("AverageHiGainArea", 436 "Average HiGain FADC sums of pixel area idx "); 437 MHCalibrationChargeHiGainPix &hist = GetAverageHiGainArea(j); 438 439 hist.GetHGausHist()->SetTitle("Summed FADC slices average Hi Gain pixels Area Idx "); 440 hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average Hi Gain pixels Area Idx "); 441 hist.SetChargeFirst(-1000.); 442 hist.SetChargeLast(4000.); 443 hist.SetChargeNbins(4000); 444 hist.Init(); 445 hist.ChangeHistId(j); 446 hist.SetEventFrequency(fPulserFrequency); 447 } 448 } 449 450 if (fAverageLoGainAreas->GetEntries()==0) 451 { 452 fAverageLoGainAreas->Expand(nareas); 453 454 for (Int_t j=0; j<nareas; j++) 455 { 456 // 457 // Oscillating pixels 458 // 459 (*fAverageLoGainAreas)[j] = 460 new MHCalibrationChargeLoGainPix("AverageLoGainArea", 461 "Average LoGain FADC sums of pixel area idx "); 462 MHCalibrationChargeLoGainPix &hist = GetAverageLoGainArea(j); 463 464 hist.GetHGausHist()->SetTitle("Summed FADC slices average Lo Gain pixels Area Idx "); 465 hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average Lo Gain pixels Area Idx "); 466 hist.SetChargeFirst(-1000.); 467 hist.SetChargeLast(4000.); 468 hist.SetChargeNbins(4000); 469 hist.Init(); 470 hist.ChangeHistId(j); 471 hist.SetEventFrequency(fPulserFrequency); 472 } 473 } 474 487 const Int_t n = signal->GetSize(); 488 const Int_t nsectors = fGeom->GetNumSectors(); 489 const Int_t nareas = fGeom->GetNumAreas(); 490 491 // 492 // The function TArrayF::Set() already sets all entries to 0. 493 // 475 494 fAverageAreaNum. Set(nareas); 476 495 fAverageAreaSat. Set(nareas); … … 479 498 fAverageAreaRelSigma. Set(nareas); 480 499 fAverageAreaRelSigmaErr.Set(nareas); 500 fAverageSectorNum. Set(nsectors); 501 502 for (Int_t i=0; i<n; i++) 503 { 504 if ((*fBadPixels)[i].IsBad()) 505 continue; 506 fAverageAreaNum [(*fGeom)[i].GetAidx() ]++; 507 fAverageSectorNum[(*fGeom)[i].GetSector()]++; 508 } 509 510 if (fHiGainArray->GetEntries()==0) 511 { 512 fHiGainArray->Expand(n); 513 for (Int_t i=0; i<n; i++) 514 { 515 (*fHiGainArray)[i] = new MHCalibrationChargeHiGainPix; 516 InitializeHiGainHists((*this)[i],(*fBadPixels)[i],i); 517 } 518 } 519 520 521 if (fLoGainArray->GetEntries()==0) 522 { 523 fLoGainArray->Expand(n); 524 525 for (Int_t i=0; i<n; i++) 526 { 527 (*fLoGainArray)[i] = new MHCalibrationChargeLoGainPix; 528 InitializeLoGainHists((*this)(i),(*fBadPixels)[i],i); 529 } 530 531 } 532 533 if (fAverageHiGainAreas->GetEntries()==0) 534 { 535 fAverageHiGainAreas->Expand(nareas); 481 536 482 for (Int_t i=0; i<n; i++) 483 { 484 if ((*this)[i].IsExcluded()) 485 continue; 486 487 const Int_t aidx = (*fGeom)[i].GetAidx(); 488 fAverageAreaNum[aidx]++; 489 } 490 491 492 const Int_t nsectors = fGeom->GetNumSectors(); 493 537 for (Int_t j=0; j<nareas; j++) 538 { 539 (*fAverageHiGainAreas)[j] = 540 new MHCalibrationChargeHiGainPix("AverageHiGainArea", 541 "Average HiGain FADC sums area idx "); 542 InitializeHiGainHists(GetAverageHiGainArea(j),fCam->GetAverageBadArea(j),j); 543 GetAverageHiGainArea(j).GetHGausHist()->SetTitle("Summed FADC slices average HiGain Area Idx "); 544 GetAverageHiGainArea(j).GetHAbsTime()->SetTitle("Absolute Arrival Time average HiGain Area Idx "); 545 GetAverageHiGainArea(j).SetChargeNbins(fAverageNbins); 546 } 547 } 548 549 if (fAverageLoGainAreas->GetEntries()==0) 550 { 551 fAverageLoGainAreas->Expand(nareas); 552 553 for (Int_t j=0; j<nareas; j++) 554 { 555 (*fAverageLoGainAreas)[j] = 556 new MHCalibrationChargeLoGainPix("AverageLoGainArea", 557 "Average LoGain FADC sums of pixel area idx "); 558 InitializeLoGainHists(GetAverageLoGainArea(j),fCam->GetAverageBadArea(j),j); 559 GetAverageLoGainArea(j).GetHGausHist()->SetTitle("Summed FADC slices average LoGain Area Idx "); 560 GetAverageLoGainArea(j).GetHAbsTime()->SetTitle("Absolute Arrival Time average LoGain Area Idx "); 561 GetAverageLoGainArea(j).SetChargeNbins(fAverageNbins); 562 } 563 } 564 494 565 if (fAverageHiGainSectors->GetEntries()==0) 495 566 { … … 498 569 for (Int_t j=0; j<nsectors; j++) 499 570 { 500 //501 // Oscillating pixels502 //503 571 (*fAverageHiGainSectors)[j] = 504 572 new MHCalibrationChargeHiGainPix("AverageHiGainSector", 505 573 "Average HiGain FADC sums of pixel sector "); 506 MHCalibrationChargeHiGainPix &hist = GetAverageHiGainSector(j); 507 508 hist.GetHGausHist()->SetTitle("Summed FADC slices average Hi Gain pixels Sector "); 509 hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average Hi Gain pixels Sector "); 510 hist.SetChargeFirst(-1000.); 511 hist.SetChargeLast(4000.); 512 hist.SetChargeNbins(4000); 513 hist.Init(); 514 hist.ChangeHistId(j); 515 hist.SetEventFrequency(fPulserFrequency); 574 InitializeHiGainHists(GetAverageHiGainSector(j),fCam->GetAverageBadSector(j),j); 575 GetAverageHiGainSector(j).GetHGausHist()->SetTitle("Summed FADC slices average HiGain Sector "); 576 GetAverageHiGainSector(j).GetHAbsTime()->SetTitle("Absolute Arrival Time average HiGain Sector "); 577 GetAverageHiGainSector(j).SetChargeNbins(fAverageNbins); 516 578 } 517 579 } … … 523 585 for (Int_t j=0; j<nsectors; j++) 524 586 { 525 //526 // Oscillating pixels527 //528 587 (*fAverageLoGainSectors)[j] = 529 588 new MHCalibrationChargeLoGainPix("AverageLoGainSector", 530 589 "Average LoGain FADC sums of pixel sector "); 531 MHCalibrationChargeLoGainPix &hist = GetAverageLoGainSector(j); 532 533 hist.GetHGausHist()->SetTitle("Summed FADC slices average Lo Gain pixels Sector "); 534 hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average Lo Gain pixels Sector "); 535 hist.SetChargeFirst(-1000.); 536 hist.SetChargeLast(4000.); 537 hist.SetChargeNbins(4000); 538 hist.Init(); 539 hist.ChangeHistId(j); 540 hist.SetEventFrequency(fPulserFrequency); 590 InitializeLoGainHists(GetAverageLoGainSector(j),fCam->GetAverageBadSector(j),j); 591 GetAverageLoGainSector(j).GetHGausHist()->SetTitle("Summed FADC slices average LoGain Sector "); 592 GetAverageLoGainSector(j).GetHAbsTime()->SetTitle("Absolute Arrival Time average LoGain Sector "); 593 GetAverageLoGainSector(j).SetChargeNbins(fAverageNbins); 541 594 } 542 595 } 543 596 544 fAverageSectorNum. Set(nsectors);545 546 for (Int_t i=0; i<n; i++)547 {548 if ((*this)[i].IsExcluded())549 continue;550 551 const Int_t sector = (*fGeom)[i].GetSector();552 fAverageSectorNum[sector]++;553 }554 555 556 597 return kTRUE; 557 598 } 558 559 560 // -------------------------------------------------------------------------- 599 600 // ------------------------------------------------------------- 601 // 602 // If MBadPixelsPix::IsBad(): 603 // - calls MHCalibrationChargeHiGainPix::SetExcluded() 604 // 605 // Calls: 606 // - MHCalibrationChargePix::Init() 607 // - MHCalibrationChargePix::ChangeHistId(i) 608 // - MHGausEvents::SetEventFrequency(fPulserFrequency) 609 // 610 void MHCalibrationChargeCam::InitializeHiGainHists(MHCalibrationChargeHiGainPix &hist,MBadPixelsPix &bad, const Int_t i) 611 { 612 613 if (bad.IsBad()) 614 { 615 *fLog << warn << "Excluded pixel: " << i << " from calibration " << endl; 616 hist.SetExcluded(); 617 } 618 619 hist.Init(); 620 hist.ChangeHistId(i); 621 hist.SetEventFrequency(fPulserFrequency); 622 623 } 624 625 // ------------------------------------------------------------- 626 // 627 // If MBadPixelsPix::IsBad(): 628 // - calls MHCalibrationChargeLoGainPix::SetExcluded() 629 // 630 // Calls: 631 // - MHCalibrationChargePix::Init() 632 // - MHCalibrationChargePix::ChangeHistId(i) 633 // - MHGausEvents::SetEventFrequency(fPulserFrequency) 634 // 635 void MHCalibrationChargeCam::InitializeLoGainHists(MHCalibrationChargeLoGainPix &hist,MBadPixelsPix &bad, const Int_t i) 636 { 637 638 if (bad.IsBad()) 639 hist.SetExcluded(); 640 641 hist.Init(); 642 hist.ChangeHistId(i); 643 hist.SetEventFrequency(fPulserFrequency); 644 } 645 646 647 // -------------------------------------------------------------------------- 648 // 649 // Retrieves from MExtractedSignalCam: 650 // - number of pixels 651 // - first used LoGain FADC slice 652 // 653 // Retrieves from MGeomCam: 654 // - number of pixel areas 655 // - number of sectors 656 // 657 // For all TObjArray's (including the averaged ones), the following steps are performed: 658 // 659 // 1) Test size and return kFALSE if not matching 660 // 661 // 2) Fill Charges histograms (MHGausEvents::FillHistAndArray()) with: 662 // - MExtractedSignalPix::GetExtractedSignalHiGain(); 663 // - MExtractedSignalPix::GetExtractedSignalLoGain(); 664 // 665 // 3) Set number of saturated slices (MHCalibrationChargePix::SetSaturated()) with: 666 // - MExtractedSignalPix::GetNumHiGainSaturated(); 667 // - MExtractedSignalPix::GetNumLoGainSaturated(); 668 // 669 // 4) Fill AbsTime histograms (MHCalibrationChargePix::FillAbsTime()) with: 670 // - MRawEvtPixelIter::GetIdxMaxHiGainSample(); 671 // - MRawEvtPixelIter::GetIdxMaxLoGainSample(first slice); 672 // 561 673 Bool_t MHCalibrationChargeCam::Fill(const MParContainer *par, const Stat_t w) 562 674 { … … 725 837 // -------------------------------------------------------------------------- 726 838 // 727 // 1) Return if the charge distribution is already succesfully fitted 728 // or if the histogram is empty 729 // 2) Fit the histograms with a Gaussian 730 // 3) In case of failure set the bit kFitted to false and take histogram means and RMS 731 // 4) Check for pickup noise 732 // 5) Check the fourier spectrum 733 // 5) Retrieve the results and store them in this class 839 // For all TObjArray's (including the averaged ones), the following steps are performed: 840 // 841 // 1) Return if the pixel is excluded 842 // 843 // 2) Call to FinalizeHiGainHists() and FinalizeLoGainHists() 844 // 845 // For all averaged areas, the fitted sigma is multiplied with the square root of 846 // the number involved pixels 734 847 // 735 848 Bool_t MHCalibrationChargeCam::Finalize() … … 832 945 } 833 946 947 // --------------------------------------------------------------------------- 948 // 949 // Returns if the histogram is empty and sets the following flag: 950 // - MBadPixelsPix::SetUnsuitable(MBadPixelsPix::kUnsuitableRun) 951 // 952 // Returns if the number of saturated slices (MHCalibrationChargePix::GetSaturated()) is 953 // higher than the allowed limit (fNumHiGainSaturationLimit*histogram-entries), creates 954 // the fourier spectrum and sets the following flags: 955 // - MCalibrationChargePix::SetHiGainSaturation() 956 // 957 // Fits the histograms with a Gaussian, in case of failure 958 // calls MHCalibrationChargePix::RepeatFit(), in case of repeated failure 959 // calls MHGausEvents::BypassFit() and sets the following flags: 960 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted ) 961 // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun ) 962 // 963 // Counts the number of pickup events 964 // 965 // Creates the fourier spectrum and tests MHGausEvents::IsFourierSpectrumOK(). 966 // In case no, sets the following flags: 967 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainOscillating ) 968 // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun ) 969 // 970 // Retrieves the results and store them in MCalibrationChargePix 971 // 834 972 void MHCalibrationChargeCam::FinalizeHiGainHists(MHCalibrationChargeHiGainPix &hist, 835 973 MCalibrationChargePix &pix, … … 851 989 return; 852 990 } 853 991 854 992 // 855 993 // 2) Fit the Hi Gain histograms with a Gaussian … … 877 1015 hist.CreateFourierSpectrum(); 878 1016 879 //880 // 6) Retrieve the results and store them in this class881 //882 pix.SetHiGainMeanCharge( hist.GetMean() );883 pix.SetHiGainMeanChargeErr( hist.GetMeanErr() );884 pix.SetHiGainSigmaCharge( hist.GetSigma() );885 pix.SetHiGainSigmaChargeErr( hist.GetSigmaErr() );886 pix.SetHiGainChargeProb ( hist.GetProb() );887 888 pix.SetAbsTimeMean ( hist.GetAbsTimeMean());889 pix.SetAbsTimeRms ( hist.GetAbsTimeRms() );890 891 pix.SetHiGainNumPickup ( hist.GetPickup() );892 893 1017 if (!hist.IsFourierSpectrumOK()) 894 1018 { … … 897 1021 bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun ); 898 1022 } 899 } 900 901 1023 1024 // 1025 // 6) Retrieve the results and store them in this class 1026 // 1027 pix.SetHiGainMeanCharge( hist.GetMean() ); 1028 pix.SetHiGainMeanChargeErr( hist.GetMeanErr() ); 1029 pix.SetHiGainSigmaCharge( hist.GetSigma() ); 1030 pix.SetHiGainSigmaChargeErr( hist.GetSigmaErr() ); 1031 pix.SetHiGainChargeProb ( hist.GetProb() ); 1032 1033 pix.SetAbsTimeMean ( hist.GetAbsTimeMean()); 1034 pix.SetAbsTimeRms ( hist.GetAbsTimeRms() ); 1035 1036 pix.SetHiGainNumPickup ( hist.GetPickup() ); 1037 1038 } 1039 1040 // --------------------------------------------------------------------------- 1041 // 1042 // Returns if the histogram is empty. If yes and the flag MCalibrationChargePix::IsHiGainSaturation() 1043 // is set, sets the following flag: 1044 // - MBadPixelsPix::SetUnsuitable(MBadPixelsPix::kUnsuitableRun) 1045 // 1046 // Returns if the number of saturated slices (MHCalibrationChargePix::GetSaturated()) is 1047 // higher than the allowed limit (fNumLoGainSaturationLimit*histogram-entries), creates 1048 // the fourier spectrum and sets the following flags: 1049 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainSaturation ); 1050 // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnsuitableRun ); 1051 // 1052 // Fits the histograms with a Gaussian, in case of failure calls MHCalibrationChargePix::RepeatFit(), 1053 // in case of repeated failure calls MHGausEvents::BypassFit() and sets the following flags: 1054 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted ) 1055 // If the flag MCalibrationChargePix::IsHiGainSaturation() is set, sets additionally: 1056 // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun ) 1057 // 1058 // Counts the number of pickup events 1059 // 1060 // Creates the fourier spectrum and tests MHGausEvents::IsFourierSpectrumOK(). 1061 // In case no, sets the following flags: 1062 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainOscillating ) 1063 // If the flag MCalibrationChargePix::IsHiGainSaturation() is set, sets additionally: 1064 // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun ) 1065 // 1066 // Retrieves the results and store them in MCalibrationChargePix 1067 // 902 1068 void MHCalibrationChargeCam::FinalizeLoGainHists(MHCalibrationChargeLoGainPix &hist, 903 1069 MCalibrationChargePix &pix, … … 915 1081 { 916 1082 *fLog << warn << "Saturated Lo Gain histogram in pixel: " << pix.GetPixId() << endl; 917 pix.SetLoGainSaturation();918 1083 bad.SetUncalibrated( MBadPixelsPix::kLoGainSaturation ); 919 1084 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun ); … … 947 1112 hist.CreateFourierSpectrum(); 948 1113 1114 if (!hist.IsFourierSpectrumOK()) 1115 { 1116 bad.SetUncalibrated( MBadPixelsPix::kLoGainOscillating ); 1117 if (pix.IsHiGainSaturation()) 1118 bad.SetUnsuitable(MBadPixelsPix::kUnreliableRun); 1119 } 949 1120 // 950 1121 // 6) Retrieve the results and store them in this class … … 964 1135 pix.SetLoGainNumPickup ( hist.GetPickup() ); 965 1136 966 if (!hist.IsFourierSpectrumOK())967 {968 bad.SetUncalibrated( MBadPixelsPix::kLoGainOscillating );969 if (pix.IsHiGainSaturation())970 bad.SetUnsuitable(MBadPixelsPix::kUnreliableRun);971 }972 1137 } 973 1138 974 975 1139 // -------------------------------------------------------------------------- 1140 // 1141 // Dummy, needed by MCamEvent 1142 // 976 1143 Bool_t MHCalibrationChargeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const 977 1144 { … … 988 1155 } 989 1156 990 1157 // ----------------------------------------------------------------------------- 1158 // 1159 // Default draw: 1160 // 1161 // Displays the averaged areas, both High Gain and Low Gain 1162 // 1163 // The following options can be chosen: 1164 // 1165 // "": displays the fHGausHist and the fHAbsTime 1166 // "all": executes additionally MHGausEvents::Draw(), with options 1167 // 991 1168 void MHCalibrationChargeCam::Draw(const Option_t *opt) 992 1169 { … … 1021 1198 } 1022 1199 1200 // ----------------------------------------------------------------------------- 1201 // 1202 // Default draw: 1203 // 1204 // Displays a TPaveText with the re-normalized sigmas of the average area 1205 // 1023 1206 void MHCalibrationChargeCam::DrawAverageSigma(Bool_t sat, Bool_t inner, 1024 1207 Float_t sigma, Float_t sigmaerr, -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.h
r3624 r3626 36 36 private: 37 37 38 static const Int_t fgAverageNbins; // The default for fAverageNbins 38 39 static const Float_t fgNumHiGainSaturationLimit; // The default for fNumHiGainSaturationLimit 39 40 static const Float_t fgNumLoGainSaturationLimit; // The default for fNumLoGainSaturationLimit 40 41 static const Int_t fgPulserFrequency; // The default for fPulserFrequency 41 42 43 Int_t fAverageNbins; // Number of bins for the average histograms 42 44 Float_t fNumHiGainSaturationLimit; // Rel. amount sat. higain FADC slices until pixel is called saturated 43 45 Float_t fNumLoGainSaturationLimit; // Rel. amount sat. logain FADC slices until pixel is called saturated 44 45 46 Int_t fPulserFrequency; // Light pulser frequency 46 47 … … 66 67 TArrayI fAverageSectorNum; // Number of pixels in average pixels per sector 67 68 69 void InitializeHiGainHists(MHCalibrationChargeHiGainPix &hist, MBadPixelsPix &bad, const Int_t i); 70 void InitializeLoGainHists(MHCalibrationChargeLoGainPix &hist, MBadPixelsPix &bad, const Int_t i); 71 68 72 void FinalizeHiGainHists(MHCalibrationChargeHiGainPix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad); 69 73 void FinalizeLoGainHists(MHCalibrationChargeLoGainPix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad); … … 77 81 ~MHCalibrationChargeCam(); 78 82 83 void SetAverageNbins( const Int_t bins=fgAverageNbins ) { fAverageNbins = bins; } 84 void SetNumLoGainSaturationLimit( const Float_t lim=fgNumLoGainSaturationLimit) { fNumLoGainSaturationLimit = lim; } 79 85 void SetNumHiGainSaturationLimit( const Float_t lim=fgNumHiGainSaturationLimit) { fNumHiGainSaturationLimit = lim; } 80 void SetNumLoGainSaturationLimit( const Float_t lim=fgNumLoGainSaturationLimit) { fNumLoGainSaturationLimit = lim; }81 86 void SetPulserFrequency ( const Int_t f=fgPulserFrequency) { fPulserFrequency = f; } 82 87
Note:
See TracChangeset
for help on using the changeset viewer.