source: fact/tools/rootmacros/PulseTemplates/pixelsum.C@ 17633

Last change on this file since 17633 was 13856, checked in by Jens Buss, 13 years ago
bugfix
  • Property svn:executable set to *
File size: 10.2 KB
Line 
1#include "pixelsum.h" // class implemented
2using namespace std;
3
4/////////////////////////////// PUBLIC ///////////////////////////////////////
5
6//============================= LIFECYCLE ====================================
7
8
9PixelSum::PixelSum(
10 TString pixelname,
11 int pixelID,
12 int maxPulsorder,
13 int verbosityLevel,
14 bool stats,
15 TString options,
16 int pixelOverlayXaxisLeft,
17 int pixelOverlayXaxisRight,
18 float bSLMean,
19 float gainMean,
20 TFile* filename
21 )
22 :Pixel(
23 pixelID,
24 maxPulsorder,
25 verbosityLevel,
26 stats,
27 options,
28 pixelOverlayXaxisLeft,
29 pixelOverlayXaxisRight,
30 bSLMean,
31 gainMean,
32 NULL,
33 filename
34 )
35{
36 mName = pixelname;
37
38 mhMaxByChid = new TH2F*[mMaxPulseOrder];
39 mhMeanByChid = new TH2F*[mMaxPulseOrder];
40 mhMedianByChid = new TH2F*[mMaxPulseOrder];
41
42 mhDistAmplitude = new TH1F*[mMaxPulseOrder];
43 mhDistSlopeRiseEdge = new TH1F*[mMaxPulseOrder];
44 mhDistSlopeFallEdge = new TH1F*[mMaxPulseOrder];
45
46 BookSumHistos();
47// BookSumDistributionHistos();
48}
49
50PixelSum::~PixelSum()
51{
52 if (mVerbosityLevel > 1)
53 {
54 cout << endl << "...deleting histograms of "
55 << mName << " ID: "<< mChid ;
56 cout << endl << "...mConstructorType = " << mConstructorType << endl;
57 }
58
59 DeleteSumHistos();
60// DeleteSumDistributionHistos();
61
62 if (mVerbosityLevel > 1)
63 {
64 cout << endl << "...histograms of "
65 << mName << " ID: "<< mChid << " deleted";
66 }
67
68}// ~PixelSum
69
70
71//============================= OPERATORS ====================================
72
73//XX&
74//XX::operator=(const XX&);
75//{
76// return *this;
77
78//}// =
79
80//============================= OPERATIONS ===================================
81
82//============================= ACESS ===================================
83//============================= INQUIRY ===================================
84/////////////////////////////// PROTECTED ///////////////////////////////////
85
86/////////////////////////////// PRIVATE ///////////////////////////////////
87void
88PixelSum::BookSumHistos()
89{
90 if (mVerbosityLevel > 2) cout << endl << "...book " << mName << " histograms" << endl;
91 for (int order = 0; order < mMaxPulseOrder; order++)
92 {
93 //mhMaxByChid
94 //----------------------------------------
95 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("mhMaxByChid", order) << endl;
96 mhMaxByChid[order]=new TH2F();
97
98 MakeTH2Pretty(
99 mhMaxByChid[order],
100 "mhMaxByChid",
101 "Distribution of Templates extracted with Max",
102 order
103 );
104
105 hList->Add( mhMaxByChid[order] );
106 //----------------------------------------
107
108 //mhMeanByChid
109 //----------------------------------------
110 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("mhMeanByChid", order) << endl;
111 mhMeanByChid[order]=new TH2F();
112
113 MakeTH2Pretty(
114 mhMeanByChid[order],
115 "mhMeanByChid",
116 "Distribution of Templates extracted with Mean",
117 order
118 );
119
120 hList->Add( mhMeanByChid[order] );
121 //----------------------------------------
122
123 //mhMedianByChid
124 //----------------------------------------
125 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("mhMedianByChid", order) << endl;
126 mhMedianByChid[order]=new TH2F();
127
128 MakeTH2Pretty(
129 mhMedianByChid[order],
130 "mhMedianByChid",
131 "Distribution of Templates extracted with Median",
132 order
133 );
134
135 hList->Add( mhMedianByChid[order] );
136 //----------------------------------------
137 }
138 if (mVerbosityLevel > 2) cout << "...done" << endl;
139}
140// end of BookHistos
141//----------------------------------------------------------------------------
142
143void
144PixelSum::BookSumDistributionHistos()
145{
146 if (mVerbosityLevel > 2) cout << endl
147 << "...book pixelsum distibution histograms" << endl;
148 for (int order = 0; order < mMaxPulseOrder; order++)
149 {
150 //mhDistAmplitude
151 //----------------------------------------
152 if (mVerbosityLevel > 3) cout << "\t...booking "
153 << HistoName("mhDistAmplitude", order) << endl;
154 mhDistAmplitude[order]=new TH1F();
155
156 MakeTH1Pretty(
157 mhDistAmplitude[order],
158 "mhDistAmplitude",
159 "Distribution of Templates extracted with Max",
160 order
161 );
162
163 hList->Add( mhDistAmplitude[order] );
164 //----------------------------------------
165
166 //mhDistSlopeRiseEdge
167 //----------------------------------------
168 if (mVerbosityLevel > 3) cout << "\t...booking "
169 << HistoName("mhDistSlopeRiseEdge", order) << endl;
170 mhDistSlopeRiseEdge[order]=new TH1F();
171
172 MakeTH1Pretty(
173 mhDistSlopeRiseEdge[order],
174 "mhDistSlopeRiseEdge",
175 "Distribution of Templates extracted with Max",
176 order
177 );
178
179 hList->Add( mhDistSlopeRiseEdge[order] );
180 //----------------------------------------
181
182 //mhDistSlopeFallEdge
183 //----------------------------------------
184 if (mVerbosityLevel > 3) cout << "\t...booking "
185 << HistoName("mhDistSlopeFallEdge", order) << endl;
186 mhDistSlopeFallEdge[order]=new TH1F();
187
188 MakeTH1Pretty(
189 mhDistSlopeFallEdge[order],
190 "mhDistSlopeFallEdge",
191 "Distribution of Templates extracted with Max",
192 order
193 );
194
195 hList->Add( mhDistSlopeFallEdge[order] );
196 //----------------------------------------
197
198 }
199 if (mVerbosityLevel > 2) cout << "...done" << endl;
200}
201// end of BookDistributionHistos
202//----------------------------------------------------------------------------
203
204void
205PixelSum::DeleteSumHistos()
206{
207 if (mVerbosityLevel > 2)
208 {
209 cout << endl
210 << "\t...delete current overlay histograms of Pixel# " << mChid;
211 }
212 for (int order = 0;
213 order < mMaxPulseOrder;
214 order ++)
215 {
216 if (mVerbosityLevel > 3)
217 cout << endl << "\t\t...deleting mhMaxByChid"
218 << mChid << "_" << order;
219
220 delete mhMaxByChid[order];
221 mhMaxByChid[order] = NULL;
222
223 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting mhMeanByChid"
224 << mChid << "_" << order ;
225 delete mhMeanByChid[order];
226 mhMeanByChid[order] = NULL;
227
228 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting mhMedianByChid"
229 << mChid << "_" << order ;
230 delete mhMedianByChid[order];
231 mhMedianByChid[order] = NULL;
232 }
233 if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays";
234
235 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting mhMaxByChid";
236 delete[] mhMaxByChid;
237 mhMaxByChid = NULL;
238
239 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting mhMeanByChid";
240 delete[] mhMeanByChid;
241 mhMeanByChid = NULL;
242
243 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting mhMedianByChid";
244 delete[] mhMedianByChid;
245 mhMedianByChid = NULL;
246}
247// end of DeletePixelHistos
248//----------------------------------------------------------------------------
249
250void
251PixelSum::DeleteSumDistributionHistos()
252{
253 if (mVerbosityLevel > 2)
254 {
255 cout << endl
256 << "\t...delete current distribution histograms" ;
257 }
258
259 for (int order = 0;
260 order < mMaxPulseOrder;
261 order ++)
262 {
263 if (mOptions.Contains("S"))
264 {
265 if (mVerbosityLevel > 3) cout << endl
266 << "\t\t...deleting mhDistAmplitude"
267 << mChid << "_" << order ;
268 delete mhDistAmplitude[order];
269 }
270
271 if (mOptions.Contains("R"))
272 {
273 if (mVerbosityLevel > 3) cout << endl
274 << "\t\t...deleting mhDistSlopeRiseEdge"
275 << mChid << "_" << order ;
276 delete mhDistSlopeRiseEdge[order];
277 }
278
279 if (mOptions.Contains("M"))
280 {
281 if (mVerbosityLevel > 3) cout << endl
282 << "\t\t...deleting mhDistSlopeFallEdge"
283 << mChid << "_" << order ;
284
285 delete mhDistSlopeFallEdge[order];
286 }
287
288 }
289
290 if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays";
291
292 if (mOptions.Contains("S"))
293 {
294 if (mVerbosityLevel > 3)
295 cout << endl << "\t\t...deleting mhDistAmplitude";
296 delete[] mhDistAmplitude;
297 mhDistAmplitude = NULL;
298 }
299
300 if (mOptions.Contains("R"))
301 {
302 if (mVerbosityLevel > 3)
303 cout << endl << "\t\t...deleting mhDistSlopeRiseEdge";
304 delete[] mhDistSlopeRiseEdge;
305 mhDistSlopeRiseEdge = NULL;
306 }
307
308 if (mOptions.Contains("M"))
309 {
310 if (mVerbosityLevel > 3)
311 cout << endl << "\t\t...deleting mhDistSlopeFallEdge";
312 delete[] mhDistSlopeFallEdge;
313 mhDistSlopeFallEdge = NULL;
314 }
315}
316// end of DeletePixelHistos
317//----------------------------------------------------------------------------
318
319TString
320PixelSum::CsvFileName(
321 TString path,
322 TString overlayMethod,
323 int order
324 )
325{
326 path += "CSV/";
327 path += overlayMethod;
328 path += "OverlayTemplate";
329 path += "_";
330 path += mName;
331 path += "_";
332 path += mChid;
333 path += "_";
334 path += order;
335 path += ".csv";
336 return path;
337}
338// end of CsvFileName
339//----------------------------------------------------------------------------
340
Note: See TracBrowser for help on using the repository browser.