ATLAS Offline Software
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
TRTTimeCorrection Class Reference

Time correction. More...

#include <TRTTimeCorrection.h>

Inheritance diagram for TRTTimeCorrection:
Collaboration diagram for TRTTimeCorrection:

Public Member Functions

 TRTTimeCorrection (const TRTDigSettings *digset, const InDetDD::TRT_DetectorManager *detmgr, const TRT_ID *, const ITRT_CalDbTool *)
 
 ~TRTTimeCorrection ()
 
double TimeShift (const int &strawID)
 Returns the time it would take to travel at light-speed from (0,0,0) to the farthest end of the wire (where the electronics are). More...
 
void PropagationTime (const int &strawID, const double &meanZ, double &propagationTime1, double &propagationTime2)
 Calculates the time between the signal reaching the wire and when it reaches the electronics. More...
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Protected Attributes

const TRT_IDm_trt_id
 

Private Member Functions

Identifier getIdentifier (int hitID, bool &statusok)
 
void Initialize ()
 
double calculateTimeShift_Barrel (const unsigned int &iPhi, const unsigned int &iRing, const unsigned int &iLayer, const unsigned int &iStraw, const int strawID)
 Time shift for barrel straws. More...
 
double calculateTimeShift_EndCap (const unsigned int &iPhi, const unsigned int &iWheel, const unsigned int &iLayer, const int strawID)
 Time shift for end cap straws. More...
 
double calculateTimeShiftFromStrawEnds (const Amg::Vector3D &strawend1_globalcoord, const Amg::Vector3D &strawend2_globalcoord, const int strawID)
 Time shift from straw endpoints in global system. More...
 
void calculateSignalDists_Barrel (const unsigned int &iRing, const unsigned int &iLayer, double &direct_dist, double &reflect_dist) const
 Calculate the distance along the wire the signal travels before reaching the electronics. More...
 
void calculateSignalDists_EndCap (const unsigned int &iWheel, double &direct_dist, double &reflect_dist) const
 Calculate the distance along the wire the signal travels before reaching the electronics. More...
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

const TRTDigSettingsm_settings
 
const InDetDD::TRT_DetectorManagerm_detmgr
 
std::vector< std::vector< std::vector< double > > > m_timeShiftForEndCapPlanes
 Cached timeshifts. More...
 
std::vector< std::vector< std::vector< std::vector< double > > > > m_timeShiftForBarrelStraws
 Cached timeshifts. More...
 
std::vector< double > m_directDistsForEndCapWheels
 Cached distances. More...
 
std::vector< double > m_reflectedDistsForEndCapWheels
 Cached distances. More...
 
std::vector< std::vector< double > > m_directDistsForBarrelLayers
 Cached distances. More...
 
std::vector< std::vector< double > > m_reflectedDistsForBarrelLayers
 Cached distances. More...
 
const unsigned int m_subdetectorMask
 
const unsigned int m_right5Bits
 
const unsigned int m_shift5Bits
 
const unsigned int m_shift10Bits
 
const unsigned int m_shift15Bits
 
const double m_notInitVal
 Value used to denote an uninitialized value. More...
 
double m_signalPropagationSpeed = 0.0
 
double m_lengthDeadRegion = 0.0
 
double m_maxVertexDisplacement = 0.0
 
bool m_timeShiftPhiSectSymmetry = false
 
bool m_getT0FromData = false
 
const ITRT_CalDbToolm_trtcaldbtool
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Time correction.

Definition at line 26 of file TRTTimeCorrection.h.

Constructor & Destructor Documentation

◆ TRTTimeCorrection()

TRTTimeCorrection::TRTTimeCorrection ( const TRTDigSettings digset,
const InDetDD::TRT_DetectorManager detmgr,
const TRT_ID trt_id,
const ITRT_CalDbTool calDbTool 
)

Definition at line 22 of file TRTTimeCorrection.cxx.

26  : AthMessaging("TRTTimeCorrection"),
27  m_settings(digset), m_detmgr(detmgr), m_trt_id(trt_id),
28  m_subdetectorMask(0x00200000), m_right5Bits(0x0000001F),
29  m_shift5Bits(5), m_shift10Bits(10), m_shift15Bits(15), m_notInitVal(-999999.0), m_trtcaldbtool(calDbTool)
30 {
31  Initialize();
32 }

◆ ~TRTTimeCorrection()

TRTTimeCorrection::~TRTTimeCorrection ( )
default

Member Function Documentation

◆ calculateSignalDists_Barrel()

void TRTTimeCorrection::calculateSignalDists_Barrel ( const unsigned int &  iRing,
const unsigned int &  iLayer,
double &  direct_dist,
double &  reflect_dist 
) const
private

Calculate the distance along the wire the signal travels before reaching the electronics.

