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

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