forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntegratedClusterCalibrator.h
More file actions
816 lines (707 loc) · 39.3 KB
/
IntegratedClusterCalibrator.h
File metadata and controls
816 lines (707 loc) · 39.3 KB
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
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file IntegratedClusterCalibrator.h
/// \brief calibrator class for accumulating integrated clusters
/// \author Matthias Kleiner <mkleiner@ikf.uni-frankfurt.de>
/// \date Jan 21, 2023
#ifndef INTEGRATEDCLUSTERCALIBRATOR_H_
#define INTEGRATEDCLUSTERCALIBRATOR_H_
#include "DetectorsCalibration/TimeSlotCalibration.h"
#include "DetectorsCalibration/TimeSlot.h"
class TTree;
namespace o2
{
// see https://stackoverflow.com/questions/56483053/if-condition-checking-multiple-vector-sizes-are-equal
// comparing if all vector have the same size
template <typename T0, typename... Ts>
bool sameSize(T0 const& first, Ts const&... rest)
{
return ((first.size() == rest.size()) && ...);
}
namespace tof
{
/// struct containing the integrated TOF currents
struct ITOFC {
std::vector<float> mITOFCNCl; ///< integrated 1D TOF cluster currents
std::vector<float> mITOFCQ; ///< integrated 1D TOF qTot currents
long mTimeMS{}; ///< start time in ms
bool areSameSize() const { return sameSize(mITOFCNCl, mITOFCQ); } ///< check if stored currents have same number of entries
bool isEmpty() const { return mITOFCNCl.empty(); } ///< check if values are empty
size_t getEntries() const { return mITOFCNCl.size(); } ///< \return returns number of values stored
void setStartTime(long timeMS) { mTimeMS = timeMS; }
/// acummulate integrated currents at given index
/// \param posIndex index where data will be copied to
/// \param data integrated currents which will be copied
void fill(const unsigned int posIndex, const ITOFC& data)
{
std::copy(data.mITOFCNCl.begin(), data.mITOFCNCl.end(), mITOFCNCl.begin() + posIndex);
std::copy(data.mITOFCQ.begin(), data.mITOFCQ.end(), mITOFCQ.begin() + posIndex);
}
/// \param nDummyValues number of empty values which are inserted at the beginning of the accumulated integrated currents
void insert(const unsigned int nDummyValues)
{
std::vector<float> vecTmp(nDummyValues, 0);
mITOFCNCl.insert(mITOFCNCl.begin(), vecTmp.begin(), vecTmp.end());
mITOFCQ.insert(mITOFCQ.begin(), vecTmp.begin(), vecTmp.end());
}
/// resize buffer for accumulated currents
void resize(const unsigned int nTotal)
{
mITOFCNCl.resize(nTotal);
mITOFCQ.resize(nTotal);
}
ClassDefNV(ITOFC, 2);
};
} // end namespace tof
namespace tpc
{
/// struct containing the integrated TPC currents
struct ITPCC {
std::vector<float> mIQMaxA; ///< integrated 1D-currents for QMax A-side
std::vector<float> mIQMaxC; ///< integrated 1D-currents for QMax C-side
std::vector<float> mIQTotA; ///< integrated 1D-currents for QTot A-side
std::vector<float> mIQTotC; ///< integrated 1D-currents for QTot A-side
std::vector<float> mINClA; ///< integrated 1D-currents for NCl A-side
std::vector<float> mINClC; ///< integrated 1D-currents for NCl A-side
long mTimeMS{}; ///< start time in ms
float compression(float value, const int nBits) const
{
const int shiftN = std::pow(2, nBits);
int exp2;
const auto mantissa = std::frexp(value, &exp2);
const auto mantissaRounded = std::round(mantissa * shiftN) / shiftN;
return std::ldexp(mantissaRounded, exp2);
}
void compress(const int nBits)
{
std::transform(mIQMaxA.begin(), mIQMaxA.end(), mIQMaxA.begin(), [this, nBits](float val) { return compression(val, nBits); });
std::transform(mIQMaxC.begin(), mIQMaxC.end(), mIQMaxC.begin(), [this, nBits](float val) { return compression(val, nBits); });
std::transform(mIQTotA.begin(), mIQTotA.end(), mIQTotA.begin(), [this, nBits](float val) { return compression(val, nBits); });
std::transform(mIQTotC.begin(), mIQTotC.end(), mIQTotC.begin(), [this, nBits](float val) { return compression(val, nBits); });
std::transform(mINClA.begin(), mINClA.end(), mINClA.begin(), [this, nBits](float val) { return compression(val, nBits); });
std::transform(mINClC.begin(), mINClC.end(), mINClC.begin(), [this, nBits](float val) { return compression(val, nBits); });
}
bool areSameSize() const { return sameSize(mIQMaxA, mIQMaxC, mIQTotA, mIQTotC, mINClA, mINClC); } ///< check if stored currents have same number of entries
bool isEmpty() const { return mIQMaxA.empty(); } ///< check if values are empty
size_t getEntries() const { return mIQMaxA.size(); } ///< \return returns number of values stored
void setStartTime(long timeMS) { mTimeMS = timeMS; }
/// acummulate integrated currents at given index
/// \param posIndex index where data will be copied to
/// \param data integrated currents which will be copied
void fill(const unsigned int posIndex, const ITPCC& data)
{
std::copy(data.mIQMaxA.begin(), data.mIQMaxA.end(), mIQMaxA.begin() + posIndex);
std::copy(data.mIQMaxC.begin(), data.mIQMaxC.end(), mIQMaxC.begin() + posIndex);
std::copy(data.mIQTotA.begin(), data.mIQTotA.end(), mIQTotA.begin() + posIndex);
std::copy(data.mIQTotC.begin(), data.mIQTotC.end(), mIQTotC.begin() + posIndex);
std::copy(data.mINClA.begin(), data.mINClA.end(), mINClA.begin() + posIndex);
std::copy(data.mINClC.begin(), data.mINClC.end(), mINClC.begin() + posIndex);
}
/// \param nDummyValues number of empty values which are inserted at the beginning of the accumulated integrated currents
void insert(const unsigned int nDummyValues)
{
std::vector<float> vecTmp(nDummyValues, 0);
mIQMaxA.insert(mIQMaxA.begin(), vecTmp.begin(), vecTmp.end());
mIQMaxC.insert(mIQMaxC.begin(), vecTmp.begin(), vecTmp.end());
mIQTotA.insert(mIQTotA.begin(), vecTmp.begin(), vecTmp.end());
mIQTotC.insert(mIQTotC.begin(), vecTmp.begin(), vecTmp.end());
mINClA.insert(mINClA.begin(), vecTmp.begin(), vecTmp.end());
mINClC.insert(mINClC.begin(), vecTmp.begin(), vecTmp.end());
}
/// resize buffer for accumulated currents
void resize(const unsigned int nTotal)
{
mIQMaxA.resize(nTotal);
mIQMaxC.resize(nTotal);
mIQTotA.resize(nTotal);
mIQTotC.resize(nTotal);
mINClA.resize(nTotal);
mINClC.resize(nTotal);
}
/// reset buffered currents
void reset()
{
std::fill(mIQMaxA.begin(), mIQMaxA.end(), 0);
std::fill(mIQMaxC.begin(), mIQMaxC.end(), 0);
std::fill(mIQTotA.begin(), mIQTotA.end(), 0);
std::fill(mIQTotC.begin(), mIQTotC.end(), 0);
std::fill(mINClA.begin(), mINClA.end(), 0);
std::fill(mINClC.begin(), mINClC.end(), 0);
}
/// normalize currents
void normalize(const float factor)
{
std::transform(mIQMaxA.begin(), mIQMaxA.end(), mIQMaxA.begin(), [factor](const float val) { return val * factor; });
std::transform(mIQMaxC.begin(), mIQMaxC.end(), mIQMaxC.begin(), [factor](const float val) { return val * factor; });
std::transform(mIQTotA.begin(), mIQTotA.end(), mIQTotA.begin(), [factor](const float val) { return val * factor; });
std::transform(mIQTotC.begin(), mIQTotC.end(), mIQTotC.begin(), [factor](const float val) { return val * factor; });
std::transform(mINClA.begin(), mINClA.end(), mINClA.begin(), [factor](const float val) { return val * factor; });
std::transform(mINClC.begin(), mINClC.end(), mINClC.begin(), [factor](const float val) { return val * factor; });
}
ClassDefNV(ITPCC, 2);
};
/// struct containing time series values
struct TimeSeries {
std::vector<float> mDCAr_A_Median; ///< integrated 1D DCAr for A-side median in phi/tgl slices
std::vector<float> mDCAr_C_Median; ///< integrated 1D DCAr for C-side weighted mean in phi/tgl slices
std::vector<float> mDCAr_A_WeightedMean; ///< integrated 1D DCAr for A-side weighted mean in phi/tgl slices
std::vector<float> mDCAr_C_WeightedMean; ///< integrated 1D DCAr for C-side median in phi/tgl slices
std::vector<float> mDCAr_A_RMS; ///< integrated 1D DCAr for A-side RMS in phi/tgl slices
std::vector<float> mDCAr_C_RMS; ///< integrated 1D DCAr for C-side RMS in phi/tgl slices
std::vector<float> mDCAr_A_NTracks; ///< number of tracks used to calculate the DCAs
std::vector<float> mDCAr_C_NTracks; ///< number of tracks used to calculate the DCAs
std::vector<float> mDCAz_A_Median; ///< integrated 1D DCAz for A-side median in phi/tgl slices
std::vector<float> mDCAz_C_Median; ///< integrated 1D DCAz for C-side median in phi/tgl slices
std::vector<float> mDCAz_A_WeightedMean; ///< integrated 1D DCAz for A-side weighted mean in phi/tgl slices
std::vector<float> mDCAz_C_WeightedMean; ///< integrated 1D DCAz for C-side weighted mean in phi/tgl slices
std::vector<float> mDCAz_A_RMS; ///< integrated 1D DCAz for A-side RMS in phi/tgl slices
std::vector<float> mDCAz_C_RMS; ///< integrated 1D DCAz for C-side RMS in phi/tgl slices
std::vector<float> mDCAz_A_NTracks; ///< number of tracks used to calculate the DCAs
std::vector<float> mDCAz_C_NTracks; ///< number of tracks used to calculate the DCAs
std::vector<float> mMIPdEdxRatioQMaxA; ///< ratio of MIP/dEdx - qMax -
std::vector<float> mMIPdEdxRatioQMaxC; ///< ratio of MIP/dEdx - qMax -
std::vector<float> mMIPdEdxRatioQTotA; ///< ratio of MIP/dEdx - qTot -
std::vector<float> mMIPdEdxRatioQTotC; ///< ratio of MIP/dEdx - qTot -
std::vector<float> mTPCChi2A; ///< Chi2 of TPC tracks
std::vector<float> mTPCChi2C; ///< Chi2 of TPC tracks
std::vector<float> mTPCNClA; ///< number of TPC cluster
std::vector<float> mTPCNClC; ///< number of TPC cluster
unsigned char mNBinsPhi{}; ///< number of tgl bins
unsigned char mNBinsTgl{}; ///< number of phi bins
float mTglMax{}; ///< absolute max tgl
unsigned char mNBinsqPt{}; ///< number of qPt bins
float mQPtMax{}; ///< abs qPt max
unsigned char mMultBins{}; ///< multiplicity bins
float mMultMax{}; ///< max local multiplicity
long mTimeMS{}; ///< start time in ms
/// dump object to tree
/// \param outFileName name of the output file
/// \param nHBFPerTF number of orbits per TF
void setStartTime(long timeMS) { mTimeMS = timeMS; }
/// \return returns total number of bins
int getNBins() const { return mNBinsTgl + mNBinsPhi + mNBinsqPt + mMultBins + 1; }
/// \return returns index for given phi bin
int getIndexPhi(const int iPhi, int slice = 0) const { return iPhi + slice * getNBins(); }
/// \return returns index for given tgl bin
int getIndexTgl(const int iTgl, int slice = 0) const { return mNBinsPhi + iTgl + slice * getNBins(); }
/// \return returns index for given qPt bin
int getIndexqPt(const int iqPt, int slice = 0) const { return mNBinsPhi + mNBinsTgl + iqPt + slice * getNBins(); }
/// \return returns index for given qPt bin
int getIndexMult(const int iMult, int slice = 0) const { return mNBinsPhi + mNBinsTgl + mNBinsqPt + iMult + slice * getNBins(); }
/// \return returns index for integrated over all bins
int getIndexInt(int slice = 0) const { return getNBins() - 1 + slice * getNBins(); }
/// resize buffer for accumulated currents
void resize(const unsigned int nTotal)
{
mDCAr_A_Median.resize(nTotal);
mDCAr_C_Median.resize(nTotal);
mDCAr_A_RMS.resize(nTotal);
mDCAr_C_RMS.resize(nTotal);
mDCAz_A_Median.resize(nTotal);
mDCAz_C_Median.resize(nTotal);
mDCAz_A_RMS.resize(nTotal);
mDCAz_C_RMS.resize(nTotal);
mDCAr_C_NTracks.resize(nTotal);
mDCAr_A_NTracks.resize(nTotal);
mDCAz_A_NTracks.resize(nTotal);
mDCAz_C_NTracks.resize(nTotal);
mDCAr_A_WeightedMean.resize(nTotal);
mDCAr_C_WeightedMean.resize(nTotal);
mDCAz_A_WeightedMean.resize(nTotal);
mDCAz_C_WeightedMean.resize(nTotal);
mMIPdEdxRatioQMaxA.resize(nTotal);
mMIPdEdxRatioQMaxC.resize(nTotal);
mMIPdEdxRatioQTotA.resize(nTotal);
mMIPdEdxRatioQTotC.resize(nTotal);
mTPCChi2A.resize(nTotal);
mTPCChi2C.resize(nTotal);
mTPCNClA.resize(nTotal);
mTPCNClC.resize(nTotal);
}
ClassDefNV(TimeSeries, 1);
};
struct ITSTPC_Matching {
std::vector<float> mITSTPC_A_MatchEff; ///< matching efficiency of ITS-TPC tracks A-side
std::vector<float> mITSTPC_C_MatchEff; ///< matching efficiency of ITS-TPC tracks C-side
std::vector<float> mITSTPC_A_Chi2Match; ///< ITS-TPC chi2 A-side
std::vector<float> mITSTPC_C_Chi2Match; ///< ITS-TPC chi2 C-side
/// resize buffer for accumulated currents
void resize(const unsigned int nTotal)
{
mITSTPC_A_MatchEff.resize(nTotal);
mITSTPC_C_MatchEff.resize(nTotal);
mITSTPC_A_Chi2Match.resize(nTotal);
mITSTPC_C_Chi2Match.resize(nTotal);
}
ClassDefNV(ITSTPC_Matching, 2);
};
struct TimeSeriesdEdx {
std::vector<float> mLogdEdx_A_Median; ///< log(dEdx_exp(pion)/dEdx) - A-side
std::vector<float> mLogdEdx_A_RMS; ///< log(dEdx_exp(pion)/dEdx) - A-side
std::vector<float> mLogdEdx_A_IROC_Median; ///< log(dedxIROC / dEdx) - A-side
std::vector<float> mLogdEdx_A_IROC_RMS; ///< log(dedxIROC / dEdx) - A-side
std::vector<float> mLogdEdx_A_OROC1_Median; ///< log(dedxOROC1 / dEdx) - A-side
std::vector<float> mLogdEdx_A_OROC1_RMS; ///< log(dedxOROC1 / dEdx) - A-side
std::vector<float> mLogdEdx_A_OROC2_Median; ///< log(dedxOROC2 / dEdx) - A-side
std::vector<float> mLogdEdx_A_OROC2_RMS; ///< log(dedxOROC2 / dEdx) - A-side
std::vector<float> mLogdEdx_A_OROC3_Median; ///< log(dedxOROC3 / dEdx) - A-side
std::vector<float> mLogdEdx_A_OROC3_RMS; ///< log(dedxOROC3 / dEdx) - A-side
std::vector<float> mLogdEdx_C_Median; ///< log(dEdx_exp(pion)/dEdx) - C-side
std::vector<float> mLogdEdx_C_RMS; ///< log(dEdx_exp(pion)/dEdx) - C-side
std::vector<float> mLogdEdx_C_IROC_Median; ///< log(dedxIROC / dEdx) - C-side
std::vector<float> mLogdEdx_C_IROC_RMS; ///< log(dedxIROC / dEdx) - C-side
std::vector<float> mLogdEdx_C_OROC1_Median; ///< log(dedxOROC1 / dEdx) - C-side
std::vector<float> mLogdEdx_C_OROC1_RMS; ///< log(dedxOROC1 / dEdx) - C-side
std::vector<float> mLogdEdx_C_OROC2_Median; ///< log(dedxOROC2 / dEdx) - C-side
std::vector<float> mLogdEdx_C_OROC2_RMS; ///< log(dedxOROC2 / dEdx) - C-side
std::vector<float> mLogdEdx_C_OROC3_Median; ///< log(dedxOROC3 / dEdx) - C-side
std::vector<float> mLogdEdx_C_OROC3_RMS; ///< log(dedxOROC3 / dEdx) - C-side
void resize(const unsigned int nTotal)
{
mLogdEdx_A_Median.resize(nTotal);
mLogdEdx_A_RMS.resize(nTotal);
mLogdEdx_A_IROC_Median.resize(nTotal);
mLogdEdx_A_IROC_RMS.resize(nTotal);
mLogdEdx_A_OROC1_Median.resize(nTotal);
mLogdEdx_A_OROC1_RMS.resize(nTotal);
mLogdEdx_A_OROC2_Median.resize(nTotal);
mLogdEdx_A_OROC2_RMS.resize(nTotal);
mLogdEdx_A_OROC3_Median.resize(nTotal);
mLogdEdx_A_OROC3_RMS.resize(nTotal);
mLogdEdx_C_Median.resize(nTotal);
mLogdEdx_C_RMS.resize(nTotal);
mLogdEdx_C_IROC_Median.resize(nTotal);
mLogdEdx_C_IROC_RMS.resize(nTotal);
mLogdEdx_C_OROC1_Median.resize(nTotal);
mLogdEdx_C_OROC1_RMS.resize(nTotal);
mLogdEdx_C_OROC2_Median.resize(nTotal);
mLogdEdx_C_OROC2_RMS.resize(nTotal);
mLogdEdx_C_OROC3_Median.resize(nTotal);
mLogdEdx_C_OROC3_RMS.resize(nTotal);
}
ClassDefNV(TimeSeriesdEdx, 1);
};
struct TimeSeriesITSTPC {
float mVDrift = 0; ///< drift velocity in cm/us
float mPressure = 0; ///< pressure
float mTemperature = 0; ///< temperature
TimeSeries mTSTPC; ///< TPC standalone DCAs
TimeSeries mTSITSTPC; ///< ITS-TPC standalone DCAs
ITSTPC_Matching mITSTPCAll; ///< ITS-TPC matching efficiency for ITS standalone + afterburner
ITSTPC_Matching mITSTPCStandalone; ///< ITS-TPC matching efficiency for ITS standalone
ITSTPC_Matching mITSTPCAfterburner; ///< ITS-TPC matchin efficiency fir ITS afterburner
TimeSeriesdEdx mdEdxQTot; ///< time series for dE/dx qTot monitoring
TimeSeriesdEdx mdEdxQMax; ///< time series for dE/dx qMax monitoring
std::vector<unsigned int> mOccupancyMapTPC; ///< cluster occupancy map
std::vector<float> nPrimVertices; ///< number of primary vertices
std::vector<float> nPrimVertices_ITS; ///< number of primary vertices selected with ITS cut 0.2<nContributorsITS/nContributors<0.8
std::vector<float> nVertexContributors_ITS_Median; ///< number of primary vertices selected with ITS cut 0.2<nContributorsITS/nContributors<0.8
std::vector<float> nVertexContributors_ITS_RMS; ///< number of primary vertices selected with ITS cut 0.2<nContributorsITS/nContributors<0.8
std::vector<float> vertexX_ITS_Median; ///< vertex x position selected with ITS cut 0.2<nContributorsITS/nContributors<0.8
std::vector<float> vertexY_ITS_Median; ///< vertex y position selected with ITS cut 0.2<nContributorsITS/nContributors<0.8
std::vector<float> vertexZ_ITS_Median; ///< vertex z position selected with ITS cut 0.2<nContributorsITS/nContributors<0.8
std::vector<float> vertexX_ITS_RMS; ///< vertex x RMS selected with ITS cut 0.2<nContributorsITS/nContributors<0.8
std::vector<float> vertexY_ITS_RMS; ///< vertex y RMS selected with ITS cut 0.2<nContributorsITS/nContributors<0.8
std::vector<float> vertexZ_ITS_RMS; ///< vertex z RMS selected with ITS cut 0.2<nContributorsITS/nContributors<0.8
std::vector<float> nPrimVertices_ITSTPC; ///< number of primary vertices with ITS-TPC cut (nContributorsITS + nContributorsITSTPC)<0.95
std::vector<float> nVertexContributors_ITSTPC_Median; ///< number of primary vertices with ITS-TPC cut (nContributorsITS + nContributorsITSTPC)<0.95
std::vector<float> nVertexContributors_ITSTPC_RMS; ///< number of primary vertices with ITS-TPC cut (nContributorsITS + nContributorsITSTPC)<0.95
std::vector<float> vertexX_ITSTPC_Median; ///< vertex x position with ITS-TPC cut (nContributorsITS + nContributorsITSTPC)<0.95
std::vector<float> vertexY_ITSTPC_Median; ///< vertex y position with ITS-TPC cut (nContributorsITS + nContributorsITSTPC)<0.95
std::vector<float> vertexZ_ITSTPC_Median; ///< vertex z position with ITS-TPC cut (nContributorsITS + nContributorsITSTPC)<0.95
std::vector<float> vertexX_ITSTPC_RMS; ///< vertex x RMS with ITS-TPC cut (nContributorsITS + nContributorsITSTPC)<0.95
std::vector<float> vertexY_ITSTPC_RMS; ///< vertex y RMS with ITS-TPC cut (nContributorsITS + nContributorsITSTPC)<0.95
std::vector<float> vertexZ_ITSTPC_RMS; ///< vertex z RMS with ITS-TPC cut (nContributorsITS + nContributorsITSTPC)<0.95
int quantileValues = 23; ///<! number of values in quantiles + truncated mean (hardcoded for the moment)
std::vector<float> nVertexContributors_Quantiles; ///< number of primary vertices for quantiles 0.1, 0.2, ... 0.9 and truncated mean values 0.05->0.95, 0.1->0.9, 0.2->0.8
std::vector<float> mDCAr_comb_A_Median; ///< DCAr for ITS-TPC track - A-side
std::vector<float> mDCAz_comb_A_Median; ///< DCAz for ITS-TPC track - A-side
std::vector<float> mDCAr_comb_A_RMS; ///< DCAr RMS for ITS-TPC track - A-side
std::vector<float> mDCAz_comb_A_RMS; ///< DCAz RMS for ITS-TPC track - A-side
std::vector<float> mDCAr_comb_C_Median; ///< DCAr for ITS-TPC track - C-side
std::vector<float> mDCAz_comb_C_Median; ///< DCAz for ITS-TPC track - C-side
std::vector<float> mDCAr_comb_C_RMS; ///< DCAr RMS for ITS-TPC track - C-side
std::vector<float> mDCAz_comb_C_RMS; ///< DCAz RMS for ITS-TPC track - C-side
std::vector<float> mITS_A_NCl_Median; ///< its number of clusters
std::vector<float> mITS_A_NCl_RMS; ///< its number of clusters
std::vector<float> mITS_C_NCl_Median; ///< its number of clusters
std::vector<float> mITS_C_NCl_RMS; ///< its number of clusters
std::vector<float> mSqrtITSChi2_Ncl_A_Median; ///< sqrt(ITC chi2 / ncl)
std::vector<float> mSqrtITSChi2_Ncl_C_Median; ///< sqrt(ITC chi2 / ncl)
std::vector<float> mSqrtITSChi2_Ncl_A_RMS; ///< sqrt(ITC chi2 / ncl)
std::vector<float> mSqrtITSChi2_Ncl_C_RMS; ///< sqrt(ITC chi2 / ncl)
std::vector<float> mITSTPCDeltaP2_A_Median; ///< track param TPC - track param ITS-TPC for param 2 - A-side
std::vector<float> mITSTPCDeltaP3_A_Median; ///< track param TPC - track param ITS-TPC for param 3 - A-side
std::vector<float> mITSTPCDeltaP4_A_Median; ///< track param TPC - track param ITS-TPC for param 4 - A-side
std::vector<float> mITSTPCDeltaP2_C_Median; ///< track param TPC - track param ITS-TPC for param 2 - A-side
std::vector<float> mITSTPCDeltaP3_C_Median; ///< track param TPC - track param ITS-TPC for param 3 - A-side
std::vector<float> mITSTPCDeltaP4_C_Median; ///< track param TPC - track param ITS-TPC for param 4 - A-side
std::vector<float> mITSTPCDeltaP2_A_RMS; ///< RMS of track param TPC - track param ITS-TPC for param 2 - A-side
std::vector<float> mITSTPCDeltaP3_A_RMS; ///< RMS of track param TPC - track param ITS-TPC for param 3 - A-side
std::vector<float> mITSTPCDeltaP4_A_RMS; ///< RMS of track param TPC - track param ITS-TPC for param 4 - A-side
std::vector<float> mITSTPCDeltaP2_C_RMS; ///< RMS of track param TPC - track param ITS-TPC for param 2 - A-side
std::vector<float> mITSTPCDeltaP3_C_RMS; ///< RMS of track param TPC - track param ITS-TPC for param 3 - A-side
std::vector<float> mITSTPCDeltaP4_C_RMS; ///< RMS of track param TPC - track param ITS-TPC for param 4 - A-side
std::vector<float> mTPCSigmaY2A_Median; ///< sigmaY2 at vertex
std::vector<float> mTPCSigmaZ2A_Median; ///< sigmaZ2 at vertex
std::vector<float> mTPCSigmaY2C_Median; ///< sigmaY2 at vertex
std::vector<float> mTPCSigmaZ2C_Median; ///< sigmaZ2 at vertex
std::vector<float> mTPCSigmaY2A_RMS; ///< sigmaY2 RMS at vertex
std::vector<float> mTPCSigmaZ2A_RMS; ///< sigmaZ2 RMS at vertex
std::vector<float> mTPCSigmaY2C_RMS; ///< sigmaY2 RMS at vertex
std::vector<float> mTPCSigmaZ2C_RMS; ///< sigmaZ2 RMS at vertex
void setStartTime(long timeMS)
{
mTSTPC.setStartTime(timeMS);
mTSITSTPC.setStartTime(timeMS);
}
void setBinning(const int nBinsPhi, const int nBinsTgl, const int qPtBins, const int nBinsMult, float tglMax, float qPtMax, float multMax)
{
mTSTPC.mNBinsPhi = nBinsPhi;
mTSTPC.mNBinsTgl = nBinsTgl;
mTSTPC.mNBinsqPt = qPtBins;
mTSTPC.mMultBins = nBinsMult;
mTSTPC.mTglMax = tglMax;
mTSTPC.mQPtMax = qPtMax;
mTSTPC.mMultMax = multMax;
mTSITSTPC.mNBinsPhi = nBinsPhi;
mTSITSTPC.mNBinsTgl = nBinsTgl;
mTSITSTPC.mNBinsqPt = qPtBins;
mTSITSTPC.mMultBins = nBinsMult;
mTSITSTPC.mTglMax = tglMax;
mTSITSTPC.mQPtMax = qPtMax;
mTSITSTPC.mMultMax = multMax;
}
/// resize buffer for accumulated currents
void resize(const unsigned int nTotal)
{
mTSTPC.resize(nTotal);
mTSITSTPC.resize(nTotal);
mITSTPCAll.resize(nTotal);
mITSTPCStandalone.resize(nTotal);
mITSTPCAfterburner.resize(nTotal);
mdEdxQTot.resize(nTotal);
mdEdxQMax.resize(nTotal);
mDCAr_comb_A_Median.resize(nTotal);
mDCAz_comb_A_Median.resize(nTotal);
mDCAr_comb_A_RMS.resize(nTotal);
mDCAz_comb_A_RMS.resize(nTotal);
mDCAr_comb_C_Median.resize(nTotal);
mDCAz_comb_C_Median.resize(nTotal);
mDCAr_comb_C_RMS.resize(nTotal);
mDCAz_comb_C_RMS.resize(nTotal);
mITS_A_NCl_Median.resize(nTotal);
mITS_A_NCl_RMS.resize(nTotal);
mITS_C_NCl_Median.resize(nTotal);
mITS_C_NCl_RMS.resize(nTotal);
mSqrtITSChi2_Ncl_A_Median.resize(nTotal);
mSqrtITSChi2_Ncl_C_Median.resize(nTotal);
mSqrtITSChi2_Ncl_A_RMS.resize(nTotal);
mSqrtITSChi2_Ncl_C_RMS.resize(nTotal);
mITSTPCDeltaP2_A_Median.resize(nTotal);
mITSTPCDeltaP3_A_Median.resize(nTotal);
mITSTPCDeltaP4_A_Median.resize(nTotal);
mITSTPCDeltaP2_C_Median.resize(nTotal);
mITSTPCDeltaP3_C_Median.resize(nTotal);
mITSTPCDeltaP4_C_Median.resize(nTotal);
mITSTPCDeltaP2_A_RMS.resize(nTotal);
mITSTPCDeltaP3_A_RMS.resize(nTotal);
mITSTPCDeltaP4_A_RMS.resize(nTotal);
mITSTPCDeltaP2_C_RMS.resize(nTotal);
mITSTPCDeltaP3_C_RMS.resize(nTotal);
mITSTPCDeltaP4_C_RMS.resize(nTotal);
mTPCSigmaY2A_Median.resize(nTotal);
mTPCSigmaZ2A_Median.resize(nTotal);
mTPCSigmaY2C_Median.resize(nTotal);
mTPCSigmaZ2C_Median.resize(nTotal);
mTPCSigmaY2A_RMS.resize(nTotal);
mTPCSigmaZ2A_RMS.resize(nTotal);
mTPCSigmaY2C_RMS.resize(nTotal);
mTPCSigmaZ2C_RMS.resize(nTotal);
const int nTotalVtx = nTotal / mTSTPC.getNBins();
nPrimVertices.resize(nTotalVtx);
nPrimVertices_ITS.resize(nTotalVtx);
nVertexContributors_ITS_Median.resize(nTotalVtx);
nVertexContributors_ITS_RMS.resize(nTotalVtx);
vertexX_ITS_Median.resize(nTotalVtx);
vertexY_ITS_Median.resize(nTotalVtx);
vertexZ_ITS_Median.resize(nTotalVtx);
vertexX_ITS_RMS.resize(nTotalVtx);
vertexY_ITS_RMS.resize(nTotalVtx);
vertexZ_ITS_RMS.resize(nTotalVtx);
nPrimVertices_ITSTPC.resize(nTotalVtx);
nVertexContributors_ITSTPC_Median.resize(nTotalVtx);
nVertexContributors_ITSTPC_RMS.resize(nTotalVtx);
vertexX_ITSTPC_Median.resize(nTotalVtx);
vertexY_ITSTPC_Median.resize(nTotalVtx);
vertexZ_ITSTPC_Median.resize(nTotalVtx);
vertexX_ITSTPC_RMS.resize(nTotalVtx);
vertexY_ITSTPC_RMS.resize(nTotalVtx);
vertexZ_ITSTPC_RMS.resize(nTotalVtx);
const int nTotalQ = quantileValues * nTotal / mTSTPC.getNBins();
nVertexContributors_Quantiles.resize(nTotalQ);
}
ClassDefNV(TimeSeriesITSTPC, 6);
};
} // end namespace tpc
namespace fit
{
/// struct containing the integrated FT0 currents
struct IFT0C {
std::vector<float> mINChanA; ///< integrated 1D FIT currents for NChan A
std::vector<float> mINChanC; ///< integrated 1D FIT currents for NChan C
std::vector<float> mIAmplA; ///< integrated 1D FIT currents for Ampl A
std::vector<float> mIAmplC; ///< integrated 1D FIT currents for Ampl C
long mTimeMS{}; ///< start time in ms
bool areSameSize() const { return sameSize(mINChanA, mINChanC, mIAmplA, mIAmplC); } ///< check if stored currents have same number of entries
bool isEmpty() const { return mINChanA.empty(); } ///< check if values are empty
size_t getEntries() const { return mINChanA.size(); } ///< \return returns number of values stored
void setStartTime(long timeMS) { mTimeMS = timeMS; }
/// acummulate integrated currents at given index
/// \param posIndex index where data will be copied to
/// \param data integrated currents which will be copied
void fill(const unsigned int posIndex, const IFT0C& data)
{
std::copy(data.mINChanA.begin(), data.mINChanA.end(), mINChanA.begin() + posIndex);
std::copy(data.mINChanC.begin(), data.mINChanC.end(), mINChanC.begin() + posIndex);
std::copy(data.mIAmplA.begin(), data.mIAmplA.end(), mIAmplA.begin() + posIndex);
std::copy(data.mIAmplC.begin(), data.mIAmplC.end(), mIAmplC.begin() + posIndex);
}
/// \param nDummyValues number of empty values which are inserted at the beginning of the accumulated integrated currents
void insert(const unsigned int nDummyValues)
{
std::vector<float> vecTmp(nDummyValues, 0);
mINChanA.insert(mINChanA.begin(), vecTmp.begin(), vecTmp.end());
mINChanC.insert(mINChanC.begin(), vecTmp.begin(), vecTmp.end());
mIAmplA.insert(mIAmplA.begin(), vecTmp.begin(), vecTmp.end());
mIAmplC.insert(mIAmplC.begin(), vecTmp.begin(), vecTmp.end());
}
/// resize buffer for accumulated currents
void resize(const unsigned int nTotal)
{
mINChanA.resize(nTotal);
mINChanC.resize(nTotal);
mIAmplA.resize(nTotal);
mIAmplC.resize(nTotal);
}
/// reset buffered currents
void reset()
{
std::fill(mINChanA.begin(), mINChanA.end(), 0);
std::fill(mINChanC.begin(), mINChanC.end(), 0);
std::fill(mIAmplA.begin(), mIAmplA.end(), 0);
std::fill(mIAmplC.begin(), mIAmplC.end(), 0);
}
/// normalize currents
void normalize(const float factor)
{
std::transform(mINChanA.begin(), mINChanA.end(), mINChanA.begin(), [factor](const float val) { return val * factor; });
std::transform(mINChanC.begin(), mINChanC.end(), mINChanC.begin(), [factor](const float val) { return val * factor; });
std::transform(mIAmplA.begin(), mIAmplA.end(), mIAmplA.begin(), [factor](const float val) { return val * factor; });
std::transform(mIAmplC.begin(), mIAmplC.end(), mIAmplC.begin(), [factor](const float val) { return val * factor; });
}
ClassDefNV(IFT0C, 2);
};
/// struct containing the integrated FV0 currents
struct IFV0C {
std::vector<float> mINChanA; ///< integrated 1D FIT currents for NChan A
std::vector<float> mIAmplA; ///< integrated 1D FIT currents for Ampl A
long mTimeMS{}; ///< start time in ms
bool areSameSize() const { return sameSize(mINChanA, mIAmplA); } ///< check if stored currents have same number of entries
bool isEmpty() const { return mINChanA.empty(); } ///< check if values are empty
size_t getEntries() const { return mINChanA.size(); } ///< \return returns number of values stored
void setStartTime(long timeMS) { mTimeMS = timeMS; }
/// acummulate integrated currents at given index
/// \param posIndex index where data will be copied to
/// \param data integrated currents which will be copied
void fill(const unsigned int posIndex, const IFV0C& data)
{
std::copy(data.mINChanA.begin(), data.mINChanA.end(), mINChanA.begin() + posIndex);
std::copy(data.mIAmplA.begin(), data.mIAmplA.end(), mIAmplA.begin() + posIndex);
}
/// \param nDummyValues number of empty values which are inserted at the beginning of the accumulated integrated currents
void insert(const unsigned int nDummyValues)
{
std::vector<float> vecTmp(nDummyValues, 0);
mINChanA.insert(mINChanA.begin(), vecTmp.begin(), vecTmp.end());
mIAmplA.insert(mIAmplA.begin(), vecTmp.begin(), vecTmp.end());
}
/// resize buffer for accumulated currents
void resize(const unsigned int nTotal)
{
mINChanA.resize(nTotal);
mIAmplA.resize(nTotal);
}
/// reset buffered currents
void reset()
{
std::fill(mINChanA.begin(), mINChanA.end(), 0);
std::fill(mIAmplA.begin(), mIAmplA.end(), 0);
}
/// normalize currents
void normalize(const float factor)
{
std::transform(mINChanA.begin(), mINChanA.end(), mINChanA.begin(), [factor](const float val) { return val * factor; });
std::transform(mIAmplA.begin(), mIAmplA.end(), mIAmplA.begin(), [factor](const float val) { return val * factor; });
}
ClassDefNV(IFV0C, 2);
};
/// struct containing the integrated FDD currents
struct IFDDC {
std::vector<float> mINChanA; ///< integrated 1D FIT currents for NChan A
std::vector<float> mINChanC; ///< integrated 1D FIT currents for NChan C
std::vector<float> mIAmplA; ///< integrated 1D FIT currents for Ampl A
std::vector<float> mIAmplC; ///< integrated 1D FIT currents for Ampl C
long mTimeMS{}; ///< start time in ms
bool areSameSize() const { return sameSize(mINChanA, mINChanC, mIAmplA, mIAmplC); } ///< check if stored currents have same number of entries
bool isEmpty() const { return mINChanA.empty(); } ///< check if values are empty
size_t getEntries() const { return mINChanA.size(); } ///< \return returns number of values stored
void setStartTime(long timeMS) { mTimeMS = timeMS; }
/// acummulate integrated currents at given index
/// \param posIndex index where data will be copied to
/// \param data integrated currents which will be copied
void fill(const unsigned int posIndex, const IFDDC& data)
{
std::copy(data.mINChanA.begin(), data.mINChanA.end(), mINChanA.begin() + posIndex);
std::copy(data.mINChanC.begin(), data.mINChanC.end(), mINChanC.begin() + posIndex);
std::copy(data.mIAmplA.begin(), data.mIAmplA.end(), mIAmplA.begin() + posIndex);
std::copy(data.mIAmplC.begin(), data.mIAmplC.end(), mIAmplC.begin() + posIndex);
}
/// \param nDummyValues number of empty values which are inserted at the beginning of the accumulated integrated currents
void insert(const unsigned int nDummyValues)
{
std::vector<float> vecTmp(nDummyValues, 0);
mINChanA.insert(mINChanA.begin(), vecTmp.begin(), vecTmp.end());
mINChanC.insert(mINChanC.begin(), vecTmp.begin(), vecTmp.end());
mIAmplA.insert(mIAmplA.begin(), vecTmp.begin(), vecTmp.end());
mIAmplC.insert(mIAmplC.begin(), vecTmp.begin(), vecTmp.end());
}
/// resize buffer for accumulated currents
void resize(const unsigned int nTotal)
{
mINChanA.resize(nTotal);
mINChanC.resize(nTotal);
mIAmplA.resize(nTotal);
mIAmplC.resize(nTotal);
}
/// reset buffered currents
void reset()
{
std::fill(mINChanA.begin(), mINChanA.end(), 0);
std::fill(mINChanC.begin(), mINChanC.end(), 0);
std::fill(mIAmplA.begin(), mIAmplA.end(), 0);
std::fill(mIAmplC.begin(), mIAmplC.end(), 0);
}
/// normalize currents
void normalize(const float factor)
{
std::transform(mINChanA.begin(), mINChanA.end(), mINChanA.begin(), [factor](const float val) { return val * factor; });
std::transform(mINChanC.begin(), mINChanC.end(), mINChanC.begin(), [factor](const float val) { return val * factor; });
std::transform(mIAmplA.begin(), mIAmplA.end(), mIAmplA.begin(), [factor](const float val) { return val * factor; });
std::transform(mIAmplC.begin(), mIAmplC.end(), mIAmplC.begin(), [factor](const float val) { return val * factor; });
}
ClassDefNV(IFDDC, 2);
};
} // end namespace fit
} // end namespace o2
namespace o2
{
namespace calibration
{
/// class for accumulating integrated currents
template <typename DataT>
class IntegratedClusters
{
public:
/// \constructor
/// \param tFirst first TF of the stored currents
/// \param tLast last TF of the stored currents
IntegratedClusters(o2::calibration::TFType tFirst, o2::calibration::TFType tLast) : mTFFirst{tFirst}, mTFLast{tLast} {};
/// \default constructor for ROOT I/O
IntegratedClusters() = default;
/// print summary informations
void print() const { LOGP(info, "TF Range from {} to {} with {} of remaining data", mTFFirst, mTFLast, mRemainingData); }
/// accumulate currents for given TF
/// \param tfID TF ID of incoming data
/// \param currentsContainer container containing the currents for given detector for one TF for number of clusters
void fill(const o2::calibration::TFType tfID, const DataT& currentsContainer);
/// merging TOF currents with previous interval
void merge(const IntegratedClusters* prev);
/// \return always return true. To specify the number of time slot intervals to wait for one should use the --max-delay option
bool hasEnoughData() const { return (mRemainingData != -1); }
/// \return returns accumulated currents
const auto& getCurrents() const& { return mCurrents; }
/// \return returns accumulated currents using move semantics
auto getCurrents() && { return std::move(mCurrents); }
/// \param currents currents for given detector which will be set
void setCurrents(const DataT& currents) { mCurrents = currents; }
/// dump object to disc
/// \param outFileName name of the output file
/// \param outName name of the object in the output file
void dumpToFile(const char* outFileName = "IntegratedClusters.root", const char* outName = "IC") const;
/// dump object to TTree for visualisation
/// \param outFileName name of the output file
void dumpToTree(const char* outFileName = "ICTree.root");
/// setting the start time
void setStartTime(long timeMS) { mCurrents.setStartTime(timeMS); }
private:
DataT mCurrents; ///< buffer for integrated currents
o2::calibration::TFType mTFFirst{}; ///< first TF of currents
o2::calibration::TFType mTFLast{}; ///< last TF of currents
o2::calibration::TFType mRemainingData = -1; ///< counter for received data
unsigned int mNValuesPerTF{}; ///< number of expected currents per TF (estimated from first received data)
bool mInitialize{true}; ///< flag if this object will be initialized when fill method is called
/// init member when first data is received
/// \param valuesPerTF number of expected values per TF
void initData(const unsigned int valuesPerTF);
ClassDefNV(IntegratedClusters, 1);
};
template <typename DataT>
class IntegratedClusterCalibrator : public o2::calibration::TimeSlotCalibration<IntegratedClusters<DataT>>
{
using TFType = o2::calibration::TFType;
using Slot = o2::calibration::TimeSlot<IntegratedClusters<DataT>>;
using CalibVector = std::vector<DataT>;
using TFinterval = std::vector<std::pair<TFType, TFType>>;
using TimeInterval = std::vector<std::pair<long, long>>;
public:
/// default constructor
IntegratedClusterCalibrator() = default;
/// default destructor
~IntegratedClusterCalibrator() final = default;
/// check if given slot has already enough data
bool hasEnoughData(const Slot& slot) const final { return slot.getContainer()->hasEnoughData(); }
/// clearing all calibration objects in the output buffer
void initOutput() final;
/// storing the integrated currents for given slot
void finalizeSlot(Slot& slot) final;
/// Creates new time slot
Slot& emplaceNewSlot(bool front, TFType tstart, TFType tend) final;
/// \return CCDB output informations
const TFinterval& getTFinterval() const { return mIntervals; }
/// \return Time frame time information
const TimeInterval& getTimeIntervals() const { return mTimeIntervals; }
/// \return returns calibration objects (pad-by-pad gain maps)
auto getCalibs() && { return std::move(mCalibs); }
/// check if calibration data is available
bool hasCalibrationData() const { return mCalibs.size() > 0; }
/// set if debug objects will be created
void setDebug(const bool debug) { mDebug = debug; }
private:
TFinterval mIntervals; ///< start and end time frames of each calibration time slots
TimeInterval mTimeIntervals; ///< start and end times of each calibration time slots
CalibVector mCalibs; ///< Calibration object containing for each pad a histogram with normalized charge
bool mDebug{false}; ///< write debug output objects
ClassDefOverride(IntegratedClusterCalibrator, 1);
};
} // end namespace calibration
} // end namespace o2
#endif