ATLAS Offline Software
Loading...
Searching...
No Matches
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
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 *=======================================================================*/
37iFatras::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 *=======================================================================*/
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 =====================================
66void 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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
std::vector< FPGATrackSimHit > hitVector
static const uint32_t nHits
The generic ISF particle definition,.
Definition ISFParticle.h:42
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
const TrkDetElementBase * associatedDetectorElement() const
return associated Detector Element
This is the base class for all tracking detector elements with read-out relevant information.
virtual Identifier identify() const =0
Identifier.
StatusCode initialize()
AlgTool initailize method.
SimHitCreatorID(const std::string &, const std::string &, const IInterface *)
Constructor.
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.
std::string m_idHelperName
Used to find out the sub-det from.
PublicToolHandle< iFatras::IHitCreator > m_pixelHitCreator
Cluster creator AlgTool.
const AtlasDetectorID * m_idHelper
PublicToolHandle< iFatras::IHitCreator > m_sctHitCreator
PublicToolHandle< iFatras::IHitCreator > m_trtHitCreator
ParametersBase< TrackParametersDim, Charged > TrackParameters