ATLAS Offline Software
Loading...
Searching...
No Matches
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, const InDetDD::TRT_DetElementContainer *detElements)
 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).
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.
bool msgLvl (const MSG::Level lvl) const
 Test the output level.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

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, const InDetDD::TRT_DetElementContainer *detElements)
 Time shift for barrel straws.
double calculateTimeShift_EndCap (const unsigned int &iPhi, const unsigned int &iWheel, const unsigned int &iLayer, const int strawID, const InDetDD::TRT_DetElementContainer *detElements)
 Time shift for end cap straws.
double calculateTimeShiftFromStrawEnds (const Amg::Vector3D &strawend1_globalcoord, const Amg::Vector3D &strawend2_globalcoord, const int strawID)
 Time shift from straw endpoints in global system.
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.
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.
void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

const TRTDigSettingsm_settings
const InDetDD::TRT_DetectorManagerm_detmgr
std::vector< std::vector< std::vector< double > > > m_timeShiftForEndCapPlanes
 Cached timeshifts.
std::vector< std::vector< std::vector< std::vector< double > > > > m_timeShiftForBarrelStraws
 Cached timeshifts.
std::vector< double > m_directDistsForEndCapWheels
 Cached distances.
std::vector< double > m_reflectedDistsForEndCapWheels
 Cached distances.
std::vector< std::vector< double > > m_directDistsForBarrelLayers
 Cached distances.
std::vector< std::vector< double > > m_reflectedDistsForBarrelLayers
 Cached distances.
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.
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.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels)
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging)

Detailed Description

Time correction.

Definition at line 27 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 23 of file TRTTimeCorrection.cxx.

27 : AthMessaging("TRTTimeCorrection"),
28 m_settings(digset), m_detmgr(detmgr), m_trt_id(trt_id),
29 m_subdetectorMask(0x00200000), m_right5Bits(0x0000001F),
30 m_shift5Bits(5), m_shift10Bits(10), m_shift15Bits(15), m_notInitVal(-999999.0), m_trtcaldbtool(calDbTool)
31{
32 Initialize();
33}
AthMessaging()
Default constructor:
const unsigned int m_subdetectorMask
const TRTDigSettings * m_settings
const TRT_ID * m_trt_id
const unsigned int m_shift10Bits
const double m_notInitVal
Value used to denote an uninitialized value.
const unsigned int m_right5Bits
const ITRT_CalDbTool * m_trtcaldbtool
const unsigned int m_shift5Bits
const unsigned int m_shift15Bits
const InDetDD::TRT_DetectorManager * m_detmgr

◆ ~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 337 of file TRTTimeCorrection.cxx.

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

◆ 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 360 of file TRTTimeCorrection.cxx.

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

◆ 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,
const InDetDD::TRT_DetElementContainer * detElements )
private

Time shift for barrel straws.

Definition at line 173 of file TRTTimeCorrection.cxx.

178 {
179
180 const InDetDD::TRT_BarrelElement * barrel_element(detElements->getBarrelDetElement(0/*positive*/,
181 iRing, iPhi, iLayer ));
182
183 //Sanity checks:
184 if (!barrel_element) {
185 ATH_MSG_ERROR("calculateTimeShift_Barrel: Could not get element for iRing = "
186 << iRing <<" and iLayer = "<<iLayer<<". Timeshift becomes 0.");
187 return 0.0;
188 }
189
190 if (iStraw >= barrel_element->nStraws()) {
191 ATH_MSG_ERROR("calculateTimeShift_Barrel: Trying to access iStraw "
192 << iStraw <<" in an element with "<<barrel_element->nStraws()<<" straws (iRing="
193 << iRing <<",iLayer="<<iLayer<<"). Timeshift becomes 0.");
194 return 0.0;
195 }
196
197 //Straw endpoints for the straw lying along the z-axis:
198 Amg::Vector3D strawend1(0,0, barrel_element->strawLength()*0.5 );
199 Amg::Vector3D strawend2(0,0, -(barrel_element->strawLength()*0.5) );
200
201 //And here put into their proper global place:
202 strawend1 = barrel_element->strawTransform(iStraw) * strawend1;
203 strawend2 = barrel_element->strawTransform(iStraw) * strawend2;
204
205 return calculateTimeShiftFromStrawEnds(strawend1,strawend2,strawID);
206
207}
#define ATH_MSG_ERROR(x)
const TRT_BarrelElement * getBarrelDetElement(unsigned int positive, unsigned int moduleIndex, unsigned int phiIndex, unsigned int strawLayerIndex) const
double calculateTimeShiftFromStrawEnds(const Amg::Vector3D &strawend1_globalcoord, const Amg::Vector3D &strawend2_globalcoord, const int strawID)
Time shift from straw endpoints in global system.
Eigen::Matrix< double, 3, 1 > Vector3D

