]>
Commit | Line | Data |
---|---|---|
2dbde04b | 1 | /** |
2 | * @file QAStructs.h | |
3 | * @author Christian Holm Christensen <cholm@nbi.dk> | |
4 | * @date Thu Nov 17 12:20:49 2011 | |
5 | * | |
6 | * @brief Data structures used in QA trending tree | |
7 | * | |
bd6f5206 | 8 | * @ingroup pwglf_forward_qa_scripts |
2dbde04b | 9 | */ |
10 | #ifndef QASTRUCTS_H | |
11 | #define QASTRUCTS_H | |
12 | #ifndef __CINT__ | |
13 | # include <TTree.h> | |
14 | # include <TString.h> | |
15 | #else | |
16 | class TTree; | |
17 | #endif | |
18 | ||
19 | // --- A quantity ---------------------------------------------------- | |
20 | /** | |
21 | * A simple quantity with mean, variance, min, and max | |
22 | * | |
bd6f5206 | 23 | * @ingroup pwglf_forward_qa_scripts |
2dbde04b | 24 | */ |
25 | struct Quantity | |
26 | { | |
27 | Double_t mean; // Mean | |
28 | Double_t var; // Variance | |
29 | Double_t min; // Minimum | |
30 | Double_t max; // Maximum | |
31 | /** | |
32 | * Make a branch to contain an object of this type | |
33 | * | |
34 | * @param tree Tree to store in | |
35 | * @param name Name of branch | |
36 | * | |
37 | * @return Newly allocated object of this type associated with the | |
38 | * branch | |
39 | */ | |
40 | static Quantity* MakeBranch(TTree* tree, const char* name) | |
41 | { | |
42 | Quantity* q = new Quantity; | |
43 | if (tree) tree->Branch(name, q, "mean/D:var:min:max"); | |
44 | return q; | |
45 | } | |
46 | /** | |
47 | * Associate a branch with an object of this type | |
48 | * | |
49 | * @param tree Tree to read from | |
50 | * @param name Name of branch | |
51 | * | |
52 | * @return Newly allocated object of this type associated with the | |
53 | * branch | |
54 | */ | |
55 | static Quantity* SetBranch(TTree* tree, const char* name) | |
56 | { | |
57 | Quantity* q = new Quantity; | |
58 | if (tree) tree->SetBranchAddress(name, q); | |
59 | return q; | |
60 | } | |
61 | }; | |
62 | ||
63 | // --- A quantity ---------------------------------------------------- | |
64 | /** | |
65 | * A per-ring quantity with mean, variance, min, and max | |
66 | * | |
bd6f5206 | 67 | * @ingroup pwglf_forward_qa_scripts |
2dbde04b | 68 | */ |
69 | struct RingQuantity : public Quantity | |
70 | { | |
71 | UShort_t det; | |
72 | Char_t ring; | |
73 | ||
74 | /** | |
75 | * Return the branch name to use | |
76 | * | |
77 | * @param d Detector | |
78 | * @param r Ring | |
60db3344 | 79 | * @param name Name |
2dbde04b | 80 | * |
81 | * @return Name of branch to use | |
82 | */ | |
83 | static const char* BranchName(UShort_t d, Char_t r, const char* name) | |
84 | { | |
85 | return Form("FMD%d%c_%s", d, r, name); | |
86 | } | |
87 | /** | |
88 | * Make a branch to contain an object of this type | |
89 | * | |
90 | * @param tree Tree to store in | |
60db3344 | 91 | * @param d Detector |
92 | * @param r Ring | |
2dbde04b | 93 | * @param name Name of branch |
94 | * | |
95 | * @return Newly allocated object of this type associated with the | |
96 | * branch | |
97 | */ | |
98 | static RingQuantity* MakeBranch(TTree* tree, UShort_t d, Char_t r, | |
99 | const char* name) | |
100 | { | |
101 | RingQuantity* q = new RingQuantity; | |
102 | if (tree) | |
103 | tree->Branch(BranchName(d, r, name), q, "mean/D:var:min:max:d/s:r/b"); | |
104 | q->det = d; | |
105 | q->ring = r; | |
106 | return q; | |
107 | } | |
108 | /** | |
109 | * Associate a branch with an object of this type | |
110 | * | |
111 | * @param tree Tree to read from | |
60db3344 | 112 | * @param d Detector |
113 | * @param r Ring | |
2dbde04b | 114 | * @param name Name of branch |
115 | * | |
116 | * @return Newly allocated object of this type associated with the | |
117 | * branch | |
118 | */ | |
119 | static RingQuantity* SetBranch(TTree* tree, UShort_t d, Char_t r, | |
120 | const char* name) | |
121 | { | |
122 | RingQuantity* q = new RingQuantity; | |
123 | if (tree) tree->SetBranchAddress(BranchName(d, r, name), q); | |
124 | return q; | |
125 | } | |
126 | }; | |
127 | ||
128 | // --- A quantity ---------------------------------------------------- | |
129 | /** | |
130 | * Per run information | |
131 | * | |
bd6f5206 | 132 | * @ingroup pwglf_forward_qa_scripts |
2dbde04b | 133 | */ |
134 | struct Global | |
135 | { | |
136 | UInt_t runNo; | |
137 | UInt_t nAccepted; | |
138 | Double_t meanVz; | |
139 | Double_t sigmaVz; | |
140 | /** | |
141 | * Make a branch to contain an object of this type | |
142 | * | |
143 | * @param tree Tree to store in | |
2dbde04b | 144 | * |
145 | * @return Newly allocated object of this type associated with the | |
146 | * branch | |
147 | */ | |
148 | static Global* MakeBranch(TTree* tree) | |
149 | { | |
150 | Global* g = new Global; | |
151 | if (tree) tree->Branch("global", g, "run/i:accepted:meanVz/D:sigmaVz"); | |
152 | return g; | |
153 | } | |
154 | /** | |
155 | * Associate a branch with an object of this type | |
156 | * | |
157 | * @param tree Tree to read from | |
2dbde04b | 158 | * |
159 | * @return Newly allocated object of this type associated with the | |
160 | * branch | |
161 | */ | |
162 | static Global* SetBranch(TTree* tree) | |
163 | { | |
164 | Global* g = new Global; | |
165 | if (tree) tree->SetBranchAddress("global", g); | |
166 | return g; | |
167 | } | |
168 | }; | |
169 | ||
170 | // --- A quantity ---------------------------------------------------- | |
171 | /** | |
172 | * Per-ring status information on ELoss fits | |
173 | * | |
bd6f5206 | 174 | * @ingroup pwglf_forward_qa_scripts |
2dbde04b | 175 | */ |
176 | struct FitStatus | |
177 | { | |
178 | UShort_t nLow; | |
179 | UShort_t nCandidates; | |
180 | UShort_t nFitted; | |
181 | UShort_t det; | |
182 | Char_t ring; | |
183 | ||
184 | /** | |
185 | * Return the branch name to use | |
186 | * | |
187 | * @param d Detector | |
188 | * @param r Ring | |
189 | * | |
190 | * @return Name of branch to use | |
191 | */ | |
192 | static const char* BranchName(UShort_t d, Char_t r) | |
193 | { | |
194 | return Form("FMD%d%c_fitstatus", d, r); | |
195 | } | |
196 | /** | |
197 | * Make a branch to contain an object of this type | |
198 | * | |
199 | * @param tree Tree to store in | |
60db3344 | 200 | * @param d Detector |
201 | * @param r Ring | |
2dbde04b | 202 | * |
203 | * @return Newly allocated object of this type associated with the | |
204 | * branch | |
205 | */ | |
206 | static FitStatus* MakeBranch(TTree* tree, UShort_t d, Char_t r) | |
207 | { | |
208 | FitStatus* s = new FitStatus; | |
209 | if (tree) | |
210 | tree->Branch(BranchName(d, r), s, "low/s:candidates:fitted:d:r/b"); | |
211 | s->det = d; | |
212 | s->ring = r; | |
213 | return s; | |
214 | } | |
215 | /** | |
216 | * Associate a branch with an object of this type | |
217 | * | |
218 | * @param tree Tree to read from | |
60db3344 | 219 | * @param d Detector |
220 | * @param r Ring | |
2dbde04b | 221 | * |
222 | * @return Newly allocated object of this type associated with the | |
223 | * branch | |
224 | */ | |
225 | static FitStatus* SetBranch(TTree* tree, UShort_t d, Char_t r) | |
226 | { | |
227 | FitStatus* s = new FitStatus; | |
228 | if (tree) tree->SetBranchAddress(BranchName(d, r), s); | |
229 | return s; | |
230 | } | |
231 | }; | |
232 | ||
233 | ||
234 | // --- A quantity ---------------------------------------------------- | |
235 | /** | |
236 | * Per-ring status information on merging (sharing filter) | |
237 | * | |
bd6f5206 | 238 | * @ingroup pwglf_forward_qa_scripts |
2dbde04b | 239 | */ |
240 | struct Merge | |
241 | { | |
242 | Double_t one; | |
243 | Double_t two; | |
244 | Double_t three; | |
245 | UShort_t det; | |
246 | Char_t ring; | |
247 | ||
248 | /** | |
249 | * Return the branch name to use | |
250 | * | |
251 | * @param d Detector | |
252 | * @param r Ring | |
253 | * | |
254 | * @return Name of branch to use | |
255 | */ | |
256 | static const char* BranchName(UShort_t d, Char_t r) | |
257 | { | |
258 | return Form("FMD%d%c_merge", d, r); | |
259 | } | |
260 | /** | |
261 | * Make a branch to contain an object of this type | |
262 | * | |
263 | * @param tree Tree to store in | |
60db3344 | 264 | * @param d Detector |
265 | * @param r Ring | |
2dbde04b | 266 | * |
267 | * @return Newly allocated object of this type associated with the | |
268 | * branch | |
269 | */ | |
270 | static Merge* MakeBranch(TTree* tree, UShort_t d, Char_t r) | |
271 | { | |
272 | Merge* s = new Merge; | |
273 | if (tree) tree->Branch(BranchName(d, r), s, "one/D:two:three:d:r/b"); | |
274 | s->det = d; | |
275 | s->ring = r; | |
276 | return s; | |
277 | } | |
278 | /** | |
279 | * Associate a branch with an object of this type | |
280 | * | |
281 | * @param tree Tree to read from | |
60db3344 | 282 | * @param d Detector |
283 | * @param r Ring | |
2dbde04b | 284 | * |
285 | * @return Newly allocated object of this type associated with the | |
286 | * branch | |
287 | */ | |
288 | static Merge* SetBranch(TTree* tree, UShort_t d, Char_t r) | |
289 | { | |
290 | Merge* s = new Merge; | |
291 | if (tree) tree->SetBranchAddress(BranchName(d, r), s); | |
292 | return s; | |
293 | } | |
294 | }; | |
295 | ||
296 | // --- Cuts ---------------------------------------------------------- | |
297 | /** | |
298 | * Per-ring status information on hit 'loss' | |
299 | * | |
bd6f5206 | 300 | * @ingroup pwglf_forward_qa_scripts |
2dbde04b | 301 | */ |
302 | struct DataLoss | |
303 | { | |
304 | Double_t merge; | |
305 | Double_t density; | |
306 | Double_t full; | |
307 | UShort_t det; | |
308 | Char_t ring; | |
309 | ||
310 | /** | |
311 | * Return the branch name to use | |
312 | * | |
313 | * @param d Detector | |
314 | * @param r Ring | |
315 | * | |
316 | * @return Name of branch to use | |
317 | */ | |
318 | static const char* BranchName(UShort_t d, Char_t r) | |
319 | { | |
320 | return Form("FMD%d%c_dataloss", d, r); | |
321 | } | |
322 | /** | |
323 | * Make a branch to contain an object of this type | |
324 | * | |
325 | * @param tree Tree to store in | |
60db3344 | 326 | * @param d Detector |
327 | * @param r Ring | |
2dbde04b | 328 | * |
329 | * @return Newly allocated object of this type associated with the | |
330 | * branch | |
331 | */ | |
332 | static DataLoss* MakeBranch(TTree* tree, UShort_t d, Char_t r) | |
333 | { | |
334 | DataLoss* s = new DataLoss; | |
335 | if (tree) tree->Branch(BranchName(d, r), s, "merge/D:density:full:d:r/b"); | |
336 | s->det = d; | |
337 | s->ring = r; | |
338 | return s; | |
339 | } | |
340 | /** | |
341 | * Associate a branch with an object of this type | |
342 | * | |
343 | * @param tree Tree to read from | |
60db3344 | 344 | * @param d Detector |
345 | * @param r Ring | |
2dbde04b | 346 | * |
347 | * @return Newly allocated object of this type associated with the | |
348 | * branch | |
349 | */ | |
350 | static DataLoss* SetBranch(TTree* tree, UShort_t d, Char_t r) | |
351 | { | |
352 | DataLoss* s = new DataLoss; | |
353 | if (tree) tree->SetBranchAddress(BranchName(d, r), s); | |
354 | return s; | |
355 | } | |
356 | }; | |
357 | ||
358 | // --- A quantity ---------------------------------------------------- | |
359 | /** | |
360 | * Per-ring status information on Poisson vs ELoss correlation | |
361 | * | |
bd6f5206 | 362 | * @ingroup pwglf_forward_qa_scripts |
2dbde04b | 363 | */ |
364 | struct Correlation | |
365 | { | |
366 | Double_t alpha; | |
367 | Double_t beta; | |
368 | Double_t a; | |
369 | Double_t ea; | |
370 | Double_t b; | |
371 | Double_t eb; | |
372 | Double_t chi2; | |
373 | UShort_t det; | |
374 | Char_t ring; | |
375 | /** | |
376 | * Return the branch name to use | |
377 | * | |
378 | * @param d Detector | |
379 | * @param r Ring | |
380 | * | |
381 | * @return Name of branch to use | |
382 | */ | |
383 | static const char* BranchName(UShort_t d, Char_t r) | |
384 | { | |
385 | return Form("FMD%d%c_correlation", d, r); | |
386 | } | |
387 | /** | |
388 | * Make a branch to contain an object of this type | |
389 | * | |
390 | * @param tree Tree to store in | |
60db3344 | 391 | * @param d Detector number |
392 | * @param r Detector ring | |
2dbde04b | 393 | * |
394 | * @return Newly allocated object of this type associated with the | |
395 | * branch | |
396 | */ | |
397 | static Correlation* MakeBranch(TTree* tree, UShort_t d, Char_t r) | |
398 | { | |
399 | Correlation* s = new Correlation; | |
400 | if (tree) tree->Branch(BranchName(d, r), s, | |
401 | "alpha/D:beta:a:ea:b:eb:chi2:d/s:r/b"); | |
402 | s->det = d; | |
403 | s->ring = r; | |
404 | return s; | |
405 | } | |
406 | /** | |
407 | * Associate a branch with an object of this type | |
408 | * | |
409 | * @param tree Tree to read from | |
60db3344 | 410 | * @param d Detector number |
411 | * @param r Detector ring | |
2dbde04b | 412 | * |
413 | * @return Newly allocated object of this type associated with the | |
414 | * branch | |
415 | */ | |
416 | static Correlation* SetBranch(TTree* tree, UShort_t d, Char_t r) | |
417 | { | |
418 | Correlation* s = new Correlation; | |
419 | if (tree) tree->SetBranchAddress(BranchName(d, r), s); | |
420 | return s; | |
421 | } | |
422 | }; | |
423 | #endif // QASTRUCTS_H | |
424 | // Local Variables: | |
425 | // mode: C++ | |
426 | // End: |