Changeset 4963 for trunk/MagicSoft/Mars/mhcalib
- Timestamp:
- 09/12/04 22:56:39 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mhcalib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindPix.cc
r4943 r4963 75 75 #include <TPaveText.h> 76 76 #include <TPaveStats.h> 77 #include <TGraph.h> 77 78 78 79 #include <TVector.h> … … 264 265 } 265 266 266 // -------------------------------------------------------------------------- 267 // 268 // Empty function to overload MHCalibrationChargePix::Reset() 269 // 270 void MHCalibrationChargeBlindPix::Reset() 271 { 272 } 273 274 275 // -------------------------------------------------------------------------- 276 // 277 // Use the MHGausEvents::Clone function and clone additionally the rest of the 278 // data members. 279 // 267 #if 0 268 // -------------------------------------------------------------------------- 269 // 270 // ATTENTION: This nasty Clone function is necessary since the ROOT cloning 271 // lead to crashes on SOME machines (unfortunately not mine...). 272 // This function is a workaround in order to achieve the correct 273 // DrawClone() behaviour. 274 // 280 275 TObject *MHCalibrationChargeBlindPix::Clone(const char *name) const 281 276 { 282 277 283 MHCalibrationChargeBlindPix &pix = (MHCalibrationChargeBlindPix&)*MHCalibrationPix::Clone(name); 278 MHCalibrationChargeBlindPix &pix = 279 *new MHCalibrationChargeBlindPix(name ? name : fName.Data(),fTitle.Data()); 280 284 281 // 285 // Copy data members 282 // Copy MHGausEvents data members 283 // 284 pix.fBinsAfterStripping = fBinsAfterStripping; 285 pix.fCurrentSize = fCurrentSize; 286 pix.fFlags = fFlags; 287 pix.fPowerProbabilityBins = fPowerProbabilityBins; 288 289 if (fHPowerProbability) 290 pix.fHPowerProbability=(TH1I*)fHPowerProbability->Clone(); 291 292 if (fPowerSpectrum) 293 pix.fPowerSpectrum = new TArrayF(*fPowerSpectrum); 294 295 pix.fEvents = fEvents; 296 297 if (fFGausFit) 298 pix.fFGausFit=(TF1*)fFGausFit->Clone(); 299 if (fFExpFit) 300 pix.fFExpFit=(TF1*)fFExpFit->Clone(); 301 302 pix.fFirst = fFirst; 303 304 if (fGraphEvents) 305 pix.fGraphEvents=(TGraph*)fGraphEvents->Clone(); 306 if (fGraphPowerSpectrum) 307 pix.fGraphPowerSpectrum=(TGraph*)fGraphPowerSpectrum->Clone(); 308 309 pix.fHGausHist = fHGausHist; 310 311 pix.fLast = fLast; 312 pix.fMean = fMean; 313 pix.fMeanErr = fMeanErr; 314 pix.fNbins = fNbins; 315 pix.fNDFLimit = fNDFLimit; 316 pix.fSigma = fSigma; 317 pix.fSigmaErr = fSigmaErr; 318 pix.fProb = fProb; 319 pix.fProbLimit = fProbLimit; 320 321 // 322 // Copy MHCalibrationPix data members 323 // 324 pix.fEventFrequency = fEventFrequency; 325 pix.fBlackoutLimit = fBlackoutLimit; 326 pix.fSaturated = fSaturated; 327 pix.fPickupLimit = fPickupLimit; 328 pix.fPixId = fPixId; 329 330 // 331 // Copy MHCalibrationChargeBlindPix data members 286 332 // 287 333 pix.fSinglePheCut = fSinglePheCut; 288 334 pix.fNumSinglePheLimit = fNumSinglePheLimit; 289 335 290 pix.fASinglePheFADCSlices = fASinglePheFADCSlices;291 pix.fAPedestalFADCSlices = fAPedestalFADCSlices;336 fASinglePheFADCSlices.Copy(pix.fASinglePheFADCSlices); 337 fAPedestalFADCSlices.Copy( pix.fAPedestalFADCSlices); 292 338 293 pix.fSinglePheFit = (TF1*)fSinglePheFit->Clone();339 pix.fSinglePheFit = (TF1*)fSinglePheFit->Clone(); 294 340 295 341 pix.fNumSinglePhes = fNumSinglePhes; … … 314 360 pix.fMeanPedestalErr = fMeanPedestalErr; 315 361 pix.fSigmaPedestalErr = fSigmaPedestalErr; 316 pix.fFlags = fFlags;317 362 318 363 return &pix; 319 364 } 365 #endif 320 366 321 367 /* -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindPix.h
r4943 r4963 94 94 95 95 void Clear(Option_t *o=""); 96 void Reset() ;97 98 TObject *Clone(const char *) const;96 void Reset() {} 97 98 // TObject *Clone(const char *) const; 99 99 100 100 Bool_t SetupFill(const MParList *pList); -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc
r4962 r4963 1468 1468 { 1469 1469 1470 TLine *green1 = new TLine(refline[0],0. 1,refline[0],0.9*hist->GetMaximum());1470 TLine *green1 = new TLine(refline[0],0.,refline[0],0.9*hist->GetMaximum()); 1471 1471 green1->SetBit(kCanDelete); 1472 1472 green1->SetLineColor(kGreen); … … 1475 1475 green1->Draw(); 1476 1476 1477 TLine *green5 = new TLine(refline[6],0. 1,refline[6],0.9*hist->GetMaximum());1477 TLine *green5 = new TLine(refline[6],0.,refline[6],0.9*hist->GetMaximum()); 1478 1478 green5->SetBit(kCanDelete); 1479 1479 green5->SetLineColor(8); … … 1482 1482 green5->Draw(); 1483 1483 1484 TLine *blue1 = new TLine(refline[1],0. 1,refline[1],0.9*hist->GetMaximum());1484 TLine *blue1 = new TLine(refline[1],0.,refline[1],0.9*hist->GetMaximum()); 1485 1485 blue1->SetBit(kCanDelete); 1486 1486 blue1->SetLineColor(227); … … 1489 1489 blue1->Draw(); 1490 1490 1491 TLine *blue5 = new TLine(refline[2],0. 1,refline[2],0.9*hist->GetMaximum());1491 TLine *blue5 = new TLine(refline[2],0.,refline[2],0.9*hist->GetMaximum()); 1492 1492 blue5->SetBit(kCanDelete); 1493 1493 blue5->SetLineColor(68); … … 1496 1496 blue5->Draw(); 1497 1497 1498 TLine *blue10 = new TLine(refline[3],0. 1,refline[3],0.9*hist->GetMaximum());1498 TLine *blue10 = new TLine(refline[3],0.,refline[3],0.9*hist->GetMaximum()); 1499 1499 blue10->SetBit(kCanDelete); 1500 1500 blue10->SetLineColor(4); … … 1503 1503 blue10->Draw(); 1504 1504 1505 TLine *uv10 = new TLine(refline[4],0. 1,refline[4],0.9*hist->GetMaximum());1505 TLine *uv10 = new TLine(refline[4],0.,refline[4],0.9*hist->GetMaximum()); 1506 1506 uv10->SetBit(kCanDelete); 1507 1507 uv10->SetLineColor(106); … … 1510 1510 uv10->Draw(); 1511 1511 1512 TLine *ct1 = new TLine(refline[5],0. 1,refline[5],0.9*hist->GetMaximum());1512 TLine *ct1 = new TLine(refline[5],0.,refline[5],0.9*hist->GetMaximum()); 1513 1513 ct1->SetBit(kCanDelete); 1514 1514 ct1->SetLineColor(6); -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.cc
r4949 r4963 108 108 #include "MBadPixelsPix.h" 109 109 110 #include <TPad.h> 111 #include <TVirtualPad.h> 112 #include <TCanvas.h> 113 #include <TStyle.h> 114 #include <TF1.h> 115 #include <TLine.h> 116 #include <TLatex.h> 117 #include <TLegend.h> 118 #include <TGraph.h> 119 110 120 ClassImp(MHCalibrationRelTimeCam); 111 121 … … 154 164 SetHistXTitle(gsHistXTitle.Data()); 155 165 SetHistYTitle(gsHistYTitle.Data()); 166 167 } 168 169 // -------------------------------------------------------------------------- 170 // 171 // Our own clone function is necessary since root 3.01/06 or Mars 0.4 172 // I don't know the reason. 173 // 174 // Creates new MHCalibrationRelTimeCam 175 // 176 TObject *MHCalibrationRelTimeCam::Clone(const char *name) const 177 { 178 179 const Int_t navhi = fAverageHiGainAreas->GetEntries(); 180 const Int_t navlo = fAverageLoGainAreas->GetEntries(); 181 const Int_t nsehi = fAverageHiGainSectors->GetEntries(); 182 const Int_t nselo = fAverageLoGainSectors->GetEntries(); 183 184 // 185 // FIXME, this might be done faster and more elegant, by direct copy. 186 // 187 MHCalibrationRelTimeCam *cam = new MHCalibrationRelTimeCam(); 188 189 cam->fAverageHiGainAreas->Expand(navhi); 190 cam->fAverageHiGainSectors->Expand(nsehi); 191 192 for (int i=0; i<navhi; i++) 193 (*cam->fAverageHiGainAreas) [i] = (*fAverageHiGainAreas) [i]->Clone(); 194 for (int i=0; i<nsehi; i++) 195 (*cam->fAverageHiGainSectors)[i] = (*fAverageHiGainSectors)[i]->Clone(); 196 197 if (IsLoGain()) 198 { 199 cam->fAverageLoGainAreas->Expand(navlo); 200 cam->fAverageLoGainSectors->Expand(nselo); 201 202 for (int i=0; i<navlo; i++) 203 (*cam->fAverageLoGainAreas) [i] = (*fAverageLoGainAreas) [i]->Clone(); 204 for (int i=0; i<nselo; i++) 205 (*cam->fAverageLoGainSectors)[i] = (*fAverageLoGainSectors)[i]->Clone(); 206 } 207 208 cam->fAverageAreaNum = fAverageAreaNum; 209 cam->fAverageAreaSat = fAverageAreaSat; 210 cam->fAverageAreaSigma = fAverageAreaSigma; 211 cam->fAverageAreaSigmaVar = fAverageAreaSigmaVar; 212 cam->fAverageAreaRelSigma = fAverageAreaRelSigma; 213 cam->fAverageAreaRelSigmaVar = fAverageAreaRelSigmaVar; 214 cam->fAverageSectorNum = fAverageSectorNum; 215 cam->fRunNumbers = fRunNumbers; 216 217 *fLog << err << "COLOR: " << fColor << endl; 218 219 cam->fColor = fColor; 220 cam->fPulserFrequency = fPulserFrequency; 221 cam->fFlags = fFlags; 222 223 return cam; 156 224 157 225 } … … 284 352 { 285 353 const Float_t reltime = pix.GetArrivalTimeLoGain() - reftime; 286 histhi. SetSaturated(1);354 histhi.AddSaturated(1); 287 355 histlo.FillHistAndArray(reltime); 288 356 fSumarealo [aidx] += reltime; … … 524 592 (*this)[idx].DrawClone(); 525 593 } 594 595 // ----------------------------------------------------------------------------- 596 // 597 // Default draw: 598 // 599 // Displays the averaged areas, both High Gain and Low Gain 600 // 601 // Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options 602 // 603 void MHCalibrationRelTimeCam::Draw(const Option_t *opt) 604 { 605 606 const Int_t nareas = fAverageHiGainAreas->GetEntries(); 607 if (nareas == 0) 608 return; 609 610 TString option(opt); 611 option.ToLower(); 612 613 if (!option.Contains("datacheck")) 614 { 615 MHCalibrationCam::Draw(opt); 616 return; 617 } 618 619 // 620 // From here on , the datacheck - Draw 621 // 622 TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this); 623 pad->SetBorderMode(0); 624 pad->Divide(1,nareas); 625 626 // 627 // Loop over inner and outer pixels 628 // 629 for (Int_t i=0; i<nareas;i++) 630 { 631 632 pad->cd(i+1); 633 634 MHCalibrationPix &hipix = GetAverageHiGainArea(i); 635 // 636 // Ask for Hi-Gain saturation 637 // 638 if (hipix.GetSaturated() > fNumHiGainSaturationLimit*hipix.GetHGausHist()->GetEntries() && IsLoGain()) 639 { 640 MHCalibrationPix &lopix = GetAverageLoGainArea(i); 641 DrawDataCheckPixel(lopix,0.); 642 } 643 else 644 DrawDataCheckPixel(hipix,0.); 645 } 646 } 647 648 // ----------------------------------------------------------------------------- 649 // 650 // Draw the average pixel for the datacheck: 651 // 652 // Displays the averaged areas, both High Gain and Low Gain 653 // 654 // Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options 655 // 656 void MHCalibrationRelTimeCam::DrawDataCheckPixel(MHCalibrationPix &pix, const Float_t refline) 657 { 658 659 TVirtualPad *newpad = gPad; 660 newpad->Divide(1,2); 661 newpad->cd(1); 662 663 gPad->SetTicks(); 664 if (!pix.IsEmpty() && !pix.IsOnlyOverflow() && !pix.IsOnlyUnderflow()) 665 gPad->SetLogy(); 666 667 TH1F *hist = pix.GetHGausHist(); 668 669 TH1F *null = new TH1F("Null",hist->GetTitle(),100,pix.GetFirst() < -3.0 ? -3.0 : pix.GetFirst(), 670 pix.GetLast() > 3.0 ? 3.0 : pix.GetLast()); 671 672 null->SetMaximum(1.1*hist->GetMaximum()); 673 null->SetDirectory(NULL); 674 null->SetBit(kCanDelete); 675 null->SetStats(kFALSE); 676 // 677 // set the labels bigger 678 // 679 TAxis *xaxe = null->GetXaxis(); 680 TAxis *yaxe = null->GetYaxis(); 681 xaxe->CenterTitle(); 682 yaxe->CenterTitle(); 683 xaxe->SetTitleSize(0.07); 684 yaxe->SetTitleSize(0.07); 685 xaxe->SetTitleOffset(0.7); 686 yaxe->SetTitleOffset(0.55); 687 xaxe->SetLabelSize(0.06); 688 yaxe->SetLabelSize(0.06); 689 690 xaxe->SetTitle(hist->GetXaxis()->GetTitle()); 691 yaxe->SetTitle(hist->GetYaxis()->GetTitle()); 692 693 null->Draw(); 694 hist->Draw("same"); 695 696 gStyle->SetOptFit(); 697 698 TF1 *fit = pix.GetFGausFit(); 699 700 if (fit) 701 { 702 switch ( fColor ) 703 { 704 case MCalibrationCam::kGREEN: 705 fit->SetLineColor(kGreen); 706 break; 707 case MCalibrationCam::kBLUE: 708 fit->SetLineColor(kBlue); 709 break; 710 case MCalibrationCam::kUV: 711 fit->SetLineColor(106); 712 break; 713 case MCalibrationCam::kCT1: 714 fit->SetLineColor(006); 715 break; 716 default: 717 fit->SetLineColor(kRed); 718 } 719 fit->Draw("same"); 720 } 721 722 // DisplayRefLines(null,refline); 723 724 gPad->Modified(); 725 gPad->Update(); 726 727 newpad->cd(2); 728 gPad->SetTicks(); 729 730 TH1F *null2 = new TH1F("Null2",hist->GetTitle(),100,0.,pix.GetEvents()->GetSize()/pix.GetEventFrequency()); 731 732 null2->SetMinimum(pix.GetMean()-10.*pix.GetSigma()); 733 null2->SetMaximum(pix.GetMean()+10.*pix.GetSigma()); 734 null2->SetDirectory(NULL); 735 null2->SetBit(kCanDelete); 736 null2->SetStats(kFALSE); 737 // 738 // set the labels bigger 739 // 740 TAxis *xaxe2 = null2->GetXaxis(); 741 TAxis *yaxe2 = null2->GetYaxis(); 742 xaxe2->CenterTitle(); 743 yaxe2->CenterTitle(); 744 xaxe2->SetTitleSize(0.07); 745 yaxe2->SetTitleSize(0.07); 746 xaxe2->SetTitleOffset(0.7); 747 yaxe2->SetTitleOffset(0.55); 748 xaxe2->SetLabelSize(0.06); 749 yaxe2->SetLabelSize(0.06); 750 751 pix.CreateGraphEvents(); 752 TGraph *gr = pix.GetGraphEvents(); 753 754 xaxe2->SetTitle(gr->GetXaxis()->GetTitle()); 755 yaxe2->SetTitle(gr->GetYaxis()->GetTitle()); 756 757 null2->Draw(); 758 759 pix.DrawEvents("same"); 760 761 return; 762 } 763 -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.h
r4949 r4963 14 14 #endif 15 15 16 class TH1F; 16 17 class MGeomCam; 17 18 class MHCalibrationRelTimeCam : public MHCalibrationCam … … 46 47 Bool_t FinalizeHists(); 47 48 void FinalizeBadPixels(); 49 50 void DrawDataCheckPixel(MHCalibrationPix &pix, const Float_t refline); 48 51 49 52 public: … … 51 54 MHCalibrationRelTimeCam(const char *name=NULL, const char *title=NULL); 52 55 ~MHCalibrationRelTimeCam() {} 56 57 TObject *Clone(const char *name="") const; 53 58 54 59 UInt_t GetReferencePixel() const { return fReferencePixel; } … … 59 64 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const; 60 65 void DrawPixelContent(Int_t idx) const; 61 66 67 // Draw 68 void Draw(const Option_t *opt); 69 62 70 ClassDef(MHCalibrationRelTimeCam, 1) // Histogram class for Relative Time Camera Calibration 63 71 };
Note:
See TracChangeset
for help on using the changeset viewer.