Both the direct and reflected signal. The signal starts in the middle of the straw.

Definition at line 334 of file TRTTimeCorrection.cxx.

335  {
336 
337  //We need to calculate the distance along the wire that the signal
338  //has to travel before it reaches the electronics. Both if it goes
339  //directly to the electronics and if it goes via a reflection in the
340  //other end of the wire.
341  //
342  //The signal starts in the middle of the active region.
343  //
344  //In addition to the length of the active gas, the signal also has
345  //to go through the little dead region at the end.
346 
347  const InDetDD::TRT_BarrelElement * barrel_element(m_detmgr->getBarrelElement(0,//positive,
348  iRing,//moduleIndex,
349  0,//int phiIndex,
350  iLayer));//strawLayerIndex
351 
352  direct_dist = 0.5*barrel_element->strawLength() + m_lengthDeadRegion;
353  reflect_dist = 1.5*barrel_element->strawLength() + 3*m_lengthDeadRegion;
354 }

◆ calculateSignalDists_EndCap()

void TRTTimeCorrection::calculateSignalDists_EndCap ( const unsigned int &  iWheel,
double &  direct_dist,
double &  reflect_dist 
) const
private

Calculate the distance along the wire the signal travels before reaching the electronics.

Both the direct and reflected signal. The signal starts in the middle of the straw.

Definition at line 357 of file TRTTimeCorrection.cxx.

359  {
360 
361  //For an explanation, please read the comment in calculateSignalDists_Barrel
362 
363  const InDetDD::TRT_EndcapElement * ec_element(m_detmgr->getEndcapElement(0,//positive,
364  iWheel,//wheelIndex,
365  0,//strawLayerIndex,
366  0));//phiIndex
367 
368  direct_dist = 0.5*ec_element->strawLength() + m_lengthDeadRegion;
369  reflect_dist = 1.5*ec_element->strawLength() + 3*m_lengthDeadRegion;
370 }

◆ calculateTimeShift_Barrel()

double TRTTimeCorrection::calculateTimeShift_Barrel ( const unsigned int &  iPhi,
const unsigned int &  iRing,
const unsigned int &  iLayer,
const unsigned int &  iStraw,
const int  strawID 
)
private

Time shift for barrel straws.

Definition at line 172 of file TRTTimeCorrection.cxx.

176  {
177 
178  const InDetDD::TRT_BarrelElement * barrel_element(m_detmgr->getBarrelElement(0/*positive*/,
179  iRing, iPhi, iLayer ));
180 
181  //Sanity checks:
182  if (!barrel_element) {
183  ATH_MSG_ERROR("calculateTimeShift_Barrel: Could not get element for iRing = "
184  << iRing <<" and iLayer = "<<iLayer<<". Timeshift becomes 0.");
185  return 0.0;
186  }
187 
188  if (iStraw >= barrel_element->nStraws()) {
189  ATH_MSG_ERROR("calculateTimeShift_Barrel: Trying to access iStraw "
190  << iStraw <<" in an element with "<<barrel_element->nStraws()<<" straws (iRing="
191  << iRing <<",iLayer="<<iLayer<<"). Timeshift becomes 0.");
192  return 0.0;
193  }
194 
195  //Straw endpoints for the straw lying along the z-axis:
196  Amg::Vector3D strawend1(0,0, barrel_element->strawLength()*0.5 );
197  Amg::Vector3D strawend2(0,0, -(barrel_element->strawLength()*0.5) );
198 
199  //And here put into their proper global place:
200  strawend1 = barrel_element->strawTransform(iStraw) * strawend1;
201  strawend2 = barrel_element->strawTransform(iStraw) * strawend2;
202 
203  return calculateTimeShiftFromStrawEnds(strawend1,strawend2,strawID);
204 
205 }

◆ calculateTimeShift_EndCap()

double TRTTimeCorrection::calculateTimeShift_EndCap ( const unsigned int &  iPhi,
const unsigned int &  iWheel,
const unsigned int &  iLayer,
const int  strawID 
)
private

Time shift for end cap straws.

Definition at line 208 of file TRTTimeCorrection.cxx.

211  {
212 
213  const InDetDD::TRT_EndcapElement * ec_element(m_detmgr->getEndcapElement(0/*positive*/,
214  iWheel, iLayer, iPhi ));
215 
216  //Sanity check:
217  if (!ec_element) {
218  ATH_MSG_ERROR("calculateTimeShift_EndCap: Could not get element for iWheel = "
219  << iWheel <<" and iLayer = "<<iLayer<<". Timeshift becomes 0.");
220  return 0.0;
221  }
222 
223  //Straw endpoints for the straw lying along the z-axis:
224  Amg::Vector3D strawend1(0,0, ec_element->strawLength() * 0.5 );
225  Amg::Vector3D strawend2(0,0, ec_element->strawLength() * (-0.5) );
226 
227  //And here put into their proper global place:
228  strawend1 = ec_element->strawTransform(0) * strawend1;
229  strawend2 = ec_element->strawTransform(0) * strawend2;
230 
231  return calculateTimeShiftFromStrawEnds(strawend1,strawend2,strawID); //,m_lvl
232 
233 }

