ATLAS Offline Software
SimHitCreatorID.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // class header
6 #include "SimHitCreatorID.h"
7 
8 // iFatras && ISF
10 // Tracking
15 #include "TrkTrack/Track.h"
16 #include "TrkTrack/TrackInfo.h"
19 //CLHEP
20 #include "CLHEP/Units/SystemOfUnits.h"
21 #include "CLHEP/Random/RandFlat.h"
22 #include "CLHEP/Random/RandGauss.h"
23 // Core
24 #include "StoreGate/StoreGateSvc.h"
27 // STL
28 #include <iomanip>
29 #include <sstream>
30 #include <iostream>
31 #include <math.h>
32 
33 /*=========================================================================
34  * DESCRIPTION OF FUNCTION:
35  * ==> see headerfile
36  *=======================================================================*/
37 iFatras::SimHitCreatorID::SimHitCreatorID(const std::string& t, const std::string& n, const IInterface* p)
38  : base_class(t,n,p)
39 {
40 }
41 
42 /*=========================================================================
43  * DESCRIPTION OF FUNCTION:
44  * ==> see headerfile
45  *=======================================================================*/
47 {}
48 
49 /*=========================================================================
50  * DESCRIPTION OF FUNCTION:
51  * ==> see headerfile
52  *=======================================================================*/
54 {
55  ATH_MSG_VERBOSE( "[ idhit ] initialize()" );
56  // Get Pixel / SCT / TRT hit creator tools
57  ATH_CHECK ( m_pixelHitCreator.retrieve( DisableTool(m_pixelHitCreator.empty()) ) );
58  ATH_CHECK ( m_sctHitCreator.retrieve( DisableTool(m_sctHitCreator.empty()) ) );
59  ATH_CHECK ( m_trtHitCreator.retrieve( DisableTool(m_trtHitCreator.empty()) ) );
60  // Get ID Helper from detector store
61  ATH_CHECK ( detStore()->retrieve(m_idHelper, m_idHelperName) );
62  return StatusCode::SUCCESS;
63 }
64 
65 //================ SimHit Creation Interface =====================================
66 void iFatras::SimHitCreatorID::createHits(const ISF::ISFParticle& isp, const std::vector<Trk::HitInfo>& hitVector) const {
67  // iterate and assign as well the layer
68  std::vector<Trk::HitInfo>::const_iterator plIter = hitVector.begin();
69  std::vector<Trk::HitInfo>::const_iterator plIterEnd = hitVector.end();
70  size_t nHits = 0;
71  for ( ; plIter != plIterEnd; ++plIter ){
72  // decide which HitCreator to take
73  // get the informations from the Simulation
74  const Trk::TrackParameters* hitParameter = (*plIter).trackParms.get();
75  double time = (*plIter).time;
76  // -------------------------------------------------------------------------
77  const Trk::TrkDetElementBase* hitDetElement = hitParameter->associatedSurface().associatedDetectorElement();
78 
79  // initialize an unvalid one
80  Identifier hitId = hitDetElement ? hitDetElement->identify() : Identifier();
81  if (m_idHelper->is_pixel(hitId)) {
82  // -----------------------------------------------------------------------
83  // HIT in Pixel Detector
84  // -----------------------------------------------------------------------
85  ATH_MSG_VERBOSE( "[ sim ] Creating Pixel Cluster" );
86  m_pixelHitCreator->createSimHit(isp,*hitParameter,time); ++nHits;
87  }
88  else if (m_idHelper->is_sct(hitId)) {
89  // -----------------------------------------------------------------------
90  // HIT in SCT Detector
91  // -----------------------------------------------------------------------
92  ATH_MSG_VERBOSE( "[ sim ] Creating SCT Cluster" );
93  m_sctHitCreator->createSimHit(isp,*hitParameter,time); ++nHits;
94  }
95  else if (m_idHelper->is_trt(hitId)) {
96  // -----------------------------------------------------------------------
97  // HIT in TRT Detector
98  // -----------------------------------------------------------------------
99  ATH_MSG_VERBOSE( "[ sim ] Creating TRT DriftCircle" );
100  m_trtHitCreator->createSimHit(isp,*hitParameter,time); ++nHits;
101  }
102  }
103  ATH_MSG_VERBOSE( "[ idtrack ] **** done, " << nHits << " hits created from this track." );
104 }
105 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TrkDetElementBase.h
Trk::Surface::associatedDetectorElement
const TrkDetElementBase * associatedDetectorElement() const
return associated Detector Element
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
MeasurementBase.h
iFatras::SimHitCreatorID::~SimHitCreatorID
~SimHitCreatorID()
Destructor.
Definition: SimHitCreatorID.cxx:46
Trk::ParametersBase::associatedSurface
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
hitVector
std::vector< FPGATrackSimHit > hitVector
Definition: FPGATrackSimCluster.h:23
ISF::ISFParticle
Definition: ISFParticle.h:42
FitQualityOnSurface.h
Trk::TrkDetElementBase
Definition: TrkDetElementBase.h:52
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
IdDictManager.h
Trk::TrkDetElementBase::identify
virtual Identifier identify() const =0
Identifier.
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
iFatras::SimHitCreatorID::createHits
void createHits(const ISF::ISFParticle &isp, const std::vector< Trk::HitInfo > &hits) const
Loop over the hits and call the hit creator, provide the ISF::StackParticle to register the hits.
Definition: SimHitCreatorID.cxx:66
Track.h
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
ISFParticle.h
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SimHitCreatorID.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::ParametersBase
Definition: ParametersBase.h:55
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
TrackInfo.h
RIO_OnTrack.h
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
iFatras::SimHitCreatorID::initialize
StatusCode initialize()
AlgTool initailize method.
Definition: SimHitCreatorID.cxx:53
iFatras::SimHitCreatorID::SimHitCreatorID
SimHitCreatorID(const std::string &, const std::string &, const IInterface *)
Constructor.
Definition: SimHitCreatorID.cxx:37
FitQuality.h
StoreGateSvc.h
TrackStateOnSurface.h