Changeset 5137 for trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.cc
- Timestamp:
- 09/25/04 14:01:50 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.cc
r5098 r5137 26 26 // MHCalibrationCam 27 27 // 28 // Base class for camera calibration classes. Incorporates the TO bjArray's:28 // Base class for camera calibration classes. Incorporates the TOrdCollection's: 29 29 // - fHiGainArray (for calibrated High Gains per pixel) 30 30 // - fLoGainArray (for calibrated Low Gains per pixel) … … 33 33 // - fAverageHiGainSectors (for averaged High Gains events per camera sector ) 34 34 // - fAverageLoGainSectors (for averaged High Gains events per camera sector ) 35 // These TO bjArray's are called by their default constructors, thus no objects35 // These TOrdCollection's are called by their default constructors, thus no objects 36 36 // are created, until the derived class does so. 37 37 // … … 61 61 #include <TText.h> 62 62 #include <TPaveText.h> 63 #include <TOrdCollection.h> 64 #include <TROOT.h> 63 65 64 66 #include "MLog.h" … … 117 119 { 118 120 119 fHiGainArray = new TO bjArray;121 fHiGainArray = new TOrdCollection; 120 122 fHiGainArray->SetOwner(); 121 122 fLoGainArray = new TO bjArray;123 124 fLoGainArray = new TOrdCollection; 123 125 fLoGainArray->SetOwner(); 124 126 125 fAverageHiGainAreas = new TO bjArray;127 fAverageHiGainAreas = new TOrdCollection; 126 128 fAverageHiGainAreas->SetOwner(); 127 129 128 fAverageLoGainAreas = new TO bjArray;130 fAverageLoGainAreas = new TOrdCollection; 129 131 fAverageLoGainAreas->SetOwner(); 130 132 131 fAverageHiGainSectors = new TO bjArray;133 fAverageHiGainSectors = new TOrdCollection; 132 134 fAverageHiGainSectors->SetOwner(); 133 135 134 fAverageLoGainSectors = new TO bjArray;136 fAverageLoGainSectors = new TOrdCollection; 135 137 fAverageLoGainSectors->SetOwner(); 136 138 … … 146 148 // -------------------------------------------------------------------------- 147 149 // 148 // Returns size of fHiGainArray 149 // 150 const Int_t MHCalibrationCam::GetSize() const 151 { 152 return fHiGainArray->GetSize(); 153 } 154 155 // -------------------------------------------------------------------------- 156 // 157 // Deletes the TClonesArray of: 150 // Deletes the TOrdCollection of: 158 151 // - fHiGainArray, fLoGainArray 159 152 // - fAverageHiGainAreas, fAverageLoGainAreas … … 171 164 delete fAverageHiGainSectors; 172 165 delete fAverageLoGainSectors; 173 } 174 175 // -------------------------------------------------------------------------- 166 /* 167 168 Remove ( fHiGainArray ); 169 Remove ( fLoGainArray ); 170 171 Remove ( fAverageHiGainAreas ); 172 Remove ( fAverageLoGainAreas ); 173 174 Remove ( fAverageHiGainSectors ); 175 Remove ( fAverageLoGainSectors ); 176 */ 177 178 } 179 180 void MHCalibrationCam::Remove(TOrdCollection *col) 181 { 182 183 if (!col) 184 return; 185 186 TOrdCollectionIter Next(col); 187 188 Int_t count = 0; 189 190 while (MHCalibrationPix *obj = (MHCalibrationPix*)Next()) 191 { 192 *fLog << ++count << " " << obj << flush; 193 if (obj && obj->IsOnHeap()) 194 { 195 obj->Draw(); 196 delete obj; 197 } 198 } 199 200 delete col; 201 } 202 203 // -------------------------------------------------------------------------- 204 // 205 // Returns size of fHiGainArray 206 // 207 const Int_t MHCalibrationCam::GetSize() const 208 { 209 return fHiGainArray->GetSize(); 210 } 211 212 // -------------------------------------------------------------------------- 213 // 214 // Get i-th High Gain pixel (pixel number) 215 // 216 MHCalibrationPix &MHCalibrationCam::operator[](UInt_t i) 217 { 218 return *static_cast<MHCalibrationPix*>(fHiGainArray->At(i)); 219 } 220 221 // -------------------------------------------------------------------------- 222 // 223 // Get i-th High Gain pixel (pixel number) 224 // 225 const MHCalibrationPix &MHCalibrationCam::operator[](UInt_t i) const 226 { 227 return *static_cast<MHCalibrationPix*>(fHiGainArray->At(i)); 228 } 229 230 // -------------------------------------------------------------------------- 231 // 232 // Get i-th Low Gain pixel (pixel number) 233 // 234 MHCalibrationPix &MHCalibrationCam::operator()(UInt_t i) 235 { 236 return *static_cast<MHCalibrationPix*>(fLoGainArray->At(i)); 237 } 238 239 // -------------------------------------------------------------------------- 240 // 241 // Get i-th Low Gain pixel (pixel number) 242 // 243 const MHCalibrationPix &MHCalibrationCam::operator()(UInt_t i) const 244 { 245 return *static_cast<MHCalibrationPix*>(fLoGainArray->At(i)); 246 } 247 248 // -------------------------------------------------------------------------- 249 // 250 // Returns the current size of the TOrdCollection fAverageHiGainAreas 251 // independently if the MHCalibrationPix is filled with values or not. 252 // 253 const Int_t MHCalibrationCam::GetAverageAreas() const 254 { 255 return fAverageHiGainAreas->GetSize(); 256 } 257 258 // -------------------------------------------------------------------------- 259 // 260 // Get i-th High Gain pixel Area (area number) 261 // 262 MHCalibrationPix &MHCalibrationCam::GetAverageHiGainArea(UInt_t i) 263 { 264 return *static_cast<MHCalibrationPix*>(fAverageHiGainAreas->At(i)); 265 } 266 267 // -------------------------------------------------------------------------- 268 // 269 // Get i-th High Gain pixel Area (area number) 270 // 271 const MHCalibrationPix &MHCalibrationCam::GetAverageHiGainArea(UInt_t i) const 272 { 273 return *static_cast<MHCalibrationPix *>(fAverageHiGainAreas->At(i)); 274 } 275 276 // -------------------------------------------------------------------------- 277 // 278 // Get i-th Low Gain pixel Area (area number) 279 // 280 MHCalibrationPix &MHCalibrationCam::GetAverageLoGainArea(UInt_t i) 281 { 282 return *static_cast<MHCalibrationPix*>(fAverageLoGainAreas->At(i)); 283 } 284 285 // -------------------------------------------------------------------------- 286 // 287 // Get i-th Low Gain pixel Area (area number) 288 // 289 const MHCalibrationPix &MHCalibrationCam::GetAverageLoGainArea(UInt_t i) const 290 { 291 return *static_cast<MHCalibrationPix*>(fAverageLoGainAreas->At(i)); 292 } 293 294 // -------------------------------------------------------------------------- 295 // 296 // Returns the current size of the TOrdCollection fAverageHiGainSectors 297 // independently if the MHCalibrationPix is filled with values or not. 298 // 299 const Int_t MHCalibrationCam::GetAverageSectors() const 300 { 301 return fAverageHiGainSectors->GetSize(); 302 } 303 304 // -------------------------------------------------------------------------- 305 // 306 // Get i-th High Gain Sector (sector number) 307 // 308 MHCalibrationPix &MHCalibrationCam::GetAverageHiGainSector(UInt_t i) 309 { 310 return *static_cast<MHCalibrationPix*>(fAverageHiGainSectors->At(i)); 311 } 312 313 // -------------------------------------------------------------------------- 314 // 315 // Get i-th High Gain Sector (sector number) 316 // 317 const MHCalibrationPix &MHCalibrationCam::GetAverageHiGainSector(UInt_t i) const 318 { 319 return *static_cast<MHCalibrationPix*>(fAverageHiGainSectors->At(i)); 320 } 321 322 // -------------------------------------------------------------------------- 323 // 324 // Get i-th Low Gain Sector (sector number) 325 // 326 MHCalibrationPix &MHCalibrationCam::GetAverageLoGainSector(UInt_t i) 327 { 328 return *static_cast<MHCalibrationPix*>(fAverageLoGainSectors->At(i)); 329 } 330 331 // -------------------------------------------------------------------------- 332 // 333 // Get i-th Low Gain Sector (sector number) 334 // 335 const MHCalibrationPix &MHCalibrationCam::GetAverageLoGainSector(UInt_t i) const 336 { 337 return *static_cast<MHCalibrationPix*>(fAverageLoGainSectors->At(i)); 338 } 339 340 // -------------------------------------------------------------------------- 341 // 342 // Calls ResetHistTitles() 176 343 // 177 344 // Calls Reset() for each entry in: … … 183 350 { 184 351 352 ResetHistTitles(); 353 185 354 if (fHiGainArray) 186 355 { fHiGainArray->ForEach(MHCalibrationPix,Reset)(); } 356 187 357 if (IsAverageing()) 188 358 { … … 209 379 // -------------------------------------------------------------------------- 210 380 // 211 // Get i-th High Gain pixel (pixel number) 212 // 213 MHCalibrationPix &MHCalibrationCam::operator[](UInt_t i) 214 { 215 return *static_cast<MHCalibrationPix*>(fHiGainArray->UncheckedAt(i)); 216 } 217 218 // -------------------------------------------------------------------------- 219 // 220 // Get i-th High Gain pixel (pixel number) 221 // 222 const MHCalibrationPix &MHCalibrationCam::operator[](UInt_t i) const 223 { 224 return *static_cast<MHCalibrationPix*>(fHiGainArray->UncheckedAt(i)); 225 } 226 227 // -------------------------------------------------------------------------- 228 // 229 // Get i-th Low Gain pixel (pixel number) 230 // 231 MHCalibrationPix &MHCalibrationCam::operator()(UInt_t i) 232 { 233 return *static_cast<MHCalibrationPix*>(fLoGainArray->UncheckedAt(i)); 234 } 235 236 // -------------------------------------------------------------------------- 237 // 238 // Get i-th Low Gain pixel (pixel number) 239 // 240 const MHCalibrationPix &MHCalibrationCam::operator()(UInt_t i) const 241 { 242 return *static_cast<MHCalibrationPix*>(fLoGainArray->UncheckedAt(i)); 243 } 244 245 // -------------------------------------------------------------------------- 246 // 247 // Returns the current size of the TObjArray fAverageHiGainAreas 248 // independently if the MHCalibrationPix is filled with values or not. 249 // 250 const Int_t MHCalibrationCam::GetAverageAreas() const 251 { 252 return fAverageHiGainAreas->GetEntries(); 253 } 254 255 // -------------------------------------------------------------------------- 256 // 257 // Get i-th High Gain pixel Area (area number) 258 // 259 MHCalibrationPix &MHCalibrationCam::GetAverageHiGainArea(UInt_t i) 260 { 261 return *static_cast<MHCalibrationPix*>(fAverageHiGainAreas->UncheckedAt(i)); 262 } 263 264 // -------------------------------------------------------------------------- 265 // 266 // Get i-th High Gain pixel Area (area number) 267 // 268 const MHCalibrationPix &MHCalibrationCam::GetAverageHiGainArea(UInt_t i) const 269 { 270 return *static_cast<MHCalibrationPix *>(fAverageHiGainAreas->UncheckedAt(i)); 271 } 272 273 // -------------------------------------------------------------------------- 274 // 275 // Get i-th Low Gain pixel Area (area number) 276 // 277 MHCalibrationPix &MHCalibrationCam::GetAverageLoGainArea(UInt_t i) 278 { 279 return *static_cast<MHCalibrationPix*>(fAverageLoGainAreas->UncheckedAt(i)); 280 } 281 282 // -------------------------------------------------------------------------- 283 // 284 // Get i-th Low Gain pixel Area (area number) 285 // 286 const MHCalibrationPix &MHCalibrationCam::GetAverageLoGainArea(UInt_t i) const 287 { 288 return *static_cast<MHCalibrationPix*>(fAverageLoGainAreas->UncheckedAt(i)); 289 } 290 291 // -------------------------------------------------------------------------- 292 // 293 // Returns the current size of the TObjArray fAverageHiGainSectors 294 // independently if the MHCalibrationPix is filled with values or not. 295 // 296 const Int_t MHCalibrationCam::GetAverageSectors() const 297 { 298 return fAverageHiGainSectors->GetEntries(); 299 } 300 301 // -------------------------------------------------------------------------- 302 // 303 // Get i-th High Gain Sector (sector number) 304 // 305 MHCalibrationPix &MHCalibrationCam::GetAverageHiGainSector(UInt_t i) 306 { 307 return *static_cast<MHCalibrationPix*>(fAverageHiGainSectors->UncheckedAt(i)); 308 } 309 310 // -------------------------------------------------------------------------- 311 // 312 // Get i-th High Gain Sector (sector number) 313 // 314 const MHCalibrationPix &MHCalibrationCam::GetAverageHiGainSector(UInt_t i) const 315 { 316 return *static_cast<MHCalibrationPix*>(fAverageHiGainSectors->UncheckedAt(i)); 317 } 318 319 // -------------------------------------------------------------------------- 320 // 321 // Get i-th Low Gain Sector (sector number) 322 // 323 MHCalibrationPix &MHCalibrationCam::GetAverageLoGainSector(UInt_t i) 324 { 325 return *static_cast<MHCalibrationPix*>(fAverageLoGainSectors->UncheckedAt(i)); 326 } 327 328 // -------------------------------------------------------------------------- 329 // 330 // Get i-th Low Gain Sector (sector number) 331 // 332 const MHCalibrationPix &MHCalibrationCam::GetAverageLoGainSector(UInt_t i) const 333 { 334 return *static_cast<MHCalibrationPix*>(fAverageLoGainSectors->UncheckedAt(i)); 381 // Resets the histogram titles for each entry in: 382 // - fHiGainArray, fLoGainArray 383 // - fAverageHiGainAreas, fAverageLoGainAreas 384 // - fAverageHiGainSectors, fAverageLoGainSectors 385 // 386 void MHCalibrationCam::ResetHistTitles() 387 { 388 389 TH1F *h; 390 391 if (fHiGainArray) 392 for (Int_t i=0;i<fHiGainArray->GetSize(); i++) 393 { 394 MHCalibrationPix &pix = (*this)[i]; 395 h = pix.GetHGausHist(); 396 h->SetName (Form("%s%s%s%4i","H",fHistName.Data(),"HiGainPix",i)); 397 h->SetTitle(Form("%s%s%4i%s",fHistTitle.Data()," High Gain Pixel ",i," Runs: ")); 398 h->SetXTitle(fHistXTitle.Data()); 399 h->SetYTitle(fHistYTitle.Data()); 400 } 401 402 if (IsAverageing()) 403 { 404 if (fAverageHiGainAreas) 405 for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++) 406 { 407 MHCalibrationPix &pix = GetAverageHiGainArea(j); 408 h = pix.GetHGausHist(); 409 h->SetName (Form("%s%s%s%d","H",fHistName.Data(),"HiGainArea",j)); 410 h->SetXTitle(fHistXTitle.Data()); 411 h->SetYTitle(fHistYTitle.Data()); 412 if (fGeom->InheritsFrom("MGeomCamMagic")) 413 h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ", 414 j==0 ? "Inner Pixels " : "Outer Pixels ","High Gain Runs: ")); 415 else 416 h->SetTitle(Form("%s%s%d%s",fHistTitle.Data(), 417 " averaged on event-by-event basis High Gain Area Idx ",j," Runs: ")); 418 } 419 420 if (fAverageHiGainSectors) 421 for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++) 422 { 423 MHCalibrationPix &pix = GetAverageHiGainSector(j); 424 h = pix.GetHGausHist(); 425 h->SetName (Form("%s%s%s%2i","H",fHistName.Data(),"HiGainSector",j)); 426 h->SetTitle(Form("%s%s%2i%s",fHistTitle.Data(), 427 " averaged on event-by-event basis High Gain Sector ",j," Runs: ")); 428 h->SetXTitle(fHistXTitle.Data()); 429 h->SetYTitle(fHistYTitle.Data()); 430 } 431 } 432 433 if (!IsLoGain()) 434 return; 435 436 if (fLoGainArray) 437 for (Int_t i=0;i<fLoGainArray->GetSize(); i++) 438 { 439 MHCalibrationPix &pix = (*this)(i); 440 h = pix.GetHGausHist(); 441 h->SetName (Form("%s%s%s%4i","H",fHistName.Data(),"LoGainPix",i)); 442 h->SetTitle(Form("%s%s%4i%s",fHistTitle.Data()," Low Gain Pixel ",i," Runs: ")); 443 h->SetXTitle(fHistXTitle.Data()); 444 h->SetYTitle(fHistYTitle.Data()); 445 } 446 447 if (IsAverageing()) 448 { 449 if (fAverageLoGainAreas) 450 for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++) 451 { 452 MHCalibrationPix &pix = GetAverageLoGainArea(j); 453 h = pix.GetHGausHist(); 454 h->SetName (Form("%s%s%s%d","H",fHistName.Data(),"LoGainArea",j)); 455 h->SetXTitle(fHistXTitle.Data()); 456 h->SetYTitle(fHistYTitle.Data()); 457 if (fGeom->InheritsFrom("MGeomCamMagic")) 458 h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ", 459 j==0 ? "Inner Pixels " : "Outer Pixels ","Low Gain Runs: ")); 460 else 461 h->SetTitle(Form("%s%s%d%s",fHistTitle.Data(), 462 " averaged on event-by-event basis Low Gain Area Idx ",j," Runs: ")); 463 } 464 465 if (fAverageLoGainSectors) 466 for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++) 467 { 468 MHCalibrationPix &pix = GetAverageLoGainSector(j); 469 h = pix.GetHGausHist(); 470 h->SetName (Form("%s%s%s%2i","H",fHistName.Data(),"LoGainSector",j)); 471 h->SetTitle(Form("%s%s%2i%s",fHistTitle.Data(), 472 " averaged on event-by-event basis Low Gain Sector ",j," Runs: ")); 473 h->SetXTitle(fHistXTitle.Data()); 474 h->SetYTitle(fHistYTitle.Data()); 475 } 476 } 335 477 } 336 478 … … 381 523 382 524 // -------------------------------------------------------------------------- 525 // 526 // Searches MRawEvtHeader to find the correct pulser colour 383 527 // 384 528 // Gets or creates the pointers to: … … 487 631 return kFALSE; 488 632 633 ResetHistTitles(); 634 489 635 if (!fRunHeader) 490 636 return kTRUE; 491 637 492 for (Int_t i=0; i<fHiGainArray->Get Entries(); i++)638 for (Int_t i=0; i<fHiGainArray->GetSize(); i++) 493 639 { 494 640 TH1F *h = (*this)[i].GetHGausHist(); … … 497 643 498 644 if (IsLoGain()) 499 for (Int_t i=0; i<fLoGainArray->Get Entries(); i++)645 for (Int_t i=0; i<fLoGainArray->GetSize(); i++) 500 646 { 501 647 TH1F *h = (*this)(i).GetHGausHist(); … … 538 684 // 539 685 // Initializes the High Gain Arrays: 540 //541 // - Expand fHiGainArrays to npixels542 // - Expand fAverageHiGainAreas to nareas543 // - Expand fAverageHiGainSectors to nsectors544 686 // 545 687 // - For every entry in the expanded arrays: … … 553 695 { 554 696 555 if (fHiGainArray->Get Entries()==0)697 if (fHiGainArray->GetSize()==0) 556 698 { 557 fHiGainArray->Expand(npixels);558 699 for (Int_t i=0; i<npixels; i++) 559 700 { 560 (*fHiGainArray)[i] =new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainPix"),561 Form("%s%s",fHistTitle.Data()," High Gain Pixel"));701 fHiGainArray->AddAt(new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainPix"), 702 Form("%s%s",fHistTitle.Data()," High Gain Pixel")),i); 562 703 563 704 MHCalibrationPix &pix = (*this)[i]; … … 566 707 pix.SetLast (fLast); 567 708 568 TH1F *h = pix.GetHGausHist();569 570 h->SetName (Form("%s%s%s","H",fHistName.Data(),"HiGainPix"));571 h->SetTitle(Form("%s%s",fHistTitle.Data()," High Gain Pixel "));572 h->SetXTitle(fHistXTitle.Data());573 h->SetYTitle(fHistYTitle.Data());574 575 709 MBadPixelsPix &bad = fIntensBad ? (*fIntensBad)[i] : (*fBadPixels)[i]; 576 710 InitHists(pix,bad,i); … … 581 715 return; 582 716 583 if (fAverageHiGainAreas->Get Entries()==0)717 if (fAverageHiGainAreas->GetSize()==0) 584 718 { 585 fAverageHiGainAreas->Expand(nareas);586 587 719 for (Int_t j=0; j<nareas; j++) 588 720 { 589 (*fAverageHiGainAreas)[j] =new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainArea"),590 Form("%s%s",fHistTitle.Data()," High Gain Area Idx "));721 fAverageHiGainAreas->AddAt(new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainArea"), 722 Form("%s%s",fHistTitle.Data()," High Gain Area Idx ")),j); 591 723 592 724 MHCalibrationPix &pix = GetAverageHiGainArea(j); … … 595 727 pix.SetFirst(fFirst); 596 728 pix.SetLast (fLast); 597 598 TH1F *h = pix.GetHGausHist();599 600 h->SetName (Form("%s%s%s","H",fHistName.Data(),"HiGainArea"));601 h->SetXTitle(fHistXTitle.Data());602 h->SetYTitle(fHistYTitle.Data());603 729 604 730 if (fGeom && fGeom->InheritsFrom("MGeomCamMagic")) 605 731 { 606 h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ",607 j==0 ? "Inner Pixels " : "Outer Pixels ","High Gain Runs: "));608 732 pix.InitBins(); 609 733 pix.SetEventFrequency(fPulserFrequency); 610 734 } 611 735 else 612 { 613 h->SetTitle(Form("%s%s",fHistTitle.Data()," averaged on event-by-event basis High Gain Area Idx ")); 614 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 615 } 736 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 616 737 } 617 738 } 618 739 619 if (fAverageHiGainSectors->GetEntries()==0) 620 { 621 fAverageHiGainSectors->Expand(nsectors); 622 740 if (fAverageHiGainSectors->GetSize()==0) 741 { 623 742 for (Int_t j=0; j<nsectors; j++) 624 743 { 625 (*fAverageHiGainSectors)[j] =new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainSector"),626 Form("%s%s",fHistTitle.Data()," High Gain Sector "));744 fAverageHiGainSectors->AddAt(new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainSector"), 745 Form("%s%s",fHistTitle.Data()," High Gain Sector ")),j); 627 746 MHCalibrationPix &pix = GetAverageHiGainSector(j); 628 747 … … 631 750 pix.SetLast (fLast); 632 751 633 TH1F *h = pix.GetHGausHist();634 635 h->SetName (Form("%s%s%s","H",fHistName.Data(),"HiGainSector"));636 h->SetTitle(Form("%s%s",fHistTitle.Data()," High Gain Sector "));637 h->SetXTitle(fHistXTitle.Data());638 h->SetYTitle(fHistYTitle.Data());639 640 752 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j); 641 753 } … … 649 761 // Initializes the Low Gain Arrays: 650 762 // 651 // - Expand fLoGainArrays to npixels652 // - Expand fAverageLoGainAreas to nareas653 // - Expand fAverageLoGainSectors to nsectors654 //655 763 // - For every entry in the expanded arrays: 656 764 // * Initialize an MHCalibrationPix … … 666 774 return; 667 775 668 if (fLoGainArray->Get Entries()==0)776 if (fLoGainArray->GetSize()==0) 669 777 { 670 fLoGainArray->Expand(npixels);671 778 for (Int_t i=0; i<npixels; i++) 672 779 { 673 (*fLoGainArray)[i] =new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainPix"),674 Form("%s%s",fHistTitle.Data()," Low Gain Pixel"));780 fLoGainArray->AddAt(new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainPix"), 781 Form("%s%s",fHistTitle.Data()," Low Gain Pixel")),i); 675 782 676 783 MHCalibrationPix &pix = (*this)[i]; … … 679 786 pix.SetLast (fLast); 680 787 681 TH1F *h = pix.GetHGausHist();682 683 h->SetName (Form("%s%s%s","H",fHistName.Data(),"LoGainPix"));684 h->SetTitle(Form("%s%s",fHistTitle.Data()," Low Gain Pixel "));685 h->SetXTitle(fHistXTitle.Data());686 h->SetYTitle(fHistYTitle.Data());687 688 788 MBadPixelsPix &bad = fIntensBad ? (*fIntensBad)[i] : (*fBadPixels)[i]; 689 789 InitHists(pix,bad,i); … … 694 794 return; 695 795 696 if (fAverageLoGainAreas->Get Entries()==0)796 if (fAverageLoGainAreas->GetSize()==0) 697 797 { 698 fAverageLoGainAreas->Expand(nareas);699 700 798 for (Int_t j=0; j<nareas; j++) 701 799 { 702 (*fAverageLoGainAreas)[j] =new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainArea"),703 Form("%s%s",fHistTitle.Data()," Low Gain Area Idx "));800 fAverageLoGainAreas->AddAt(new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainArea"), 801 Form("%s%s",fHistTitle.Data()," Low Gain Area Idx ")),j); 704 802 705 803 MHCalibrationPix &pix = GetAverageLoGainArea(j); … … 709 807 pix.SetLast (fLast); 710 808 711 TH1F *h = pix.GetHGausHist();712 713 h->SetName (Form("%s%s%s","H",fHistName.Data(),"LoGainArea"));714 h->SetXTitle(fHistXTitle.Data());715 h->SetYTitle(fHistYTitle.Data());716 717 809 if (fGeom && fGeom->InheritsFrom("MGeomCamMagic")) 718 810 { 719 h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ",720 j==0 ? "Inner Pixels " : "Outer Pixels ","Low Gain Runs: "));721 811 pix.InitBins(); 722 812 pix.SetEventFrequency(fPulserFrequency); 723 813 } 724 814 else 725 { 726 h->SetTitle(Form("%s%s",fHistTitle.Data()," averaged on event-by-event basis Low Gain Area Idx ")); 727 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 728 } 815 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 729 816 } 730 817 } 731 818 732 if (fAverageLoGainSectors->GetEntries()==0) 733 { 734 fAverageLoGainSectors->Expand(nsectors); 735 819 if (fAverageLoGainSectors->GetSize()==0) 820 { 736 821 for (Int_t j=0; j<nsectors; j++) 737 822 { 738 (*fAverageLoGainSectors)[j] =new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainSector"),739 Form("%s%s",fHistTitle.Data()," Low Gain Sector "));823 fAverageLoGainSectors->AddAt(new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainSector"), 824 Form("%s%s",fHistTitle.Data()," Low Gain Sector ")),j); 740 825 MHCalibrationPix &pix = GetAverageLoGainSector(j); 741 826 … … 744 829 pix.SetLast (fLast); 745 830 746 TH1F *h = pix.GetHGausHist();747 748 h->SetName (Form("%s%s%s","H",fHistName.Data(),"LoGainSector"));749 h->SetTitle(Form("%s%s",fHistTitle.Data()," Low Gain Sector "));750 h->SetXTitle(fHistXTitle.Data());751 h->SetYTitle(fHistYTitle.Data());752 753 831 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j); 754 832 } … … 763 841 // - number of sectors 764 842 // 765 // Return kFALSE, if sizes of the TO bjArrays do not match npixels, nareas or nsectors843 // Return kFALSE, if sizes of the TOrdCollections do not match npixels, nareas or nsectors 766 844 // 767 845 // Call FillHists() … … 778 856 779 857 // 780 // Hi-Gain O bjArrays858 // Hi-Gain OrdCollections 781 859 // 782 if (fHiGainArray->Get Entries() != npixels)860 if (fHiGainArray->GetSize() != npixels) 783 861 { 784 862 *fLog << err << "ERROR - Size mismatch in number of pixels... abort." << endl; … … 788 866 if (IsLoGain()) 789 867 { 790 if (fLoGainArray->Get Entries() != npixels)868 if (fLoGainArray->GetSize() != npixels) 791 869 { 792 870 *fLog << err << "ERROR - Size mismatch in number of pixels... abort." << endl; … … 798 876 return FillHists(par,w); 799 877 800 if (fAverageHiGainAreas->Get Entries() != nareas)878 if (fAverageHiGainAreas->GetSize() != nareas) 801 879 { 802 880 *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl; … … 804 882 } 805 883 806 if (fAverageHiGainSectors->Get Entries() != nsectors)884 if (fAverageHiGainSectors->GetSize() != nsectors) 807 885 { 808 886 *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl; … … 813 891 { 814 892 815 if (fAverageLoGainAreas->Get Entries() != nareas)893 if (fAverageLoGainAreas->GetSize() != nareas) 816 894 { 817 895 *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl; … … 819 897 } 820 898 821 if (fAverageLoGainSectors->Get Entries() != nsectors)899 if (fAverageLoGainSectors->GetSize() != nsectors) 822 900 { 823 901 *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl; … … 840 918 { 841 919 842 if (fHiGainArray->Get Entries() == 0 && fLoGainArray->GetEntries() == 0)920 if (fHiGainArray->GetSize() == 0 && fLoGainArray->GetSize() == 0) 843 921 { 844 922 *fLog << err << GetDescriptor() … … 847 925 } 848 926 927 for (Int_t i=0; i<fAverageHiGainAreas->GetSize(); i++) 928 { 929 TH1F *h = GetAverageHiGainArea(i).GetHGausHist(); 930 switch (fColor) 931 { 932 case MCalibrationCam::kNONE: 933 break; 934 case MCalibrationCam::kBLUE: 935 h->SetTitle( Form("%s%s", h->GetTitle(),"BLUE ")); 936 break; 937 case MCalibrationCam::kGREEN: 938 h->SetTitle( Form("%s%s", h->GetTitle(),"GREEN ")); 939 break; 940 case MCalibrationCam::kUV: 941 h->SetTitle( Form("%s%s", h->GetTitle(),"UV ")); 942 break; 943 case MCalibrationCam::kCT1: 944 h->SetTitle( Form("%s%s", h->GetTitle(),"CT1-Pulser ")); 945 break; 946 } 947 } 948 949 for (Int_t i=0; i<fAverageLoGainAreas->GetSize(); i++) 950 { 951 TH1F *h = GetAverageLoGainArea(i).GetHGausHist(); 952 switch (fColor) 953 { 954 case MCalibrationCam::kNONE: 955 break; 956 case MCalibrationCam::kBLUE: 957 h->SetTitle( Form("%s%s", h->GetTitle(),"BLUE ")); 958 break; 959 case MCalibrationCam::kGREEN: 960 h->SetTitle( Form("%s%s", h->GetTitle(),"GREEN ")); 961 break; 962 case MCalibrationCam::kUV: 963 h->SetTitle( Form("%s%s", h->GetTitle(),"UV ")); 964 break; 965 case MCalibrationCam::kCT1: 966 h->SetTitle( Form("%s%s", h->GetTitle(),"CT1-Pulser ")); 967 break; 968 } 969 } 970 849 971 if (!FinalizeHists()) 850 972 return kFALSE; 973 851 974 852 975 FinalizeBadPixels(); … … 873 996 874 997 hist.InitBins(); 875 hist.ChangeHistId(i);876 998 hist.SetEventFrequency(fPulserFrequency); 877 878 TH1F *h = hist.GetHGausHist();879 h->SetTitle( Form("%s%s", h->GetTitle()," Runs: "));880 999 } 881 1000 … … 904 1023 905 1024 FitHiGainHists(hist,pix,bad,fittyp,osctyp); 906 907 1025 } 908 1026 … … 913 1031 { 914 1032 915 MHCalibrationPix 1033 MHCalibrationPix &hist = GetAverageHiGainArea(j); 916 1034 MCalibrationPix &pix = calcam.GetAverageArea(j); 917 1035 MBadPixelsPix &bad = calcam.GetAverageBadArea(j); 918 1036 919 1037 FitHiGainHists(hist,pix,bad,fittyp,osctyp); 920 1038 } 921 1039 922 923 1040 for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++) 924 1041 { 925 926 MHCalibrationPix &hist = GetAverageHiGainSector(j); 1042 MHCalibrationPix &hist = GetAverageHiGainSector(j); 927 1043 MCalibrationPix &pix = calcam.GetAverageSector(j); 928 1044 MBadPixelsPix &bad = calcam.GetAverageBadSector(j); 929 1045 930 1046 FitHiGainHists(hist,pix,bad,fittyp,osctyp); 931 1047 } 932 933 1048 } 934 1049 … … 976 1091 } 977 1092 978 979 1093 for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++) 980 1094 { … … 1045 1159 MBadPixelsPix::UncalibratedType_t osctyp) 1046 1160 { 1047 1048 1161 1049 1162 if (hist.IsEmpty() || hist.IsOnlyOverflow() || hist.IsOnlyUnderflow()) … … 1088 1201 if (IsDebug()) 1089 1202 { 1090 *fLog << dbginf << GetDescriptor() << ": ID " << hist.GetPixId()1203 *fLog << dbginf << GetDescriptor() << ": ID " << GetName() 1091 1204 << " HiGainSaturation: " << pix.IsHiGainSaturation() 1092 1205 << " HiGainMean: " << hist.GetMean () … … 1170 1283 if (IsDebug()) 1171 1284 { 1172 *fLog << dbginf << GetDescriptor() << "ID: " << hist.Get PixId()1285 *fLog << dbginf << GetDescriptor() << "ID: " << hist.GetName() 1173 1286 << " HiGainSaturation: " << pix.IsHiGainSaturation() 1174 1287 << " LoGainMean: " << hist.GetMean () … … 1200 1313 return; 1201 1314 1202 const Int_t nareas = fAverageHiGainAreas->Get Entries();1315 const Int_t nareas = fAverageHiGainAreas->GetSize(); 1203 1316 if (nareas == 0) 1204 1317 return;
Note:
See TracChangeset
for help on using the changeset viewer.