ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
iFatras::HitCreatorTRT Class Reference

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

Private Attributes

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

◆ 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
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);
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 }

◆ 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 }

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.

◆ m_hitColl

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

the sim hit collection

Definition at line 75 of file HitCreatorTRT.h.

◆ m_incidentSvc

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

Definition at line 72 of file HitCreatorTRT.h.

◆ m_randomEngine

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

Random Engine.

Definition at line 81 of file HitCreatorTRT.h.

◆ 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.

◆ 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.

◆ m_trtIdHelper

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

TRT ID helper.

Definition at line 84 of file HitCreatorTRT.h.

◆ 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.

◆ 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.

◆ m_useConditionsSvc

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

Definition at line 87 of file HitCreatorTRT.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
iFatras::HitCreatorTRT::m_trtIdHelperName
StringProperty m_trtIdHelperName
where to find the SCT helper
Definition: HitCreatorTRT.h:83
Trk::Surface::associatedDetectorElement
const TrkDetElementBase * associatedDetectorElement() const
return associated Detector Element
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
hist_file_dump.d
d
Definition: hist_file_dump.py:137
Trk::Surface::associatedDetectorElementIdentifier
Identifier associatedDetectorElementIdentifier() const
return Identifier of the associated Detector Element
ALFA_EventTPCnv_Dict::t1
std::vector< ALFA_RawDataCollection_p1 > t1
Definition: ALFA_EventTPCnvDict.h:43
Trk::none
@ none
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:21
ISF::ISFParticle::pdgCode
int pdgCode() const
PDG value.
iFatras::HitCreatorTRT::m_useConditionsSvc
bool m_useConditionsSvc
Definition: HitCreatorTRT.h:87
Trk::TrkDetElementBase
Definition: TrkDetElementBase.h:52
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Trk::Surface::center
const Amg::Vector3D & center() const
Returns the center position of the Surface.
AtlasHitsVector::Emplace
void Emplace(Args &&... args)
Definition: AtlasHitsVector.h:81
TRT_ID::straw
int straw(const Identifier &id) const
Definition: TRT_ID.h:902
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
iFatras::HitCreatorTRT::m_randomEngineName
StringProperty m_randomEngineName
Name of the random number stream.
Definition: HitCreatorTRT.h:80
beamspotman.n
n
Definition: beamspotman.py:731
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
iFatras::HitCreatorTRT::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Definition: HitCreatorTRT.h:72
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
HepMC::uniqueID
int uniqueID(const T &p)
Definition: MagicNumbers.h:109
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::RealQuadraticEquation
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:52
TRTHitIdHelper::GetHelper
static const TRTHitIdHelper * GetHelper()
Definition: TRTHitIdHelper.cxx:13
AnalysisUtils::Delta::R
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
Definition: AnalysisMisc.h:49
TRT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: TRT_ID.h:866
TRT_ID::straw_layer
int straw_layer(const Identifier &id) const
Definition: TRT_ID.h:893
iFatras::HitCreatorTRT::m_randomSvc
ServiceHandle< IAtRndmGenSvc > m_randomSvc
Pointer to the random number generator service.
Definition: HitCreatorTRT.h:79
TRT_ID::layer_or_wheel
int layer_or_wheel(const Identifier &id) const
Definition: TRT_ID.h:884
iFatras::HitCreatorTRT::m_trtIdHelper
const TRT_ID * m_trtIdHelper
TRT ID helper.
Definition: HitCreatorTRT.h:84
iFatras::HitCreatorTRT::m_collectionName
StringProperty m_collectionName
name of the collection on storegate
Definition: HitCreatorTRT.h:76
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
Trk::Surface::bounds
virtual const SurfaceBounds & bounds() const =0
Surface Bounds method.
TRTHitIdHelper::buildHitId
int buildHitId(const int, const int, const int, const int, const int, const int) const
Definition: TRTHitIdHelper.cxx:72
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
TRT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: TRT_ID.h:875
iFatras::HitCreatorTRT::m_hitColl
TRTUncompressedHitCollection * m_hitColl
the sim hit collection
Definition: HitCreatorTRT.h:75
ALFA_EventTPCnv_Dict::t2
std::vector< ALFA_RawDataContainer_p1 > t2
Definition: ALFA_EventTPCnvDict.h:44
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
iFatras::HitCreatorTRT::m_randomEngine
CLHEP::HepRandomEngine * m_randomEngine
Random Engine.
Definition: HitCreatorTRT.h:81
unit
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
Definition: AmgMatrixBasePlugin.h:21
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
Trk::Surface::transform
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
TRTHitIdHelper
Definition: TRTHitIdHelper.h:25
iFatras::HitCreatorTRT::m_trtStatusSummaryTool
ToolHandle< ITRT_StrawStatusSummaryTool > m_trtStatusSummaryTool
Handle to TRT conditions service.
Definition: HitCreatorTRT.h:86
fitman.k
k
Definition: fitman.py:528
InDetDD::TRT_BaseElement
Definition: TRT_BaseElement.h:57
ISF::ISFParticle::mass
double mass() const
mass of the particle
Identifier
Definition: IdentifierFieldParser.cxx:14
Trk::SurfaceBounds::r
virtual double r() const =0
Interface method for the maximal extension or the radius.
TRTUncompressedHitCollection
AtlasHitsVector< TRTUncompressedHit > TRTUncompressedHitCollection
Definition: TRTUncompressedHitCollection.h:16