59{
60 ATH_MSG_DEBUG(
"TRT_StrawNeighbourSvc initialize method called");
61
62 if (StatusCode::SUCCESS!=
m_detStore.retrieve()) {
64 return StatusCode::FAILURE;
65 }
66
67
69 msg(MSG::FATAL) <<
"Problem retrieving TRTID helper" <<
endmsg;
70 return StatusCode::FAILURE;
71 }
72
73
74 int chipConversionSocketToChip_m1[]={0,1,2,3,4,21,7,6,5,20,19,8,9,16,17,18,10,15,14,13,12,11};
76 int chipConversionChipToSocket_m1[] = {0,1,2,3,4,8,7,6,11,12,16,21,20,19,18,17,13,14,15,10,9,5};
78
79 int chipConversionSocketToChip_m2[] = {0,5,4,3,2,1,33,6,7,8,9,32,31,12,11,10,27,28,29,30,13,14,26,25,24,23,22,15,16,17,18,19,20,21};
81 int chipConversionChipToSocket_m2[] = {0,5,4,3,2,1,7,8,9,10,15,14,13,20,21,27,28,29,30,31,32,33,26,25,24,23,22,16,17,18,19,12,11,6};
83
84 int chipConversionSocketToChip_m3[] = {0,1,2,3,4,5,6,50,11,10,9,8,7,49,12,13,14,15,48,47,46,18,17,16,42,43,44,45,19,20,41,40,39,38,37,22,21,31,32,33,34,35,36,23,30,29,28,27,26,25,24};
86 int chipConversionChipToSocket_m3[] = {0,1,2,3,4,5,6,12,11,10,9,8,14,15,16,17,23,22,21,28,29,36,35,43,50,49,48,47,46,45,44,37,38,39,40,41,42,34,33,32,31,30,24,25,26,27,20,19,18,13,7};
88
89 if (1) {
90
91 int chipIndexToChipHardware_A0[] = {2, 1, 3, 0, 6, 5, 7, 4, 10, 9, 11, 8};
92 int chipIndexToChipHardware_A8[] = {8, 11, 9, 10, 4, 7, 5, 6, 0, 3, 1, 2};
93 int chipIndexToChipHardware_C0[] = {1, 2, 0, 3, 5, 6, 4, 7, 9, 10, 8, 11};
94 int chipIndexToChipHardware_C8[] = {11, 8, 10, 9, 7, 4, 6, 5, 3, 0, 2, 1};
96 int *chip_list[] = {chipIndexToChipHardware_A0, chipIndexToChipHardware_A8, chipIndexToChipHardware_C0, chipIndexToChipHardware_C8};
97 for (
int i=0;
i<4;
i++)
for (
int j=0; j<12; j++) map_list[i][j] = chip_list[i][j];
98 }
99
100
101
102
103
104 SmartIF<IRDBAccessSvc> iAccessSvc{service("RDBAccessSvc")};
105 if ( !iAccessSvc ) {
106 msg(MSG::FATAL) <<
"Could not initialize RDBAccessSvc!" <<
endmsg;
107 throw GaudiException("Could not initalize RDBAccessSvc","TRT_GeoModel",StatusCode::FAILURE);
108 }
109
110 SmartIF<IGeoModelSvc> geoModel{service("GeoModelSvc")};
111 if ( !geoModel ) {
112 msg(MSG::FATAL) <<
"Could not locate GeoModelSvc" <<
endmsg;
113 throw GaudiException("Could not locate GeoModelSvc","TRT_GeoModel",StatusCode::FAILURE);
114 }
115 DecodeVersionKey versionKey(geoModel, "TRT");
116 const std::string& detectorKey = versionKey.tag();
117 const std::string& detectorNode = versionKey.node();
118 IRDBRecordset_ptr RDB_TRTElec = iAccessSvc->getRecordsetPtr(
"TRTBarElecToStrawRel",detectorKey,detectorNode);
119
120 if (RDB_TRTElec->
size()==0) {
121 RDB_TRTElec = iAccessSvc->getRecordsetPtr("TRTBarElecToStrawRel","TRTBarElecToStrawRel-02");
122 msg(MSG::INFO) <<
"The folder: InnerDetector->TRT->TRTBarrel->TRTBarrelElectronics not found in DetDesc tag. Using hardcoded tag: TRTBarElecToStrawRel-02" <<
endmsg;
123 }
124
125
126
127
128 const int numberOfm1layers=19;
129 const int numberOfm2layers=24;
130 const int numberOfm3layers=30;
131
132 int layer_m1_array[numberOfm1layers]= {15,16,16,16,16,17,17,17,17,17,18,18,18,18,18,19,19,19,18};
133 int layer_m2_array[numberOfm2layers]= {19,20,20,20,20,20,21,21,21,21,21,22,22,22,22,22,23,23,23,23,23,24,24,23};
134 int layer_m3_array[numberOfm3layers]= {23,24,24,24,24,25,25,25,25,25,26,26,26,26,26,27,27,27,27,27,28,28,28,28,28,29,29,29,29,28};
135
138
139 for (i=0;
i<numberOfm1layers ;
i++){
141 acc +=layer_m1_array[
i];
143 }
144
146 for (i=0;
i<numberOfm2layers;
i++){
148 acc +=layer_m2_array[
i];
150 }
151
153 for (i=0;
i<numberOfm3layers;
i++){
155 acc +=layer_m3_array[
i];
157 }
158
159
160
161
163
164
166 int stnm=0, pad=0, previous_pad=1,
layer = 0, pad_rel_mod=0;
167 double chip=0.;
168
169 std::vector<std::vector<int> >
dummy1;
170 std::vector<int> dummy12;
171 std::vector<std::vector<int> >
dummy2;
173 std::vector<std::vector<int> >
dummy3;
174 std::vector<int> dummy32;
175
176 std::vector<std::vector<int> > dumdumdum1;
177 std::vector<std::vector<int> > dumdumdum2;
178 std::vector<std::vector<int> > dumdumdum3;
179 std::vector<int> dumdum ;
180 for (
unsigned int d =0;
d<=100;
d++ ) {
181 dumdumdum1.push_back(dumdum);
182 dumdumdum2.push_back(dumdum);
183 dumdumdum3.push_back(dumdum);
184 }
185
189
190
192 dummy12.clear();
193 while(layer == 0) {
194 const IRDBRecord* RDBVars__TRTElec = (*RDB_TRTElec)[
straw];
196 if (!(layer==0)) break;
197 stnm = RDBVars__TRTElec->
getInt(
"STRAWNUM");
198 pad = RDBVars__TRTElec->
getInt(
"HVPADRELSTRAW");
199 pad_rel_mod = RDBVars__TRTElec->
getInt(
"HVPADRELMOD");
200 m_m1.push_back(pad_rel_mod);
201 if (pad==previous_pad) dummy12.push_back(stnm);
202 else if (pad != previous_pad) {
203 previous_pad=pad;
204 dummy1.push_back(dummy12);
205 dummy12.clear();
206 dummy12.push_back(stnm);
207 }
208 chip=(RDBVars__TRTElec->
getDouble(
"CHIPRELSTRAW"));
210 (dumdumdum1[(
int)chip]).push_back(straw+1);
212 }
215
216
219 previous_pad=1;
220 while(layer == 1) {
221 const IRDBRecord* RDBVars__TRTElec = (*RDB_TRTElec)[
straw];
223 if (!(layer==1)) break;
224 stnm = RDBVars__TRTElec->
getInt(
"STRAWNUM");
225 pad = RDBVars__TRTElec->
getInt(
"HVPADRELSTRAW");
226 pad_rel_mod = RDBVars__TRTElec->
getInt(
"HVPADRELMOD");
227 m_m2.push_back(pad_rel_mod);
228 if (pad==previous_pad)
dummy22.push_back(stnm);
229 else if (pad != previous_pad) {
230 previous_pad=pad;
234 }
235 chip=(RDBVars__TRTElec->
getDouble(
"CHIPRELSTRAW"));
237 (dumdumdum2[(
int)chip]).push_back(straw+1-329);
239 }
242
243
244
246 dummy32.clear();
247 previous_pad=1;
248 while(layer == 2) {
249 if (straw>1641) break;
250 const IRDBRecord* RDBVars__TRTElec = (*RDB_TRTElec)[
straw];
252 if (!(layer==2)) break;
253 stnm = RDBVars__TRTElec->
getInt(
"STRAWNUM");
254 pad = RDBVars__TRTElec->
getInt(
"HVPADRELSTRAW");
255 pad_rel_mod = RDBVars__TRTElec->
getInt(
"HVPADRELMOD");
256 m_m3.push_back(pad_rel_mod);
257 if (pad==previous_pad) dummy32.push_back(stnm);
258 else if (pad != previous_pad) {
259 previous_pad=pad;
260 dummy3.push_back(dummy32);
261 dummy32.clear();
262 dummy32.push_back(stnm);
263 }
264 chip=(RDBVars__TRTElec->
getDouble(
"CHIPRELSTRAW"));
266 (dumdumdum3[(
int)chip]).push_back(straw+1-329-520);
268
269 }
272
273
274
276 if (!((
m_m1.size()==330)&&(
m_m2.size()==521)&&(
m_m3.size()==794) ))
ATH_MSG_WARNING(
"Initialization of TRT_StrawNeighbourTool incomplete. Depending on usage, this can give rise to runtime problems");
277
278
279
280 int numberOfStraws[75] = {0,
281 15,
282 16,16,16,16,
283 17,17,17,17,17,
284 18,18,18,18,18,
285 19,19,19,
286 18,
287 19,
288 20,20,20,20,20,
289 21,21,21,21,21,
290 22,22,22,22,22,
291 23,23,23,23,23,
292 24,24,
293 23,23,
294 24,24,24,24,
295 25,25,25,25,25,
296 26,26,26,26,26,
297 27,27,27,27,27,
298 28,28,28,28,28,
299 29,29,29,29,
300 28,
301 0};
303
304 int TripletOrientation[2][32] = {
305 {1,1,1,1,1,1,1,1,
306 0,0,0,0,0,0,0,0,
307 1,1,1,1,1,1,1,1,
308 0,0,0,0,0,0,0,0},
309 {1,1,1,1,1,1,1,1,
310 0,0,0,0,0,0,0,0,
311 1,1,1,1,1,1,1,1,
312 0,0,0,0,0,0,0,0}
313 };
314
315
316
317 for(int j=0; j<2; j++)
318 for(int jj=0; jj<32; jj++)
320
321
322 return StatusCode::SUCCESS;
323
324
325
326}
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
virtual double getDouble(const std::string &fieldName) const =0
Get double field value.
virtual unsigned int size() const =0
std::vector< unsigned int > m_layer_m3
std::vector< unsigned int > m_layer_m1
std::vector< unsigned int > m_layer_m2
int m_TripletOrientation[2][32]