/
Analyzer_config.cxx
518 lines (486 loc) · 20.9 KB
/
Analyzer_config.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
/*
Copyright:
2011, 2012, 2013 daid KAHL
This file is part of crabat
crabat is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
crabat is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with crabat. If not, see <http://www.gnu.org/licenses/>.
In order to publish results obtained from crabat or any
future derivative software, the authors must make reference
to the paper describing it (in preparation): D. Kahl et al.
``Algorithms for Active Target Data Analysis'' 2013. This is an
additional term to the license as stipulated in section 7b.
Publication includes, but is not limited to: books, peer-
reviewed journals, conference proceedings, annual reports, etc.
*/
/**
@file Analyzer_config.cxx
@author daid
@version 1.0
* @brief Sets configurations which vary experiment-by-experiment
* @details If we share analysis code across experiments,\n
* it is impractical to get new updates which over-ride experiment\n
* specific data. But if we put these details all only in one file\n
* it is much easier for different experiments to use the crabat code.\n
* Handles MSTPC pad mapping.\n
* Handles MSTPC pad gain.\n
* Does detailed PPAC calibration.\n
* Defines rf frequency.
@date 05 Dec 2011 16:03:48
*/
// If run from ROOT, exit with message
#if defined (__CINT__)
{
cout << "This is C++ code, not a ROOT macro!" << endl;
cout << "To continue, run:" << endl;
cout << "make" << endl;
cout << "./run" << endl;
gApplication->Terminate();
}
#endif
#define Analyzer_config_cxx
/**
* @brief Sets the MSTPC pad mapping
* @details Creates a 2D vector for left and right channel mapping.
* TPC mapping is non-trivial because there is not an invertible function,
* i.e. each pad has two sides.
* Thus we create two sets of 144 channels, half of which are not used
* on either side. When the vector is queried with a raw channel map,
* it returns the pad number.
*/
vector<vector<Short_t> > TDetector::SetTpcMap()
{
//basic vector usage from http://www.cplusplus.com/forum/articles/7459/
static const Short_t HEIGHT=2;
static const Short_t WIDTH=144;
static const Short_t tpc_ch[HEIGHT][WIDTH]={
//Hayakawa found some inversions 23 Aug 2013 21:11:00
//daid confirming, order appears upside down
{
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,00:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,01:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,02:OCCUPIED
6,7,4,5,3,2,1,0, // SET 0,03:Beam right upstream
15,14,13,12,10,11,8,9, // SET 0,04:Beam right upstream
23,22,21,20,19,18,16,17, // SET 0,05:Beam right upstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,06:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,07:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,08:OCCUPIED
30,31,28,29,27,26,25,24, // SET 0,09:Beam right downstream
39,38,37,36,34,35,32,33, // SET 0,10:Beam right downstream
47,46,45,44,43,42,40,41, // SET 0,11:Beam right downstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,12:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,13:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,14:DISABLED
//7,6,5,4,3,2,1,0, // SET 1,15:high gain right center // hacking all this 01 Nov 2013 16:28:12
0,1,2,3,4,5,6,7, // SET 0,15:high gain right center hacking more 01 Nov 2013 19:04:20
7,6,5,4,3,2,1,0, // SET 1,15:high gain right down hacking
//7,6,5,4,3,2,1,0, // SET 1,15:high gain right upstream
0,1,2,3,4,5,6,7, // SET 0,15:high gain right upstream
//-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,17:DISABLED
},
{
17,16,19,18,20,21,22,23, // SET 1,00:Beam left upstream
8,9,10,11,13,12,15,14, // SET 1,01:Beam left upstream
0,1,2,3,4,5,7,6, // SET 1,02:Beam left upstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,03:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,04:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,05:OCCUPIED
41,40,43,42,44,45,46,47, // SET 1,06:Beam left downstream
32,33,34,35,37,36,39,38, // SET 1,07:Beam left downstream
24,25,26,27,28,29,31,30, // SET 1,08:Beam left downstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,09:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,10:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,11:OCCUPIED
//0,1,2,3,4,5,6,7, // SET 1,13:high gain left center // hacking 01 Nov 2013 16:29:08
//6,5,-1,4,3,1,1,1, // SET 1,12:high gain left center //mismatching
7,6,5,4,3,2,1,0, // SET 1,12:high gain left center
///0,1,2,3,7,6,5,4, // SET 1,12:high gain left center
//7,6,5,4,3,2,1,0, // SET 1,14:high gain left up
0,1,2,3,4,5,6,7, // SET 1,13:high gain left down
////7,6,5,4,0,1,2,3, // SET 1,14:high gain left up
7,6,5,4,3,2,1,0, // SET 1,12:high gain left up more hacking 01 Nov 2013 19:03:44
//0,-1,2,3,4,5,6,7, // SET 1,14:high gain left up //mismatching
//-1,7,6,5,4,2,2,0, // SET 1,12:high gain left center //mismatching
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,15:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,16:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1 // SET 1,17:DISABLED
}
};
/*
//Hayakawa found some inversions 23 Aug 2013 21:11:00
{
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,00:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,01:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,02:OCCUPIED
6,7,5,4,3,2,1,0, // SET 0,03:Beam right upstream
14,15,12,13,11,10,9,8, // SET 0,04:Beam right upstream
23,22,21,20,18,19,16,17, // SET 0,05:Beam right upstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,06:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,07:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,08:OCCUPIED
30,31,29,28,27,26,25,24, // SET 0,09:Beam right downstream
38,39,36,37,35,34,33,32, // SET 0,10:Beam right downstream
47,46,45,44,42,43,40,41, // SET 0,11:Beam right downstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,12:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,13:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,14:DISABLED
0,1,2,3,4,5,6,7, // SET 0,15:high gain right center
//7,6,5,4,3,2,1,0, // SET 1,15:high gain right center hacking
7,6,5,4,3,2,1,0, // SET 1,15:high gain right downstream
0,1,2,3,4,5,6,7, // SET 0,15:high gain right upstream
//-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,17:DISABLED
},
{
17,16,19,18,20,21,22,23, // SET 1,00:Beam left upstream
8,9,10,11,13,12,15,14, // SET 1,01:Beam left upstream
0,1,2,3,4,5,7,6, // SET 1,02:Beam left upstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,03:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,04:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,05:OCCUPIED
41,40,43,42,44,45,46,47, // SET 1,06:Beam left downstream
32,33,34,35,37,36,39,38, // SET 1,07:Beam left downstream
24,25,26,27,28,29,31,30, // SET 1,08:Beam left downstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,09:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,10:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,11:OCCUPIED
//0,1,2,3,4,5,6,7, // SET 1,13:high gain left down
//6,5,-1,4,3,1,1,1, // SET 1,12:high gain left center //mismatching
7,6,5,4,3,2,1,0, // SET 1,12:high gain left center
///0,1,2,3,7,6,5,4, // SET 1,12:high gain left center
7,6,5,4,3,2,1,0, // SET 1,14:high gain left up
0,1,2,3,4,5,6,7, // SET 1,13:high gain left down
////7,6,5,4,0,1,2,3, // SET 1,14:high gain left up
//7,6,5,4,3,2,1,0, // SET 1,12:high gain left center
//0,-1,2,3,4,5,6,7, // SET 1,14:high gain left up //mismatching
//-1,7,6,5,4,2,2,0, // SET 1,12:high gain left center //mismatching
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,15:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,16:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1 // SET 1,17:DISABLED
}
};
*/
/*
// low gain mapping daid 26 Oct 2011 03:36:43 22Mg, now 30S
// rough high gain mapping daid 11 Sep 2012 00:09:38 (SET 0,15 might be inverted?)
// should be correct now I think!
{
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,00:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,01:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,02:OCCUPIED
7,6,5,4,3,2,1,0, // SET 0,03:Beam right upstream
15,14,13,12,11,10,9,8, // SET 0,04:Beam right upstream
23,22,21,20,19,18,17,16, // SET 0,05:Beam right upstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,06:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,07:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,08:OCCUPIED
31,30,29,28,27,26,25,24, // SET 0,09:Beam right downstream
39,38,37,36,35,34,33,32, // SET 0,10:Beam right downstream
47,46,45,44,43,42,41,40, // SET 0,11:Beam right downstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,12:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,13:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,14:DISABLED
0,1,2,3,4,5,6,7, // SET 0,15:high gain right center
//7,6,5,4,3,2,1,0, // SET 1,15:high gain right center hacking
7,6,5,4,3,2,1,0, // SET 1,15:high gain right downstream
0,1,2,3,4,5,6,7, // SET 0,15:high gain right upstream
//-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,17:DISABLED
},
{
16,17,18,19,20,21,22,23, // SET 1,00:Beam left upstream
8,9,10,11,12,13,14,15, // SET 1,01:Beam left upstream
0,1,2,3,4,5,6,7, // SET 1,02:Beam left upstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,03:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,04:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,05:OCCUPIED
40,41,42,43,44,45,46,47, // SET 1,06:Beam left downstream
32,33,34,35,36,37,38,39, // SET 1,07:Beam left downstream
24,25,26,27,28,29,30,31, // SET 1,08:Beam left downstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,09:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,10:OCCUPIED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,11:OCCUPIED
//0,1,2,3,4,5,6,7, // SET 1,13:high gain left down
//6,5,-1,4,3,1,1,1, // SET 1,12:high gain left center //mismatching
7,6,5,4,3,2,1,0, // SET 1,12:high gain left center
///0,1,2,3,7,6,5,4, // SET 1,12:high gain left center
7,6,5,4,3,2,1,0, // SET 1,14:high gain left up
0,1,2,3,4,5,6,7, // SET 1,13:high gain left down
////7,6,5,4,0,1,2,3, // SET 1,14:high gain left up
//7,6,5,4,3,2,1,0, // SET 1,12:high gain left center
//0,-1,2,3,4,5,6,7, // SET 1,14:high gain left up //mismatching
//-1,7,6,5,4,2,2,0, // SET 1,12:high gain left center //mismatching
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,15:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,16:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1 // SET 1,17:DISABLED
}
};
*/
/*
{ -1,-1,-1,-1,-1,-1,-1,-1, // SET 0,01:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,02:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,03:DISABLED
40,41,42,43,44,45,46,47, // SET 0,04:Beam right downstream
32,33,34,35,36,37,38,39, // SET 0,05:Beam right downstream
24,25,26,27,28,29,30,31, // SET 0,06:Beam right downstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,07:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,08:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,09:DISABLED
16,17,18,19,20,21,22,23, // SET 0,10:Beam right upstream
8,9,10,11,12,13,14,15, // SET 0,11:Beam right upstream
0,1,2,3,4,5,6,7, // SET 0,12:Beam right upstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,13:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,14:DISABLED
0,1,2,3,4,5,6,7, // SET 0,15:Left upstream
7,6,5,4,3,2,1,0, // SET 0,16:Center right should it be?: // 0,1,2,3,4,5,6,7, // Center right
-1,-1,-1,-1,-1,-1,-1,-1, // SET 0,17:DISABLED
0,1,2,3,4,5,6,7}, // SET 0,18:Right upstream
{ 31,30,29,28,27,26,25,24, // SET 1,01:Beam left downstream
39,38,37,36,35,34,33,32, // SET 1,02:Beam left downstream
47,46,45,44,43,42,41,40, // SET 1,03:Beam left downstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,04:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,05:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,06:DISABLED
7,6,5,4,3,2,1,0, // SET 1,07:Beam left upstream
15,14,13,12,11,10,9,8, // SET 1,08:Beam left upstream
23,22,21,20,19,18,17,16, // SET 1,09:Beam left upstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,10:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,11:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,12:DISABLED
0,1,2,3,4,5,6,7, // SET 1,13:Center left
0,1,2,3,4,5,6,7, // SET 1,14:Left downstream
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,15:DISABLED
-1,-1,-1,-1,-1,-1,-1,-1, // SET 1,16:DISABLED
0,1,2,3,4,5,6,7 // SET 1,17:Right downstream
-1,-1,-1,-1,-1,-1,-1,-1} // SET 1,18:DISABLED
};*/
vector<vector<Short_t> > array2D;
array2D.resize(HEIGHT);
for (int i = 0; i < HEIGHT; ++i)
array2D[i].resize(WIDTH);
for (int i = 0; i < HEIGHT; i++)
for (int j = 0; j < WIDTH; j++)
array2D[i][j]=tpc_ch[i][j];
return array2D;
}
/**
* @brief Sets the MSTPC Beam pad gain
* @details Creates a vector for gain mapping.
* As a vector, we can create as many different gain
* vectors as required, since vector sizes are dynamic.
* Here for 30S I create a 2D vector, since the gain was
* changed after some early production runs.
*/
vector<vector<Double_t> > TDetector::SetTpcBgain()
{
//basic vector use suggested at http://www.cplusplus.com/forum/articles/7459/
//internal calibration for beam pad
static const Short_t HEIGHT=2;
static const Short_t WIDTH=48;
static const Double_t padBgain[HEIGHT][WIDTH]={
/* { // runs 1001-1005
1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,// 0-7
1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , // 8-15
0.712629, .69137310,0.706643,0.732711,.74086605,0.655,1.,1., // 16-23
0.708874,0.706074,0.70031,0.701813,0.696598713,0.70119423,0.6988148,1., //24-31
0.69839515,0.693352,0.69736996,0.696989,0.697088,0.696793,0.69828,0.696932, //32-39
1.,0.65594417,0.701976,0.701372,0.706313,0.70744137,.70876,0.68}, //40-47
//46 is weird here even though the same method is used...
//1.,0.65594417,0.701976,0.701372,0.706313,0.70744137,.77039460,0.68}, //40-47
{ //other runs
1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , // 0-7
1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , // 8-15
1. ,1.10,1. ,1. ,0.95,1. ,1. ,1. , // 16-23
1. ,1. ,1. ,1. ,0.97,0.99,0.94,1. , // 24-31
0.97,1. ,0.98,1. ,1. ,1. ,1. ,1. , // 32-39
1.03,1.03,1. ,1. ,1. ,0.97,0.90,1. // 40-47
}};*/
{ // runs 1001-1005
1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,// 0-7
1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , // 8-15
1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , // 8-15
1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , // 8-15
1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , // 8-15
1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. }, // 8-15
{ //other runs
// 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , // 0-7
// 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , // 8-15
// 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , // 0-7
// 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , // 8-15
// 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , // 0-7
// 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. // 8-15
0.,
0.0001021486,
0.0001088012,
0.0001076046,
0.0001072071,
0.0001051142,
0.0001066826,
0.0001062733,
0.0001040419,
0.000101733,
0.0001026983,
0.0001013712,
0.0001014689,
0.0001034165,
0.0001038815,
0.0001042219,
0.0001058612,
0,
0.0001137782,
0.0001127487,
0.0001174811,
0.0001185898,
0.0001182403,
0.0001176346,
0,
0,
0,
0.0001090059,
0.0001169127,
0.0001150819,
0.0001154769,
0.0001132917,
0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.
}};
vector<vector<Double_t> > array2D;
array2D.resize(HEIGHT);
for (int i = 0; i < HEIGHT; ++i)
array2D[i].resize(WIDTH);
for (int i = 0; i < HEIGHT; i++)
for (int j = 0; j < WIDTH; j++)
array2D[i][j]=padBgain[i][j];
return array2D;
}
vector<Double_t> TDetector::SetGeoXB()
{
//basic vector use suggested at http://www.cplusplus.com/forum/articles/7459/
//internal calibration for beam pad
static const Short_t HEIGHT=48;
static const Double_t padXBgeo[HEIGHT]={
5.21587,5.37543,5.535,5.69457,5.85414,6.0137,6.17327,6.33284,
6.49241,6.65197,6.81154,6.97111,7.13068,7.29024,7.44981,7.60938,
7.76895,7.92851,8.08808,8.24765,8.40722,8.56678,8.72635,8.88592,
9.04549,9.20505,9.36462,9.52419,9.68376,9.84332,10.0029,10.1625,
10.322,10.4816,10.6412,10.8007,10.9603,11.1199,11.2794,11.439,
11.5986,11.7581,11.9177,12.0773,12.2368,12.3964,12.556,12.7155
};
vector<Double_t> array1D;
array1D.resize(HEIGHT);
for (int i = 0; i < HEIGHT; i++)
array1D[i]=padXBgeo[i];
return array1D;
}
vector<Double_t> TDetector::SetGeoXC()
{
//basic vector use suggested at http://www.cplusplus.com/forum/articles/7459/
//internal calibration for beam pad
static const Short_t HEIGHT=8;
static const Double_t padXCgeo[HEIGHT]={
13.4934,13.653,13.8126,13.9721,14.1317,14.2913,14.4508,14.6104
};
vector<Double_t> array1D;
array1D.resize(HEIGHT);
for (int i = 0; i < HEIGHT; i++)
array1D[i]=padXCgeo[i];
return array1D;
}
void inline Analyzer::SetRF()
{
// Define RF
// Note in class structure we cannot use static const style
// as it is forbidden by ISO C++ for non-integers
#define rf 59.70; // real RF value
}
UShort_t inline Analyzer::SetPpacSepZ()
{
return(156) ; // mm
//#define PpacSepZ 156; // mm
//static const UShort_t PpacSepZ = 156; // mm
}
// change this to pass by address
Bool_t inline Analyzer::WindowCut(Double_t x, Double_t y)
{
// modified from http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=1145
double radius = 20; // real value 20 mm...practically speaking 22 is the cut off for 29P bragg appearing
const Int_t n = 300;
Double_t winx[n+1],winy[n+1];
Double_t rcut = 1.00*radius;
Double_t dphi = TMath::TwoPi()/n;
for (Int_t i=0;i<n;i++) {
winx[i] = rcut*TMath::Cos(i*dphi);
winy[i] = rcut*TMath::Sin(i*dphi);
}
winx[n] = winx[0]; winy[n] = winy[0];
TCutG *window = new TCutG("window",n+1,winx,winy);
if (window->IsInside(x,y)) {
delete window;
return(true);
}
delete window;
return (false);
}
UShort_t inline Analyzer::PpacXYCalib(Bool_t flag_detail, Bool_t flag_ppac){
if (!flag_detail || !flag_ppac) return(EXIT_FAILURE);
// PPAC calibration that is not handled in ppac_calib.dat
Float_t dxy[2]; // 1 is X, 2 is Y; tmp variable for calibration loops
Float_t PpacOffset[2][2];
Float_t PpacOffsetLine[2][2];
Float_t PpacPositionGain[2][2];
Float_t PpacOffsetGeometry[2][2];
//PPACa -- check these values! 24 Jan 2011 11:56:55
PpacOffset[0][0]=0.92; //18 Jul 2011 16:56:44
PpacOffset[0][1]=1.58; //18 Jul 2011 16:56:57
PpacOffsetLine[0][0]=0.0; //18 Jul 2011 16:58:08
PpacOffsetLine[0][1]=-0.22; //18 Jul 2011 16:58:10
PpacPositionGain[0][0]=0.6200; // 18 Jul 2011 16:54:57
PpacPositionGain[0][1]=0.6210; // 18 Jul 2011 16:54:59
PpacOffsetGeometry[0][0]=-0.60;
PpacOffsetGeometry[0][1]=0.0; // checked 08 Jul 2011 16:00:27
//PpacOffsetGeometry[1][1]=1.83;
//PPACb -- check these values! 24 Jan 2011 11:56:52
PpacOffset[1][0]=0.17; //18 Jul 2011 16:57:56
PpacOffset[1][1]=0.11; //18 Jul 2011 16:57:54
//PpacOffsetLine[1][0]=-1.4; //05 Sep 2012 18:07:28
PpacOffsetLine[1][0]=-4.3; //18 Jul 2011 16:58:03 checking again 17 Apr 2013 15:57:19, and see Vol 4 p. 153...it has to be of such a value or projections wrong
PpacOffsetLine[1][1]=-1.0; //18 Jul 2011 16:58:04
PpacPositionGain[1][0]=0.6205; //18 Jul 2011 16:55:04
PpacPositionGain[1][1]=0.6125; //18 Jul 2011 16:55:06
PpacOffsetGeometry[1][0]=0.0;
PpacOffsetGeometry[1][1]=0.0; // checked 08 Jul 2011 16:00:22
//PpacOffsetGeometry[1][1]=-3.5;
// PPAC calibration for loop
for (UShort_t i=0;i<2;i++){
//average time
tof[i] = 0.25*(fPPACcal[i][0]+fPPACcal[i][1]+fPPACcal[i][2]+fPPACcal[i][3]);
// J1 results are consistent with calculations
// But in AT data there is some offset
// e.g. easily may have slightly different cable lengths
//if (i==1) tof[i]-=2.;
// we need to compare with SSDT data to see which direction
// i.e. tof0+2 vs tof1-2
dxy[0]=(fPPACcal[i][0]-fPPACcal[i][1]);
//if (i==1) dxy[0]=(fPPACcal[i][1]-fPPACcal[i][0]); // inverted PPACbX 03 Sep 2012 20:23:40 goatface
dxy[1]=(fPPACcal[i][2]-fPPACcal[i][3]);
for (UShort_t ii = 0; ii < 2; ii++) {
// time calibration
dxy[ii] -=PpacOffset[i][ii];
dxy[ii] -= PpacOffsetLine[i][ii];
// position calibration
dxy[ii] *= PpacPositionGain[i][ii];
dxy[ii] -= PpacOffsetGeometry[i][ii];
}
PpacX[i]=dxy[0];
PpacY[i]=dxy[1];
// Previously I thought the PPACbY cable was inverted...must be false from projection data! 28 Aug 2012 19:48:04
// PPACaY is normal
//if (i==1) PpacY[i]=(dxy[1]*-1.0); // PPACbY cables were inverted
} //end PPAC calibration for loop
return(EXIT_SUCCESS);
}