ATLAS Offline Software
TRTDigitizationTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRT_DIGITIZATION_TRTDIGITIZATIONTOOL_H
6 #define TRT_DIGITIZATION_TRTDIGITIZATIONTOOL_H
7 
16 #include "GaudiKernel/ServiceHandle.h"
17 #include "GaudiKernel/ToolHandle.h"
19 #include "ITRT_SimDriftTimeTool.h"
23 
26 #include "TRTDigit.h"
27 
28 // particle table
29 #include "HepPDT/ParticleDataTable.hh"
30 #include "GaudiKernel/IPartPropSvc.h"
31 
32 // For magneticfield
34 
38 #include "StoreGate/WriteHandle.h"
39 #include <vector>
40 #include <set>
41 #include <utility> /* pair */
42 
43 class TRT_ID;
46 class TRTDigCondBase;
47 class TRTNoise;
48 
49 namespace CLHEP{
50  class HepRandomEngine;
51 }
52 
54 class TRTUncompressedHit;
56 //class TRTUncompressedHitCollection;
57 namespace InDetDD {
58  class TRT_DetectorManager;
59 }
60 
61 class TRTDigSettings;
62 
63 class TRTDigitizationTool : virtual public IPileUpTool, public PileUpToolBase {
64 public:
65  TRTDigitizationTool( const std::string& type, const std::string& name, const IInterface* parent );
66 
69 
71  virtual StatusCode initialize() override final;
72 
74  virtual StatusCode finalize() override final;
75 
77  virtual StatusCode mergeEvent(const EventContext& ctx) override final;
78 
80  virtual StatusCode processBunchXing( int bunchXing,
81  SubEventIterator bSubEvents,
82  SubEventIterator eSubEvents ) override final;
85  // virtual bool toProcess(int bunchXing) const;
86 
87  virtual StatusCode prepareEvent( const EventContext& ctx, const unsigned int nInputEvents ) override final;
88 
96  virtual StatusCode processAllSubEvents(const EventContext& ctx) override final;
97 
98 private:
99  CLHEP::HepRandomEngine* getRandomEngine(const std::string& streamName, const EventContext& ctx) const;
100  CLHEP::HepRandomEngine* getRandomEngine(const std::string& streamName, unsigned long int randomSeedOffset, const EventContext& ctx) const;
101 
102  Identifier getIdentifier( int hitID,
103  IdentifierHash& hashId,
104  Identifier& layerID,
105  bool& statusok ) const;
106 
107  StatusCode lateInitialize(const EventContext& ctx);
108  StatusCode processStraws(const EventContext& ctx,
110  std::set<int>& sim_hitids,
111  std::set<Identifier>& simhitsIdentifiers,
112  CLHEP::HepRandomEngine *rndmEngine,
113  CLHEP::HepRandomEngine *strawRndmEngine,
114  CLHEP::HepRandomEngine *elecProcRndmEngine,
115  CLHEP::HepRandomEngine *elecNoiseRndmEngine,
116  CLHEP::HepRandomEngine *paiRndmEngine);
118 
119  static double getCosmicEventPhase(CLHEP::HepRandomEngine *rndmEngine);
120 
122  ToolHandle<ITRT_PAITool> m_TRTpaiToolXe{this, "PAI_Tool_Xe", "TRT_PAI_Process_Xe", "The PAI model for ionisation in the TRT Xe gas"};
123  ToolHandle<ITRT_PAITool> m_TRTpaiToolAr{this, "PAI_Tool_Ar", "TRT_PAI_Process_Ar", "The PAI model for ionisation in the TRT Ar gas"};
124  ToolHandle<ITRT_PAITool> m_TRTpaiToolKr{this, "PAI_Tool_Kr", "TRT_PAI_Process_Kr", "The PAI model for ionisation in the TRT Kr gas"};
125  ToolHandle<ITRT_SimDriftTimeTool> m_TRTsimdrifttimetool{this, "SimDriftTimeTool", "TRT_SimDriftTimeTool", "Drift time versus distance (r-t-relation) for TRT straws"};
126  ToolHandle<ITRT_StrawStatusSummaryTool> m_sumTool{this, "InDetTRTStrawStatusSummaryTool", "TRT_StrawStatusSummaryTool", ""};
127  ToolHandle<ITRT_CalDbTool> m_calDbTool{this, "InDetTRTCalDbTool", "TRT_CalDbTool", ""};
128  ServiceHandle<PileUpMergeSvc> m_mergeSvc{this, "MergeSvc", "PileUpMergeSvc", "Merge service"};
129  ServiceHandle<IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""};
130  ServiceHandle<ITRT_StrawNeighbourSvc> m_TRTStrawNeighbourSvc{this, "TRT_StrawNeighbourSvc", "TRT_StrawNeighbourSvc", ""};
131  // Read handle for conditions object to get the field cache
132  SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj",
133  "Name of the Magnetic Field conditions object key"};
134  Gaudi::Property<bool> m_onlyUseContainerName{this, "OnlyUseContainerName", true, "Don't use the ReadHandleKey directly. Just extract the container name from it."};
135  SG::ReadHandleKey<TRTUncompressedHitCollection> m_hitsContainerKey{this, "DataObjectName", "TRTUncompressedHits", "Data Object Name"};
136  std::string m_dataObjectName{""};
137  SG::WriteHandleKey<TRT_RDO_Container> m_outputRDOCollName{this,"OutputObjectName","TRT_RDOs","WHK Output Object name"};
138  SG::WriteHandleKey<InDetSimDataCollection> m_outputSDOCollName{this,"OutputSDOName","TRT_SDO_Map","WHK Output SDO container name"};
140 
141  Gaudi::Property<bool> m_printOverrideableSettings{this, "PrintOverrideableSettings", false, "Print overrideable settings"};
142  Gaudi::Property<bool> m_printUsedDigSettings{this, "PrintDigSettings", true, "Print ditigization settings"};
143  Gaudi::Property<int> m_HardScatterSplittingMode{this, "HardScatterSplittingMode", 0, ""};
144  Gaudi::Property<int> m_UseGasMix{this, "UseGasMix", 0, ""};
145  Gaudi::Property<unsigned long int> m_randomSeedOffset{this, "RandomSeedOffset", 678910, ""};
146 
148 
149  std::vector<std::pair<unsigned int, int> > m_seen;
150  std::vector<TRTDigit> m_vDigits;
155  //unsigned int m_timer_eventcount;
157  const TRT_ID* m_trt_id{};
158  std::vector<TRTUncompressedHitCollection*> m_trtHitCollList;
161  double m_minCrossingTimeSDO{0.0};
162  double m_maxCrossingTimeSDO{0.0};
163  double m_minpileuptruthEkin{0.0};
164  // const ComTime* m_ComTime{};
165  double m_cosmicEventPhase{0.0}; // local replacement for the comTime service
166 
168  ServiceHandle<IPartPropSvc> m_ppSvc{this, "PartPropSvc", "PartPropSvc"};
169  const HepPDT::ParticleDataTable* m_particleTable{};
170 
171  bool m_first_event{true};
172 
174 
175 };
176 
177 #endif
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
TRT_RDO_Container.h
TRTDigitizationTool::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number service.
Definition: TRTDigitizationTool.h:129
AtlasFieldCacheCondObj.h
TRTDigitizationTool::m_calDbTool
ToolHandle< ITRT_CalDbTool > m_calDbTool
Definition: TRTDigitizationTool.h:127
TRTDigitizationTool::m_vDigits
std::vector< TRTDigit > m_vDigits
Vector of all digits.
Definition: TRTDigitizationTool.h:150
TRTDigitizationTool::m_outputRDOCollName
SG::WriteHandleKey< TRT_RDO_Container > m_outputRDOCollName
name of the output RDOs.
Definition: TRTDigitizationTool.h:137
TRTDigitizationTool::processBunchXing
virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
called for each active bunch-crossing to process current SubEvents bunchXing is in ns
Definition: TRTDigitizationTool.cxx:180
TRTUncompressedHit
Definition: TRTUncompressedHit.h:11
TRTDigitizationTool::~TRTDigitizationTool
~TRTDigitizationTool()
Destructor.
Definition: TRTDigitizationTool.cxx:63
TRTElectronicsProcessing
Electronics Processing.
Definition: TRTElectronicsProcessing.h:23
TRTDigitizationTool::processStraws
StatusCode processStraws(const EventContext &ctx, TimedHitCollection< TRTUncompressedHit > &thpctrt, std::set< int > &sim_hitids, std::set< Identifier > &simhitsIdentifiers, CLHEP::HepRandomEngine *rndmEngine, CLHEP::HepRandomEngine *strawRndmEngine, CLHEP::HepRandomEngine *elecProcRndmEngine, CLHEP::HepRandomEngine *elecNoiseRndmEngine, CLHEP::HepRandomEngine *paiRndmEngine)
Definition: TRTDigitizationTool.cxx:309
TRTDigitizationTool::m_trtrdo_container
SG::WriteHandle< TRT_RDO_Container > m_trtrdo_container
Definition: TRTDigitizationTool.h:139
TRTDigitizationTool::m_seen
std::vector< std::pair< unsigned int, int > > m_seen
Definition: TRTDigitizationTool.h:149
TRTDigitizationTool::m_pNoise
TRTNoise * m_pNoise
Definition: TRTDigitizationTool.h:154
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
TRTDigitizationTool::m_settings
TRTDigSettings * m_settings
Definition: TRTDigitizationTool.h:147
TRTDigitizationTool::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: TRTDigitizationTool.h:132
TRTDigitizationTool::m_pDigConditions
TRTDigCondBase * m_pDigConditions
Definition: TRTDigitizationTool.h:153
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
TRTDigitizationTool::m_particleTable
const HepPDT::ParticleDataTable * m_particleTable
Definition: TRTDigitizationTool.h:169
TRTDigitizationTool::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Definition: TRTDigitizationTool.h:128
TRTDigitizationTool::m_randomSeedOffset
Gaudi::Property< unsigned long int > m_randomSeedOffset
Definition: TRTDigitizationTool.h:145
TRTDigitizationTool::m_manager
const InDetDD::TRT_DetectorManager * m_manager
Definition: TRTDigitizationTool.h:156
WriteHandle.h
Handle class for recording to StoreGate.
TRTDigitizationTool::getRandomEngine
CLHEP::HepRandomEngine * getRandomEngine(const std::string &streamName, const EventContext &ctx) const
Definition: TRTDigitizationTool.cxx:583
TRTDigitizationTool::createAndStoreRDOs
StatusCode createAndStoreRDOs()
Definition: TRTDigitizationTool.cxx:684
ITRT_PAITool.h
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
ITRT_StrawStatusSummaryTool.h
abstract interface to TRT straw status constants
TRTDigitizationTool::prepareEvent
virtual StatusCode prepareEvent(const EventContext &ctx, const unsigned int nInputEvents) override final
return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase...
Definition: TRTDigitizationTool.cxx:170
TRTDigitizationTool::m_TRTpaiToolAr
ToolHandle< ITRT_PAITool > m_TRTpaiToolAr
Definition: TRTDigitizationTool.h:123
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TRTDigitizationTool::m_minpileuptruthEkin
double m_minpileuptruthEkin
Definition: TRTDigitizationTool.h:163
TRTDigitizationTool::m_dataObjectName
std::string m_dataObjectName
Definition: TRTDigitizationTool.h:136
CLHEP
STD'S.
Definition: CaloNoiseCompCondAlg.h:58
TRTDigitizationTool::getCosmicEventPhase
static double getCosmicEventPhase(CLHEP::HepRandomEngine *rndmEngine)
Definition: TRTDigitizationTool.cxx:837
TRTDigitizationTool::m_UseGasMix
Gaudi::Property< int > m_UseGasMix
Definition: TRTDigitizationTool.h:144
TRTNoise
Simulation of noise hits in the TRT.
Definition: TRTNoise.h:39
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TimedHitCollection.h
TRTDigitizationTool::m_pProcessingOfStraw
TRTProcessingOfStraw * m_pProcessingOfStraw
Definition: TRTDigitizationTool.h:152
TRTDigitizationTool::m_printOverrideableSettings
Gaudi::Property< bool > m_printOverrideableSettings
Definition: TRTDigitizationTool.h:141
TRTDigitizationTool::m_sumTool
ToolHandle< ITRT_StrawStatusSummaryTool > m_sumTool
Definition: TRTDigitizationTool.h:126
ITRT_CalDbTool.h
abstract interface to TRT calibration constants
IPileUpTool
Definition: IPileUpTool.h:24
TRTDigitizationTool::m_TRTpaiToolKr
ToolHandle< ITRT_PAITool > m_TRTpaiToolKr
Definition: TRTDigitizationTool.h:124
TRTDigitizationTool::getIdentifier
Identifier getIdentifier(int hitID, IdentifierHash &hashId, Identifier &layerID, bool &statusok) const
Definition: TRTDigitizationTool.cxx:750
PileUpToolBase
Definition: PileUpToolBase.h:18
TRTProcessingOfStraw
TRT Digitization: Processing of a TRT Straws.
Definition: TRTProcessingOfStraw.h:54
TRTDigitizationTool::processAllSubEvents
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
Perform digitization:
Definition: TRTDigitizationTool.cxx:461
TRTDigitizationTool::m_HardScatterSplittingMode
Gaudi::Property< int > m_HardScatterSplittingMode
Definition: TRTDigitizationTool.h:143
ReadCondHandleKey.h
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
TRTDigitizationTool::TRTDigitizationTool
TRTDigitizationTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TRTDigitizationTool.cxx:53
WriteHiveWithMetaData.streamName
string streamName
Definition: WriteHiveWithMetaData.py:23
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
TRTDigitizationTool::m_TRTStrawNeighbourSvc
ServiceHandle< ITRT_StrawNeighbourSvc > m_TRTStrawNeighbourSvc
Definition: TRTDigitizationTool.h:130
TRTDigitizationTool::m_trtHitCollList
std::vector< TRTUncompressedHitCollection * > m_trtHitCollList
Definition: TRTDigitizationTool.h:158
TRTDigit.h
TRTDigitizationTool::lateInitialize
StatusCode lateInitialize(const EventContext &ctx)
Definition: TRTDigitizationTool.cxx:225
ITRT_StrawNeighbourSvc.h
Abstract interface to information on straws electronic grouping.
TRTDigitizationTool
Definition: TRTDigitizationTool.h:63
SG::ReadCondHandleKey< AtlasFieldCacheCondObj >
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
TRTDigitizationTool::m_trt_id
const TRT_ID * m_trt_id
TRT Id Helper.
Definition: TRTDigitizationTool.h:157
TRTDigitizationTool::m_TRTpaiToolXe
ToolHandle< ITRT_PAITool > m_TRTpaiToolXe
Configurable properties.
Definition: TRTDigitizationTool.h:122
TRT_ID
Definition: TRT_ID.h:82
TRTDigitizationTool::m_printUsedDigSettings
Gaudi::Property< bool > m_printUsedDigSettings
Definition: TRTDigitizationTool.h:142
InDetDD::TRT_DetectorManager
The Detector Manager for all TRT Detector elements, it acts as the interface to the detector elements...
Definition: TRT_DetectorManager.h:63
TRTUncompressedHitCollection.h
TRTDigitizationTool::m_pElectronicsProcessing
TRTElectronicsProcessing * m_pElectronicsProcessing
Definition: TRTDigitizationTool.h:151
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
TRTDigitizationTool::m_cosmicEventPhase
double m_cosmicEventPhase
Definition: TRTDigitizationTool.h:165
PileUpMergeSvc.h
the preferred mechanism to access information from the different event stores in a pileup job.
TRTDigitizationTool::initialize
virtual StatusCode initialize() override final
Initialize.
Definition: TRTDigitizationTool.cxx:76
TRTDigitizationTool::mergeEvent
virtual StatusCode mergeEvent(const EventContext &ctx) override final
called at the end of the subevts loop. Not (necessarily) able to access SubEvents
Definition: TRTDigitizationTool.cxx:602
InDetSimDataCollection.h
ITRT_SimDriftTimeTool.h
TRTDigitizationTool::m_maxCrossingTimeSDO
double m_maxCrossingTimeSDO
Definition: TRTDigitizationTool.h:162
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
TRTDigitizationTool::finalize
virtual StatusCode finalize() override final
Finalize.
Definition: TRTDigitizationTool.cxx:825
TRTDigitizationTool::m_alreadyPrintedPDGcodeWarning
bool m_alreadyPrintedPDGcodeWarning
Definition: TRTDigitizationTool.h:160
TRTDigitizationTool::m_outputSDOCollName
SG::WriteHandleKey< InDetSimDataCollection > m_outputSDOCollName
name of the output SDOs.
Definition: TRTDigitizationTool.h:138
TRTDigitizationTool::m_first_event
bool m_first_event
Definition: TRTDigitizationTool.h:171
TRTDigSettings
Class containing parameters and settings used by TRT digitization.
Definition: TRTDigSettings.h:34
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
TRTDigitizationTool::m_hitsContainerKey
SG::ReadHandleKey< TRTUncompressedHitCollection > m_hitsContainerKey
Definition: TRTDigitizationTool.h:135
PileUpToolBase.h
helper base class IPileUpTool::toProcess().
TRTDigitizationTool::m_HardScatterSplittingSkipper
bool m_HardScatterSplittingSkipper
Definition: TRTDigitizationTool.h:173
TRTDigitizationTool::m_TRTsimdrifttimetool
ToolHandle< ITRT_SimDriftTimeTool > m_TRTsimdrifttimetool
Definition: TRTDigitizationTool.h:125
TRTDigitizationTool::m_thpctrt
TimedHitCollection< TRTUncompressedHit > * m_thpctrt
Definition: TRTDigitizationTool.h:159
TRTDigitizationTool::m_onlyUseContainerName
Gaudi::Property< bool > m_onlyUseContainerName
Definition: TRTDigitizationTool.h:134
TimedHitCollection< TRTUncompressedHit >
TRTDigitizationTool::m_minCrossingTimeSDO
double m_minCrossingTimeSDO
Definition: TRTDigitizationTool.h:161
IAthRNGSvc.h
ServiceHandle< PileUpMergeSvc >
TRTDigitizationTool::m_ppSvc
ServiceHandle< IPartPropSvc > m_ppSvc
Handle on the particle property service.
Definition: TRTDigitizationTool.h:168
Identifier
Definition: IdentifierFieldParser.cxx:14
TRTDigCondBase
Communication with CondDB.
Definition: TRTDigCondBase.h:34