Changeset 2931 for trunk/MagicSoft/Mars/mcalib/MHCalibrationPINDiode.cc
- Timestamp:
- 01/27/04 20:32:42 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MHCalibrationPINDiode.cc
r2905 r2931 36 36 #include <TH1.h> 37 37 #include <TF1.h> 38 #include <TPaveText.h> 38 39 39 40 ClassImp(MHCalibrationPINDiode); … … 46 47 // 47 48 MHCalibrationPINDiode::MHCalibrationPINDiode(const char *name, const char *title) 48 : fVarGausFit(NULL) 49 : fChargeNbins(1000), 50 fTimeNbins(64), 51 fChargevsNbins(10000), 52 fTimeFirst(-0.25), 53 fTimeLast(31.75) 49 54 { 50 55 … … 53 58 54 59 // Create a large number of bins, later we will rebin 55 fChargeFirstHiGain = -1000.; 56 fChargeLastHiGain = gkStartPINDiodeBinNr; 57 fChargeNbinsHiGain = gkStartPINDiodeBinNr; 60 fChargeFirstHiGain = -100.5; 61 fChargeLastHiGain = 1999.5; 58 62 59 fHP Charge = new TH1I("HPCharge","Distribution of Summed FADC Slices",60 fChargeNbinsHiGain,fChargeFirstHiGain,fChargeLastHiGain);61 fHP Charge->SetXTitle("Sum FADC Slices");62 fHP Charge->SetYTitle("Nr. of events");63 fHP Charge->Sumw2();64 fHP Charge->SetDirectory(0);63 fHPINDiodeCharge = new TH1F("HPINDiodeCharge","Distribution of Summed FADC Slices PINDiode", 64 fChargeNbins,fChargeFirstHiGain,fChargeLastHiGain); 65 fHPINDiodeCharge->SetXTitle("Sum FADC Slices"); 66 fHPINDiodeCharge->SetYTitle("Nr. of events"); 67 fHPINDiodeCharge->Sumw2(); 68 fHPINDiodeCharge->SetDirectory(NULL); 65 69 66 fErrChargeFirst = 0.; 67 fErrChargeLast = gkStartPINDiodeBinNr; 68 fErrChargeNbins = gkStartPINDiodeBinNr; 70 fHPINDiodeTime = new TH1F("HPINDiodeTime","Distribution of Mean Arrival Times PINDiode", 71 fTimeNbins,fTimeFirst,fTimeLast); 72 fHPINDiodeTime->SetXTitle("Mean Arrival Times [FADC slice nr]"); 73 fHPINDiodeTime->SetYTitle("Nr. of events"); 74 fHPINDiodeTime->Sumw2(); 75 fHPINDiodeTime->SetDirectory(NULL); 69 76 70 fH ErrCharge = new TH1F("HErrCharge","Distribution of Variances of Summed FADC Slices",fErrChargeNbins,fErrChargeFirst,fErrChargeLast);71 fHErrCharge->SetXTitle("Variance Summed FADC Slices");72 fH ErrCharge->SetYTitle("Nr. of events");73 fH ErrCharge->Sumw2();74 fH ErrCharge->SetDirectory(0);77 fHPINDiodeChargevsN = new TH1I("HPINDiodeChargevsN","Sum of Hi Gain Charges vs. Event Number Pixel ", 78 fChargevsNbins,-0.5,(Axis_t)fChargevsNbins - 0.5); 79 fHPINDiodeChargevsN->SetXTitle("Event Nr."); 80 fHPINDiodeChargevsN->SetYTitle("Sum of Hi Gain FADC slices"); 81 fHPINDiodeChargevsN->SetDirectory(NULL); 75 82 76 Int_t tfirst = 0; 77 Int_t tlast = 31; 78 Int_t nbins = 32; 79 80 fHPTime = new TH1F("HPTime","Distribution of Mean Arrival Times",nbins,tfirst,tlast); 81 fHPTime->SetXTitle("Mean Arrival Times [FADC slice nr]"); 82 fHPTime->SetYTitle("Nr. of events"); 83 fHPTime->Sumw2(); 84 fHPTime->SetDirectory(0); 85 83 Clear(); 86 84 } 87 85 … … 89 87 { 90 88 91 delete fHPCharge; 92 delete fHErrCharge; 89 delete fHPINDiodeCharge; 90 delete fHPINDiodeTime; 91 delete fHPINDiodeChargevsN; 92 93 if (fChargeGausFit) 94 delete fChargeGausFit; 95 if (fTimeGausFit) 96 delete fTimeGausFit; 97 if (fFitLegend) 98 delete fFitLegend; 99 } 100 101 void MHCalibrationPINDiode::Clear(Option_t *o) 102 { 93 103 94 if (fVarGausFit) 95 delete fVarGausFit; 96 97 delete fHPTime; 104 fTotalEntries = 0; 105 106 fChargeFirstHiGain = -100.5; 107 fChargeLastHiGain = 1999.5; 108 109 fChargeChisquare = -1.; 110 fChargeProb = -1.; 111 fChargeNdf = -1; 112 fTimeChisquare = -1.; 113 fTimeProb = -1.; 114 fTimeNdf = -1; 115 fTimeMean = -1.; 116 fTimeSigma = -1.; 117 118 fTimeLowerFitRangeHiGain = 0; 119 fTimeUpperFitRangeHiGain = 0; 120 fTimeLowerFitRangeLoGain = 0; 121 fTimeUpperFitRangeLoGain = 0; 122 123 if (fChargeGausFit) 124 delete fChargeGausFit; 125 if (fTimeGausFit) 126 delete fTimeGausFit; 127 if (fFitLegend) 128 delete fFitLegend; 129 130 return; 98 131 99 132 } 100 133 101 const Double_t MHCalibrationPINDiode::GetTime() const 134 void MHCalibrationPINDiode::Reset() 102 135 { 103 return fVarGausFit->GetParameter(2); 136 137 Clear(); 138 139 fHPINDiodeCharge->Reset(); 140 fHPINDiodeTime->Reset(); 141 fHPINDiodeChargevsN->Reset(); 104 142 } 105 143 106 const Double_t MHCalibrationPINDiode::GetErrTime() const 144 145 Bool_t MHCalibrationPINDiode::FillCharge(Float_t q) 107 146 { 108 return fVarGausFit->GetParameter(3);147 return (fHPINDiodeCharge->Fill(q) > -1); 109 148 } 149 150 Bool_t MHCalibrationPINDiode::FillTime(Float_t t) 151 { 152 return (fHPINDiodeTime->Fill(t) > -1); 153 } 154 155 Bool_t MHCalibrationPINDiode::FillChargevsN(Float_t q, Int_t n) 156 { 157 return (fHPINDiodeChargevsN->Fill(n,q) > -1); 158 } 159 160 void MHCalibrationPINDiode::CutAllEdges() 161 { 162 163 Int_t nbins = 30; 164 165 CutEdges(fHPINDiodeCharge,nbins); 166 167 fChargeFirstHiGain = fHPINDiodeCharge->GetBinLowEdge(fHPINDiodeCharge->GetXaxis()->GetFirst()); 168 fChargeLastHiGain = fHPINDiodeCharge->GetBinLowEdge(fHPINDiodeCharge->GetXaxis()->GetLast()) 169 +fHPINDiodeCharge->GetBinWidth(0); 170 CutEdges(fHPINDiodeChargevsN,0); 171 172 } 173
Note:
See TracChangeset
for help on using the changeset viewer.