Project
Loading...
Searching...
No Matches
testDigit.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
15
16#define BOOST_TEST_MODULE Test TRD_Digit
17#define BOOST_TEST_MAIN
18#define BOOST_TEST_DYN_LINK
19#include <boost/test/unit_test.hpp>
20#include <iostream>
21#include <numeric>
22
25
26namespace o2
27{
28namespace trd
29{
30
31using namespace o2::trd::constants;
32
33void testDigitDetRowPad(Digit& test, int det, int row, int pad)
34{
35 BOOST_CHECK(test.getPadCol() == pad);
36 BOOST_CHECK(test.getPadRow() == row);
37 BOOST_CHECK(test.getDetector() == det);
38}
39
40void testDigitDetROBMCM(Digit& test, int det, int rob, int mcm, int channel)
41{
42 BOOST_CHECK(test.getMCM() == mcm);
43 BOOST_CHECK(test.getROB() == rob);
44 BOOST_CHECK(test.getChannel() == channel);
45 BOOST_CHECK(test.getDetector() == det);
46}
47
49{
50 //TPD
51 //pg 14 for rob to chamber
52 //
53 // 540 read out chambers (detector)
54 // each one is made up of 16 row of 144 pads.
55 // each one is also made up of 8 or 6 read out boards comprising 16 mcm and 21 adc each.
56 // we need to check the pad,row to rob,mcm and back and the inverse holds true.
57 // also the boundaries hold true.ends, of readout boards, ends of mcm.
58 //
59 //check digit at bottom of row is correctly assigned.
60
61 // a pad row spans 2 read out boards. with 4 mcm in each.
62 // i.e. pad row 0 will have read out board 0 and 1 and mcm 0-4 and 0-4 in each making up the 8 mcm in the pad row.
63 // channel 0 and 1 of MCM n are shared with 18 and 19 (respectively) of MCM n+1 and channel 20 of MCM n is shared with MCM n-1 channel 2
64 // channel 20 of MCM n is connected to the preceding MCM's highest number pad. i.e. MCM01 channel 20 is connected to MCM00 pad 17 (18th pad) of row.
65
66 // so check various combinations of that, mostly just the boundaries.
67 Digit first(0, 0, 0); //det row pad
68 BOOST_CHECK(first.getMCM() == 0);
69
70 Digit last(MAXCHAMBER - 1, NROWC1 - 1, NCOLUMN - 1); // last det row and pad
71 BOOST_CHECK(last.getMCM() == NMCMROB - 1);
72 // end of first mcm
73 Digit a(0, 0, NCOLMCM - 1);
74 BOOST_CHECK(a.getMCM() == 0);
75 // start of new mcm?
76 Digit b(0, 0, NCOLMCM);
77 BOOST_CHECK(b.getMCM() == 1);
78 // last pad connected to start of new mcm?
79 Digit c(0, 0, 89);
80 BOOST_CHECK(c.getMCM() == 0);
81 // last pad connected to start of new mcm?
82 Digit d(0, 0, 90);
83 BOOST_CHECK(d.getMCM() == 1);
84 // now to test if we set the rob and mcm do we get the correct pad and row.
85 // using the reciprical of the values above for simplicity.
86 //
87 //test block 1.
88 Digit e(0, 0, 0, 0);
89 //first channel of the first mcm, this is in fact the 19 pad of the first row, and connected to the 18th adc of the second trap ...
90 Digit f(0, e.getPadRow(), e.getPadCol()); // createa digit based on the above digits pad and row.
91 // we *shoulud* end up with a rob:mcm of 0:1 and channel 18
92 testDigitDetROBMCM(f, 0, 0, 1, NCOLMCM);
93
94 Digit g(0, 0, NCOLMCM - 1); // row 0 pad 17 --- should be mcm 0 and channel 2
95 testDigitDetROBMCM(g, 0, 0, 0, 2);
96
97 Digit h(0, 0, 0, 2);
98 testDigitDetRowPad(h, 0, 0, NCOLMCM - 1);
99
100 //test block2 repeat block1 but at the edge of a rob boundary i.e. going from row0 the 72nd pad to 73rd. Spanning the half of 144(NCOLUMN)
101 Digit i(0, 0, (NCOLUMN / 2) - 1);
102 testDigitDetROBMCM(i, 0, 0, 3, 2);
103 //check the reverse creation
104 Digit k(0, 0, 3, 2);
105 testDigitDetRowPad(k, 0, 0, (NCOLUMN / 2) - 1);
106
107 Digit j(0, 0, NCOLUMN / 2);
108 testDigitDetROBMCM(j, 0, 1, 0, 19);
109 //check the reverse creation
110 Digit l(0, 1, 0, 19);
111 testDigitDetRowPad(l, 0, 0, NCOLUMN / 2);
112
113 // now repeat the same for another part of the first chamber, middle rows
114 //
115 Digit m(0, 12, (NCOLUMN / 2) - 1);
116 testDigitDetROBMCM(m, 0, 6, 3, 2);
117 //check the reverse creation
118 Digit n(0, 6, 3, 2);
119 testDigitDetRowPad(n, 0, 12, (NCOLUMN / 2) - 1);
120
121 Digit o(0, 12, NCOLMCM - 1);
122 testDigitDetROBMCM(o, 0, 6, 0, 2);
123 Digit p(0, 6, 0, 2);
124 testDigitDetRowPad(p, 0, 12, NCOLMCM - 1);
125
126 //and now for the last row.
127 Digit q(0, 15, (NCOLUMN / 2) - 1);
128 testDigitDetROBMCM(q, 0, 6, 15, 2);
129 //check the reverse creation
130 Digit r(0, 6, 3, 2);
131 testDigitDetRowPad(r, 0, 12, (NCOLUMN / 2) - 1);
132
133 Digit s(0, 15, NCOLMCM - 1);
134 testDigitDetROBMCM(s, 0, 6, 12, 2);
135 Digit t(0, 6, 0, 2);
136 testDigitDetRowPad(t, 0, 12, NCOLMCM - 1);
137
138 // as a last check that for detector changes.
139 //
140 Digit u(1, 15, (NCOLUMN / 2) - 1);
141 testDigitDetROBMCM(u, 1, 6, 15, 2);
142 //check the reverse creation
143 Digit v(1, 6, 3, 2);
144 testDigitDetRowPad(v, 1, 12, (NCOLUMN / 2) - 1);
145
146 Digit w(10, 15, NCOLMCM - 1);
147 testDigitDetROBMCM(w, 10, 6, 12, 2);
148 Digit x(10, 6, 0, 2);
149 testDigitDetRowPad(x, 10, 12, NCOLMCM - 1);
150
151 /*
152 * The below is left in, it helps to remove confusion when debugging
153 for(int rob=0;rob<8;rob++)for(int mcm=0;mcm<16;mcm++)for(int channel=0;channel<21;channel++){
154 std::cout << "Digit e(0,"<<rob<<"," << mcm <<","<< channel<<");" << std::endl;
155 Digit e(0,rob,mcm,channel);
156 std::cout << " e is " << e.getPadRow() << " " << e.getPadCol();
157 std::cout << " for an rob:mcm combo of " << e.getROB() << ":"<< e.getMCM() << " and adc channel:" << e.getChannel() <<std::endl;
158 std::cout << "Digit f(0,e.getPadRow(),e.getPadCol())" << std::endl;;
159 Digit f(0,e.getPadRow(),e.getPadCol());
160 std::cout << " f is " << f.getPadRow() << " " << f.getPadCol();
161 std::cout << " for an rob:mcm combo of " << f.getROB() << ":"<< f.getMCM() << " and adc channel:" << f.getChannel() <<std::endl;
162 std::cout << "*********************************************************************" << std::endl;
163 }
164 */
165
166 //now check that the timebins get correctly assigned on instantiation
168 std::iota(data.begin(), data.end(), 42); // 42 for my personal amusement.
169 Digit z(10, 15, NCOLMCM - 1, data);
170 testDigitDetROBMCM(z, 10, 6, 12, 2);
171 //test adc values are true.
172 BOOST_CHECK(z.getADC()[4] == 46); // 4th time bin should be 46;
173 BOOST_CHECK(z.getADC()[6] == 48); // 6th time bin should be 48;
174
175 Digit za(10, 6, 0, 2, data);
176 testDigitDetRowPad(za, 10, 12, NCOLMCM - 1);
177 BOOST_CHECK(za.getADC()[14] == 56); // 14th time bin should be 56;
178 BOOST_CHECK(za.getADC()[16] == 58); // 16th time bin should be 58;
179
180 // check the setting and reading of the phase for various combinations of setting the detector and phase.
181 Digit withphase(10, 6, 0, 2, data, 3);
182 BOOST_CHECK(withphase.getPreTrigPhase() == 0x3);
183 withphase.setPreTrigPhase(1);
184 BOOST_CHECK(withphase.getPreTrigPhase() == 0x1);
185 withphase.setDetector(12);
186 BOOST_CHECK(withphase.getPreTrigPhase() == 0x1);
187 BOOST_CHECK(withphase.getDetector() == 0xc);
188 withphase.setDetector(539);
189 BOOST_CHECK(withphase.getPreTrigPhase() == 0x1);
190 BOOST_CHECK(withphase.getDetector() == 539);
191 withphase.setDetector(12);
192 BOOST_CHECK(withphase.getPreTrigPhase() == 0x1);
193 BOOST_CHECK(withphase.getDetector() == 12);
194 withphase.setDetector(0);
195 BOOST_CHECK(withphase.getPreTrigPhase() == 0x1);
196 BOOST_CHECK(withphase.getDetector() == 0);
197 withphase.setPreTrigPhase(0);
198 BOOST_CHECK(withphase.getPreTrigPhase() == 0x0);
199 BOOST_CHECK(withphase.getDetector() == 0);
200}
201
202} // namespace trd
203} // namespace o2
uint16_t mcm
uint16_t rob
Global TRD definitions and constants.
int32_t i
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h trd
uint32_t j
Definition RawData.h:0
uint32_t c
Definition RawData.h:2
Class for time synchronization of RawReader instances.
int getPreTrigPhase() const
Definition Digit.h:89
int getDetector() const
Definition Digit.h:80
void setPreTrigPhase(int phase)
Definition Digit.cxx:59
ArrayADC const & getADC() const
Definition Digit.h:93
void setDetector(int det)
Definition Digit.h:74
GLboolean GLboolean g
Definition glcorearb.h:1233
GLdouble n
Definition glcorearb.h:1982
GLint GLenum GLint x
Definition glcorearb.h:403
const GLfloat * m
Definition glcorearb.h:4066
const GLdouble * v
Definition glcorearb.h:832
GLint first
Definition glcorearb.h:399
GLdouble f
Definition glcorearb.h:310
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLboolean r
Definition glcorearb.h:1233
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
GLubyte GLubyte GLubyte GLubyte w
Definition glcorearb.h:852
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
void testDigitDetRowPad(Digit &test, int det, int row, int pad)
Definition testDigit.cxx:33
void testDigitDetROBMCM(Digit &test, int det, int rob, int mcm, int channel)
Definition testDigit.cxx:40
std::array< ADC_t, constants::TIMEBINS > ArrayADC
Definition Digit.h:32
BOOST_AUTO_TEST_CASE(TRDDigit_test)
Definition testDigit.cxx:48
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
FIXME: do not use data model tables.
BOOST_CHECK(tree)
std::vector< int > row