◆ calculateTimeShiftFromStrawEnds()

double TRTTimeCorrection::calculateTimeShiftFromStrawEnds ( const Amg::Vector3D strawend1_globalcoord,
const Amg::Vector3D strawend2_globalcoord,
const int  strawID 
)
private

Time shift from straw endpoints in global system.

Definition at line 236 of file TRTTimeCorrection.cxx.

238  {
239 
240  //The two (hopefully relevant) extreme points of the vertex region:
241  Amg::Vector3D vertexExtension1( m_settings->timeOffsetCalcVertexX(),
244  Amg::Vector3D vertexExtension2( m_settings->timeOffsetCalcVertexX(),
247 
248  //Minimum distance between vertex region and the straw ends:
249  // const double mindisttoend1(std::min(strawend1_globalcoord.distance(vertexExtension1),
250  // strawend1_globalcoord.distance(vertexExtension2)));
251  const double mindisttoend1(std::min((strawend1_globalcoord-vertexExtension1).mag(),
252  (strawend1_globalcoord-vertexExtension2).mag()));
253  // const double mindisttoend2(std::min(strawend2_globalcoord.distance(vertexExtension1),
254  // strawend2_globalcoord.distance(vertexExtension2)));
255  const double mindisttoend2(std::min((strawend2_globalcoord-vertexExtension1).mag(),
256  (strawend2_globalcoord-vertexExtension2).mag()));
257 
258  //Just a sanity check here:
259  if ( (mindisttoend2<mindisttoend1) == m_settings->electronicsAreAtFarEnd() ) {
260  ATH_MSG_WARNING("It would seem that the local z-coordinate of a test straw grows TOWARDS"
261  <<" the electronics ends. This will give trouble elsewhere!!");
262  }
263 
264  double shift = 1.0; // 1 ns (negative) overall shift for the whole TRT detector. Now set in stone.
265  // Used to be set with overallT0Shift() & overallT0ShiftShortBarrel()
266  // Note: if you change this then you need to set ToolSvc.InDetTRT_DriftFunctionTool.MCTuningShift
267 
268  if (m_settings->getT0FromData()) {
269  bool identifierOK;
270  const Identifier idStraw(getIdentifier(strawID, identifierOK));
271  if (identifierOK) {
272  shift = m_trtcaldbtool->getT0(idStraw);
273  } else {
274  ATH_MSG_ERROR("Attempt to use t0 from data failed: TRTCalDbSvc was not able to supply t0 for straw with identifier: "
275  << idStraw << ". Please set getT0FromData=false in jobOptions and run again");
276  }
277  }
278 
280  return std::max(mindisttoend1,mindisttoend2) / (m_settings->distanceToTimeFactor() * CLHEP::c_light) - shift;
281  else
282  return std::min(mindisttoend1,mindisttoend2) / (m_settings->distanceToTimeFactor() * CLHEP::c_light) - shift;
283 
284 }

◆ getIdentifier()

Identifier TRTTimeCorrection::getIdentifier ( int  hitID,
bool &  statusok 
)
private

Definition at line 373 of file TRTTimeCorrection.cxx.

375 {
376  statusok = true;
377 
378  Identifier IdStraw;
379  Identifier IdLayer;
380 
381  const int mask(0x0000001F);
382  const int word_shift(5);
383  int trtID, ringID, moduleID, layerID, strawID;
384  int wheelID, planeID, sectorID;
385 
386  const InDetDD::TRT_BarrelElement *barrelElement;
387  const InDetDD::TRT_EndcapElement *endcapElement;
388 
389  if ( !(hitID & 0x00200000) ) { // barrel
390  strawID = hitID & mask;
391  hitID >>= word_shift;
392  layerID = hitID & mask;
393  hitID >>= word_shift;
394  moduleID = hitID & mask;
395  hitID >>= word_shift;
396  ringID = hitID & mask;
397  trtID = hitID >> word_shift;
398 
399  barrelElement =
400  m_detmgr->getBarrelElement(trtID, ringID, moduleID, layerID);
401  if ( barrelElement ) {
402 
403  IdLayer = barrelElement->identify();
404  IdStraw = m_trt_id->straw_id(IdLayer, strawID);
405  } else {
406  ATH_MSG_ERROR("Could not find detector element for barrel identifier with "
407  << "(ipos,iring,imod,ilayer,istraw) = ("
408  << trtID << ", " << ringID << ", " << moduleID << ", "
409  << layerID << ", " << strawID << ")");
410  statusok = false;
411  }
412  } else { // endcap
413  strawID = hitID & mask;
414  hitID >>= word_shift;
415  planeID = hitID & mask;
416  hitID >>= word_shift;
417  sectorID = hitID & mask;
418  hitID >>= word_shift;
419  wheelID = hitID & mask;
420  trtID = hitID >> word_shift;
421 
422  // change trtID (which is 2/3 for endcaps) to use 0/1 in getEndcapElement
423  if (trtID == 3) trtID = 0;
424  else trtID = 1;
425 
426  endcapElement =
427  m_detmgr->getEndcapElement(trtID, wheelID, planeID, sectorID);
428 
429  if ( endcapElement ) {
430  IdLayer = endcapElement->identify();
431  IdStraw = m_trt_id->straw_id(IdLayer, strawID);
432  } else {
433  ATH_MSG_ERROR("Could not find detector element for endcap identifier with "
434  << "(ipos,iwheel,isector,iplane,istraw) = ("
435  << trtID << ", " << wheelID << ", " << sectorID << ", "
436  << planeID << ", " << strawID << ")");
437  ATH_MSG_ERROR("If this happens very rarely, don't be alarmed (it is a Geant4 'feature')");
438  ATH_MSG_ERROR("If it happens a lot, you probably have misconfigured geometry in the sim. job.");
439  statusok = false;
440  }
441 
442  }
443 
444  return IdStraw;
445 }

◆ Initialize()

void TRTTimeCorrection::Initialize ( )
private

Definition at line 39 of file TRTTimeCorrection.cxx.

39  {
40 
46 
47  if ( m_getT0FromData && !m_trtcaldbtool ) {
48  ATH_MSG_ERROR("Could not find TRT_CalDbTool => cannot use t0 of data.");
49  m_getT0FromData=false;
50  }
51 
52  const InDetDD::TRT_Numerology *numerology(m_detmgr->getNumerology());
53 
54  const unsigned int nbarrelphi(m_timeShiftPhiSectSymmetry ? 1 : numerology->getNBarrelPhi());
55  const unsigned int nendcapphi(m_timeShiftPhiSectSymmetry ? 1 : numerology->getNEndcapPhi());
56 
57  //Initialize barrel max timeshift arrays:
58  m_timeShiftForBarrelStraws.resize(nbarrelphi);
59  for (auto & timeShiftForBarrelStraw : m_timeShiftForBarrelStraws) {
60  timeShiftForBarrelStraw.resize(numerology->getNBarrelRings());
61  for (unsigned int iRing = 0; iRing < timeShiftForBarrelStraw.size(); ++iRing) {
62  timeShiftForBarrelStraw[iRing].resize(numerology->getNBarrelLayers(iRing));
63  for (unsigned int iLayer = 0; iLayer < timeShiftForBarrelStraw[iRing].size(); ++iLayer) {
64  if (m_detmgr->getBarrelElement(0,iRing,0,iLayer)) {
65  unsigned int nstraws_in_layer = m_detmgr->getBarrelElement(0,iRing,0,iLayer)->nStraws();
66  timeShiftForBarrelStraw[iRing][iLayer].assign(nstraws_in_layer,m_notInitVal);
67  }
68  }
69  }
70  }
71 
72  //Initialize endcap max timeshift arrays:
73  m_timeShiftForEndCapPlanes.resize(nendcapphi);
74  for (auto & timeShiftForEndCapPlane : m_timeShiftForEndCapPlanes) {
75  timeShiftForEndCapPlane.resize(numerology->getNEndcapWheels());
76  for (unsigned int iWheel = 0; iWheel < timeShiftForEndCapPlane.size(); ++iWheel) {
77  timeShiftForEndCapPlane[iWheel].assign(numerology->getNEndcapLayers(iWheel),m_notInitVal);
78  }
79  }
80 
81  //Initialize barrel direct/reflected distances array
82  m_directDistsForBarrelLayers.resize(numerology->getNBarrelRings());
83  m_reflectedDistsForBarrelLayers.resize(numerology->getNBarrelRings());
84  for (unsigned int iRing = 0; iRing < m_directDistsForBarrelLayers.size(); ++iRing) {
85  m_directDistsForBarrelLayers[iRing].assign(numerology->getNBarrelLayers(iRing),m_notInitVal);
86  m_reflectedDistsForBarrelLayers[iRing].assign(numerology->getNBarrelLayers(iRing),m_notInitVal);
87  };
88 
89  //Initialize endcap direct/reflected distances array
90  m_directDistsForEndCapWheels.assign(numerology->getNEndcapWheels(),m_notInitVal);
91  m_reflectedDistsForEndCapWheels.assign(numerology->getNEndcapWheels(),m_notInitVal);
92 
93 }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ PropagationTime()

void TRTTimeCorrection::PropagationTime ( const int &  strawID,
const double &  meanZ,
double &  propagationTime1,
double &  propagationTime2 
)

Calculates the time between the signal reaching the wire and when it reaches the electronics.

Result are two times: direct and reflected signal.

Parameters
strawIDstraw ID
meanZz coordinate of signal in straw local coordinates (z counted positive away from electronics)
propagationTime1propagation time - direct signal
propagationTime2propagation time - reflected signal

Definition at line 287 of file TRTTimeCorrection.cxx.

288  {
289 
290  double direct_distance, reflect_distance;
291 
292  if (strawID & m_subdetectorMask) {
293 
294  //===// EndCap //===//
295  const unsigned int iWheel((strawID >> m_shift15Bits) & m_right5Bits);
296  direct_distance = m_directDistsForEndCapWheels[iWheel];
297  reflect_distance = m_reflectedDistsForEndCapWheels[iWheel];
298 
299  if (direct_distance==m_notInitVal) {
300  //We need to initialize
301  calculateSignalDists_EndCap(iWheel,direct_distance,reflect_distance);
302  m_directDistsForEndCapWheels[iWheel] = direct_distance;
303  m_reflectedDistsForEndCapWheels[iWheel] = reflect_distance;
304  };
305 
306  //Z is counted positive AWAY from the electronics:
307  propagationTime1 = (direct_distance + meanZ) / m_signalPropagationSpeed;
308  propagationTime2 = (reflect_distance - meanZ) / m_signalPropagationSpeed;
309 
310  } else {
311 
312  //===// Barrel //===//
313  const unsigned int iRing((strawID >> m_shift15Bits) & m_right5Bits);
314  const unsigned int iLayer((strawID >> m_shift5Bits) & m_right5Bits);
315  direct_distance = m_directDistsForBarrelLayers[iRing][iLayer];
316  reflect_distance = m_reflectedDistsForBarrelLayers[iRing][iLayer];
317 
318  if (direct_distance==m_notInitVal) {
319  //We need to initialize
320  calculateSignalDists_Barrel(iRing,iLayer,direct_distance,reflect_distance);
321  m_directDistsForBarrelLayers[iRing][iLayer] = direct_distance;
322  m_reflectedDistsForBarrelLayers[iRing][iLayer] = reflect_distance;
323  };
324 
325  //Z is counted positive AWAY from the electronics:
326  propagationTime1 = (direct_distance + meanZ) / m_signalPropagationSpeed;
327  propagationTime2 = (reflect_distance - meanZ) / m_signalPropagationSpeed;
328 
329  }
330 
331  }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

◆ TimeShift()

double TRTTimeCorrection::TimeShift ( const int &  strawID)

Returns the time it would take to travel at light-speed from (0,0,0) to the farthest end of the wire (where the electronics are).

Parameters
strawIDstraw ID
Returns
time correction

Definition at line 96 of file TRTTimeCorrection.cxx.

96  {
97 
98  //TODO: Use hit id helpers (but resolve efficiency issues first).
99 
100  double timeshift=0.;
101 
102  //Layer and phi index are needed for both endcap and barrel:
103  const unsigned int iLayer((strawID >> m_shift5Bits) & m_right5Bits);
104  const unsigned int iPhi(m_timeShiftPhiSectSymmetry ? 0 : ( (strawID >> m_shift10Bits) & m_right5Bits ));
105 
106  if (strawID & m_subdetectorMask) {
107 
108  //===// EndCap //===//
109 
110  const unsigned int iWheel((strawID >> m_shift15Bits) & m_right5Bits);
111 
112  //Sanity check:
113  if (iPhi>=m_timeShiftForEndCapPlanes.size()||
114  iWheel>=m_timeShiftForEndCapPlanes[iPhi].size()||
115  iLayer>=m_timeShiftForEndCapPlanes[iPhi][iWheel].size()) {
117  ATH_MSG_ERROR("TimeCorrection::TimeShift: (iWheel,iLayer) = ("
118  << iWheel << ", " << iLayer << ") out of bounds! Returning 0.");
119  } else {
120  ATH_MSG_ERROR("TimeCorrection::TimeShift: (iPhi,iWheel,iLayer) = ("
121  << iPhi << ", " << iWheel << ", " << iLayer << ") out of bounds! Returning 0.");
122  }
123  return 0.0;
124  }
125 
126  timeshift = m_timeShiftForEndCapPlanes[iPhi][iWheel][iLayer];
127 
128  if (timeshift==m_notInitVal) {
129  //We need to initialize
130  timeshift = calculateTimeShift_EndCap(iPhi,iWheel,iLayer,strawID);
131  m_timeShiftForEndCapPlanes[iPhi][iWheel][iLayer] = timeshift;
132  }
133 
134  } else {
135 
136  //===// Barrel //===//
137 
138  const unsigned int iRing((strawID >> m_shift15Bits) & m_right5Bits);
139  const unsigned int iStraw(strawID & m_right5Bits);
140 
141  //Sanity check:
142  if (iPhi>=m_timeShiftForBarrelStraws.size()||
143  iRing>=m_timeShiftForBarrelStraws[iPhi].size()||
144  iLayer>=m_timeShiftForBarrelStraws[iPhi][iRing].size()||
145  iStraw>=m_timeShiftForBarrelStraws[iPhi][iRing][iLayer].size()) {
147  ATH_MSG_ERROR("TimeCorrection::TimeShift: (iRing,iLayer,iStraw) = ("
148  << iRing << ", " << iLayer << ", " << iStraw
149  << ") out of bounds! Returning 0.");
150  } else {
151  ATH_MSG_ERROR("TimeCorrection::TimeShift: (iPhi,iRing,iLayer,iStraw) = ("
152  << iPhi << ", " << iRing << ", " << iLayer << ", " << iStraw
153  << ") out of bounds! Returning 0.");
154  }
155  return 0.0;
156  }
157 
158  timeshift = m_timeShiftForBarrelStraws[iPhi][iRing][iLayer][iStraw];
159 
160  if (timeshift==m_notInitVal) {
161  //We need to initialize
162  timeshift = calculateTimeShift_Barrel(iPhi,iRing,iLayer,iStraw,strawID);
163  m_timeShiftForBarrelStraws[iPhi][iRing][iLayer][iStraw] = timeshift;
164  }
165 
166  }
167 
168  return timeshift;
169 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_detmgr

const InDetDD::TRT_DetectorManager* TRTTimeCorrection::m_detmgr
private

Definition at line 105 of file TRTTimeCorrection.h.

◆ m_directDistsForBarrelLayers

std::vector< std::vector<double> > TRTTimeCorrection::m_directDistsForBarrelLayers
private

Cached distances.

Definition at line 121 of file TRTTimeCorrection.h.

◆ m_directDistsForEndCapWheels

std::vector<double> TRTTimeCorrection::m_directDistsForEndCapWheels
private

Cached distances.

Definition at line 117 of file TRTTimeCorrection.h.

◆ m_getT0FromData

bool TRTTimeCorrection::m_getT0FromData = false
private

Definition at line 140 of file TRTTimeCorrection.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lengthDeadRegion

double TRTTimeCorrection::m_lengthDeadRegion = 0.0
private

Definition at line 137 of file TRTTimeCorrection.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_maxVertexDisplacement

double TRTTimeCorrection::m_maxVertexDisplacement = 0.0
private

Definition at line 138 of file TRTTimeCorrection.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_notInitVal

const double TRTTimeCorrection::m_notInitVal
private

Value used to denote an uninitialized value.

Definition at line 133 of file TRTTimeCorrection.h.

◆ m_reflectedDistsForBarrelLayers

std::vector< std::vector<double> > TRTTimeCorrection::m_reflectedDistsForBarrelLayers
private

Cached distances.

Definition at line 123 of file TRTTimeCorrection.h.

◆ m_reflectedDistsForEndCapWheels

std::vector<double> TRTTimeCorrection::m_reflectedDistsForEndCapWheels
private

Cached distances.

Definition at line 119 of file TRTTimeCorrection.h.

◆ m_right5Bits

const unsigned int TRTTimeCorrection::m_right5Bits
private

Definition at line 127 of file TRTTimeCorrection.h.

◆ m_settings

const TRTDigSettings* TRTTimeCorrection::m_settings
private

Definition at line 104 of file TRTTimeCorrection.h.

◆ m_shift10Bits

const unsigned int TRTTimeCorrection::m_shift10Bits
private

Definition at line 129 of file TRTTimeCorrection.h.

◆ m_shift15Bits

const unsigned int TRTTimeCorrection::m_shift15Bits
private

Definition at line 130 of file TRTTimeCorrection.h.

◆ m_shift5Bits

const unsigned int TRTTimeCorrection::m_shift5Bits
private

Definition at line 128 of file TRTTimeCorrection.h.

◆ m_signalPropagationSpeed

double TRTTimeCorrection::m_signalPropagationSpeed = 0.0
private

Definition at line 136 of file TRTTimeCorrection.h.

◆ m_subdetectorMask

const unsigned int TRTTimeCorrection::m_subdetectorMask
private

Definition at line 126 of file TRTTimeCorrection.h.

◆ m_timeShiftForBarrelStraws

std::vector< std::vector< std::vector< std::vector<double> > > > TRTTimeCorrection::m_timeShiftForBarrelStraws
private

Cached timeshifts.

Definition at line 114 of file TRTTimeCorrection.h.

◆ m_timeShiftForEndCapPlanes

std::vector< std::vector< std::vector<double> > > TRTTimeCorrection::m_timeShiftForEndCapPlanes
private

Cached timeshifts.

Definition at line 111 of file TRTTimeCorrection.h.

◆ m_timeShiftPhiSectSymmetry

bool TRTTimeCorrection::m_timeShiftPhiSectSymmetry = false
private

Definition at line 139 of file TRTTimeCorrection.h.

◆ m_trt_id

const TRT_ID* TRTTimeCorrection::m_trt_id
protected

Definition at line 107 of file TRTTimeCorrection.h.

◆ m_trtcaldbtool

const ITRT_CalDbTool* TRTTimeCorrection::m_trtcaldbtool
private

Definition at line 142 of file TRTTimeCorrection.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
TRTTimeCorrection::m_maxVertexDisplacement
double m_maxVertexDisplacement
Definition: TRTTimeCorrection.h:138
TRTTimeCorrection::m_subdetectorMask
const unsigned int m_subdetectorMask
Definition: TRTTimeCorrection.h:126
TRTDigSettings::getT0FromData
bool getT0FromData() const
TRTTimeCorrection::m_signalPropagationSpeed
double m_signalPropagationSpeed
Definition: TRTTimeCorrection.h:136
TRTDigSettings::timeOffsetCalcVertexZ
double timeOffsetCalcVertexZ() const
Get x value of point where particles are assumed to originate.
TRTTimeCorrection::m_trt_id
const TRT_ID * m_trt_id
Definition: TRTTimeCorrection.h:107
InDetDD::TRT_BarrelElement
Definition: TRT_BarrelElement.h:44
TRTTimeCorrection::m_detmgr
const InDetDD::TRT_DetectorManager * m_detmgr
Definition: TRTTimeCorrection.h:105
max
#define max(a, b)
Definition: cfImp.cxx:41
TRTTimeCorrection::calculateTimeShift_Barrel
double calculateTimeShift_Barrel(const unsigned int &iPhi, const unsigned int &iRing, const unsigned int &iLayer, const unsigned int &iStraw, const int strawID)
Time shift for barrel straws.
Definition: TRTTimeCorrection.cxx:172
TRTTimeCorrection::m_lengthDeadRegion
double m_lengthDeadRegion
Definition: TRTTimeCorrection.h:137
TRTTimeCorrection::calculateSignalDists_Barrel
void calculateSignalDists_Barrel(const unsigned int &iRing, const unsigned int &iLayer, double &direct_dist, double &reflect_dist) const
Calculate the distance along the wire the signal travels before reaching the electronics.
Definition: TRTTimeCorrection.cxx:334
TRTTimeCorrection::calculateTimeShiftFromStrawEnds
double calculateTimeShiftFromStrawEnds(const Amg::Vector3D &strawend1_globalcoord, const Amg::Vector3D &strawend2_globalcoord, const int strawID)
Time shift from straw endpoints in global system.
Definition: TRTTimeCorrection.cxx:236
InDetDD::TRT_DetectorManager::getBarrelElement
const TRT_BarrelElement * getBarrelElement(unsigned int positive, unsigned int moduleIndex, unsigned int phiIndex, unsigned int strawLayerIndex) const
Access Barrel Elements:---------------—(Fast)-------------------------—.
Definition: TRT_DetectorManager.cxx:113
TRTTimeCorrection::m_right5Bits
const unsigned int m_right5Bits
Definition: TRTTimeCorrection.h:127
TRTDigSettings::timeshiftsSymmetricForPhiSectors
bool timeshiftsSymmetricForPhiSectors() const
Query whether time offsets are assumed to be symmetric in phi.
InDetDD::TRT_BaseElement::nStraws
unsigned int nStraws() const
Number of straws in the element.
TRTDigSettings::lengthOfDeadRegion
double lengthOfDeadRegion() const
Get length of dead region at end of straws.
ITRT_CalDbTool::getT0
virtual float getT0(const Identifier &, int level=TRTCond::ExpandedIdentifier::STRAW) const =0
InDetDD::TRT_EndcapElement
Definition: TRT_EndcapElement.h:44
TRTTimeCorrection::m_shift15Bits
const unsigned int m_shift15Bits
Definition: TRTTimeCorrection.h:130
TRTTimeCorrection::m_getT0FromData
bool m_getT0FromData
Definition: TRTTimeCorrection.h:140
TRTTimeCorrection::m_directDistsForEndCapWheels
std::vector< double > m_directDistsForEndCapWheels
Cached distances.
Definition: TRTTimeCorrection.h:117
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
TRTTimeCorrection::m_timeShiftPhiSectSymmetry
bool m_timeShiftPhiSectSymmetry
Definition: TRTTimeCorrection.h:139
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
TRTTimeCorrection::m_timeShiftForEndCapPlanes
std::vector< std::vector< std::vector< double > > > m_timeShiftForEndCapPlanes
Cached timeshifts.
Definition: TRTTimeCorrection.h:111
TRTTimeCorrection::getIdentifier
Identifier getIdentifier(int hitID, bool &statusok)
Definition: TRTTimeCorrection.cxx:373
TRTTimeCorrection::m_shift10Bits
const unsigned int m_shift10Bits
Definition: TRTTimeCorrection.h:129
AthMessaging::AthMessaging
AthMessaging()
Default constructor:
InDetDD::TRT_DetectorManager::getNumerology
TRT_Numerology * getNumerology()
Access Numerological information:---------------------------------------—.
Definition: TRT_DetectorManager.cxx:56
InDetDD::TRT_Numerology
Definition: TRT_Numerology.h:22
TRTTimeCorrection::m_shift5Bits
const unsigned int m_shift5Bits
Definition: TRTTimeCorrection.h:128
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TRTTimeCorrection::m_reflectedDistsForEndCapWheels
std::vector< double > m_reflectedDistsForEndCapWheels
Cached distances.
Definition: TRTTimeCorrection.h:119
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
TRTDigSettings::timeOffsetCalcVertexX
double timeOffsetCalcVertexX() const
Get x value of point where particles are assumed to originate.
TRTTimeCorrection::m_settings
const TRTDigSettings * m_settings
Definition: TRTTimeCorrection.h:104
TRTTimeCorrection::m_reflectedDistsForBarrelLayers
std::vector< std::vector< double > > m_reflectedDistsForBarrelLayers
Cached distances.
Definition: TRTTimeCorrection.h:123
TRTTimeCorrection::m_directDistsForBarrelLayers
std::vector< std::vector< double > > m_directDistsForBarrelLayers
Cached distances.
Definition: TRTTimeCorrection.h:121
InDetDD::TRT_BaseElement::identify
virtual Identifier identify() const override final
identifier of this detector element:
TRTTimeCorrection::calculateTimeShift_EndCap
double calculateTimeShift_EndCap(const unsigned int &iPhi, const unsigned int &iWheel, const unsigned int &iLayer, const int strawID)
Time shift for end cap straws.
Definition: TRTTimeCorrection.cxx:208
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
min
#define min(a, b)
Definition: cfImp.cxx:40
TRTTimeCorrection::m_notInitVal
const double m_notInitVal
Value used to denote an uninitialized value.
Definition: TRTTimeCorrection.h:133
InDetDD::TRT_DetectorManager::getEndcapElement
const TRT_EndcapElement * getEndcapElement(unsigned int positive, unsigned int wheelIndex, unsigned int strawLayerIndex, unsigned int phiIndex) const
Access Endcap Elements:---------------—(Fast)--------------------------—.
Definition: TRT_DetectorManager.cxx:129
TRTTimeCorrection::m_timeShiftForBarrelStraws
std::vector< std::vector< std::vector< std::vector< double > > > > m_timeShiftForBarrelStraws
Cached timeshifts.
Definition: TRTTimeCorrection.h:114
TRTTimeCorrection::m_trtcaldbtool
const ITRT_CalDbTool * m_trtcaldbtool
Definition: TRTTimeCorrection.h:142
TRTDigSettings::electronicsAreAtFarEnd
bool electronicsAreAtFarEnd() const
Query whether electronics is assumed to be at far end of straw.
python.PhysicalConstants.c_light
float c_light
Definition: PhysicalConstants.py:63
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::iPhi
@ iPhi
Definition: ParamDefs.h:53
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
TRTTimeCorrection::Initialize
void Initialize()
Definition: TRTTimeCorrection.cxx:39
TRTDigSettings::maxVertexDisplacement
double maxVertexDisplacement() const
Get max vertex displacement.
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
TRTDigSettings::timeOffsetCalcVertexY
double timeOffsetCalcVertexY() const
Get y value of point where particles are assumed to originate.
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
TRTDigSettings::signalPropagationSpeed
double signalPropagationSpeed() const
Get wire signal propagation speed.
TRTDigSettings::distanceToTimeFactor
double distanceToTimeFactor() const
Get "distanceToTimeFactor" (fugde factor)
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:25
TRTTimeCorrection::calculateSignalDists_EndCap
void calculateSignalDists_EndCap(const unsigned int &iWheel, double &direct_dist, double &reflect_dist) const
Calculate the distance along the wire the signal travels before reaching the electronics.
Definition: TRTTimeCorrection.cxx:357
TRT_ID::straw_id
Identifier straw_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer, int straw) const
Three ways of getting id for a single straw:
Definition: TRT_ID.h:581