ATLAS Offline Software
TRTFastDigitizationTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef FASTTRT_DIGITIZATION_FASTTRT_DIGITIZATIONTOOL_H
6 #define FASTTRT_DIGITIZATION_FASTTRT_DIGITIZATIONTOOL_H
7 
14 
15 #include "GaudiKernel/ServiceHandle.h"
16 #include "GaudiKernel/ToolHandle.h"
18 
23 
24 #include "GaudiKernel/RndmGenerators.h"
25 
27 
29 
30 #include "Identifier/Identifier.h"
31 #include "CLHEP/Random/RandGauss.h"
32 
34 
36 
39 #include "StoreGate/WriteHandle.h"
42 
43 #include <utility>
44 #include <vector>
45 #include <map>
46 #include <cmath>
47 
48 class TRT_ID;
49 class TRTUncompressedHit;
50 
51 namespace InDetDD {
52  class TRT_DetectorManager;
53 }
54 
55 class TRT_ID;
56 class StoreGateSvc;
58 
59 
61 public:
62  TRTFastDigitizationTool( const std::string &type, const std::string &name, const IInterface *parent );
63 
66  StatusCode mergeEvent(const EventContext& ctx);
67 
70  StatusCode processBunchXing( int bunchXing,
71  SubEventIterator bSubEvents,
72  SubEventIterator eSubEvents );
73 
76  // virtual bool toProcess(int bunchXing) const;
77 
78  StatusCode prepareEvent(const EventContext& ctx, const unsigned int /*nInputEvents*/ );
79 
82  StatusCode processAllSubEvents(const EventContext& ctx);
83 
85  virtual StatusCode initialize();
86 
89 
90 private:
91 
92  StatusCode initializeNumericalConstants(); // once per run
93  StatusCode setNumericalConstants(); // once per event (pileup-dependent constants)
94 
95  StatusCode produceDriftCircles(const EventContext& ctx,
96  CLHEP::HepRandomEngine* rndmEngine,
98 
99  Identifier getIdentifier( int hitID, IdentifierHash &hash, Identifier &layer_id, bool &status ) const;
100 
101  StatusCode createAndStoreRIOs(const EventContext& ctx, CLHEP::HepRandomEngine* rndmEngine);
102 
103  static double getDriftRadiusFromXYZ( const TimedHitPtr< TRTUncompressedHit > &hit );
104  HepGeom::Point3D< double > getGlobalPosition( const TimedHitPtr< TRTUncompressedHit > &hit );
105  bool isArgonStraw( const Identifier &straw_id ) const;
106  int gasType( const Identifier &straw_id ) const;
107  double getProbHT( int particleEncoding, float kineticEnergy, const Identifier &straw_id, double driftRadiusLoc, double hitGlobalPosition ) const;
108  static double HTProbabilityElectron_high_pt( double eta );
109  static double HTProbabilityElectron_low_pt( double eta );
110  static double HTProbabilityMuon_5_20( double eta );
111  static double HTProbabilityMuon_60( double eta );
112  static double strawEfficiency( double driftRadius, int BEC = 0 );
113  static double correctionHT( double momentum, Trk::ParticleHypothesis hypothesis );
114  double particleMass( int i ) const;
115 
116  // Tools and Services
117  PublicToolHandle< ITRT_DriftFunctionTool > m_trtDriftFunctionTool{this, "TRT_DriftFunctionTool", "TRT_DriftFunctionTool/FatrasTrtDriftFunctionTool"};
118  bool m_useTrtElectronPidTool{true}; // false: use Tina's parametrization
119  PublicToolHandle< Trk::ITRT_ElectronPidTool > m_trtElectronPidTool{this, "TRT_ElectronPidTool", "InDet::TRT_ElectronPidToolRun2/InDetTRT_ElectronPidTool"};
120  ToolHandle< ITRT_StrawStatusSummaryTool > m_trtStrawStatusSummaryTool{this, "TRT_StrawStatusSummaryTool", "InDetTRTStrawStatusSummaryTool"}; // Argon / Xenon
121  ServiceHandle< PileUpMergeSvc > m_mergeSvc{this, "MergeSvc", "PileUpMergeSvc"}; // PileUp Merge service
122  ServiceHandle<IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""};
123  StringProperty m_randomEngineName{this, "RandomStreamName", "FatrasRnd"}; // Name of the random number stream
124 
125  // INPUT
126  StringProperty m_trtHitCollectionKey{this, "trtHitCollectionName", "TRTUncompressedHits"};
127  std::vector< TRTUncompressedHitCollection * > m_trtHitCollList;
128 
129  // OUTPUT
130  SG::WriteHandleKey< InDet::TRT_DriftCircleContainer > m_trtDriftCircleContainerKey{this, "trtDriftCircleContainer", "TRT_DriftCircles"};
131  SG::WriteHandleKey< PRD_MultiTruthCollection > m_trtPrdTruthKey{this, "trtPrdMultiTruthCollection", "PRD_MultiTruthTRT"};
132 
134  std::multimap< Identifier, InDet::TRT_DriftCircle * > m_driftCircleMap;
135 
136  // Helpers
138  const TRT_ID *m_trt_id{}; // TRT Id Helper
139 
140  // Split configuration
141  IntegerProperty m_HardScatterSplittingMode{this, "HardScatterSplittingMode", 0, "Control pileup & signal splitting"}; // Process all TRT_Hits or just those from signal or background events
143 
144  BooleanProperty m_useEventInfo{this, "useEventInfo", false}; // get mu from EventInfo ?
146  { this, "EventInfoKey", "EventInfo", "SG key for EventInfo" };
147  FloatProperty m_NCollPerEvent{this, "NCollPerEvent", 30};
148 
149  // numerical constants. Might wish to move these to a DB in the future
150  double m_trtTailFraction{0.0}; // fraction in tails
151  double m_trtSigmaDriftRadiusTail{0.0}; // sigma of one TRT straw in R
154  double m_cFit[ 8 ][ 5 ]{}; // efficiency and resolution
155 
156 };
157 
158 #endif // FASTTRT_DIGITIZATION_FASTTRT_DIGITIZATIONTOOL_H
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
TRTFastDigitizationTool::m_thpctrt
TimedHitCollection< TRTUncompressedHit > * m_thpctrt
Definition: TRTFastDigitizationTool.h:133
TRTFastDigitizationTool::m_HardScatterSplittingMode
IntegerProperty m_HardScatterSplittingMode
Definition: TRTFastDigitizationTool.h:141
TRTFastDigitizationTool::getGlobalPosition
HepGeom::Point3D< double > getGlobalPosition(const TimedHitPtr< TRTUncompressedHit > &hit)
Definition: TRTFastDigitizationTool.cxx:674
LArNewCalib_Delay_OFC_Cali.BEC
BEC
Definition: LArNewCalib_Delay_OFC_Cali.py:119
TRTFastDigitizationTool::m_NCollPerEvent
FloatProperty m_NCollPerEvent
Definition: TRTFastDigitizationTool.h:147
TrackParameters.h
ITRT_ElectronPidTool.h
TRTFastDigitizationTool::m_cFit
double m_cFit[8][5]
Definition: TRTFastDigitizationTool.h:154
ITRT_DriftFunctionTool
Definition: ITRT_DriftFunctionTool.h:16
TRTFastDigitizationTool::getProbHT
double getProbHT(int particleEncoding, float kineticEnergy, const Identifier &straw_id, double driftRadiusLoc, double hitGlobalPosition) const
Definition: TRTFastDigitizationTool.cxx:747
TRTFastDigitizationTool::HTProbabilityMuon_60
static double HTProbabilityMuon_60(double eta)
Definition: TRTFastDigitizationTool.cxx:926
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
TRTFastDigitizationTool::createAndStoreRIOs
StatusCode createAndStoreRIOs(const EventContext &ctx, CLHEP::HepRandomEngine *rndmEngine)
Definition: TRTFastDigitizationTool.cxx:493
TRTFastDigitizationTool::m_trtStrawStatusSummaryTool
ToolHandle< ITRT_StrawStatusSummaryTool > m_trtStrawStatusSummaryTool
Definition: TRTFastDigitizationTool.h:120
TRTFastDigitizationTool::m_trtHighProbabilityBoostEle
double m_trtHighProbabilityBoostEle
Definition: TRTFastDigitizationTool.h:153
TRTFastDigitizationTool
Definition: TRTFastDigitizationTool.h:60
TRTFastDigitizationTool::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number service.
Definition: TRTFastDigitizationTool.h:122
TRTUncompressedHit
Definition: TRTUncompressedHit.h:11
TRTFastDigitizationTool::m_trtSigmaDriftRadiusTail
double m_trtSigmaDriftRadiusTail
Definition: TRTFastDigitizationTool.h:151
TRTFastDigitizationTool::m_trtTailFraction
double m_trtTailFraction
Definition: TRTFastDigitizationTool.h:150
TRTFastDigitizationTool::HTProbabilityElectron_high_pt
static double HTProbabilityElectron_high_pt(double eta)
Definition: TRTFastDigitizationTool.cxx:823
TimedHitPtr< TRTUncompressedHit >
TRTFastDigitizationTool::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Definition: TRTFastDigitizationTool.h:121
SG::ReadHandleKey< xAOD::EventInfo >
TRTFastDigitizationTool::HTProbabilityMuon_5_20
static double HTProbabilityMuon_5_20(double eta)
Definition: TRTFastDigitizationTool.cxx:871
TRTFastDigitizationTool::prepareEvent
StatusCode prepareEvent(const EventContext &ctx, const unsigned int)
return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase...
Definition: TRTFastDigitizationTool.cxx:106
TRTFastDigitizationTool::m_trtPrdTruthKey
SG::WriteHandleKey< PRD_MultiTruthCollection > m_trtPrdTruthKey
Definition: TRTFastDigitizationTool.h:131
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
WriteHandle.h
Handle class for recording to StoreGate.
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
TRTFastDigitizationTool::m_EventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_EventInfoKey
Definition: TRTFastDigitizationTool.h:146
TRTFastDigitizationTool::gasType
int gasType(const Identifier &straw_id) const
Definition: TRTFastDigitizationTool.cxx:725
SG::WriteHandleKey< InDet::TRT_DriftCircleContainer >
ITRT_StrawStatusSummaryTool.h
abstract interface to TRT straw status constants
TRTFastDigitizationTool::HTProbabilityElectron_low_pt
static double HTProbabilityElectron_low_pt(double eta)
Definition: TRTFastDigitizationTool.cxx:847
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
lumiFormat.i
int i
Definition: lumiFormat.py:85
TRTFastDigitizationTool::strawEfficiency
static double strawEfficiency(double driftRadius, int BEC=0)
Definition: TRTFastDigitizationTool.cxx:982
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::driftRadius
@ driftRadius
trt, straws
Definition: ParamDefs.h:53
TRTFastDigitizationTool::isArgonStraw
bool isArgonStraw(const Identifier &straw_id) const
Definition: TRTFastDigitizationTool.cxx:717
TRTFastDigitizationTool::m_trtElectronPidTool
PublicToolHandle< Trk::ITRT_ElectronPidTool > m_trtElectronPidTool
Definition: TRTFastDigitizationTool.h:119
AthAlgTool.h
TRTFastDigitizationTool::m_trtHighProbabilityBoostBkg
double m_trtHighProbabilityBoostBkg
Definition: TRTFastDigitizationTool.h:152
TRTFastDigitizationTool::m_trt_id
const TRT_ID * m_trt_id
Definition: TRTFastDigitizationTool.h:138
TRTFastDigitizationTool::finalize
StatusCode finalize()
Finalize.
Definition: TRTFastDigitizationTool.cxx:1042
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TimedHitCollection.h
TRTFastDigitizationTool::m_useEventInfo
BooleanProperty m_useEventInfo
Definition: TRTFastDigitizationTool.h:144
TRTFastDigitizationTool::m_trtHitCollList
std::vector< TRTUncompressedHitCollection * > m_trtHitCollList
Definition: TRTFastDigitizationTool.h:127
PileUpToolBase
Definition: PileUpToolBase.h:18
TRT_DriftCircleContainer.h
TRTFastDigitizationTool::m_randomEngineName
StringProperty m_randomEngineName
Definition: TRTFastDigitizationTool.h:123
TRTFastDigitizationTool::m_driftCircleMap
std::multimap< Identifier, InDet::TRT_DriftCircle * > m_driftCircleMap
Definition: TRTFastDigitizationTool.h:134
ITRT_DriftFunctionTool.h
TRTFastDigitizationTool::setNumericalConstants
StatusCode setNumericalConstants()
Definition: TRTFastDigitizationTool.cxx:170
TRTFastDigitizationTool::m_trtDriftCircleContainerKey
SG::WriteHandleKey< InDet::TRT_DriftCircleContainer > m_trtDriftCircleContainerKey
Definition: TRTFastDigitizationTool.h:130
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TRTFastDigitizationTool::particleMass
double particleMass(int i) const
TRTFastDigitizationTool::m_trtDriftFunctionTool
PublicToolHandle< ITRT_DriftFunctionTool > m_trtDriftFunctionTool
Definition: TRTFastDigitizationTool.h:117
TRTFastDigitizationTool::initialize
virtual StatusCode initialize()
Initialize.
Definition: TRTFastDigitizationTool.cxx:61
TRTFastDigitizationTool::m_trtHitCollectionKey
StringProperty m_trtHitCollectionKey
Definition: TRTFastDigitizationTool.h:126
EventInfo.h
TRT_ID
Definition: TRT_ID.h:84
InDetDD::TRT_DetectorManager
The Detector Manager for all TRT Detector elements, it acts as the interface to the detector elements...
Definition: TRT_DetectorManager.h:69
TRTUncompressedHitCollection.h
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
PileUpMergeSvc.h
the preferred mechanism to access information from the different event stores in a pileup job.
TRTFastDigitizationTool::TRTFastDigitizationTool
TRTFastDigitizationTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TRTFastDigitizationTool.cxx:53
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TRTFastDigitizationTool::produceDriftCircles
StatusCode produceDriftCircles(const EventContext &ctx, CLHEP::HepRandomEngine *rndmEngine, TimedHitCollection< TRTUncompressedHit > &thpctrt)
Definition: TRTFastDigitizationTool.cxx:253
TRTFastDigitizationTool::correctionHT
static double correctionHT(double momentum, Trk::ParticleHypothesis hypothesis)
Definition: TRTFastDigitizationTool.cxx:1027
TRTFastDigitizationTool::m_trt_manager
const InDetDD::TRT_DetectorManager * m_trt_manager
Definition: TRTFastDigitizationTool.h:137
TRTFastDigitizationTool::getDriftRadiusFromXYZ
static double getDriftRadiusFromXYZ(const TimedHitPtr< TRTUncompressedHit > &hit)
Definition: TRTFastDigitizationTool.cxx:586
PRD_MultiTruthCollection.h
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
TRTFastDigitizationTool::initializeNumericalConstants
StatusCode initializeNumericalConstants()
Definition: TRTFastDigitizationTool.cxx:161
TRTFastDigitizationTool::m_HardScatterSplittingSkipper
bool m_HardScatterSplittingSkipper
Definition: TRTFastDigitizationTool.h:142
merge.status
status
Definition: merge.py:17
TRTFastDigitizationTool::processBunchXing
StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents)
called for each active bunch-crossing to process current SubEvents bunchXing is in ns
Definition: TRTFastDigitizationTool.cxx:119
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
TRTFastDigitizationTool::m_useTrtElectronPidTool
bool m_useTrtElectronPidTool
Definition: TRTFastDigitizationTool.h:118
PileUpToolBase.h
helper base class IPileUpTool::toProcess().
TRTFastDigitizationTool::getIdentifier
Identifier getIdentifier(int hitID, IdentifierHash &hash, Identifier &layer_id, bool &status) const
Definition: TRTFastDigitizationTool.cxx:616
TRTFastDigitizationTool::mergeEvent
StatusCode mergeEvent(const EventContext &ctx)
called at the end of the subevts loop.
Definition: TRTFastDigitizationTool.cxx:466
TimedHitCollection< TRTUncompressedHit >
TRTFastDigitizationTool::processAllSubEvents
StatusCode processAllSubEvents(const EventContext &ctx)
alternative interface which uses the PileUpMergeSvc to obtain all the required SubEvents.
Definition: TRTFastDigitizationTool.cxx:424
IAthRNGSvc.h
ServiceHandle< PileUpMergeSvc >
Identifier
Definition: IdentifierFieldParser.cxx:14