Changeset 3631
- Timestamp:
- 04/01/04 23:05:48 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.cc
r3630 r3631 38 38 // The corresponding operators: [],() and the operators GetAverageHiGainArea(), 39 39 // GetAverageLoGainArea(), GetAverageHiGainSector() and GetAverageLoGainSector() 40 // have to cast to the corresponding class. It is assumed that all classes dealing41 // with calibration pixels derive from MHGausEvents40 // have to be cast to the corresponding class. It is assumed that all classes 41 // dealing with calibration pixels derive from MHGausEvents. 42 42 // 43 43 ///////////////////////////////////////////////////////////////////////////// … … 56 56 57 57 #include "MGeomCam.h" 58 #include "MGeomPix.h"59 58 60 59 ClassImp(MHCalibrationCam); … … 62 61 using namespace std; 63 62 64 const Int_t MHCalibrationCam::fgPulserFrequency 63 const Int_t MHCalibrationCam::fgPulserFrequency = 500; 65 64 // -------------------------------------------------------------------------- 66 65 // -
trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.h
r3629 r3631 30 30 protected: 31 31 32 static const Int_t fgPulserFrequency; // The default for fPulserFrequency 32 static const Int_t fgPulserFrequency; // The default for fPulserFrequency (now set to: 500) 33 33 Int_t fPulserFrequency; // Light pulser frequency 34 34 … … 86 86 virtual void DrawPixelContent( Int_t num ) const; 87 87 88 ClassDef(MHCalibrationCam, 1) // Base Histogram class for camera calibration88 ClassDef(MHCalibrationCam, 1) // Base Histogram class for Calibration Camera 89 89 }; 90 90 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc
r3626 r3631 29 29 // MHCalibrationChargeHiGainPix and MHCalibrationChargeLoGainPix for every: 30 30 // 31 // - pixel, stored in the TObjArray's fHiGainArray and fLoGainArray 31 // - pixel, stored in the TObjArray's MHCalibrationCam::fHiGainArray and 32 // MHCalibrationCam::fLoGainArray 32 33 // 33 34 // - average pixel per area index (e.g. inner and outer for the MAGIC camera), 34 // stored in the TObjArray's fAverageHiGainAreas and fAverageLoGainAreas 35 // stored in the TObjArray's MHCalibrationCam::fAverageHiGainAreas and 36 // MHCalibrationCam::fAverageLoGainAreas 35 37 // 36 38 // - average pixel per camera sector (e.g. sectors 1-6 for the MAGIC camera), 37 // stored in the TObjArray's fAverageHiGainSectors and fAverageLoGainSectors 39 // stored in the TObjArray's MHCalibrationCam::fAverageHiGainSectors and 40 // MHCalibrationCam::fAverageLoGainSectors 38 41 // 39 42 // Every signal is filled into a Charge histogram and an array, in order to perform 40 43 // 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. 44 // event-by-event basis and written into the corresponding average pixels 43 45 // 44 46 // Additionally, the (FADC slice) position of the maximum is stored in an Absolute … … 108 110 ///////////////////////////////////////////////////////////////////////////// 109 111 #include "MHCalibrationChargeCam.h" 110 111 #include <TVirtualPad.h> 112 #include <TCanvas.h> 113 #include <TPad.h> 114 #include <TText.h> 115 #include <TPaveText.h> 112 #include "MHCalibrationCam.h" 116 113 117 114 #include "MLog.h" … … 146 143 const Float_t MHCalibrationChargeCam::fgNumHiGainSaturationLimit = 0.01; 147 144 const Float_t MHCalibrationChargeCam::fgNumLoGainSaturationLimit = 0.005; 148 const Int_t MHCalibrationChargeCam::fgPulserFrequency = 500;149 145 // -------------------------------------------------------------------------- 150 146 // … … 154 150 // - all pointers to NULL 155 151 // 156 // Initializes and sets owner of :152 // Initializes and sets owner of (done in MHCalibrationCam): 157 153 // - fHiGainArray, fLoGainArray 158 154 // - fAverageHiGainAreas, fAverageLoGainAreas … … 162 158 // - fNumHiGainSaturationLimit to fgNumHiGainSaturationLimit 163 159 // - fNumLoGainSaturationLimit to fgNumLoGainSaturationLimit 164 // - fPulserFrequency to fgPulserFrequency 160 // - fPulserFrequency to fgPulserFrequency (in MHCalibrationCam) 165 161 // 166 162 MHCalibrationChargeCam::MHCalibrationChargeCam(const char *name, const char *title) … … 170 166 fTitle = title ? title : "Class to fill the calibration histograms "; 171 167 172 fHiGainArray = new TObjArray;173 fHiGainArray->SetOwner();174 175 fLoGainArray = new TObjArray;176 fLoGainArray->SetOwner();177 178 fAverageHiGainAreas = new TObjArray;179 fAverageHiGainAreas->SetOwner();180 181 fAverageLoGainAreas = new TObjArray;182 fAverageLoGainAreas->SetOwner();183 184 fAverageHiGainSectors = new TObjArray;185 fAverageHiGainSectors->SetOwner();186 187 fAverageLoGainSectors = new TObjArray;188 fAverageLoGainSectors->SetOwner();189 190 168 SetNumHiGainSaturationLimit(); 191 169 SetNumLoGainSaturationLimit(); 192 SetPulserFrequency();193 }194 195 // --------------------------------------------------------------------------196 //197 // Deletes the TClonesArray of:198 // - fHiGainArray, fLoGainArray199 // - fAverageHiGainAreas, fAverageLoGainAreas200 // - fAverageHiGainSectors, fAverageLoGainSectors201 //202 MHCalibrationChargeCam::~MHCalibrationChargeCam()203 {204 delete fHiGainArray;205 delete fLoGainArray;206 207 delete fAverageHiGainAreas;208 delete fAverageLoGainAreas;209 210 delete fAverageHiGainSectors;211 delete fAverageLoGainSectors;212 }213 214 // --------------------------------------------------------------------------215 //216 // Get i-th High Gain pixel (pixel number)217 //218 MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::operator[](UInt_t i)219 {220 return *static_cast<MHCalibrationChargeHiGainPix*>(fHiGainArray->UncheckedAt(i));221 }222 223 // --------------------------------------------------------------------------224 //225 // Get i-th High Gain pixel (pixel number)226 //227 const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::operator[](UInt_t i) const228 {229 return *static_cast<MHCalibrationChargeHiGainPix*>(fHiGainArray->UncheckedAt(i));230 }231 232 // --------------------------------------------------------------------------233 //234 // Get i-th Low Gain pixel (pixel number)235 //236 MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::operator()(UInt_t i)237 {238 return *static_cast<MHCalibrationChargeLoGainPix*>(fLoGainArray->UncheckedAt(i));239 }240 241 // --------------------------------------------------------------------------242 //243 // Get i-th Low Gain pixel (pixel number)244 //245 const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::operator()(UInt_t i) const246 {247 return *static_cast<MHCalibrationChargeLoGainPix*>(fLoGainArray->UncheckedAt(i));248 }249 250 // --------------------------------------------------------------------------251 //252 // Get i-th High Gain pixel Area (area number)253 //254 MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainArea(UInt_t i)255 {256 return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainAreas->UncheckedAt(i));257 }258 259 // --------------------------------------------------------------------------260 //261 // Get i-th High Gain pixel Area (area number)262 //263 const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainArea(UInt_t i) const264 {265 return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainAreas->UncheckedAt(i));266 }267 268 // --------------------------------------------------------------------------269 //270 // Get i-th Low Gain pixel Area (area number)271 //272 MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainArea(UInt_t i)273 {274 return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainAreas->UncheckedAt(i));275 }276 277 // --------------------------------------------------------------------------278 //279 // Get i-th Low Gain pixel Area (area number)280 //281 const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainArea(UInt_t i) const282 {283 return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainAreas->UncheckedAt(i));284 }285 286 // --------------------------------------------------------------------------287 //288 // Get i-th High Gain Sector (sector number)289 //290 MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainSector(UInt_t i)291 {292 return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainSectors->UncheckedAt(i));293 }294 295 // --------------------------------------------------------------------------296 //297 // Get i-th High Gain Sector (sector number)298 //299 const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainSector(UInt_t i) const300 {301 return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainSectors->UncheckedAt(i));302 }303 304 // --------------------------------------------------------------------------305 //306 // Get i-th Low Gain Sector (sector number)307 //308 MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainSector(UInt_t i)309 {310 return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainSectors->UncheckedAt(i));311 }312 313 // --------------------------------------------------------------------------314 //315 // Get i-th Low Gain Sector (sector number)316 //317 const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainSector(UInt_t i) const318 {319 return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainSectors->UncheckedAt(i));320 }321 322 // --------------------------------------------------------------------------323 //324 // Our own clone function is necessary since root 3.01/06 or Mars 0.4325 // I don't know the reason.326 //327 // Creates new MHCalibrationChargeCam328 // Deletes the TObjArray's and Clones them individually329 // Copies the TArray's330 //331 TObject *MHCalibrationChargeCam::Clone(const char *) const332 {333 334 const Int_t nhi = fHiGainArray->GetEntries();335 const Int_t nlo = fLoGainArray->GetEntries();336 const Int_t navhi = fAverageHiGainAreas->GetEntries();337 const Int_t navlo = fAverageLoGainAreas->GetEntries();338 const Int_t nsehi = fAverageHiGainSectors->GetEntries();339 const Int_t nselo = fAverageLoGainSectors->GetEntries();340 341 //342 // FIXME, this might be done faster and more elegant, by direct copy.343 //344 MHCalibrationChargeCam *cam = new MHCalibrationChargeCam();345 346 cam->fHiGainArray->Expand(nhi);347 cam->fLoGainArray->Expand(nlo);348 cam->fAverageHiGainAreas->Expand(navhi);349 cam->fAverageLoGainAreas->Expand(navlo);350 cam->fAverageHiGainSectors->Expand(nsehi);351 cam->fAverageLoGainSectors->Expand(nselo);352 353 for (int i=0; i<nhi; i++)354 {355 delete (*cam->fHiGainArray)[i];356 (*cam->fHiGainArray)[i] = (MHCalibrationChargeHiGainPix*)(*fHiGainArray)[i]->Clone();357 }358 for (int i=0; i<nlo; i++)359 {360 delete (*cam->fLoGainArray)[i];361 (*cam->fLoGainArray)[i] = (MHCalibrationChargeLoGainPix*)(*fLoGainArray)[i]->Clone();362 }363 for (int i=0; i<navhi; i++)364 {365 delete (*cam->fAverageHiGainAreas)[i];366 (*cam->fAverageHiGainAreas)[i] = (MHCalibrationChargeHiGainPix*)(*fAverageHiGainAreas)[i]->Clone();367 }368 for (int i=0; i<navlo; i++)369 {370 delete (*cam->fAverageLoGainAreas)[i];371 (*cam->fAverageLoGainAreas)[i] = (MHCalibrationChargeLoGainPix*)(*fAverageLoGainAreas)[i]->Clone();372 }373 for (int i=0; i<nsehi; i++)374 {375 delete (*cam->fAverageHiGainSectors)[i];376 (*cam->fAverageHiGainSectors)[i] = (MHCalibrationChargeHiGainPix*)(*fAverageHiGainSectors)[i]->Clone();377 }378 for (int i=0; i<nselo; i++)379 {380 delete (*cam->fAverageLoGainSectors)[i];381 (*cam->fAverageLoGainSectors)[i] = (MHCalibrationChargeLoGainPix*)(*fAverageLoGainSectors)[i]->Clone();382 }383 384 cam->fAverageAreaNum = fAverageAreaNum;385 cam->fAverageAreaSat = fAverageAreaSat;386 cam->fAverageAreaSigma = fAverageAreaSigma;387 cam->fAverageAreaSigmaErr = fAverageAreaSigmaErr;388 cam->fAverageAreaRelSigma = fAverageAreaRelSigma;389 cam->fAverageAreaRelSigmaErr = fAverageAreaRelSigmaErr;390 cam->fAverageSectorNum = fAverageSectorNum;391 392 return cam;393 170 } 394 171 … … 400 177 // 401 178 // Calls Delete-Function of: 402 // - fHiGainArray,fLoGainArray403 // - fAverageHiGainAreas,fAverageLoGainAreas404 // - fAverageHiGainSectors,fAverageLoGainSectors179 // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray 180 // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas 181 // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors 405 182 // 406 183 Bool_t MHCalibrationChargeCam::SetupFill(const MParList *pList) … … 443 220 // 444 221 // Initializes, if empty to MExtractedSignalCam::GetSize() for: 445 // - fHiGainArray,fLoGainArray222 // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray 446 223 // 447 224 // Initializes, if empty to MGeomCam::GetNumAreas() for: 448 // - fAverageHiGainAreas,fAverageLoGainAreas225 // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas 449 226 // 450 227 // Initializes, if empty to MGeomCam::GetNumSectors() for: 451 // - fAverageHiGainSectors,fAverageLoGainSectors228 // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors 452 229 // 453 230 // Initializes TArrays to MGeomCam::GetNumAreas and MGeomCam::GetNumSectors, respectively 454 231 // Fills with number of valid pixels (if !MBadPixelsPix::IsBad()): 455 // - fAverageAreaNum[area index]456 // - fAverageSectorNum[area index]232 // - MHCalibrationCam::fAverageAreaNum[area index] 233 // - MHCalibrationCam::fAverageSectorNum[area index] 457 234 // 458 235 // Calls InitializeHiGainHists() and InitializeLoGainHists() for every entry in: 459 // - fHiGainArray,fLoGainArray460 // - fAverageHiGainAreas,fAverageLoGainAreas461 // - fAverageHiGainSectors,fAverageLoGainSectors236 // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray 237 // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas 238 // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors 462 239 // 463 240 // Sets Titles and Names for the Charge Histograms and 464 241 // Sets number of bins to fAverageNbins for: 465 // - fAverageHiGainAreas,fAverageLoGainAreas466 // - fAverageHiGainSectors,fAverageLoGainSectors242 // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas 243 // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors 467 244 // 468 245 Bool_t MHCalibrationChargeCam::ReInit(MParList *pList) … … 514 291 { 515 292 (*fHiGainArray)[i] = new MHCalibrationChargeHiGainPix; 516 InitializeHiGainHists(( *this)[i],(*fBadPixels)[i],i);293 InitializeHiGainHists((MHCalibrationChargePix&)(*this)[i],(*fBadPixels)[i],i); 517 294 } 518 295 } … … 526 303 { 527 304 (*fLoGainArray)[i] = new MHCalibrationChargeLoGainPix; 528 InitializeLoGainHists(( *this)(i),(*fBadPixels)[i],i);305 InitializeLoGainHists((MHCalibrationChargePix&)(*this)(i),(*fBadPixels)[i],i); 529 306 } 530 307 … … 540 317 new MHCalibrationChargeHiGainPix("AverageHiGainArea", 541 318 "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); 319 320 MHCalibrationChargePix &hist = (MHCalibrationChargePix&)GetAverageHiGainArea(j); 321 322 InitializeHiGainHists(hist,fCam->GetAverageBadArea(j),j); 323 324 hist.GetHGausHist()->SetTitle("Summed FADC slices average HiGain Area Idx "); 325 hist.SetChargeNbins(fAverageNbins); 326 hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average HiGain Area Idx "); 546 327 } 547 328 } … … 556 337 new MHCalibrationChargeLoGainPix("AverageLoGainArea", 557 338 "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); 339 340 MHCalibrationChargePix &hist = (MHCalibrationChargePix&)GetAverageLoGainArea(j); 341 342 InitializeLoGainHists(hist,fCam->GetAverageBadArea(j),j); 343 344 hist.GetHGausHist()->SetTitle("Summed FADC slices average LoGain Area Idx "); 345 hist.SetChargeNbins(fAverageNbins); 346 hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average LoGain Area Idx "); 347 562 348 } 563 349 } … … 572 358 new MHCalibrationChargeHiGainPix("AverageHiGainSector", 573 359 "Average HiGain FADC sums of pixel sector "); 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); 360 361 MHCalibrationChargePix &hist = (MHCalibrationChargePix&)GetAverageHiGainSector(j); 362 363 InitializeHiGainHists(hist,fCam->GetAverageBadSector(j),j); 364 365 hist.GetHGausHist()->SetTitle("Summed FADC slices average HiGain Sector "); 366 hist.SetChargeNbins(fAverageNbins); 367 hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average HiGain Sector "); 368 578 369 } 579 370 } … … 588 379 new MHCalibrationChargeLoGainPix("AverageLoGainSector", 589 380 "Average LoGain FADC sums of pixel sector "); 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); 381 382 MHCalibrationChargePix &hist = (MHCalibrationChargePix&)GetAverageLoGainSector(j); 383 384 InitializeLoGainHists(hist,fCam->GetAverageBadSector(j),j); 385 386 hist.GetHGausHist()->SetTitle("Summed FADC slices average LoGain Sector "); 387 hist.SetChargeNbins(fAverageNbins); 388 hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average LoGain Sector "); 389 594 390 } 595 391 } … … 601 397 // 602 398 // If MBadPixelsPix::IsBad(): 603 // - calls MHCalibrationCharge HiGainPix::SetExcluded()399 // - calls MHCalibrationChargePix::SetExcluded() 604 400 // 605 401 // Calls: … … 608 404 // - MHGausEvents::SetEventFrequency(fPulserFrequency) 609 405 // 610 void MHCalibrationChargeCam::InitializeHiGainHists(MHCalibrationCharge HiGainPix &hist,MBadPixelsPix &bad, const Int_t i)406 void MHCalibrationChargeCam::InitializeHiGainHists(MHCalibrationChargePix &hist, MBadPixelsPix &bad, const Int_t i) 611 407 { 612 408 … … 626 422 // 627 423 // If MBadPixelsPix::IsBad(): 628 // - calls MHCalibrationCharge LoGainPix::SetExcluded()424 // - calls MHCalibrationChargePix::SetExcluded() 629 425 // 630 426 // Calls: … … 633 429 // - MHGausEvents::SetEventFrequency(fPulserFrequency) 634 430 // 635 void MHCalibrationChargeCam::InitializeLoGainHists(MHCalibrationCharge LoGainPix &hist,MBadPixelsPix &bad, const Int_t i)431 void MHCalibrationChargeCam::InitializeLoGainHists(MHCalibrationChargePix &hist,MBadPixelsPix &bad, const Int_t i) 636 432 { 637 433 … … 738 534 { 739 535 740 if ((*this)[i].IsExcluded()) 536 MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[i]; 537 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(i); 538 539 if (histhi.IsExcluded()) 741 540 continue; 742 541 … … 746 545 const Float_t sumlo = pix.GetExtractedSignalLoGain(); 747 546 748 (*this)[i].FillHistAndArray(sumhi);749 (*this)(i).FillHistAndArray(sumlo);547 histhi.FillHistAndArray(sumhi); 548 histlo.FillHistAndArray(sumlo); 750 549 751 550 const Int_t sathi = (Int_t)pix.GetNumHiGainSaturated(); 752 551 const Int_t satlo = (Int_t)pix.GetNumLoGainSaturated(); 753 552 754 (*this)[i].SetSaturated(sathi);755 (*this)(i).SetSaturated(satlo);553 histhi.SetSaturated(sathi); 554 histlo.SetSaturated(satlo); 756 555 757 556 const Int_t aidx = (*fGeom)[i].GetAidx(); … … 774 573 775 574 const UInt_t pixid = pixel.GetPixelId(); 776 if ((*this)[pixid].IsExcluded()) 575 576 MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[pixid]; 577 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(pixid); 578 579 if (histhi.IsExcluded()) 777 580 continue; 778 581 779 582 const Float_t timehi = (Float_t)pixel.GetIdxMaxHiGainSample(); 780 583 const Float_t timelo = (Float_t)pixel.GetIdxMaxLoGainSample(lofirst); 781 584 782 (*this)[pixid].FillAbsTime(timehi);783 (*this)(pixid).FillAbsTime(timelo);585 histhi.FillAbsTime(timehi); 586 histlo.FillAbsTime(timelo); 784 587 785 588 const Int_t aidx = (*fGeom)[pixid].GetAidx(); … … 799 602 const Int_t npix = fAverageAreaNum[j]; 800 603 801 MHCalibrationCharge HiGainPix &hipix =GetAverageHiGainArea(j);802 MHCalibrationCharge LoGainPix &lopix =GetAverageLoGainArea(j);604 MHCalibrationChargePix &hipix = (MHCalibrationChargePix&)GetAverageHiGainArea(j); 605 MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainArea(j); 803 606 804 607 hipix.FillHistAndArray(sumhiarea[j]/npix); … … 818 621 const Int_t npix = fAverageSectorNum[j]; 819 622 820 MHCalibrationCharge HiGainPix &hipix =GetAverageHiGainSector(j);821 MHCalibrationCharge LoGainPix &lopix =GetAverageLoGainSector(j);623 MHCalibrationChargePix &hipix = (MHCalibrationChargePix&)GetAverageHiGainSector(j); 624 MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainSector(j); 822 625 823 626 hipix.FillHistAndArray(sumhisector[j]/npix); … … 852 655 { 853 656 854 if ((*this)[i].IsExcluded()) 657 MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[i]; 658 659 if (histhi.IsExcluded()) 855 660 continue; 856 661 857 MHCalibrationChargeHiGainPix &histhi = (*this)[i]; 662 MCalibrationChargePix &pix = (*fCam)[i]; 663 MBadPixelsPix &bad = (*fBadPixels)[i]; 664 665 FinalizeHiGainHists(histhi,pix,bad); 666 667 } 668 669 for (Int_t i=0; i<fLoGainArray->GetSize(); i++) 670 { 671 672 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(i); 673 674 if (histlo.IsExcluded()) 675 continue; 676 858 677 MCalibrationChargePix &pix = (*fCam)[i]; 859 678 MBadPixelsPix &bad = (*fBadPixels)[i]; 860 679 680 FinalizeLoGainHists(histlo,pix,bad); 681 682 } 683 684 for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++) 685 { 686 687 MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainArea(j); 688 MCalibrationChargePix &pix = fCam->GetAverageArea(j); 689 MBadPixelsPix &bad = fCam->GetAverageBadArea(j); 690 861 691 FinalizeHiGainHists(histhi,pix,bad); 862 863 } 864 865 for (Int_t i=0; i<fLoGainArray->GetSize(); i++) 866 { 867 868 if ((*this)(i).IsExcluded()) 869 continue; 870 871 MHCalibrationChargeLoGainPix &histlo = (*this)(i); 872 MCalibrationChargePix &pix = (*fCam)[i]; 873 MBadPixelsPix &bad = (*fBadPixels)[i]; 692 } 693 694 for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++) 695 { 696 697 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainArea(j); 698 MCalibrationChargePix &pix = fCam->GetAverageArea(j); 699 MBadPixelsPix &bad = fCam->GetAverageBadArea(j); 874 700 875 701 FinalizeLoGainHists(histlo,pix,bad); 876 877 } 878 879 for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++) 880 { 881 882 MHCalibrationChargeHiGainPix &histhi = GetAverageHiGainArea(j); 883 MCalibrationChargePix &pix = fCam->GetAverageArea(j); 884 MBadPixelsPix &bad = fCam->GetAverageBadArea(j); 702 } 703 704 for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++) 705 { 706 707 MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainSector(j); 708 MCalibrationChargePix &pix = fCam->GetAverageSector(j); 709 MBadPixelsPix &bad = fCam->GetAverageBadSector(j); 885 710 886 711 FinalizeHiGainHists(histhi,pix,bad); 887 712 } 888 713 889 for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++)890 {891 892 MHCalibrationChargeLoGainPix &histlo = GetAverageLoGainArea(j);893 MCalibrationChargePix &pix = fCam->GetAverageArea(j);894 MBadPixelsPix &bad = fCam->GetAverageBadArea(j);895 896 FinalizeLoGainHists(histlo,pix,bad);897 }898 899 for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)900 {901 902 MHCalibrationChargeHiGainPix &histhi = GetAverageHiGainSector(j);903 MCalibrationChargePix &pix = fCam->GetAverageSector(j);904 MBadPixelsPix &bad = fCam->GetAverageBadSector(j);905 906 FinalizeHiGainHists(histhi,pix,bad);907 }908 909 714 for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++) 910 715 { 911 716 912 MHCalibrationCharge LoGainPix &histlo =GetAverageLoGainSector(j);913 MCalibrationChargePix 914 MBadPixelsPix 717 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainSector(j); 718 MCalibrationChargePix &pix = fCam->GetAverageSector(j); 719 MBadPixelsPix &bad = fCam->GetAverageBadSector(j); 915 720 916 721 FinalizeLoGainHists(histlo,pix,bad); … … 970 775 // Retrieves the results and store them in MCalibrationChargePix 971 776 // 972 void MHCalibrationChargeCam::FinalizeHiGainHists(MHCalibrationCharge HiGainPix &hist,777 void MHCalibrationChargeCam::FinalizeHiGainHists(MHCalibrationChargePix &hist, 973 778 MCalibrationChargePix &pix, 974 779 MBadPixelsPix &bad) … … 1066 871 // Retrieves the results and store them in MCalibrationChargePix 1067 872 // 1068 void MHCalibrationChargeCam::FinalizeLoGainHists(MHCalibrationCharge LoGainPix &hist,873 void MHCalibrationChargeCam::FinalizeLoGainHists(MHCalibrationChargePix &hist, 1069 874 MCalibrationChargePix &pix, 1070 875 MBadPixelsPix &bad) … … 1155 960 } 1156 961 1157 // -----------------------------------------------------------------------------1158 //1159 // Default draw:1160 //1161 // Displays the averaged areas, both High Gain and Low Gain1162 //1163 // The following options can be chosen:1164 //1165 // "": displays the fHGausHist and the fHAbsTime1166 // "all": executes additionally MHGausEvents::Draw(), with options1167 //1168 void MHCalibrationChargeCam::Draw(const Option_t *opt)1169 {1170 1171 const Int_t nareas = fAverageHiGainAreas->GetEntries();1172 if (nareas == 0)1173 return;1174 1175 TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this);1176 pad->SetBorderMode(0);1177 1178 pad->Divide(2,nareas);1179 1180 for (Int_t i=0; i<nareas;i++)1181 {1182 pad->cd(2*(i+1)-1);1183 GetAverageHiGainArea(i).Draw(opt);1184 1185 if (!fAverageAreaSat[i])1186 DrawAverageSigma(fAverageAreaSat[i], i,1187 fAverageAreaSigma[i], fAverageAreaSigmaErr[i],1188 fAverageAreaRelSigma[i], fAverageAreaRelSigmaErr[i]);1189 1190 pad->cd(2*(i+1));1191 GetAverageLoGainArea(i).Draw(opt);1192 1193 if (fAverageAreaSat[i])1194 DrawAverageSigma(fAverageAreaSat[i], i,1195 fAverageAreaSigma[i], fAverageAreaSigmaErr[i],1196 fAverageAreaRelSigma[i], fAverageAreaRelSigmaErr[i]);1197 }1198 }1199 1200 // -----------------------------------------------------------------------------1201 //1202 // Default draw:1203 //1204 // Displays a TPaveText with the re-normalized sigmas of the average area1205 //1206 void MHCalibrationChargeCam::DrawAverageSigma(Bool_t sat, Bool_t inner,1207 Float_t sigma, Float_t sigmaerr,1208 Float_t relsigma, Float_t relsigmaerr) const1209 {1210 1211 if (sigma != 0)1212 {1213 1214 TPad *newpad = new TPad("newpad","transparent",0,0,1,1);1215 newpad->SetFillStyle(4000);1216 newpad->Draw();1217 newpad->cd();1218 1219 TPaveText *text = new TPaveText(sat? 0.1 : 0.35,0.7,sat ? 0.4 : 0.7,1.0);1220 text->SetTextSize(0.07);1221 const TString line1 = Form("%s%s%s",inner ? "Outer" : "Inner",1222 " Pixels ", sat ? "Low Gain" : "High Gain");1223 TText *txt1 = text->AddText(line1.Data());1224 const TString line2 = Form("Sigma per Pixel: %2.2f #pm %2.2f",sigma,sigmaerr);1225 TText *txt2 = text->AddText(line2.Data());1226 const TString line3 = Form("Rel. Sigma per Pixel: %2.2f #pm %2.2f",relsigma,relsigmaerr);1227 TText *txt3 = text->AddText(line3.Data());1228 text->Draw("");1229 1230 text->SetBit(kCanDelete);1231 txt1->SetBit(kCanDelete);1232 txt2->SetBit(kCanDelete);1233 txt3->SetBit(kCanDelete);1234 newpad->SetBit(kCanDelete);1235 }1236 }1237 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.h
r3626 r3631 2 2 #define MARS_MHCalibrationChargeCam 3 3 4 #ifndef ROOT_TObjArray5 #include <TObjArray.h>4 #ifndef MARS_MHCalibrationCam 5 #include "MHCalibrationCam.h" 6 6 #endif 7 7 8 #ifndef ROOT_TArrayI9 #include <TArrayI.h>10 #endif11 12 #ifndef ROOT_TArrayF13 #include <TArrayF.h>14 #endif15 16 #ifndef MARS_MH17 #include "MH.h"18 #endif19 #ifndef MARS_MCamEvent20 #include "MCamEvent.h"21 #endif22 23 class TText;24 class TArrayI;25 class TArrayF;26 8 class MRawEvtData; 27 9 class MGeomCam; … … 30 12 class MCalibrationChargeCam; 31 13 class MCalibrationChargePix; 32 class MHCalibrationChargeHiGainPix; 33 class MHCalibrationChargeLoGainPix; 34 class MHCalibrationChargeCam : public MH, public MCamEvent 14 class MHCalibrationChargePix; 15 class MHCalibrationChargeCam : public MHCalibrationCam 35 16 { 36 17 private: … … 39 20 static const Float_t fgNumHiGainSaturationLimit; // The default for fNumHiGainSaturationLimit 40 21 static const Float_t fgNumLoGainSaturationLimit; // The default for fNumLoGainSaturationLimit 41 static const Int_t fgPulserFrequency; // The default for fPulserFrequency42 22 43 23 Int_t fAverageNbins; // Number of bins for the average histograms 44 24 Float_t fNumHiGainSaturationLimit; // Rel. amount sat. higain FADC slices until pixel is called saturated 45 25 Float_t fNumLoGainSaturationLimit; // Rel. amount sat. logain FADC slices until pixel is called saturated 46 Int_t fPulserFrequency; // Light pulser frequency47 26 48 TObjArray *fHiGainArray; //-> Array of MHCalibrationChargeHiGainPix, one per pixel49 TObjArray *fLoGainArray; //-> Array of MHCalibrationChargeLoGainPix, one per pixel50 TObjArray *fAverageHiGainAreas; //-> Array of MHCalibrationChargeHiGainPix, one per pixel area51 TObjArray *fAverageLoGainAreas; //-> Array of MHCalibrationChargeLoGainPix, one per pixel area52 TObjArray *fAverageHiGainSectors; //-> Array of MHCalibrationChargeHiGainPix, one per camera sector53 TObjArray *fAverageLoGainSectors; //-> Array of MHCalibrationChargeLoGainPix, one per camera sector54 55 27 MCalibrationChargeCam *fCam; //! Calibration Cam with the results 56 28 MRawEvtData *fRawEvt; //! Raw event data … … 58 30 MBadPixelsCam *fBadPixels; //! Bad Pixels storage container 59 31 60 TArrayI fAverageAreaNum; // Number of pixels in average pixels per area 61 TArrayI fAverageAreaSat; // Number of saturated slices in average pixels per area 62 TArrayF fAverageAreaSigma; // Re-normalized sigmas in average pixels per area 63 TArrayF fAverageAreaSigmaErr; // Errors of Re-normalized sigmas in average pixels per area 64 TArrayF fAverageAreaRelSigma; // Re-normalized relative sigmas in average pixels per area 65 TArrayF fAverageAreaRelSigmaErr; // Errors of Re-normalized relative sigmas in average pixels per area 32 void InitializeHiGainHists(MHCalibrationChargePix &hist, MBadPixelsPix &bad, const Int_t i); 33 void InitializeLoGainHists(MHCalibrationChargePix &hist, MBadPixelsPix &bad, const Int_t i); 34 35 void FinalizeHiGainHists(MHCalibrationChargePix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad); 36 void FinalizeLoGainHists(MHCalibrationChargePix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad); 66 37 67 TArrayI fAverageSectorNum; // Number of pixels in average pixels per sector 68 69 void InitializeHiGainHists(MHCalibrationChargeHiGainPix &hist, MBadPixelsPix &bad, const Int_t i); 70 void InitializeLoGainHists(MHCalibrationChargeLoGainPix &hist, MBadPixelsPix &bad, const Int_t i); 71 72 void FinalizeHiGainHists(MHCalibrationChargeHiGainPix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad); 73 void FinalizeLoGainHists(MHCalibrationChargeLoGainPix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad); 74 void DrawAverageSigma(Bool_t sat, Bool_t inner, 75 Float_t sigma, Float_t sigmaerr, 76 Float_t relsigma, Float_t relsigmaerr) const; 77 78 public: 38 public: 79 39 80 40 MHCalibrationChargeCam(const char *name=NULL, const char *title=NULL); 81 ~MHCalibrationChargeCam(); 41 ~MHCalibrationChargeCam() {} 42 82 43 83 44 void SetAverageNbins( const Int_t bins=fgAverageNbins ) { fAverageNbins = bins; } 84 45 void SetNumLoGainSaturationLimit( const Float_t lim=fgNumLoGainSaturationLimit) { fNumLoGainSaturationLimit = lim; } 85 46 void SetNumHiGainSaturationLimit( const Float_t lim=fgNumHiGainSaturationLimit) { fNumHiGainSaturationLimit = lim; } 86 void SetPulserFrequency ( const Int_t f=fgPulserFrequency) { fPulserFrequency = f; }87 47 88 Float_t GetNumHiGainSaturationLimit() const { return fNumHiGainSaturationLimit; } 89 Float_t GetNumLoGainSaturationLimit() const { return fNumLoGainSaturationLimit; } 90 91 MHCalibrationChargeHiGainPix &operator[](UInt_t i); 92 const MHCalibrationChargeHiGainPix &operator[](UInt_t i) const; 93 94 MHCalibrationChargeLoGainPix &operator()(UInt_t i); 95 const MHCalibrationChargeLoGainPix &operator()(UInt_t i) const; 96 97 MHCalibrationChargeHiGainPix &GetAverageHiGainArea(UInt_t i); 98 const MHCalibrationChargeHiGainPix &GetAverageHiGainArea(UInt_t i) const; 99 100 MHCalibrationChargeLoGainPix &GetAverageLoGainArea(UInt_t i); 101 const MHCalibrationChargeLoGainPix &GetAverageLoGainArea(UInt_t i) const; 102 103 MHCalibrationChargeHiGainPix &GetAverageHiGainSector(UInt_t i); 104 const MHCalibrationChargeHiGainPix &GetAverageHiGainSector(UInt_t i) const; 105 106 MHCalibrationChargeLoGainPix &GetAverageLoGainSector(UInt_t i); 107 const MHCalibrationChargeLoGainPix &GetAverageLoGainSector(UInt_t i) const; 48 Float_t GetNumHiGainSaturationLimit() const { return fNumHiGainSaturationLimit; } 49 Float_t GetNumLoGainSaturationLimit() const { return fNumLoGainSaturationLimit; } 108 50 109 51 Bool_t SetupFill(const MParList *pList); … … 111 53 Bool_t Fill (const MParContainer *par, const Stat_t w=1); 112 54 Bool_t Finalize ( ); 113 114 // Clone115 TObject *Clone(const char *) const;116 117 // Draw118 void Draw(const Option_t *opt);119 55 120 56 Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const; -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.h
r3625 r3631 92 92 void CountPickup(); 93 93 94 ClassDef(MHCalibrationChargePix, 1) // Base Histogram class for a C alibration Pixel94 ClassDef(MHCalibrationChargePix, 1) // Base Histogram class for a Charge Calibration Pixel 95 95 }; 96 96
Note:
See TracChangeset
for help on using the changeset viewer.