9 #include "GaudiKernel/ISvcLocator.h"
30 #include "CLHEP/Units/PhysicalConstants.h"
31 #include "CLHEP/Random/RandFlat.h"
32 #include "CLHEP/Random/RandGauss.h"
33 #include "CLHEP/Random/RandLandau.h"
38 const IInterface*
p ) :
51 m_randomEngine = m_randomSvc->GetEngine(m_randomEngineName);
52 if (!m_randomEngine) {
53 ATH_MSG_ERROR(
"[ --- ] Could not get random engine '" << m_randomEngineName <<
"'" );
54 return StatusCode::FAILURE;
58 ATH_CHECK ( m_trtStatusSummaryTool.retrieve( DisableTool{ !m_useConditionsSvc } ) );
65 m_incidentSvc->addListener(
this, IncidentType::BeginEvent );
68 return StatusCode::SUCCESS;
74 if ( inc.type() == IncidentType::BeginEvent ){
77 if ( evtStore()->contains<TRTUncompressedHitCollection>(m_collectionName) ){
78 if ( (evtStore()->
retrieve(m_hitColl , m_collectionName)).isFailure() )
79 ATH_MSG_ERROR(
"[ --- ] Unable to retrieve TRTUncompressedHitCollection " << m_collectionName);
83 if ( (evtStore()->record(m_hitColl, m_collectionName,
true)).isFailure() ) {
84 ATH_MSG_ERROR(
"[ --- ] Unable to record TRTUncompressedHitCollection " << m_collectionName);
85 delete m_hitColl; m_hitColl=0;
100 if ( !hitTrtDetElement )
return;
102 if (hitTrtDetElement) {
106 if (m_useConditionsSvc && !m_trtStatusSummaryTool->get_status(hitId, Gaudi::Hive::currentContext()) ){
107 ATH_MSG_VERBOSE(
"[ trthit ] Straw is not active ( says ConditionsTool). Ignore. ");
123 double k = (direc.y())/(direc.x());
124 double d = (lpoint2.x()*lpoint1.y() - lpoint1.x()*lpoint2.y())/(direc.x());
125 double R = hitSurface.
bounds().
r();
130 double t1 = (pquad.
first - lpoint1.x())/direc.x();
131 double t2 = (pquad.
second - lpoint1.x())/direc.x();
137 ATH_MSG_VERBOSE(
"[ trthit ] Entry / exit : " << sol1raw <<
", " << sol2raw );
141 const double mom2 =
pars.momentum().mag2();
143 const float energyDepositInKeV = 0.;
145 int barrel_endcap = 0;
147 switch ( m_trtIdHelper->barrel_ec(hitId) ) {
148 case -2: barrel_endcap = 1; ispos = 1;
break;
149 case -1: barrel_endcap = 0; ispos = 0;
break;
150 case 1: barrel_endcap = 0; ispos = 1;
break;
151 case 2: barrel_endcap = 1; ispos = 0;
break;
153 ATH_MSG_WARNING(
"[ trthit ] Problem estimating barrel_endcap and ispos" );
return;
156 const int ringwheel = m_trtIdHelper->layer_or_wheel(hitId);
157 const int phisector = m_trtIdHelper->phi_module(hitId);
158 const int layer = m_trtIdHelper->straw_layer(hitId);
159 const int istraw = m_trtIdHelper->straw(hitId);
162 const int hitID = hitid_helper->
buildHitId( barrel_endcap, ispos, ringwheel, phisector,
layer,istraw);
164 ATH_MSG_VERBOSE(
"[ trthit ] Add a TRTUncompressedHit hit to the collection. ");
169 m_hitColl->Emplace( hitID,
172 (
float) kineticEnergy, (
float) energyDepositInKeV,
173 (
float) sol1raw.x(), (
float) sol1raw.y(), sol1raw.z(),
174 (
float) sol2raw.x(), (
float) sol2raw.y(), sol2raw.z(),