Changeset 2932 for trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.cc
- Timestamp:
- 01/27/04 20:39:14 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.cc
r2922 r2932 56 56 MHCalibrationPixel::MHCalibrationPixel(const char *name, const char *title) 57 57 : fPixId(-1), 58 fTotalEntries(0),59 f HChargeHiGain(NULL),60 f HTimeHiGain(NULL),61 f HChargevsNHiGain(NULL),62 f HChargeLoGain(NULL),63 f HTimeLoGain(NULL),64 fHChargevsNLoGain(NULL),65 fChargeGausFit(NULL), 58 fChargeNbinsHiGain(2100), 59 fChargeNbinsLoGain(1010), 60 fTimeNbins(32), 61 fChargevsNbins(1000), 62 fTimeFirst(-0.25), 63 fTimeLast(15.75), 64 fHivsLoGain(NULL), 65 fChargeGausFit(NULL), 66 66 fTimeGausFit(NULL), 67 fHivsLoGain(NULL), 68 fFitLegend(NULL), 69 fChargeFirstHiGain(-100.5), 70 fChargeLastHiGain(1999.5), 71 fChargeNbinsHiGain(2100), 72 fChargeFirstLoGain(-100.5), 73 fChargeLastLoGain(9999.5), 74 fChargeNbinsLoGain(1010), 75 fChargeChisquare(-1.), 76 fChargeProb(-1.), 77 fChargeNdf(-1), 78 fTimeChisquare(-1.), 79 fTimeProb(-1.), 80 fTimeNdf(-1), 81 fTimeMean(-1.), 82 fTimeSigma(-1.), 83 fTimeLowerFitRangeHiGain(0), 84 fTimeUpperFitRangeHiGain(0), 85 fTimeLowerFitRangeLoGain(0), 86 fTimeUpperFitRangeLoGain(0), 87 fOffset(0.), 88 fSlope(0.) 67 fFitLegend(NULL) 89 68 { 90 69 91 70 fName = name ? name : "MHCalibrationPixel"; 92 71 fTitle = title ? title : "Fill the accumulated charges and times of all events and perform fits"; 72 73 fChargeFirstHiGain = -100.5; 74 fChargeLastHiGain = 1999.5; 75 fChargeFirstLoGain = -100.5; 76 fChargeLastLoGain = 9999.5; 93 77 94 78 // Create a large number of bins, later we will rebin 95 79 fHChargeHiGain = new TH1F("HChargeHiGain","Distribution of Summed FADC Hi Gain Slices Pixel ", 96 80 fChargeNbinsHiGain,fChargeFirstHiGain,fChargeLastHiGain); 97 fHChargeHiGain->SetXTitle("Sum FADC Slices (Hi Gain)");98 fHChargeHiGain->SetYTitle("Nr. of events");99 fHChargeHiGain->Sumw2();100 101 fHChargeHiGain->SetDirectory(NULL);102 103 81 fHChargeLoGain = new TH1F("HChargeLoGain","Distribution of Summed FADC Lo Gain Slices Pixel ", 104 82 fChargeNbinsLoGain,fChargeFirstLoGain,fChargeLastLoGain); 83 105 84 fHChargeLoGain->SetXTitle("Sum FADC Slices (Lo Gain)"); 85 fHChargeHiGain->SetXTitle("Sum FADC Slices (Hi Gain)"); 86 106 87 fHChargeLoGain->SetYTitle("Nr. of events"); 88 fHChargeHiGain->SetYTitle("Nr. of events"); 89 90 fHChargeHiGain->Sumw2(); 107 91 fHChargeLoGain->Sumw2(); 108 92 93 fHTimeHiGain = new TH1F("HTimeHiGain","Distribution of Mean Arrival Hi Gain Times Pixel ", 94 fTimeNbins,fTimeFirst,fTimeLast); 95 fHTimeLoGain = new TH1F("HTimeLoGain","Distribution of Mean Arrival Lo Gain Times Pixel ", 96 fTimeNbins,fTimeFirst,fTimeLast); 97 98 fHTimeHiGain->SetXTitle("Mean Arrival Times [Hi Gain FADC slice nr]"); 99 fHTimeLoGain->SetXTitle("Mean Arrival Times [Lo Gain FADC slice nr]"); 100 101 fHTimeHiGain->SetYTitle("Nr. of events"); 102 fHTimeLoGain->SetYTitle("Nr. of events"); 103 104 // We define a reasonable number and later enlarge it if necessary 105 fHChargevsNHiGain = new TH1I("HChargevsNHiGain","Sum of Hi Gain Charges vs. Event Number Pixel ", 106 fChargevsNbins,-0.5,(Axis_t)fChargevsNbins - 0.5); 107 fHChargevsNLoGain = new TH1I("HChargevsNLoGain","Sum of Lo Gain Charges vs. Event Number Pixel ", 108 fChargevsNbins,-0.5,(Axis_t)fChargevsNbins - 0.5); 109 110 fHChargevsNHiGain->SetXTitle("Event Nr."); 111 fHChargevsNLoGain->SetXTitle("Event Nr."); 112 113 fHChargevsNHiGain->SetYTitle("Sum of Hi Gain FADC slices"); 114 fHChargevsNLoGain->SetYTitle("Sum of Lo Gain FADC slices"); 115 116 fHChargeHiGain->SetDirectory(NULL); 109 117 fHChargeLoGain->SetDirectory(NULL); 110 111 Axis_t tfirst = -0.5;112 Axis_t tlast = 15.5;113 Int_t ntbins = 32;114 115 fHTimeHiGain = new TH1F("HTimeHiGain","Distribution of Mean Arrival Hi Gain Times Pixel ",116 ntbins,tfirst,tlast);117 fHTimeHiGain->SetXTitle("Mean Arrival Times [Hi Gain FADC slice nr]");118 fHTimeHiGain->SetYTitle("Nr. of events");119 118 fHTimeHiGain->SetDirectory(NULL); 120 121 fHTimeLoGain = new TH1F("HTimeLoGain","Distribution of Mean Arrival Lo Gain Times Pixel ",122 ntbins,tfirst,tlast);123 fHTimeLoGain->SetXTitle("Mean Arrival Times [Lo Gain FADC slice nr]");124 fHTimeLoGain->SetYTitle("Nr. of events");125 119 fHTimeLoGain->SetDirectory(NULL); 126 127 // We define a reasonable number and later enlarge it if necessary128 Int_t nqbins = 20000;129 Axis_t nfirst = -0.5;130 Axis_t nlast = (Axis_t)nqbins - 0.5;131 132 fHChargevsNHiGain = new TH1I("HChargevsNHiGain","Sum of Hi Gain Charges vs. Event Number Pixel ",133 nqbins,nfirst,nlast);134 fHChargevsNHiGain->SetXTitle("Event Nr.");135 fHChargevsNHiGain->SetYTitle("Sum of Hi Gain FADC slices");136 137 120 fHChargevsNHiGain->SetDirectory(NULL); 138 139 fHChargevsNLoGain = new TH1I("HChargevsNLoGain","Sum of Lo Gain Charges vs. Event Number Pixel ",140 nqbins,nfirst,nlast);141 fHChargevsNLoGain->SetXTitle("Event Nr.");142 fHChargevsNLoGain->SetYTitle("Sum of Lo Gain FADC slices");143 144 121 fHChargevsNLoGain->SetDirectory(NULL); 145 122 146 123 fHiGains = new TArrayF(); 147 124 fLoGains = new TArrayF(); 125 126 Clear(); 148 127 149 128 } … … 171 150 if (fHivsLoGain) 172 151 delete fHivsLoGain; 173 174 } 152 } 153 154 155 void MHCalibrationPixel::Clear(Option_t *o) 156 { 157 158 fTotalEntries = 0; 159 160 fChargeFirstHiGain = -100.5; 161 fChargeLastHiGain = 1999.5; 162 fChargeFirstLoGain = -100.5; 163 fChargeLastLoGain = 9999.5; 164 165 fChargeChisquare = -1.; 166 fChargeProb = -1.; 167 fChargeNdf = -1; 168 fTimeChisquare = -1.; 169 fTimeProb = -1.; 170 fTimeNdf = -1; 171 fTimeMean = -1.; 172 fTimeSigma = -1.; 173 174 fTimeLowerFitRangeHiGain = 0; 175 fTimeUpperFitRangeHiGain = 0; 176 fTimeLowerFitRangeLoGain = 0; 177 fTimeUpperFitRangeLoGain = 0; 178 179 fOffset = 0.; 180 fSlope = 0; 181 182 if (fChargeGausFit) 183 delete fChargeGausFit; 184 if (fTimeGausFit) 185 delete fTimeGausFit; 186 if (fFitLegend) 187 delete fFitLegend; 188 if (fHivsLoGain) 189 delete fHivsLoGain; 190 if (fHPSD) 191 delete fHPSD; 192 193 return; 194 } 195 196 197 void MHCalibrationPixel::Reset() 198 { 199 200 Clear(); 201 202 fHChargeHiGain->Reset(); 203 fHChargeLoGain->Reset(); 204 fHTimeHiGain->Reset(); 205 fHTimeLoGain->Reset(); 206 fHChargevsNHiGain->Reset(); 207 fHChargevsNLoGain->Reset(); 208 209 fHChargeHiGain->SetName("HChargeHiGain"); 210 fHChargeLoGain->SetName("HChargeLoGain"); 211 fHTimeHiGain->SetName("HTimeHiGain"); 212 fHTimeLoGain->SetName("HTimeLoGain"); 213 fHChargevsNHiGain->SetName("HChargevsNHiGain"); 214 fHChargevsNLoGain->SetName("HChargevsNLoGain"); 215 216 fHiGains->Reset(); 217 fLoGains->Reset(); 218 219 } 220 221 175 222 176 223 Bool_t MHCalibrationPixel::IsEmpty() const … … 295 342 296 343 return kTRUE; 297 }298 299 300 void MHCalibrationPixel::Reset()301 {302 303 for (Int_t i = fHChargeHiGain->FindBin(fChargeFirstHiGain);304 i <= fHChargeHiGain->FindBin(fChargeLastHiGain); i++)305 fHChargeHiGain->SetBinContent(i, 1.e-20);306 307 for (Int_t i = 0; i < 16; i++)308 fHTimeHiGain->SetBinContent(i, 1.e-20);309 310 fChargeFirstHiGain = -100.5;311 fChargeLastHiGain = 1999.5;312 313 fHChargeHiGain->GetXaxis()->UnZoom();314 315 for (Int_t i = fHChargeLoGain->FindBin(fChargeFirstLoGain);316 i <= fHChargeLoGain->FindBin(fChargeLastLoGain); i++)317 fHChargeLoGain->SetBinContent(i, 1.e-20);318 319 for (Int_t i = 0; i < 16; i++)320 fHTimeLoGain->SetBinContent(i, 1.e-20);321 322 fChargeFirstLoGain = -100.5;323 fChargeLastLoGain = 9999.5;324 325 fHChargeLoGain->GetXaxis()->UnZoom();326 327 return;328 344 } 329 345 … … 866 882 fChargeLastHiGain = fHChargeHiGain->GetBinLowEdge(fHChargeHiGain->GetXaxis()->GetLast()) 867 883 +fHChargeHiGain->GetBinWidth(0); 868 fChargeNbinsHiGain = nbins;869 884 870 885 CutEdges(fHChargeLoGain,nbins); … … 873 888 fChargeLastLoGain = fHChargeLoGain->GetBinLowEdge(fHChargeLoGain->GetXaxis()->GetLast()) 874 889 +fHChargeLoGain->GetBinWidth(0); 875 fChargeNbinsLoGain = nbins;876 890 877 891 CutEdges(fHChargevsNHiGain,0);
Note:
See TracChangeset
for help on using the changeset viewer.