16 #include "CLHEP/Units/SystemOfUnits.h"
42 return StatusCode::SUCCESS;
52 if( !
cabling.range( id_range ) ) {
59 if( !
manager.range( id_range ) ) {
69 if( !conditions.
range( id_range ) ) {
73 conditions_ptr = conditions.
cptr();
82 std::unique_ptr<RegSelSiLUT>
lut = std::make_unique<RegSelSiLUT>();
87 std::vector<Identifier>::const_iterator itr =
helper->module_begin();
88 std::vector<Identifier>::const_iterator idlast =
helper->module_end();
90 for ( ; itr!=idlast; ++itr ) {
95 helper->get_hash(Id, Idhash, &ModuleContext);
98 if (
helper->get_expanded_id( Id, exp_id, &ModuleContext)) {
99 ATH_MSG_DEBUG(
"Failed retrieving ExpandedIdentifier for PRD Identifier = " << Id.
getString() <<
". Skipping to the next PRD.");
102 if (conditions_ptr && !conditions_ptr->
isGood(Id)) {
106 int detid = ( exp_id[2]<0 ? -1 : 1 );
107 int layerid = exp_id[1]+1;
113 if (mdt1 ==
nullptr) {
131 Idv[0] =
helper->channelID(Id, 1, 1, 1);
132 Idv[1] =
helper->channelID(Id, 1, 1, ntubesl1);
133 Idv[2] =
helper->channelID(Id, 2, ntlay, 1);
134 Idv[3] =
helper->channelID(Id, 2, ntlay, ntubesl2);
139 double rmin = 99999999.;
140 double rmax = -99999999.;
141 double zmin = 99999999.;
142 double zmax = -99999999.;
143 double emin = 99999999.;
144 double emax = -99999999.;
145 double phimin = 999999.;
146 double phimax = -999999.;
160 for (
int i=0;
i<4;
i++) {
164 if (
i<2 ) mdt = mdt1;
166 if (mdt ==
nullptr) {
169 Idv[2] =
helper->channelID(Id, 1, ntlay, 1);
170 mdt =
manager->getMdtReadoutElement(Idv[2]);
173 Idv[3] =
helper->channelID(Id, 1, ntlay, ntubesl1);
174 mdt =
manager->getMdtReadoutElement(Idv[3]);
188 double scaleMin = (mdtPos.perp()-tubePitch/2.)/mdtPos.perp();
189 double scalePlus = (mdtPos.perp()+tubePitch/2.)/mdtPos.perp();
196 mdtPos1[2] = mdtPos.z()-tubePitch/2.;
197 mdtPos2[2] = mdtPos.z()+tubePitch/2.;
202 mdtPos2[2] = mdtPos2.z()+tubePitch/2.;
204 else if (zpos21 < -1.) {
206 mdtPos1[2] = mdtPos1.z()-tubePitch/2.;
210 mdtPos1[0] *= scaleMin;
211 mdtPos1[1] *= scaleMin;
212 mdtPos2[0] *= scaleMin;
213 mdtPos2[1] *= scaleMin;
218 mdtPos1[0] *= scalePlus;
219 mdtPos1[1] *= scalePlus;
220 mdtPos2[0] *= scalePlus;
221 mdtPos2[1] *= scalePlus;
229 mdtPos1[0] *= scaleMin;
230 mdtPos1[1] *= scaleMin;
231 mdtPos2[0] *= scalePlus;
232 mdtPos2[1] *= scalePlus;
237 scalePlus = (mdtPos2.perp()+tubePitch/2.)/mdtPos2.perp();
238 mdtPos2[0] *= scalePlus;
239 mdtPos2[1] *= scalePlus;
242 else if (zpos21 < -1.) {
243 scaleMin = (mdtPos1.perp()-tubePitch/2.)/mdtPos1.perp();
244 mdtPos1[0] *= scaleMin;
245 mdtPos1[1] *= scaleMin;
252 mdtPos1[2] = mdtPos.z()-tubePitch/2.;
253 mdtPos2[2] = mdtPos.z()-tubePitch/2.;
258 mdtPos1[2] = mdtPos.z()+tubePitch/2.;
259 mdtPos2[2] = mdtPos.z()+tubePitch/2.;
266 mdtPos1[2] = mdtPos.z()+tubePitch/2.;
267 mdtPos2[2] = mdtPos.z()+tubePitch/2.;
272 mdtPos1[2] = mdtPos.z()-tubePitch/2.;
273 mdtPos2[2] = mdtPos.z()-tubePitch/2.;
287 eminMod = mdtPos1.eta();
288 emaxMod = mdtPos2.eta();
290 zminMod = mdtPos1.z();
291 zmaxMod = mdtPos2.z();
293 rminMod = mdtPos1.perp();
294 rmaxMod = mdtPos2.perp();
296 dphi = atan2(mdt->
getSsize()/2., (mdtPos.perp()-tubePitch/2.));
300 eminMod = mdtPos2.eta();
301 emaxMod = mdtPos1.eta();
303 zminMod = mdtPos2.z();
304 zmaxMod = mdtPos1.z();
306 rminMod = mdtPos1.perp();
307 rmaxMod = mdtPos2.perp();
310 eminMod = mdtPos1.eta();
311 emaxMod = mdtPos2.eta();
313 zminMod = mdtPos1.z();
314 zmaxMod = mdtPos2.z();
316 rminMod = mdtPos1.perp();
317 rmaxMod = mdtPos2.perp();
320 dphi = atan2(mdt->
tubeLength(Idv[
i])/2., (mdtPos.perp()-tubePitch/2.));
323 double pminMod = mdtPos.phi() - dphi;
324 double pmaxMod = mdtPos.phi() + dphi;
326 if (zminMod <
zmin) {
330 if (zmaxMod >
zmax) {
334 if (pminMod < phimin) phimin = pminMod;
335 if (pmaxMod > phimax) phimax = pmaxMod;
336 if (eminMod < emin) emin = eminMod;
337 if (emaxMod > emax) emax = emaxMod;
338 if (rminMod < rmin) rmin = rminMod;
339 if (rmaxMod > rmax) rmax = rmaxMod;
345 if (phimin<0) phimin = phimin + 2*
M_PI;
346 if (phimax<0) phimax = phimax + 2*
M_PI;
352 if ( mdt1->
sideA() ) detid = 1;
353 else if ( mdt1->
sideC() ) detid = -1;
356 if ( mdt1->
sideA() ) detid = 2;
357 else if ( mdt1->
sideC() ) detid = -2;