◆ calculateTimeShift_EndCap()

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

Time shift for end cap straws.

Definition at line 210 of file TRTTimeCorrection.cxx.

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

◆ 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 239 of file TRTTimeCorrection.cxx.

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

◆ getIdentifier()

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

Definition at line 376 of file TRTTimeCorrection.cxx.

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

◆ Initialize()

void TRTTimeCorrection::Initialize ( )
private

Definition at line 40 of file TRTTimeCorrection.cxx.

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

◆ 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 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ 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 167 of file AthMessaging.h.

168{
169 MsgStream* ms = m_msg_tls.get();
170 if (!ms) {
171 if (!m_initialized.test_and_set()) initMessaging();
172 ms = new MsgStream(m_imsg,m_nm);
173 m_msg_tls.reset( ms );
174 }
175
176 ms->setLevel (m_lvl);
177 return *ms;
178}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
void initMessaging() const
Initialize our message level and MessageSvc.

◆ 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 182 of file AthMessaging.h.

183{ return msg() << lvl; }
MsgStream & msg() const
The standard message stream.

◆ 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 user did not set explicit message level we have to initialize
154 // the messaging and retrieve the default via the MessageSvc.
155 if (m_lvl==MSG::NIL && !m_initialized.test_and_set()) initMessaging();
156
157 if (m_lvl <= lvl) {
158 msg() << lvl;
159 return true;
160 } else {
161 return false;
162 }
163}

◆ 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 290 of file TRTTimeCorrection.cxx.

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

◆ 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,
const InDetDD::TRT_DetElementContainer * detElements )

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 97 of file TRTTimeCorrection.cxx.

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

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 109 of file TRTTimeCorrection.h.

◆ m_directDistsForBarrelLayers

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

Cached distances.

Definition at line 125 of file TRTTimeCorrection.h.

◆ m_directDistsForEndCapWheels

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

Cached distances.

Definition at line 121 of file TRTTimeCorrection.h.

◆ m_getT0FromData

bool TRTTimeCorrection::m_getT0FromData = false
private

Definition at line 144 of file TRTTimeCorrection.h.

◆ m_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_lengthDeadRegion

double TRTTimeCorrection::m_lengthDeadRegion = 0.0
private

Definition at line 141 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.

138{ MSG::NIL };

◆ m_maxVertexDisplacement

double TRTTimeCorrection::m_maxVertexDisplacement = 0.0
private

Definition at line 142 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 137 of file TRTTimeCorrection.h.

◆ m_reflectedDistsForBarrelLayers

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

Cached distances.

Definition at line 127 of file TRTTimeCorrection.h.

◆ m_reflectedDistsForEndCapWheels

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

Cached distances.

Definition at line 123 of file TRTTimeCorrection.h.

◆ m_right5Bits

const unsigned int TRTTimeCorrection::m_right5Bits
private

Definition at line 131 of file TRTTimeCorrection.h.

◆ m_settings

const TRTDigSettings* TRTTimeCorrection::m_settings
private

Definition at line 108 of file TRTTimeCorrection.h.

◆ m_shift10Bits

const unsigned int TRTTimeCorrection::m_shift10Bits
private

Definition at line 133 of file TRTTimeCorrection.h.

◆ m_shift15Bits

const unsigned int TRTTimeCorrection::m_shift15Bits
private

Definition at line 134 of file TRTTimeCorrection.h.

◆ m_shift5Bits

const unsigned int TRTTimeCorrection::m_shift5Bits
private

Definition at line 132 of file TRTTimeCorrection.h.

◆ m_signalPropagationSpeed

double TRTTimeCorrection::m_signalPropagationSpeed = 0.0
private

Definition at line 140 of file TRTTimeCorrection.h.

◆ m_subdetectorMask

const unsigned int TRTTimeCorrection::m_subdetectorMask
private

Definition at line 130 of file TRTTimeCorrection.h.

◆ m_timeShiftForBarrelStraws

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

Cached timeshifts.

Definition at line 118 of file TRTTimeCorrection.h.

◆ m_timeShiftForEndCapPlanes

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

Cached timeshifts.

Definition at line 115 of file TRTTimeCorrection.h.

◆ m_timeShiftPhiSectSymmetry

bool TRTTimeCorrection::m_timeShiftPhiSectSymmetry = false
private

Definition at line 143 of file TRTTimeCorrection.h.

◆ m_trt_id

const TRT_ID* TRTTimeCorrection::m_trt_id
protected

Definition at line 111 of file TRTTimeCorrection.h.

◆ m_trtcaldbtool

const ITRT_CalDbTool* TRTTimeCorrection::m_trtcaldbtool
private

Definition at line 146 of file TRTTimeCorrection.h.


The documentation for this class was generated from the following files: