Changeset 5137 for trunk/MagicSoft/Mars/mhcalib
- Timestamp:
- 09/25/04 14:01:50 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mhcalib
- Files:
-
- 16 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; -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.h
r5098 r5137 24 24 25 25 class TText; 26 class TO bjArray;26 class TOrdCollection; 27 27 28 28 class MHCalibrationPix; … … 54 54 Axis_t fLast; // Upper histogram limit 55 55 56 TString fHistName; // Histogram names57 TString fHistTitle; // Histogram titles58 TString fHistXTitle; // Histogram x-axis titles59 TString fHistYTitle; // Histogram y-axis titles56 TString fHistName; //! Histogram names 57 TString fHistTitle; //! Histogram titles 58 TString fHistXTitle; //! Histogram x-axis titles 59 TString fHistYTitle; //! Histogram y-axis titles 60 60 61 61 Float_t fNumHiGainSaturationLimit; // Rel. amount sat. higain FADC slices until pixel is called saturated … … 70 70 MArrayF fAverageAreaSigmaVar; // Variance Re-normalized sigmas in average pixels per area 71 71 MArrayI fAverageAreaNum; // Number of pixels in average pixels per area 72 MArrayI fAverageSectorNum; // Number of pixels in average pixels per sector 73 74 TO bjArray *fAverageHiGainAreas;// Array of calibration pixels, one per pixel area75 TO bjArray *fAverageHiGainSectors;// Array of calibration pixels, one per camera sector76 TO bjArray *fAverageLoGainAreas;// Array of calibration pixels, one per pixel area77 TO bjArray *fAverageLoGainSectors;// Array of calibration pixels, one per camera sector72 MArrayI fAverageSectorNum; // Number of pixels in average pixels per sector 73 74 TOrdCollection *fAverageHiGainAreas; // Array of calibration pixels, one per pixel area 75 TOrdCollection *fAverageHiGainSectors; // Array of calibration pixels, one per camera sector 76 TOrdCollection *fAverageLoGainAreas; // Array of calibration pixels, one per pixel area 77 TOrdCollection *fAverageLoGainSectors; // Array of calibration pixels, one per camera sector 78 78 79 79 MCalibrationCam::PulserColor_t fColor; // Colour of the pulsed LEDs … … 86 86 MRawRunHeader *fRunHeader; //! Run Header 87 87 88 TO bjArray *fHiGainArray;// Array of calibration pixels, one per pixel89 TO bjArray *fLoGainArray;// Array of calibration pixels, one per pixel88 TOrdCollection *fHiGainArray; // Array of calibration pixels, one per pixel 89 TOrdCollection *fLoGainArray; // Array of calibration pixels, one per pixel 90 90 91 91 Int_t fPulserFrequency; // Light pulser frequency … … 108 108 virtual void InitLoGainArrays( const Int_t npix, const Int_t nareas, const Int_t nsectors ); 109 109 110 virtual void ResetHistTitles(); 111 110 112 void DrawAverageSigma( Bool_t sat, Bool_t inner, 111 113 Float_t sigma, Float_t sigmaerr, … … 139 141 Bool_t IsOscillations() const { return TESTBIT(fFlags,kOscillations); } 140 142 Bool_t IsSizeCheck () const { return TESTBIT(fFlags,kSizeCheck); } 143 144 void Remove(TOrdCollection *col); 141 145 142 146 Int_t ReadEnv ( const TEnv &env, TString prefix, Bool_t print); … … 214 218 215 219 #endif 216 217 218 219 220 221 222 223 224 -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindCam.cc
r5098 r5137 35 35 #include <TCanvas.h> 36 36 #include <TPad.h> 37 #include <TOrdCollection.h> 37 38 38 39 #include "MLog.h" … … 59 60 const Axis_t MHCalibrationChargeBlindCam::fgSPheCut = 20.; 60 61 const TString MHCalibrationChargeBlindCam::gsHistName = "ChargeBlind"; 61 const TString MHCalibrationChargeBlindCam::gsHistTitle = "Signals Blind 62 const TString MHCalibrationChargeBlindCam::gsHistTitle = "Signals Blind"; 62 63 const TString MHCalibrationChargeBlindCam::gsHistXTitle = "Signal [FADC counts]"; 63 64 const TString MHCalibrationChargeBlindCam::gsHistYTitle = "Nr. events"; … … 184 185 const Int_t integ = signal->IsExtractionType( MExtractBlindPixel::kIntegral ); 185 186 186 TH1F *h; 187 188 if (fHiGainArray->GetEntries()==0) 187 if (fHiGainArray->GetSize()==0) 189 188 { 190 fHiGainArray->Expand(nblindpixels);191 189 for (Int_t i=0; i<nblindpixels; i++) 192 190 { 193 (*fHiGainArray)[i] = new MHCalibrationChargeBlindPix(Form("%s%s",fHistName.Data(),"Pix"),194 Form("%s%s ",fHistTitle.Data()," Pixel "));191 fHiGainArray->AddAt(new MHCalibrationChargeBlindPix(Form("%s%s%d",fHistName.Data(),"Pix",i), 192 Form("%s%s%d",fHistTitle.Data()," Pixel ",i)),i); 195 193 196 194 MHCalibrationChargeBlindPix &pix = (MHCalibrationChargeBlindPix&)(*this)[i]; … … 202 200 pix.SetFitFunc ( integ ? MHCalibrationChargeBlindPix::kEPoisson5 : fFitFunc ); 203 201 204 h = pix.GetHGausHist();205 206 h->SetName (Form("%s%s%s","H",fHistName.Data(),"Pix"));207 h->SetTitle(Form("%s%s",fHistTitle.Data()," Pixel "));208 h->SetXTitle(fHistXTitle.Data());209 h->SetYTitle(fHistYTitle.Data());210 211 pix.ChangeHistId(i);212 202 pix.InitBins(); 213 203 214 h->SetTitle( Form("%s%s", h->GetTitle()," Runs: "));215 204 } 216 205 } 217 206 return kTRUE; 207 } 208 209 // -------------------------------------------------------------------------- 210 // 211 // Resets the histogram titles for each entry in: 212 // - fHiGainArray 213 // 214 void MHCalibrationChargeBlindCam::ResetHistTitles() 215 { 216 217 TH1F *h; 218 219 if (fHiGainArray) 220 for (Int_t i=0;i<fHiGainArray->GetSize(); i++) 221 { 222 MHCalibrationPix &pix = (*this)[i]; 223 h = pix.GetHGausHist(); 224 h->SetName (Form("%s%s%s%d","H",fHistName.Data(),"Pix",i)); 225 h->SetTitle(Form("%s%s%d%s",fHistTitle.Data()," Pixel ",i," Runs: ")); 226 h->SetXTitle(fHistXTitle.Data()); 227 h->SetYTitle(fHistYTitle.Data()); 228 } 218 229 } 219 230 … … 327 338 for (Int_t i=0; i<fHiGainArray->GetSize(); i++) 328 339 { 329 330 340 MHCalibrationChargeBlindPix &hist = (MHCalibrationChargeBlindPix&)(*this)[i]; 331 341 332 342 TH1F *h = hist.GetHGausHist(); 333 343 344 switch (fColor) 345 { 346 case MCalibrationCam::kNONE: 347 break; 348 case MCalibrationCam::kBLUE: 349 h->SetTitle( Form("%s%s", h->GetTitle(),"BLUE ")); 350 break; 351 case MCalibrationCam::kGREEN: 352 h->SetTitle( Form("%s%s", h->GetTitle(),"GREEN ")); 353 break; 354 case MCalibrationCam::kUV: 355 h->SetTitle( Form("%s%s", h->GetTitle(),"UV ")); 356 break; 357 case MCalibrationCam::kCT1: 358 h->SetTitle( Form("%s%s", h->GetTitle(),"CT1-Pulser ")); 359 break; 360 } 361 334 362 Stat_t overflow = h->GetBinContent(h->GetNbinsX()+1); 335 363 if (overflow > 0.1) … … 373 401 if (hist.IsEmpty()) 374 402 { 375 *fLog << err << GetDescriptor() << " ID: " << hist.Get PixId()403 *fLog << err << GetDescriptor() << " ID: " << hist.GetName() 376 404 << " My histogram has not been filled !! " << endl; 377 405 return; … … 405 433 } 406 434 435 // -------------------------------------------------------------------------- 436 // 437 // This Clone-function has to be different from the MHCalibrationCam 438 // Clone function since it does not store and display the averaged values 439 // (in fAverageAreas), but the blind pixels stored in fHiGainArray. 440 // 441 // Creates new MHCalibrationChargeBlindCam and 442 // Clones MHCalibrationChargeBlindPix's individually 443 // 444 #if 0 445 TObject *MHCalibrationChargeBlindCam::Clone(const char *name) const 446 { 447 448 MHCalibrationChargeBlindCam *cam = new MHCalibrationChargeBlindCam(); 449 450 // 451 // Copy the data members 452 // 453 cam->fRunNumbers = fRunNumbers; 454 cam->fPulserFrequency = fPulserFrequency; 455 cam->fFlags = fFlags; 456 cam->fNbins = fNbins; 457 cam->fFirst = fFirst; 458 cam->fLast = fLast; 459 cam->fFitFunc = fFitFunc; 460 461 const Int_t nhi = fHiGainArray->GetSize(); 462 463 for (int i=0; i<nhi; i++) 464 cam->fHiGainArray->AddAt((*this)[i].Clone(),i); 465 466 return cam; 467 } 468 #endif 407 469 // ----------------------------------------------------------------------------- 408 470 // … … 416 478 { 417 479 418 const Int_t size = fHiGainArray->Get Entries();480 const Int_t size = fHiGainArray->GetSize(); 419 481 420 482 if (size == 0) -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindCam.h
r5098 r5137 1 1 2 #ifndef MARS_MHCalibrationChargeBlindCam 2 3 #define MARS_MHCalibrationChargeBlindCam … … 39 40 Bool_t FinalizeHists(); 40 41 42 void ResetHistTitles(); 41 43 void FitBlindPixel( MHCalibrationChargeBlindPix &hist, MCalibrationBlindPix &pix); 42 44 … … 46 48 47 49 MHCalibrationChargeBlindCam(const char *name=NULL, const char *title=NULL); 48 50 ~MHCalibrationChargeBlindCam() {} 51 49 52 // Draw 50 53 void Draw(Option_t *opt=""); -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindPix.cc
r5098 r5137 146 146 { 147 147 148 // 149 // The next two lines are important for the case that 150 // the class has been stored to a file and is read again. 151 // In this case, the next two lines prevent a segm. violation 152 // in the destructor 153 // 154 gROOT->GetListOfFunctions()->Remove(fSinglePheFit); 155 148 156 if (fSinglePheFit) 149 157 delete fSinglePheFit; -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc
r5098 r5137 29 29 // MHCalibrationChargeHiGainPix and MHCalibrationChargeLoGainPix for every: 30 30 // 31 // - Pixel, stored in the TO bjArray's MHCalibrationCam::fHiGainArray and31 // - Pixel, stored in the TOrdCollection's MHCalibrationCam::fHiGainArray and 32 32 // MHCalibrationCam::fLoGainArray 33 33 // 34 34 // - Average pixel per AREA index (e.g. inner and outer for the MAGIC camera), 35 // stored in the TO bjArray's MHCalibrationCam::fAverageHiGainAreas and35 // stored in the TOrdCollection's MHCalibrationCam::fAverageHiGainAreas and 36 36 // MHCalibrationCam::fAverageLoGainAreas 37 37 // 38 38 // - Average pixel per camera SECTOR (e.g. sectors 1-6 for the MAGIC camera), 39 // stored in the TO bjArray's MHCalibrationCam::fAverageHiGainSectors and39 // stored in the TOrdCollection's MHCalibrationCam::fAverageHiGainSectors and 40 40 // MHCalibrationCam::fAverageLoGainSectors 41 41 // … … 141 141 #include "MArrayD.h" 142 142 143 #include <TOrdCollection.h> 143 144 #include <TPad.h> 144 145 #include <TVirtualPad.h> … … 156 157 const Int_t MHCalibrationChargeCam::fgChargeHiGainNbins = 550; 157 158 const Axis_t MHCalibrationChargeCam::fgChargeHiGainFirst = -100.5; 158 const Axis_t MHCalibrationChargeCam::fgChargeHiGainLast = 999.5;159 const Int_t MHCalibrationChargeCam::fgChargeLoGainNbins = 325;159 const Axis_t MHCalibrationChargeCam::fgChargeHiGainLast = 999.5; 160 const Int_t MHCalibrationChargeCam::fgChargeLoGainNbins = 525; 160 161 const Axis_t MHCalibrationChargeCam::fgChargeLoGainFirst = -150.5; 161 const Axis_t MHCalibrationChargeCam::fgChargeLoGainLast = 499.5;162 const Axis_t MHCalibrationChargeCam::fgChargeLoGainLast = 899.5; 162 163 const TString MHCalibrationChargeCam::gsHistName = "Charge"; 163 164 const TString MHCalibrationChargeCam::gsHistTitle = "Signals"; … … 241 242 // -------------------------------------------------------------------------- 242 243 // 244 // Creates new MHCalibrationChargeCam only with the averaged areas: 245 // the rest has to be retrieved directly, e.g. via: 246 // MHCalibrationChargeCam *cam = MParList::FindObject("MHCalibrationChargeCam"); 247 // - cam->GetAverageSector(5).DrawClone(); 248 // - (*cam)[100].DrawClone() 249 // 250 TObject *MHCalibrationChargeCam::Clone(const char *) const 251 { 252 253 MHCalibrationChargeCam *cam = new MHCalibrationChargeCam(); 254 255 // 256 // Copy the data members 257 // 258 cam->fColor = fColor; 259 cam->fRunNumbers = fRunNumbers; 260 cam->fPulserFrequency = fPulserFrequency; 261 cam->fFlags = fFlags; 262 cam->fNbins = fNbins; 263 cam->fFirst = fFirst; 264 cam->fLast = fLast; 265 cam->fLoGainNbins = fLoGainNbins; 266 cam->fLoGainFirst = fLoGainFirst; 267 cam->fLoGainLast = fLoGainLast; 268 269 // 270 // Copy the MArrays 271 // 272 cam->fAverageAreaRelSigma = fAverageAreaRelSigma; 273 cam->fAverageAreaRelSigmaVar = fAverageAreaRelSigmaVar; 274 cam->fAverageAreaSat = fAverageAreaSat; 275 cam->fAverageAreaSigma = fAverageAreaSigma; 276 cam->fAverageAreaSigmaVar = fAverageAreaSigmaVar; 277 cam->fAverageAreaNum = fAverageAreaNum; 278 cam->fAverageSectorNum = fAverageSectorNum; 279 280 if (!IsAverageing()) 281 return cam; 282 283 const Int_t navhi = fAverageHiGainAreas->GetSize(); 284 285 for (int i=0; i<navhi; i++) 286 cam->fAverageHiGainAreas->AddAt(GetAverageHiGainArea(i).Clone(),i); 287 288 if (IsLoGain()) 289 { 290 291 const Int_t navlo = fAverageLoGainAreas->GetSize(); 292 for (int i=0; i<navlo; i++) 293 cam->fAverageLoGainAreas->AddAt(GetAverageLoGainArea(i).Clone(),i); 294 295 } 296 297 return cam; 298 } 299 300 // -------------------------------------------------------------------------- 301 // 243 302 // Gets the pointers to: 244 303 // - MRawEvtData … … 323 382 const Float_t numlogain = signal->GetNumUsedLoGainFADCSlices(); 324 383 325 326 384 if (fCam) 327 385 { … … 350 408 const Int_t nareas = fGeom->GetNumAreas(); 351 409 410 // 411 // In case of the intense blue, double the range 412 // 413 if (fGeom->InheritsFrom("MGeomCamMagic")) 414 if ( fColor == MCalibrationCam::kBLUE) 415 SetLoGainLast(2.*fLoGainLast - fLoGainFirst); 416 352 417 InitHiGainArrays(npixels,nareas,nsectors); 353 418 InitLoGainArrays(npixels,nareas,nsectors); … … 377 442 // Initializes the High Gain Arrays: 378 443 // 379 // - Expand fHiGainArrays to npixels380 // - Expand fAverageHiGainAreas to nareas381 // - Expand fAverageHiGainSectors to nsectors382 //383 444 // - For every entry in the expanded arrays: 384 445 // * Initialize an MHCalibrationChargePix … … 399 460 const Int_t higainsamples = fRunHeader->GetNumSamplesHiGain(); 400 461 401 if (fHiGainArray->Get Entries()==0)462 if (fHiGainArray->GetSize()==0) 402 463 { 403 fHiGainArray->Expand(npixels);404 464 for (Int_t i=0; i<npixels; i++) 405 465 { 406 (*fHiGainArray)[i] = new MHCalibrationChargePix(Form("%s%s",fHistName.Data(),"HiGainPix"),407 Form("%s%s",fHistTitle.Data()," High Gain Pixel"));466 fHiGainArray->AddAt(new MHCalibrationChargePix(Form("%s%s%4i",fHistName.Data(),"HiGainPix",i), 467 Form("%s%s%4i",fHistTitle.Data()," High Gain Pixel",i)),i); 408 468 409 469 MHCalibrationChargePix &pix = (MHCalibrationChargePix&)(*this)[i]; … … 417 477 pix.SetAbsTimeLast(higainsamples-0.5); 418 478 419 h = pix.GetHGausHist();420 421 h->SetName (Form("%s%s%s","H",fHistName.Data(),"HiGainPix"));422 h->SetTitle(Form("%s%s",fHistTitle.Data()," High Gain Pixel "));423 h->SetXTitle(fHistXTitle.Data());424 h->SetYTitle(fHistYTitle.Data());425 426 479 h = pix.GetHAbsTime(); 427 480 428 h->SetName (Form("%s%s%s ","H",fAbsHistName.Data(),"HiGainPix"));429 h->SetTitle(Form("%s%s ",fAbsHistTitle.Data()," High Gain Pixel "));481 h->SetName (Form("%s%s%s%4i","H",fAbsHistName.Data(),"HiGainPix",i)); 482 h->SetTitle(Form("%s%s%4i",fAbsHistTitle.Data()," High Gain Pixel ",i)); 430 483 h->SetXTitle(fAbsHistXTitle.Data()); 431 484 h->SetYTitle(fAbsHistYTitle.Data()); … … 437 490 438 491 439 if (fAverageHiGainAreas->Get Entries()==0)492 if (fAverageHiGainAreas->GetSize()==0) 440 493 { 441 fAverageHiGainAreas->Expand(nareas);442 443 494 for (Int_t j=0; j<nareas; j++) 444 495 { 445 (*fAverageHiGainAreas)[j] = 446 new MHCalibrationChargePix(Form("%s%s",fHistName.Data(),"HiGainArea"), 447 Form("%s%s",fHistTitle.Data()," High Gain Area Idx ")); 496 fAverageHiGainAreas->AddAt(new MHCalibrationChargePix(Form("%s%s%d",fHistName.Data(),"HiGainArea",j), 497 Form("%s%s%d",fHistTitle.Data()," High Gain Area Idx ",j)),j); 448 498 449 499 MHCalibrationChargePix &pix = (MHCalibrationChargePix&)GetAverageHiGainArea(j); … … 457 507 pix.SetAbsTimeLast(higainsamples-0.5); 458 508 459 h = pix.GetHGausHist(); 460 461 h->SetName (Form("%s%s%s","H",fHistName.Data(),"HiGainArea")); 462 h->SetXTitle(fHistXTitle.Data()); 463 h->SetYTitle(fHistYTitle.Data()); 464 465 if (fGeom->InheritsFrom("MGeomCamMagic")) 466 { 467 h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ", 468 j==0 ? "Inner Pixels " : "Outer Pixels ","High Gain Runs: ")); 469 pix.InitBins(); 470 pix.SetEventFrequency(fPulserFrequency); 471 } 472 else 473 { 474 h->SetTitle(Form("%s%s",fHistTitle.Data(), 475 " averaged on event-by-event basis High Gain Area Idx ")); 476 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 477 } 509 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 478 510 479 511 h = pix.GetHAbsTime(); 480 512 481 h->SetName (Form("%s%s%s ","H",fAbsHistName.Data(),"HiGainArea"));482 h->SetTitle(Form("%s%s ",fAbsHistTitle.Data(),483 " averaged on event-by-event basis High Gain Area Idx " ));513 h->SetName (Form("%s%s%s%d","H",fAbsHistName.Data(),"HiGainArea",j)); 514 h->SetTitle(Form("%s%s%d",fAbsHistTitle.Data(), 515 " averaged on event-by-event basis High Gain Area Idx ",j)); 484 516 h->SetXTitle(fAbsHistXTitle.Data()); 485 517 h->SetYTitle(fAbsHistYTitle.Data()); … … 487 519 } 488 520 489 if (fAverageHiGainSectors->Get Entries()==0)521 if (fAverageHiGainSectors->GetSize()==0) 490 522 { 491 fAverageHiGainSectors->Expand(nsectors);492 493 523 for (Int_t j=0; j<nsectors; j++) 494 { 495 (*fAverageHiGainSectors)[j] = 496 new MHCalibrationChargePix(Form("%s%s",fHistName.Data(),"HiGainSector"), 497 Form("%s%s",fHistTitle.Data()," High Gain Sector ")); 524 { 525 fAverageHiGainSectors->AddAt(new MHCalibrationChargePix(Form("%s%s%2i",fHistName.Data(),"HiGainSector",j), 526 Form("%s%s%2i",fHistTitle.Data()," High Gain Sector ",j)),j); 498 527 499 528 MHCalibrationChargePix &pix = (MHCalibrationChargePix&)GetAverageHiGainSector(j); … … 507 536 pix.SetAbsTimeLast(higainsamples-0.5); 508 537 509 h = pix.GetHGausHist();510 511 h->SetName (Form("%s%s%s","H",fHistName.Data(),"HiGainSector"));512 h->SetTitle(Form("%s%s",fHistTitle.Data()," High Gain Sector "));513 h->SetXTitle(fHistXTitle.Data());514 h->SetYTitle(fHistYTitle.Data());515 516 538 h = pix.GetHAbsTime(); 517 539 518 h->SetName (Form("%s%s%s ","H",fAbsHistName.Data(),"HiGainSector"));519 h->SetTitle(Form("%s%s ",fAbsHistTitle.Data(),520 " averaged on event-by-event basis High Gain Area Sector " ));540 h->SetName (Form("%s%s%s%2i","H",fAbsHistName.Data(),"HiGainSector",j)); 541 h->SetTitle(Form("%s%s%2i",fAbsHistTitle.Data(), 542 " averaged on event-by-event basis High Gain Area Sector ",j)); 521 543 h->SetXTitle(fAbsHistXTitle.Data()); 522 544 h->SetYTitle(fAbsHistYTitle.Data()); … … 536 558 // Initializes the Low Gain Arrays: 537 559 // 538 // - Expand fLoGainArrays to npixels539 // - Expand fAverageLoGainAreas to nareas540 // - Expand fAverageLoGainSectors to nsectors541 //542 560 // - For every entry in the expanded arrays: 543 561 // * Initialize an MHCalibrationChargePix … … 560 578 TH1F *h; 561 579 562 if (fLoGainArray->GetEntries()==0 ) 563 { 564 fLoGainArray->Expand(npixels); 565 580 if (fLoGainArray->GetSize()==0 ) 581 { 566 582 for (Int_t i=0; i<npixels; i++) 567 583 { 568 (*fLoGainArray)[i] = 569 new MHCalibrationChargePix(Form("%s%s",fHistName.Data(),"LoGainPix"), 570 Form("%s%s",fHistTitle.Data()," Low Gain Pixel")); 584 fLoGainArray->AddAt(new MHCalibrationChargePix(Form("%s%s%4i",fHistName.Data(),"LoGainPix",i), 585 Form("%s%s%4i",fHistTitle.Data()," Low Gain Pixel",i)),i); 571 586 572 587 MHCalibrationChargePix &pix = (MHCalibrationChargePix&)(*this)(i); … … 580 595 pix.SetAbsTimeLast(logainsamples-0.5); 581 596 582 h = pix.GetHGausHist();583 584 h->SetName (Form("%s%s%s","H",fHistName.Data(),"LoGainPix"));585 h->SetTitle(Form("%s%s",fHistTitle.Data()," Low Gain Pixel "));586 h->SetXTitle(fHistXTitle.Data());587 h->SetYTitle(fHistYTitle.Data());588 589 597 h = pix.GetHAbsTime(); 590 598 591 h->SetName (Form("%s%s%s ","H",fAbsHistName.Data(),"HiGainPix"));592 h->SetTitle(Form("%s%s ",fAbsHistTitle.Data()," High Gain Pixel "));599 h->SetName (Form("%s%s%s%4i","H",fAbsHistName.Data(),"HiGainPix",i)); 600 h->SetTitle(Form("%s%s%4i",fAbsHistTitle.Data()," High Gain Pixel ",i)); 593 601 h->SetXTitle(fAbsHistXTitle.Data()); 594 602 h->SetYTitle(fAbsHistYTitle.Data()); … … 599 607 } 600 608 601 if (fAverageLoGainAreas->GetEntries()==0) 602 { 603 fAverageLoGainAreas->Expand(nareas); 604 609 if (fAverageLoGainAreas->GetSize()==0) 610 { 605 611 for (Int_t j=0; j<nareas; j++) 606 612 { 607 (*fAverageLoGainAreas)[j] = 608 new MHCalibrationChargePix(Form("%s%s",fHistName.Data(),"LoGainArea"), 609 Form("%s%s",fHistTitle.Data()," Low Gain Area Idx ")); 610 611 MHCalibrationChargePix &pix = (MHCalibrationChargePix&)GetAverageLoGainArea(j); 612 613 pix.SetNbins(fLoGainNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas)); 614 pix.SetFirst(fLoGainFirst); 615 pix.SetLast (fLoGainLast); 616 617 pix.SetAbsTimeNbins(logainsamples); 618 pix.SetAbsTimeFirst(-0.5); 619 pix.SetAbsTimeLast(logainsamples-0.5); 620 621 h = pix.GetHGausHist(); 622 623 h->SetName (Form("%s%s%s","H",fHistName.Data(),"LoGainArea")); 624 h->SetXTitle(fHistXTitle.Data()); 625 h->SetYTitle(fHistYTitle.Data()); 626 627 628 if (fGeom->InheritsFrom("MGeomCamMagic")) 629 { 630 h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ", 631 j==0 ? "Inner Pixels " : "Outer Pixels ","Low Gain Runs: ")); 632 pix.InitBins(); 633 pix.SetEventFrequency(fPulserFrequency); 634 } 635 else 636 { 637 h->SetTitle(Form("%s%s",fHistTitle.Data()," averaged on event-by-event basis Low Gain Area Idx ")); 638 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 639 } 640 641 h = pix.GetHAbsTime(); 642 643 h->SetName (Form("%s%s%s","H",fAbsHistName.Data(),"LoGainArea")); 644 h->SetTitle(Form("%s%s",fAbsHistTitle.Data(), 645 " averaged on event-by-event basis Low Gain Area Idx ")); 646 h->SetXTitle(fAbsHistXTitle.Data()); 647 h->SetYTitle(fAbsHistYTitle.Data()); 648 649 } 650 } 651 652 653 if (fAverageLoGainSectors->GetEntries()==0 && IsLoGain()) 654 { 655 fAverageLoGainSectors->Expand(nsectors); 656 657 for (Int_t j=0; j<nsectors; j++) 658 { 659 (*fAverageLoGainSectors)[j] = 660 new MHCalibrationChargePix(Form("%s%s",fHistName.Data(),"LoGainSector"), 661 Form("%s%s",fHistTitle.Data()," Low Gain Sector ")); 662 663 MHCalibrationChargePix &pix = (MHCalibrationChargePix&)GetAverageLoGainSector(j); 664 613 fAverageLoGainAreas->AddAt(new MHCalibrationChargePix(Form("%s%s%d",fHistName.Data(),"LoGainArea",j), 614 Form("%s%s%d",fHistTitle.Data()," Low Gain Area Idx ",j)),j); 615 616 MHCalibrationChargePix &pix = (MHCalibrationChargePix&)GetAverageLoGainArea(j); 617 665 618 pix.SetNbins(fLoGainNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas)); 666 619 pix.SetFirst(fLoGainFirst); 667 620 pix.SetLast (fLoGainLast); 668 621 669 622 pix.SetAbsTimeNbins(logainsamples); 670 623 pix.SetAbsTimeFirst(-0.5); 671 624 pix.SetAbsTimeLast(logainsamples-0.5); 672 625 673 h = pix.GetHGausHist();674 675 h->SetName (Form("%s%s%s","H",fHistName.Data(),"LoGainSector"));676 h->SetTitle(Form("%s%s",fHistTitle.Data()," Low Gain Sector "));677 h->SetXTitle(fHistXTitle.Data());678 h->SetYTitle(fHistYTitle.Data());679 680 626 h = pix.GetHAbsTime(); 681 627 682 h->SetName (Form("%s%s%s ","H",fAbsHistName.Data(),"LoGainSector"));683 h->SetTitle(Form("%s%s ",fAbsHistTitle.Data(),684 " averaged on event-by-event basis Low Gain Area Sector "));628 h->SetName (Form("%s%s%s%2i","H",fAbsHistName.Data(),"LoGainArea",j)); 629 h->SetTitle(Form("%s%s%2i",fAbsHistTitle.Data(), 630 " averaged on event-by-event basis Low Gain Area Idx ",j)); 685 631 h->SetXTitle(fAbsHistXTitle.Data()); 686 632 h->SetYTitle(fAbsHistYTitle.Data()); 687 633 688 // 689 // Adapt the range for the case, the intense blue is used: 690 // FIXME: this is a nasty workaround, but for the moment necessary 691 // in order to avoid default memory space. 692 // 693 if (fGeom->InheritsFrom("MGeomCamMagic")) 694 { 695 if ( fColor == MCalibrationCam::kBLUE) 696 { 697 pix.SetFirst(-10.5); 698 pix.SetLast(999.5); 699 pix.SetNbins(3030); 700 } 701 } 702 703 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j); 634 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 635 } 636 } 637 638 639 if (fAverageLoGainSectors->GetSize()==0 && IsLoGain()) 640 { 641 for (Int_t j=0; j<nsectors; j++) 642 { 643 fAverageLoGainSectors->AddAt(new MHCalibrationChargePix(Form("%s%s%2i",fHistName.Data(),"LoGainSector",j), 644 Form("%s%s%2i",fHistTitle.Data()," Low Gain Sector ",j)),j); 645 646 MHCalibrationChargePix &pix = (MHCalibrationChargePix&)GetAverageLoGainSector(j); 647 648 pix.SetNbins(fLoGainNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas)); 649 pix.SetFirst(fLoGainFirst); 650 pix.SetLast (fLoGainLast); 651 652 pix.SetAbsTimeNbins(logainsamples); 653 pix.SetAbsTimeFirst(-0.5); 654 pix.SetAbsTimeLast(logainsamples-0.5); 655 656 h = pix.GetHAbsTime(); 657 658 h->SetName (Form("%s%s%s%2i","H",fAbsHistName.Data(),"LoGainSector",j)); 659 h->SetTitle(Form("%s%s%2i",fAbsHistTitle.Data(), 660 " averaged on event-by-event basis Low Gain Area Sector ",j)); 661 h->SetXTitle(fAbsHistXTitle.Data()); 662 h->SetYTitle(fAbsHistYTitle.Data()); 663 664 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j); 704 665 } 705 666 } 706 667 } 707 668 708 669 709 670 // -------------------------------------------------------------------------- 710 671 // … … 717 678 // - number of sectors 718 679 // 719 // For all TO bjArray's (including the averaged ones), the following steps are performed:680 // For all TOrdCollection's (including the averaged ones), the following steps are performed: 720 681 // 721 682 // 1) Fill Charges histograms (MHGausEvents::FillHistAndArray()) with: … … 852 813 853 814 MHCalibrationChargePix &hipix = (MHCalibrationChargePix&)GetAverageHiGainArea(j); 815 854 816 855 817 if (IsOscillations()) … … 910 872 // -------------------------------------------------------------------------- 911 873 // 912 // For all TO bjArray's (including the averaged ones), the following steps are performed:874 // For all TOrdCollection's (including the averaged ones), the following steps are performed: 913 875 // 914 876 // 1) Returns if the pixel is excluded. … … 934 896 MCalibrationCam *chargecam = fIntensCam ? fIntensCam->GetCam() : fCam; 935 897 MBadPixelsCam *badcam = fIntensBad ? fIntensBad->GetCam() : fBadPixels; 936 898 899 937 900 for (Int_t i=0; i<fHiGainArray->GetSize(); i++) 938 901 { … … 1022 985 FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain); 1023 986 } 1024 987 1025 988 for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++) 1026 989 { … … 1040 1003 FinalizeAbsTimes(histhi, pix, bad, fFirstHiGain, fLastHiGain); 1041 1004 } 1042 1005 1043 1006 if (IsLoGain()) 1044 1007 for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++) … … 1147 1110 *fLog << warn << GetDescriptor() 1148 1111 << Form("%s%3.1f%s%2.1f%s%4i",": Mean ArrivalTime: ",mean," smaller than ",fTimeLowerLimit, 1149 " FADC slices from lower edge in pixel ",hist.Get PixId()) << endl;1112 " FADC slices from lower edge in pixel ",hist.GetName()) << endl; 1150 1113 bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInFirstBin ); 1151 1114 } … … 1155 1118 *fLog << warn << GetDescriptor() 1156 1119 << Form("%s%3.1f%s%2.1f%s%4i",": Mean ArrivalTime: ",mean," greater than ",fTimeUpperLimit, 1157 " FADC slices from upper edge in pixel ",hist.Get PixId()) << endl;1120 " FADC slices from upper edge in pixel ",hist.GetName()) << endl; 1158 1121 bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInLast2Bins ); 1159 1122 } … … 1230 1193 { 1231 1194 1232 const Int_t nareas = fAverageHiGainAreas->Get Entries();1195 const Int_t nareas = fAverageHiGainAreas->GetSize(); 1233 1196 if (nareas == 0) 1234 1197 return; … … 1262 1225 // Ask for Hi-Gain saturation 1263 1226 // 1227 *fLog << err << hipix.GetSaturated() << " " << fNumHiGainSaturationLimit*hipix.GetHGausHist()->GetEntries() << endl; 1264 1228 if (hipix.GetSaturated() > fNumHiGainSaturationLimit*hipix.GetHGausHist()->GetEntries() && IsLoGain()) 1265 1229 { … … 1269 1233 else 1270 1234 DrawDataCheckPixel(hipix,i ? gkHiGainOuterRefLines : gkHiGainInnerRefLines); 1235 1271 1236 } 1272 1237 } … … 1296 1261 pix.GetFirst() > 0. ? pix.GetFirst() : 0., 1297 1262 pix.GetLast() > pix.GetFirst() 1298 ? ( pix.GetLast() > 450. ? 450. : pix.GetLast() ) 1263 ? ( pix.GetLast() > 450. 1264 ? ( fColor == MCalibrationCam::kBLUE ? 800. : 450. ) 1265 : pix.GetLast() ) 1299 1266 : pix.GetFirst()*2.); 1300 1267 … … 1383 1350 1384 1351 pix.DrawEvents("same"); 1352 1353 // newpad->cd(3); 1354 // pix.DrawPowerSpectrum(*newpad,4); 1355 1385 1356 return; 1386 1357 -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.h
r5098 r5137 105 105 ~MHCalibrationChargeCam() {} 106 106 107 // Clone 108 TObject *Clone(const char *name="") const; 109 107 110 void SetLoGainNbins ( const Int_t i ) { fLoGainNbins = i; } 108 111 void SetLoGainFirst ( const Axis_t f ) { fLoGainFirst = f; } -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargePix.cc
r5098 r5137 101 101 MHGausEvents::Reset(); 102 102 fHAbsTime.Reset(); 103 }104 105 // --------------------------------------------------------------------------106 //107 // Calls MHCalibrationPix::ChangeHistId()108 //109 // Add id to names and titles of:110 // - fHAbsTime111 //112 void MHCalibrationChargePix::ChangeHistId(Int_t id)113 {114 115 MHCalibrationPix::ChangeHistId(id);116 117 fHAbsTime.SetName (Form("%s%d", fHAbsTime.GetName(), id));118 fHAbsTime.SetTitle(Form("%s%d", fHAbsTime.GetTitle(), id));119 120 103 } 121 104 -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargePix.h
r5098 r5137 44 44 virtual void Draw(Option_t *opt=""); 45 45 46 // Miscelleaneous47 void ChangeHistId(Int_t id);48 49 46 ClassDef(MHCalibrationChargePix, 1) // Base Histogram class for Charge Pixel Calibration 50 47 }; -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationPix.cc
r5098 r5137 62 62 // 63 63 MHCalibrationPix::MHCalibrationPix(const char *name, const char *title) 64 : fPixId(-1)65 64 { 66 65 … … 108 107 { 109 108 *fLog << warn << GetDescriptor() 110 << ": Cannot bypass fit. Number of entries smaller or equal 0 in pixel: " << fPixId<< endl;109 << ": Cannot bypass fit. Number of entries smaller or equal 0 in pixel: " << GetName() << endl; 111 110 return; 112 111 } … … 116 115 fSigma = fHGausHist.GetRMS() ; 117 116 fSigmaErr = fHGausHist.GetRMS() / TMath::Sqrt(entries) / 2.; 118 }119 120 // --------------------------------------------------------------------------121 //122 // - Set fPixId to id123 //124 // Add id to names and titles of:125 // - fHGausHist126 //127 void MHCalibrationPix::ChangeHistId(const Int_t id)128 {129 130 fPixId = id;131 132 fHGausHist.SetName( Form("%s%d", fHGausHist.GetName(), id));133 fHGausHist.SetTitle( Form("%s%d", fHGausHist.GetTitle(), id));134 135 fName = Form("%s%d", fName.Data(), id);136 fTitle = Form("%s%d", fTitle.Data(), id);137 138 117 } 139 118 -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationPix.h
r5098 r5137 18 18 Int_t fSaturated; // Number of events classified as saturated 19 19 Float_t fPickupLimit; // Upper nr sigmas from mean until event is considered pickup 20 Int_t fPixId; // Pixel ID21 20 22 21 public: 23 22 24 23 MHCalibrationPix(const char* name=NULL, const char* title=NULL); 25 ~MHCalibrationPix() {}26 24 27 25 void Clear(Option_t *o=""); … … 30 28 const Double_t GetBlackout () const; 31 29 const Double_t GetPickup () const; 32 const Int_t GetPixId () const { return fPixId; }33 30 const Float_t GetSaturated () const { return fSaturated; } 34 31 … … 41 38 void SetBlackoutLimit ( const Float_t lim=fgBlackoutLimit ) { fBlackoutLimit = lim; } 42 39 void SetPickupLimit ( const Float_t lim=fgPickupLimit ) { fPickupLimit = lim; } 43 void SetPixId ( const Int_t i ) { fPixId = i; }44 40 45 41 // Miscelleaneous 46 virtual void ChangeHistId(const Int_t id); // Changes names and titles of the histogram47 42 virtual void Renorm(); // Re-normalize the results 48 43 -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.cc
r5098 r5137 109 109 #include "MBadPixelsPix.h" 110 110 111 #include <TOrdCollection.h> 111 112 #include <TPad.h> 112 113 #include <TVirtualPad.h> … … 167 168 168 169 } 170 171 // -------------------------------------------------------------------------- 172 // 173 // Creates new MHCalibrationRelTimeCam only with the averaged areas: 174 // the rest has to be retrieved directly, e.g. via: 175 // MHCalibrationRelTimeCam *cam = MParList::FindObject("MHCalibrationRelTimeCam"); 176 // - cam->GetAverageSector(5).DrawClone(); 177 // - (*cam)[100].DrawClone() 178 // 179 #if 0 180 TObject *MHCalibrationRelTimeCam::Clone(const char *) const 181 { 182 183 MHCalibrationRelTimeCam *cam = new MHCalibrationRelTimeCam(); 184 185 // 186 // Copy the data members 187 // 188 cam->fRunNumbers = fRunNumbers; 189 cam->fPulserFrequency = fPulserFrequency; 190 cam->fFlags = fFlags; 191 cam->fNbins = fNbins; 192 cam->fFirst = fFirst; 193 cam->fLast = fLast; 194 195 // 196 // Copy the MArrays 197 // 198 cam->fAverageAreaRelSigma = fAverageAreaRelSigma; 199 cam->fAverageAreaRelSigmaVar = fAverageAreaRelSigmaVar; 200 cam->fAverageAreaSat = fAverageAreaSat; 201 cam->fAverageAreaSigma = fAverageAreaSigma; 202 cam->fAverageAreaSigmaVar = fAverageAreaSigmaVar; 203 cam->fAverageAreaNum = fAverageAreaNum; 204 cam->fAverageSectorNum = fAverageSectorNum; 205 206 if (!IsAverageing()) 207 return cam; 208 209 const Int_t navhi = fAverageHiGainAreas->GetSize(); 210 211 for (int i=0; i<navhi; i++) 212 cam->fAverageHiGainAreas->AddAt(GetAverageHiGainArea(i).Clone(),i); 213 214 if (IsLoGain()) 215 { 216 217 const Int_t navlo = fAverageLoGainAreas->GetSize(); 218 for (int i=0; i<navlo; i++) 219 cam->fAverageLoGainAreas->AddAt(GetAverageLoGainArea(i).Clone(),i); 220 221 } 222 223 return cam; 224 } 225 #endif 169 226 170 227 // -------------------------------------------------------------------------- … … 351 408 Bool_t MHCalibrationRelTimeCam::FinalizeHists() 352 409 { 410 411 *fLog << endl; 412 413 MCalibrationCam *relcam = fIntensCam ? fIntensCam->GetCam() : fCam; 414 MBadPixelsCam *badcam = fIntensBad ? fIntensBad->GetCam() : fBadPixels; 415 353 416 for (Int_t i=0; i<fHiGainArray->GetSize(); i++) 354 417 { … … 359 422 continue; 360 423 361 MCalibrationRelTimePix &pix = fIntensCam 362 ? (MCalibrationRelTimePix&)(*fIntensCam)[i] 363 : (MCalibrationRelTimePix&)(*fCam)[i]; 424 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*relcam)[i] ; 364 425 365 426 if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries()) … … 398 459 if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries()) 399 460 { 400 MCalibrationRelTimePix &pix = fIntensCam 401 ? (MCalibrationRelTimePix&)fIntensCam->GetAverageArea(j) 402 : (MCalibrationRelTimePix&)fCam->GetAverageArea(j); 461 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)relcam->GetAverageArea(j); 403 462 pix.SetHiGainSaturation(); 404 463 histhi.SetExcluded(); … … 414 473 415 474 MHCalibrationPix &histhi = GetAverageHiGainSector(j); 416 MCalibrationRelTimePix &pix = fIntensCam 417 ? (MCalibrationRelTimePix&)fIntensCam->GetAverageSector(j) 418 : (MCalibrationRelTimePix&)fCam->GetAverageSector(j); 475 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)relcam->GetAverageSector(j) ; 419 476 420 477 if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries()) … … 428 485 } 429 486 430 FitHiGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam), 431 fIntensBad ? (*fIntensBad->GetCam()) : *fBadPixels, 487 FitHiGainArrays(*relcam,*badcam, 432 488 MBadPixelsPix::kRelTimeNotFitted, 433 489 MBadPixelsPix::kRelTimeOscillating); 434 490 435 491 if (IsLoGain()) 436 FitLoGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam), 437 fIntensBad ? (*fIntensBad->GetCam()) : *fBadPixels, 492 FitLoGainArrays(*relcam,*badcam, 438 493 MBadPixelsPix::kRelTimeNotFitted, 439 494 MBadPixelsPix::kRelTimeOscillating); … … 548 603 { 549 604 550 const Int_t nareas = fAverageHiGainAreas->Get Entries();605 const Int_t nareas = fAverageHiGainAreas->GetSize(); 551 606 if (nareas == 0) 552 607 return; -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.h
r5102 r5137 32 32 static const TString gsHistYTitle; //! Default Histogram y-axis titles 33 33 34 MArrayD fSumareahi ; // !35 MArrayD fSumarealo ; // !36 MArrayD fSumsectorhi; // !37 MArrayD fSumsectorlo; // !38 MArrayI fNumareahi ; // !39 MArrayI fNumarealo ; // !40 MArrayI fNumsectorhi; // !41 MArrayI fNumsectorlo; // !34 MArrayD fSumareahi ; // 35 MArrayD fSumarealo ; // 36 MArrayD fSumsectorhi; // 37 MArrayD fSumsectorlo; // 38 MArrayI fNumareahi ; // 39 MArrayI fNumarealo ; // 40 MArrayI fNumsectorhi; // 41 MArrayI fNumsectorlo; // 42 42 43 43 UInt_t fReferencePixel; // The reference pixel for rel. times … … 57 57 UInt_t GetReferencePixel() const { return fReferencePixel; } 58 58 59 // Clone 60 // TObject *Clone(const char *name="") const; 61 59 62 // Setters 60 63 void SetReferencePixel( const UInt_t i=fgReferencePixel) { fReferencePixel = i; } … … 70 73 71 74 #endif 72 -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationTestCam.cc
r4950 r5137 103 103 #include "MBadPixelsPix.h" 104 104 105 #include <TOrdCollection.h> 106 105 107 ClassImp(MHCalibrationTestCam); 106 108 107 109 using namespace std; 108 110 109 const Int_t MHCalibrationTestCam::fgNbins = 900;110 const Axis_t MHCalibrationTestCam::fgFirst = - 5.;111 const Axis_t MHCalibrationTestCam::fgLast = 5.;111 const Int_t MHCalibrationTestCam::fgNbins = 1000; 112 const Axis_t MHCalibrationTestCam::fgFirst = -0.5; 113 const Axis_t MHCalibrationTestCam::fgLast = 39999.5; 112 114 const TString MHCalibrationTestCam::gsHistName = "Test"; 113 115 const TString MHCalibrationTestCam::gsHistTitle = "Calibrated Calibration Signals"; … … 188 190 189 191 192 //-------------------------------------------------------------------------------------- 193 // 194 // Initializes the High Gain Arrays: 195 // 196 // - For every entry in the expanded arrays: 197 // * Initialize an MHCalibrationPix 198 // * Set Binning from fNbins, fFirst and fLast 199 // * Set Histgram names and titles from fHistName and fHistTitle 200 // * Set X-axis and Y-axis titles with fHistXTitle and fHistYTitle 201 // * Call InitHists 202 // 203 void MHCalibrationTestCam::InitHiGainArrays(const Int_t npixels, const Int_t nareas, const Int_t nsectors) 204 { 205 206 if (fHiGainArray->GetSize()==0) 207 { 208 for (Int_t i=0; i<npixels; i++) 209 { 210 fHiGainArray->AddAt(new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainPix"), 211 Form("%s%s",fHistTitle.Data()," High Gain Pixel")),i); 212 213 MHCalibrationPix &pix = (*this)[i]; 214 pix.SetNbins(fNbins); 215 pix.SetFirst(fFirst); 216 pix.SetLast (fLast); 217 218 MBadPixelsPix &bad = (*fBadPixels)[i]; 219 InitHists(pix,bad,i); 220 } 221 } 222 223 if (!IsAverageing()) 224 return; 225 226 if (fAverageHiGainAreas->GetSize()==0) 227 { 228 for (Int_t j=0; j<nareas; j++) 229 { 230 fAverageHiGainAreas->AddAt(new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainArea"), 231 Form("%s%s",fHistTitle.Data()," High Gain Area Idx ")),j); 232 233 MHCalibrationPix &pix = GetAverageHiGainArea(j); 234 235 pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas)); 236 pix.SetFirst(fFirst); 237 pix.SetLast (fLast); 238 239 pix.InitBins(); 240 pix.SetEventFrequency(fPulserFrequency); 241 } 242 } 243 244 if (fAverageHiGainSectors->GetSize()==0) 245 { 246 for (Int_t j=0; j<nsectors; j++) 247 { 248 fAverageHiGainSectors->AddAt(new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainSector"), 249 Form("%s%s",fHistTitle.Data()," High Gain Sector ")),j); 250 MHCalibrationPix &pix = GetAverageHiGainSector(j); 251 252 pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nsectors)); 253 pix.SetFirst(fFirst); 254 pix.SetLast (fLast); 255 256 pix.InitBins(); 257 pix.SetEventFrequency(fPulserFrequency); 258 } 259 } 260 } 261 190 262 // ------------------------------------------------------------------------------- 191 263 // -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationTestCam.h
r4950 r5137 35 35 Bool_t FillHists(const MParContainer *par, const Stat_t w=1); 36 36 Bool_t FinalizeHists(); 37 38 void InitHiGainArrays(const Int_t npix, const Int_t nareas, const Int_t nsectors); 37 39 38 40 public: -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationTestTimeCam.cc
r4950 r5137 102 102 #include "MBadPixelsPix.h" 103 103 104 #include <TOrdCollection.h> 105 104 106 ClassImp(MHCalibrationTestTimeCam); 105 107
Note:
See TracChangeset
for help on using the changeset viewer.