]>
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 | * | |
8 | * @ingroup pwg2_forward_qa_scripts | |
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 | * | |
23 | * @ingroup pwg2_forward_qa_scripts | |
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 | * | |
67 | * @ingroup pwg2_forward_qa_scripts | |
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 | |
79 | * | |
80 | * @return Name of branch to use | |
81 | */ | |
82 | static const char* BranchName(UShort_t d, Char_t r, const char* name) | |
83 | { | |
84 | return Form("FMD%d%c_%s", d, r, name); | |
85 | } | |
86 | /** | |
87 | * Make a branch to contain an object of this type | |
88 | * | |
89 | * @param tree Tree to store in | |
90 | * @param name Name of branch | |
91 | * | |
92 | * @return Newly allocated object of this type associated with the | |
93 | * branch | |
94 | */ | |
95 | static RingQuantity* MakeBranch(TTree* tree, UShort_t d, Char_t r, | |
96 | const char* name) | |
97 | { | |
98 | RingQuantity* q = new RingQuantity; | |
99 | if (tree) | |
100 | tree->Branch(BranchName(d, r, name), q, "mean/D:var:min:max:d/s:r/b"); | |
101 | q->det = d; | |
102 | q->ring = r; | |
103 | return q; | |
104 | } | |
105 | /** | |
106 | * Associate a branch with an object of this type | |
107 | * | |
108 | * @param tree Tree to read from | |
109 | * @param name Name of branch | |
110 | * | |
111 | * @return Newly allocated object of this type associated with the | |
112 | * branch | |
113 | */ | |
114 | static RingQuantity* SetBranch(TTree* tree, UShort_t d, Char_t r, | |
115 | const char* name) | |
116 | { | |
117 | RingQuantity* q = new RingQuantity; | |
118 | if (tree) tree->SetBranchAddress(BranchName(d, r, name), q); | |
119 | return q; | |
120 | } | |
121 | }; | |
122 | ||
123 | // --- A quantity ---------------------------------------------------- | |
124 | /** | |
125 | * Per run information | |
126 | * | |
127 | * @ingroup pwg2_forward_qa_scripts | |
128 | */ | |
129 | struct Global | |
130 | { | |
131 | UInt_t runNo; | |
132 | UInt_t nAccepted; | |
133 | Double_t meanVz; | |
134 | Double_t sigmaVz; | |
135 | /** | |
136 | * Make a branch to contain an object of this type | |
137 | * | |
138 | * @param tree Tree to store in | |
139 | * @param name Name of branch | |
140 | * | |
141 | * @return Newly allocated object of this type associated with the | |
142 | * branch | |
143 | */ | |
144 | static Global* MakeBranch(TTree* tree) | |
145 | { | |
146 | Global* g = new Global; | |
147 | if (tree) tree->Branch("global", g, "run/i:accepted:meanVz/D:sigmaVz"); | |
148 | return g; | |
149 | } | |
150 | /** | |
151 | * Associate a branch with an object of this type | |
152 | * | |
153 | * @param tree Tree to read from | |
154 | * @param name Name of branch | |
155 | * | |
156 | * @return Newly allocated object of this type associated with the | |
157 | * branch | |
158 | */ | |
159 | static Global* SetBranch(TTree* tree) | |
160 | { | |
161 | Global* g = new Global; | |
162 | if (tree) tree->SetBranchAddress("global", g); | |
163 | return g; | |
164 | } | |
165 | }; | |
166 | ||
167 | // --- A quantity ---------------------------------------------------- | |
168 | /** | |
169 | * Per-ring status information on ELoss fits | |
170 | * | |
171 | * @ingroup pwg2_forward_qa_scripts | |
172 | */ | |
173 | struct FitStatus | |
174 | { | |
175 | UShort_t nLow; | |
176 | UShort_t nCandidates; | |
177 | UShort_t nFitted; | |
178 | UShort_t det; | |
179 | Char_t ring; | |
180 | ||
181 | /** | |
182 | * Return the branch name to use | |
183 | * | |
184 | * @param d Detector | |
185 | * @param r Ring | |
186 | * | |
187 | * @return Name of branch to use | |
188 | */ | |
189 | static const char* BranchName(UShort_t d, Char_t r) | |
190 | { | |
191 | return Form("FMD%d%c_fitstatus", d, r); | |
192 | } | |
193 | /** | |
194 | * Make a branch to contain an object of this type | |
195 | * | |
196 | * @param tree Tree to store in | |
197 | * @param name Name of branch | |
198 | * | |
199 | * @return Newly allocated object of this type associated with the | |
200 | * branch | |
201 | */ | |
202 | static FitStatus* MakeBranch(TTree* tree, UShort_t d, Char_t r) | |
203 | { | |
204 | FitStatus* s = new FitStatus; | |
205 | if (tree) | |
206 | tree->Branch(BranchName(d, r), s, "low/s:candidates:fitted:d:r/b"); | |
207 | s->det = d; | |
208 | s->ring = r; | |
209 | return s; | |
210 | } | |
211 | /** | |
212 | * Associate a branch with an object of this type | |
213 | * | |
214 | * @param tree Tree to read from | |
215 | * @param name Name of branch | |
216 | * | |
217 | * @return Newly allocated object of this type associated with the | |
218 | * branch | |
219 | */ | |
220 | static FitStatus* SetBranch(TTree* tree, UShort_t d, Char_t r) | |
221 | { | |
222 | FitStatus* s = new FitStatus; | |
223 | if (tree) tree->SetBranchAddress(BranchName(d, r), s); | |
224 | return s; | |
225 | } | |
226 | }; | |
227 | ||
228 | ||
229 | // --- A quantity ---------------------------------------------------- | |
230 | /** | |
231 | * Per-ring status information on merging (sharing filter) | |
232 | * | |
233 | * @ingroup pwg2_forward_qa_scripts | |
234 | */ | |
235 | struct Merge | |
236 | { | |
237 | Double_t one; | |
238 | Double_t two; | |
239 | Double_t three; | |
240 | UShort_t det; | |
241 | Char_t ring; | |
242 | ||
243 | /** | |
244 | * Return the branch name to use | |
245 | * | |
246 | * @param d Detector | |
247 | * @param r Ring | |
248 | * | |
249 | * @return Name of branch to use | |
250 | */ | |
251 | static const char* BranchName(UShort_t d, Char_t r) | |
252 | { | |
253 | return Form("FMD%d%c_merge", d, r); | |
254 | } | |
255 | /** | |
256 | * Make a branch to contain an object of this type | |
257 | * | |
258 | * @param tree Tree to store in | |
259 | * @param name Name of branch | |
260 | * | |
261 | * @return Newly allocated object of this type associated with the | |
262 | * branch | |
263 | */ | |
264 | static Merge* MakeBranch(TTree* tree, UShort_t d, Char_t r) | |
265 | { | |
266 | Merge* s = new Merge; | |
267 | if (tree) tree->Branch(BranchName(d, r), s, "one/D:two:three:d:r/b"); | |
268 | s->det = d; | |
269 | s->ring = r; | |
270 | return s; | |
271 | } | |
272 | /** | |
273 | * Associate a branch with an object of this type | |
274 | * | |
275 | * @param tree Tree to read from | |
276 | * @param name Name of branch | |
277 | * | |
278 | * @return Newly allocated object of this type associated with the | |
279 | * branch | |
280 | */ | |
281 | static Merge* SetBranch(TTree* tree, UShort_t d, Char_t r) | |
282 | { | |
283 | Merge* s = new Merge; | |
284 | if (tree) tree->SetBranchAddress(BranchName(d, r), s); | |
285 | return s; | |
286 | } | |
287 | }; | |
288 | ||
289 | // --- Cuts ---------------------------------------------------------- | |
290 | /** | |
291 | * Per-ring status information on hit 'loss' | |
292 | * | |
293 | * @ingroup pwg2_forward_qa_scripts | |
294 | */ | |
295 | struct DataLoss | |
296 | { | |
297 | Double_t merge; | |
298 | Double_t density; | |
299 | Double_t full; | |
300 | UShort_t det; | |
301 | Char_t ring; | |
302 | ||
303 | /** | |
304 | * Return the branch name to use | |
305 | * | |
306 | * @param d Detector | |
307 | * @param r Ring | |
308 | * | |
309 | * @return Name of branch to use | |
310 | */ | |
311 | static const char* BranchName(UShort_t d, Char_t r) | |
312 | { | |
313 | return Form("FMD%d%c_dataloss", d, r); | |
314 | } | |
315 | /** | |
316 | * Make a branch to contain an object of this type | |
317 | * | |
318 | * @param tree Tree to store in | |
319 | * @param name Name of branch | |
320 | * | |
321 | * @return Newly allocated object of this type associated with the | |
322 | * branch | |
323 | */ | |
324 | static DataLoss* MakeBranch(TTree* tree, UShort_t d, Char_t r) | |
325 | { | |
326 | DataLoss* s = new DataLoss; | |
327 | if (tree) tree->Branch(BranchName(d, r), s, "merge/D:density:full:d:r/b"); | |
328 | s->det = d; | |
329 | s->ring = r; | |
330 | return s; | |
331 | } | |
332 | /** | |
333 | * Associate a branch with an object of this type | |
334 | * | |
335 | * @param tree Tree to read from | |
336 | * @param name Name of branch | |
337 | * | |
338 | * @return Newly allocated object of this type associated with the | |
339 | * branch | |
340 | */ | |
341 | static DataLoss* SetBranch(TTree* tree, UShort_t d, Char_t r) | |
342 | { | |
343 | DataLoss* s = new DataLoss; | |
344 | if (tree) tree->SetBranchAddress(BranchName(d, r), s); | |
345 | return s; | |
346 | } | |
347 | }; | |
348 | ||
349 | // --- A quantity ---------------------------------------------------- | |
350 | /** | |
351 | * Per-ring status information on Poisson vs ELoss correlation | |
352 | * | |
353 | * @ingroup pwg2_forward_qa_scripts | |
354 | */ | |
355 | struct Correlation | |
356 | { | |
357 | Double_t alpha; | |
358 | Double_t beta; | |
359 | Double_t a; | |
360 | Double_t ea; | |
361 | Double_t b; | |
362 | Double_t eb; | |
363 | Double_t chi2; | |
364 | UShort_t det; | |
365 | Char_t ring; | |
366 | /** | |
367 | * Return the branch name to use | |
368 | * | |
369 | * @param d Detector | |
370 | * @param r Ring | |
371 | * | |
372 | * @return Name of branch to use | |
373 | */ | |
374 | static const char* BranchName(UShort_t d, Char_t r) | |
375 | { | |
376 | return Form("FMD%d%c_correlation", d, r); | |
377 | } | |
378 | /** | |
379 | * Make a branch to contain an object of this type | |
380 | * | |
381 | * @param tree Tree to store in | |
382 | * @param name Name of branch | |
383 | * | |
384 | * @return Newly allocated object of this type associated with the | |
385 | * branch | |
386 | */ | |
387 | static Correlation* MakeBranch(TTree* tree, UShort_t d, Char_t r) | |
388 | { | |
389 | Correlation* s = new Correlation; | |
390 | if (tree) tree->Branch(BranchName(d, r), s, | |
391 | "alpha/D:beta:a:ea:b:eb:chi2:d/s:r/b"); | |
392 | s->det = d; | |
393 | s->ring = r; | |
394 | return s; | |
395 | } | |
396 | /** | |
397 | * Associate a branch with an object of this type | |
398 | * | |
399 | * @param tree Tree to read from | |
400 | * @param name Name of branch | |
401 | * | |
402 | * @return Newly allocated object of this type associated with the | |
403 | * branch | |
404 | */ | |
405 | static Correlation* SetBranch(TTree* tree, UShort_t d, Char_t r) | |
406 | { | |
407 | Correlation* s = new Correlation; | |
408 | if (tree) tree->SetBranchAddress(BranchName(d, r), s); | |
409 | return s; | |
410 | } | |
411 | }; | |
412 | #endif // QASTRUCTS_H | |
413 | // Local Variables: | |
414 | // mode: C++ | |
415 | // End: |