ATLAS Offline Software
Loading...
Searching...
No Matches
iFatras::HitCreatorTRT Class Reference

RIOOnTrack creation, starting from intersection on an active surface. More...

#include <HitCreatorTRT.h>

Inheritance diagram for iFatras::HitCreatorTRT:
Collaboration diagram for iFatras::HitCreatorTRT:

Public Member Functions

 HitCreatorTRT (const std::string &, const std::string &, const IInterface *)
 Constructor.
virtual ~HitCreatorTRT ()=default
 Destructor.
StatusCode initialize ()
 AlgTool initailize method.
void handle (const Incident &inc)
 handle for incident service
void createSimHit (const ISF::ISFParticle &isp, const Trk::TrackParameters &, double) const
 Record the hit.
const ParametersROTcreateHit (const ISF::ISFParticle &, const Trk::TrackParameters &) const
 Return the cluster on Track – the PrepRawData is contained in this one.
const std::vector< ParametersROT > * createHits (const ISF::ISFParticle &, const ParametersLayer &) const
 Return the cluster on Track – the PrepRawData is contained in this one.

Private Attributes

ServiceHandle< IIncidentSvc > m_incidentSvc {this, "IncidentService", "IncidentSvc"}
TRTUncompressedHitCollectionm_hitColl {}
 the sim hit collection
StringProperty m_collectionName {this, "CollectionName", "TRTUncompressedHits"}
 name of the collection on storegate
ServiceHandle< IAtRndmGenSvcm_randomSvc {this, "RandomNumberService", "AtDSFMTGenSvc"}
 Pointer to the random number generator service.
StringProperty m_randomEngineName {this, "RandomStreamName", "FatrasRnd"}
 Name of the random number stream.
CLHEP::HepRandomEngine * m_randomEngine {}
 Random Engine.
StringProperty m_trtIdHelperName {this, "TRT_IdHelperName", "TRT_ID"}
 where to find the SCT helper
const TRT_IDm_trtIdHelper {}
 TRT ID helper.
ToolHandle< ITRT_StrawStatusSummaryToolm_trtStatusSummaryTool {this, "StrawStatusSummaryTool", "TRT_StrawStatusSummaryTool"}
 Handle to TRT conditions service.
bool m_useConditionsSvc {false}

Detailed Description

RIOOnTrack creation, starting from intersection on an active surface.

Author
Andreas.Salzburger -at- cern.ch

Definition at line 44 of file HitCreatorTRT.h.

Constructor & Destructor Documentation

◆ HitCreatorTRT()

iFatras::HitCreatorTRT::HitCreatorTRT ( const std::string & t,
const std::string & n,
const IInterface * p )

Constructor.

Definition at line 36 of file HitCreatorTRT.cxx.

38 :
39 base_class(t,n,p)
40{
41}

◆ ~HitCreatorTRT()

virtual iFatras::HitCreatorTRT::~HitCreatorTRT ( )
virtualdefault

Destructor.

Member Function Documentation

◆ createHit()

const ParametersROT * iFatras::HitCreatorTRT::createHit ( const ISF::ISFParticle & ,
const Trk::TrackParameters &  ) const
inline

Return the cluster on Track – the PrepRawData is contained in this one.

Definition at line 64 of file HitCreatorTRT.h.

64{ return 0; };

◆ createHits()

const std::vector< ParametersROT > * iFatras::HitCreatorTRT::createHits ( const ISF::ISFParticle & ,
const ParametersLayer &  ) const
inline

Return the cluster on Track – the PrepRawData is contained in this one.

Definition at line 67 of file HitCreatorTRT.h.

67{ return 0; }

◆ createSimHit()

void iFatras::HitCreatorTRT::createSimHit ( const ISF::ISFParticle & isp,
const Trk::TrackParameters & pars,
double time ) const

Record the hit.

<

Todo
: fill information, decide which one is pre/post step point

Definition at line 92 of file HitCreatorTRT.cxx.

93{
94 // get surface and DetElement base
95 const Trk::Surface &hitSurface = pars.associatedSurface();
96 const Trk::TrkDetElementBase* detElementBase = hitSurface.associatedDetectorElement();
97 // the detector element cast -> needed
98 const InDetDD::TRT_BaseElement* hitTrtDetElement = dynamic_cast<const InDetDD::TRT_BaseElement*>((detElementBase));
99 //if cast fails, return 0
100 if ( !hitTrtDetElement ) return;
101 // checks for detector element and surface
102 if (hitTrtDetElement) {
103 // get the real identifier
104 Identifier hitId = hitSurface.associatedDetectorElementIdentifier();
105 // check conditions of the straw
106 if (m_useConditionsSvc && !m_trtStatusSummaryTool->get_status(hitId, Gaudi::Hive::currentContext()) ){
107 ATH_MSG_VERBOSE("[ trthit ] Straw is not active ( says ConditionsTool). Ignore. ");
108 return;
109 }
110 // create entry/exit point
111 const Amg::Vector3D& gpos1 = pars.position();
112 Amg::Vector3D gpos2 = gpos1 + pars.momentum().unit();
113 // get the rotation
114 const Amg::Transform3D& sTransform = hitSurface.transform();
115 // create the hep points
116 Amg::Vector3D lpoint1(sTransform.inverse() * gpos1);
117 Amg::Vector3D lpoint2(sTransform.inverse() * gpos2);
118
119 // new direction in 3D frame of cylinder
120 Amg::Vector3D direc((lpoint2 - lpoint1).unit());
121
122 // get line and circle constants
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();
126
127 // and solve the qaudratic equation
128 Trk::RealQuadraticEquation pquad(1 + k*k, 2*k*d, d*d - R*R);
129 if (pquad.solutions != Trk::none){
130 double t1 = (pquad.first - lpoint1.x())/direc.x();
131 double t2 = (pquad.second - lpoint1.x())/direc.x();
132 // the solutions in the 3D frame of the cylinder : local coordination
133 Amg::Vector3D sol1raw( (lpoint1 + t1 * direc) );
134 Amg::Vector3D sol2raw( (lpoint1 + t2 * direc) );
135
136 ATH_MSG_VERBOSE("[ trthit ] Straw center : " << hitSurface.center());
137 ATH_MSG_VERBOSE("[ trthit ] Entry / exit : " << sol1raw << ", " << sol2raw );
138
140 const double mass = isp.mass();
141 const double mom2 = pars.momentum().mag2();
142 const float kineticEnergy = sqrt(mom2+mass*mass)-mass;
143 const float energyDepositInKeV = 0.; // only used for TRT hits directly created by photons
144
145 int barrel_endcap = 0;
146 int ispos = 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;
152 default:
153 ATH_MSG_WARNING("[ trthit ] Problem estimating barrel_endcap and ispos" ); return;
154 }
155
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);
160
161 const TRTHitIdHelper* hitid_helper = TRTHitIdHelper::GetHelper();
162 const int hitID = hitid_helper->buildHitId( barrel_endcap, ispos, ringwheel, phisector,layer,istraw);
163
164 ATH_MSG_VERBOSE("[ trthit ] Add a TRTUncompressedHit hit to the collection. ");
165 // fill into the HitCollection
166 HepMcParticleLink partLink(HepMC::uniqueID(isp), 0,
169 m_hitColl->Emplace( hitID,
170 partLink,
171 isp.pdgCode(),
172 (float) kineticEnergy, (float) energyDepositInKeV,
173 (float) sol1raw.x(), (float) sol1raw.y(), sol1raw.z(),
174 (float) sol2raw.x(), (float) sol2raw.y(), sol2raw.z(),
175 (float) time );
176 }
177
178 }
179}
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
int pdgCode() const
PDG value.
double mass() const
mass of the particle
static const TRTHitIdHelper * GetHelper()
int buildHitId(const int, const int, const int, const int, const int, const int) const
virtual double r() const =0
Interface method for the maximal extension or the radius.
const TrkDetElementBase * associatedDetectorElement() const
return associated Detector Element
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
Identifier associatedDetectorElementIdentifier() const
return Identifier of the associated Detector Element
virtual const SurfaceBounds & bounds() const =0
Surface Bounds method.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
TRTUncompressedHitCollection * m_hitColl
the sim hit collection
const TRT_ID * m_trtIdHelper
TRT ID helper.
ToolHandle< ITRT_StrawStatusSummaryTool > m_trtStatusSummaryTool
Handle to TRT conditions service.
std::vector< ALFA_RawDataContainer_p1 > t2
std::vector< ALFA_RawDataCollection_p1 > t1
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
int uniqueID(const T &p)
@ layer
Definition HitInfo.h:79

◆ handle()

void iFatras::HitCreatorTRT::handle ( const Incident & inc)

handle for incident service

Definition at line 72 of file HitCreatorTRT.cxx.

72 {
73 // check the incident type
74 if ( inc.type() == IncidentType::BeginEvent ){
75 // check if the hit collection already contains:
76 // (a) if yes ... try to retrieve it
78 if ( (evtStore()->retrieve(m_hitColl , m_collectionName)).isFailure() )
79 ATH_MSG_ERROR( "[ --- ] Unable to retrieve TRTUncompressedHitCollection " << m_collectionName);
80 // (a) if no ... try to create it
81 } else {
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;
86 }
87 }
88 }
89 return;
90}
#define ATH_MSG_ERROR(x)
AtlasHitsVector< TRTUncompressedHit > TRTUncompressedHitCollection
StringProperty m_collectionName
name of the collection on storegate
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ initialize()

StatusCode iFatras::HitCreatorTRT::initialize ( )

AlgTool initailize method.

Definition at line 46 of file HitCreatorTRT.cxx.

47{
48 // Random number service
49 ATH_CHECK ( m_randomSvc.retrieve() );
50 //Get own engine with own seeds:
52 if (!m_randomEngine) {
53 ATH_MSG_ERROR( "[ --- ] Could not get random engine '" << m_randomEngineName << "'" );
54 return StatusCode::FAILURE;
55 }
56
57 // Tools & Services
58 ATH_CHECK ( m_trtStatusSummaryTool.retrieve( DisableTool{ !m_useConditionsSvc } ) );
59 // Get the TRT Identifier-helper:
61
62 // Athena/Gaudi framework
63 ATH_CHECK ( m_incidentSvc.retrieve() );
64 // register to the incident service: BeginEvent for TrackCollection
65 m_incidentSvc->addListener( this, IncidentType::BeginEvent );
66
67 ATH_MSG_VERBOSE( "[ trthit ] initialize() successful." );
68 return StatusCode::SUCCESS;
69}
#define ATH_CHECK
Evaluate an expression and check for errors.
ServiceHandle< IIncidentSvc > m_incidentSvc
ServiceHandle< IAtRndmGenSvc > m_randomSvc
Pointer to the random number generator service.
CLHEP::HepRandomEngine * m_randomEngine
Random Engine.
StringProperty m_trtIdHelperName
where to find the SCT helper
StringProperty m_randomEngineName
Name of the random number stream.

Member Data Documentation

◆ m_collectionName

StringProperty iFatras::HitCreatorTRT::m_collectionName {this, "CollectionName", "TRTUncompressedHits"}
private

name of the collection on storegate

Definition at line 76 of file HitCreatorTRT.h.

76{this, "CollectionName", "TRTUncompressedHits"};

◆ m_hitColl

TRTUncompressedHitCollection* iFatras::HitCreatorTRT::m_hitColl {}
private

the sim hit collection

Definition at line 75 of file HitCreatorTRT.h.

75{};

◆ m_incidentSvc

ServiceHandle<IIncidentSvc> iFatras::HitCreatorTRT::m_incidentSvc {this, "IncidentService", "IncidentSvc"}
private

Definition at line 72 of file HitCreatorTRT.h.

72{this, "IncidentService", "IncidentSvc"};

◆ m_randomEngine

CLHEP::HepRandomEngine* iFatras::HitCreatorTRT::m_randomEngine {}
private

Random Engine.

Definition at line 81 of file HitCreatorTRT.h.

81{};

◆ m_randomEngineName

StringProperty iFatras::HitCreatorTRT::m_randomEngineName {this, "RandomStreamName", "FatrasRnd"}
private

Name of the random number stream.

Definition at line 80 of file HitCreatorTRT.h.

80{this, "RandomStreamName", "FatrasRnd"};

◆ m_randomSvc

ServiceHandle<IAtRndmGenSvc> iFatras::HitCreatorTRT::m_randomSvc {this, "RandomNumberService", "AtDSFMTGenSvc"}
private

Pointer to the random number generator service.

Random Svc

Definition at line 79 of file HitCreatorTRT.h.

79{this, "RandomNumberService", "AtDSFMTGenSvc"};

◆ m_trtIdHelper

const TRT_ID* iFatras::HitCreatorTRT::m_trtIdHelper {}
private

TRT ID helper.

Definition at line 84 of file HitCreatorTRT.h.

84{};

◆ m_trtIdHelperName

StringProperty iFatras::HitCreatorTRT::m_trtIdHelperName {this, "TRT_IdHelperName", "TRT_ID"}
private

where to find the SCT helper

Definition at line 83 of file HitCreatorTRT.h.

83{this, "TRT_IdHelperName", "TRT_ID"};

◆ m_trtStatusSummaryTool

ToolHandle<ITRT_StrawStatusSummaryTool> iFatras::HitCreatorTRT::m_trtStatusSummaryTool {this, "StrawStatusSummaryTool", "TRT_StrawStatusSummaryTool"}
private

Handle to TRT conditions service.

Definition at line 86 of file HitCreatorTRT.h.

86{this, "StrawStatusSummaryTool", "TRT_StrawStatusSummaryTool"};

◆ m_useConditionsSvc

bool iFatras::HitCreatorTRT::m_useConditionsSvc {false}
private

Definition at line 87 of file HitCreatorTRT.h.

87{false};

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