ATLAS Offline Software
Loading...
Searching...
No Matches
RpcDigitizationTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef RPC_DIGITIZATIONTOOL_H
6#define RPC_DIGITIZATIONTOOL_H
38
45
49#include "xAODEventInfo/EventInfo.h" // NEW EDM
50
51
54
55class RpcHitIdHelper;
56
57
58class RpcIdHelper;
59
60namespace CLHEP {
61 class HepRandomEngine;
62}
63
65public:
66 RpcDigitizationTool(const std::string& type, const std::string& name, const IInterface* pIID);
67
69 virtual StatusCode initialize() override final;
70
73 virtual StatusCode prepareEvent(const EventContext& ctx, const unsigned int /*nInputEvents*/) override final;
74
77
78 virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final;
79
82 virtual StatusCode mergeEvent(const EventContext& ctx) override final;
83
86 virtual StatusCode processAllSubEvents(const EventContext& ctx) override final;
87
88private:
90
91 using Collections_t = std::vector<std::unique_ptr<RpcDigitCollection> >;
93 StatusCode getNextEvent(const EventContext& ctx);
95 StatusCode doDigitization(const EventContext& ctx, Collections_t& collections, MuonSimDataCollection* sdoContainer);
97 StatusCode fillTagInfo();
99 long long int PackMCTruth(float proptime, float tof, float posx, float posz) const;
101 static void UnPackMCTruth(double theWord, float& proptime, float& tof, float& posy, float& posz) ;
105 std::array<int, 3> physicalClusterSize(const EventContext& ctx,
106 const MuonGM::RpcReadoutElement* reEle,
107 const Identifier& id,
108 const Amg::Vector3D& posAtCentre,
109 CLHEP::HepRandomEngine* rndmEngine) const;
113 std::array<int, 3> TurnOnStrips(const MuonGM::RpcReadoutElement* reEle,
114 std::array<int, 3>&& pcs,
115 const Identifier& id) const;
117 double PropagationTime(const MuonGM::RpcReadoutElement* reEle,
118 const Identifier& id,
119 const Amg::Vector3D& globPos) const;
123 Gaudi::Property<double> m_UncorrJitter{this, "UncorrJitter", 1.5, "jitter uncorrelated between eta and phi"};
124 Gaudi::Property<double> m_CorrJitter{this, "CorrJitter", 0.0, "jitter correlated between eta and phi"};
125
126 Gaudi::Property<double> m_UncorrJitter_BIS78{this, "UncorrJitter_BIS78", 0.3, "jitter uncorrelated between eta and phi BIS78"};
127 Gaudi::Property<double> m_CorrJitter_BIS78{this, "CorrJitter_BIS78", 0.0, "jitter correlated between eta and phi BIS78"};
128
129
132 const Identifier& layerId) const;
133
134
135 // pile-up
136 bool outsideWindow(double time) const;
137 Gaudi::Property<double> m_timeWindowLowerOffset{this, "WindowLowerOffset", -100., "digitization window lower limit"};
138 Gaudi::Property<double> m_timeWindowUpperOffset{this, "WindowUpperOffset", +150., "digitization window lower limit"};
139
141 std::pair<bool, bool> detectionEfficiency(const EventContext& ctx,
142 const Identifier& ideta,
143 const Identifier& idphi,
144 CLHEP::HepRandomEngine* rndmEngine,
145 const HepMcParticleLink& trkParticle) const;
146
147
148 double FCPEfficiency(const HepMC::ConstGenParticlePtr& genParticle) const;
150 int determineClusterSize(const EventContext& ctx,
151 const Identifier& id,
152 double xstripnorm,
153 CLHEP::HepRandomEngine* rndmEngine) const;
154
155 SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_detMgrKey {this, "DetectorManagerKey", "MuonDetectorManager",
156 "Key of input MuonDetectorManager condition data"};
159 std::vector<std::unique_ptr<RPCSimHitCollection>> m_RPCHitCollList;
160 std::unique_ptr<TimedHitCollection<RPCSimHit>> m_thpcRPC{};
161 SG::ReadCondHandleKey<RpcCondDbData> m_readKey{this, "ReadKey", "RpcCondDbData", "Key of RpcCondDbData"};
162 std::map<Identifier, std::vector<MuonSimData::Deposit>> m_sdo_tmp_map;
163 Gaudi::Property<int> m_deadTime{this, "DeadTime", 100., "dead time"};
164 Gaudi::Property<bool> m_patch_for_rpc_time{this, "PatchForRpcTime", false, ""};
165 Gaudi::Property<double> m_rpc_time_shift{this, "PatchForRpcTimeShift", 12.5,
166 "shift rpc digit time to match hardware time calibration: Zmumu muons are at the center of "
167 "BC0, i.e. at 12.5ns+BC0shift w.r.t. RPC readout (BC0shift=2x3.125)"};
168
169 Gaudi::Property<bool> m_validationSetup{this, "ValidationSetup", false, ""};
170 Gaudi::Property<bool> m_includePileUpTruth{this, "IncludePileUpTruth", true, "pileup truth veto"};
171
172 Gaudi::Property<bool> m_turnON_efficiency{this, "turnON_efficiency", true, ""};
173 Gaudi::Property<bool> m_kill_deadstrips{this, "KillDeadStrips", false, ""}; // gabriele
174 Gaudi::Property<bool> m_turnON_clustersize{this, "turnON_clustersize", true, ""};
175 Gaudi::Property<int> m_FirstClusterSizeInTail{this, "FirstClusterSizeInTail", 3, ""};
176
177 Gaudi::Property<std::vector<float>> m_PhiAndEtaEff_A{this, "PhiAndEtaEff_A", {}, ""};
178 Gaudi::Property<std::vector<float>> m_OnlyPhiEff_A{this, "OnlyPhiEff_A", {}, ""};
179 Gaudi::Property<std::vector<float>> m_OnlyEtaEff_A{this, "OnlyEtaEff_A", {}, ""};
180 Gaudi::Property<std::vector<float>> m_PhiAndEtaEff_C{this, "PhiAndEtaEff_C", {}, ""};
181 Gaudi::Property<std::vector<float>> m_OnlyPhiEff_C{this, "OnlyPhiEff_C", {}, ""};
182 Gaudi::Property<std::vector<float>> m_OnlyEtaEff_C{this, "OnlyEtaEff_C", {}, ""};
183
184 Gaudi::Property<float> m_PhiAndEtaEff_BIS78{this, "PhiAndEtaEff_BIS78", 0.93, ""};
185 Gaudi::Property<float> m_OnlyEtaEff_BIS78{this, "OnlyEtaEff_BIS78", 0.96, ""};
186 Gaudi::Property<float> m_OnlyPhiEff_BIS78{this, "OnlyPhiEff_BIS78", 0.96, ""};
187
188 Gaudi::Property<std::vector<double>> m_FracClusterSize1_A{this, "FracClusterSize1_A", {}, ""};
189 Gaudi::Property<std::vector<double>> m_FracClusterSize2_A{this, "FracClusterSize2_A", {}, ""};
190 Gaudi::Property<std::vector<double>> m_FracClusterSizeTail_A{this, "FracClusterSizeTail_A", {}, ""};
191 Gaudi::Property<std::vector<double>> m_MeanClusterSizeTail_A{this, "MeanClusterSizeTail_A", {}, ""};
192
193 Gaudi::Property<std::vector<double>> m_FracClusterSize1_C{this, "FracClusterSize1_C", {}, ""};
194 Gaudi::Property<std::vector<double>> m_FracClusterSize2_C{this, "FracClusterSize2_C", {}, ""};
195 Gaudi::Property<std::vector<double>> m_FracClusterSizeTail_C{this, "FracClusterSizeTail_C", {}, ""};
196 Gaudi::Property<std::vector<double>> m_MeanClusterSizeTail_C{this, "MeanClusterSizeTail_C", {}, ""};
197
198 Gaudi::Property<float> m_FracClusterSize1_BIS78{this, "FracClusterSize1_BIS78", 0.60, ""};
199 Gaudi::Property<float> m_FracClusterSize2_BIS78{this, "FracClusterSize2_BIS78", 0.35, ""};
200 Gaudi::Property<float> m_FracClusterSizeTail_BIS78{this, "FracClusterSizeTail_BIA78", 0.05, ""};
201 Gaudi::Property<float> m_MeanClusterSizeTail_BIS78{this, "MeanClusterSizeTail_BIA78", 3.5, ""};
202
203
204
205 Gaudi::Property<bool> m_muonOnlySDOs{this, "MuonOnlySDOs", true, ""};
206
207 static double timeOverThreshold(CLHEP::HepRandomEngine* rndmEngine) ;
208
209protected:
210 ServiceHandle<PileUpMergeSvc> m_mergeSvc{this, "PileUpMergeSvc", "PileUpMergeSvc", "Pile up service"};
211 Gaudi::Property<bool> m_onlyUseContainerName{this, "OnlyUseContainerName", true,
212 "Don't use the ReadHandleKey directly. Just extract the container name from it."};
213 SG::ReadHandleKey<RPCSimHitCollection> m_hitsContainerKey{this, "InputObjectName", "RPC_Hits", "name of the input object"};
216 this, "OutputObjectName", "RPC_DIGITS", "WriteHandleKey for Output RpcDigitContainer"}; // name of the output digits
218 this, "OutputSDOName", "RPC_SDO", "WriteHandleKey for Output MuonSimDataCollection"}; // name of the output SDOs
219
220 SG::WriteHandleKey<RPCSimHitCollection> m_simHitValidKey{this, "SimHitValidationKey", "InputRpcHits"};
221 ServiceHandle<IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""}; // Random number service
222
223 Gaudi::Property<std::string> m_RPC_TimeSchema{this, "RPC_TimeSchema", "RPC_TimeSchema", "Tag info name of Rpc Time Info"};
224 Gaudi::Property<bool> m_sdoAreOnlyDigits{this, "RPCSDOareRPCDigits", true,
225 "decide is SDO deposits are saved for all G4 hits or only for those accepted as digits"};
226
227 Gaudi::Property<bool> m_Efficiency_fromCOOL{this, "Efficiency_fromCOOL", false, "Read efficiency from CoolDB"};
228 Gaudi::Property<bool> m_EfficiencyPatchForBMShighEta{this, "EfficiencyPatchForBMShighEta", false,
229 "special patch to be true only when m_Efficiency_fromCOOL=true and "
230 "/RPC/DQMF/ELEMENT_STATUS tag is RPCDQMFElementStatus_2012_Jaunuary_26"};
231 Gaudi::Property<bool> m_ClusterSize_fromCOOL{this, "ClusterSize_fromCOOL", false, "Read cluster size from CoolDB"};
232 Gaudi::Property<bool> m_ClusterSize1_2uncorr{this, "ClusterSize1_2uncorr", false,
233 "Cluster size 1 and 2 not correlated to track position"};
234 Gaudi::Property<bool> m_BOG_BOF_DoubletR2_OFF{this, "Force_BOG_BOF_DoubletR2_OFF", false, "Turn-off BOG and BOF with DoubletR=2"};
235 Gaudi::Property<bool> m_ignoreRunDepConfig{this, "IgnoreRunDependentConfig", false,
236 "true if we want to force the RUN1/RUN2 dependent options"};
237 Gaudi::Property<bool> m_Efficiency_BIS78_fromCOOL{this, "Efficiency_BIS78_fromCOOL", false, " read BIS78 Efficiency from COOL DB"};
238 Gaudi::Property<bool> m_ClusterSize_BIS78_fromCOOL{this, "ClusterSize_BIS78_fromCOOL", false, " read BIS78 Cluster Size from COOL DB"};
239
240
241 Gaudi::Property<bool> m_RPCInfoFromDb{this, "RPCInfoFromDb", false, ""};
242 Gaudi::Property<float> m_CutMaxClusterSize{this, "CutMaxClusterSize", 5.0, ""};
243 Gaudi::Property<int> m_CutProjectedTracks{this, "CutProjectedTracks", 100, ""};
244
245 int m_BOF_id{-1};
246 int m_BOG_id{-1};
247 int m_BOS_id{-1};
248
249 int m_BIL_id{-1};
250 int m_BIS_id{-1};
251
252};
253
254inline bool RpcDigitizationTool::outsideWindow(double time) const {
255 return time < m_timeWindowLowerOffset || time > m_timeWindowUpperOffset;
256}
257#endif // RpcDigitizationTool
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition IPileUpTool.h:22
the preferred mechanism to access information from the different event stores in a pileup job.
helper base class IPileUpTool::toProcess().
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
PileUpToolBase(const std::string &type, const std::string &name, const IInterface *parent)
std::pair< bool, bool > detectionEfficiency(const EventContext &ctx, const Identifier &ideta, const Identifier &idphi, CLHEP::HepRandomEngine *rndmEngine, const HepMcParticleLink &trkParticle) const
Evaluate detection efficiency.
Gaudi::Property< float > m_MeanClusterSizeTail_BIS78
Gaudi::Property< double > m_CorrJitter_BIS78
std::vector< std::unique_ptr< RpcDigitCollection > > Collections_t
bool outsideWindow(double time) const
const RpcHitIdHelper * m_muonHelper
int determineClusterSize(const EventContext &ctx, const Identifier &id, double xstripnorm, CLHEP::HepRandomEngine *rndmEngine) const
virtual StatusCode mergeEvent(const EventContext &ctx) override final
When being run from PileUpToolsAlgs, this method is called at the end of the subevts loop.
virtual StatusCode initialize() override final
Initialize.
long long int PackMCTruth(float proptime, float tof, float posx, float posz) const
Gaudi::Property< bool > m_turnON_efficiency
double FCPEfficiency(const HepMC::ConstGenParticlePtr &genParticle) const
Gaudi::Property< bool > m_EfficiencyPatchForBMShighEta
Gaudi::Property< bool > m_patch_for_rpc_time
std::array< int, 3 > physicalClusterSize(const EventContext &ctx, const MuonGM::RpcReadoutElement *reEle, const Identifier &id, const Amg::Vector3D &posAtCentre, CLHEP::HepRandomEngine *rndmEngine) const
Cluster simulation: first step.
RpcDigitizationTool(const std::string &type, const std::string &name, const IInterface *pIID)
Gaudi::Property< int > m_FirstClusterSizeInTail
Gaudi::Property< std::vector< double > > m_FracClusterSize2_A
ServiceHandle< IAthRNGSvc > m_rndmSvc
Gaudi::Property< double > m_timeWindowLowerOffset
Gaudi::Property< float > m_FracClusterSize2_BIS78
Amg::Transform3D fromSimHitToLayer(const MuonGM::RpcReadoutElement *readOutEle, const Identifier &layerId) const
Returns the position of the hit expressed in the gasGap coordinate system.
Gaudi::Property< int > m_CutProjectedTracks
Gaudi::Property< double > m_timeWindowUpperOffset
Gaudi::Property< std::vector< double > > m_FracClusterSize1_A
Gaudi::Property< int > m_deadTime
Gaudi::Property< bool > m_kill_deadstrips
Gaudi::Property< bool > m_ClusterSize_fromCOOL
std::array< int, 3 > TurnOnStrips(const MuonGM::RpcReadoutElement *reEle, std::array< int, 3 > &&pcs, const Identifier &id) const
Cluster simulation: second step.
Gaudi::Property< bool > m_includePileUpTruth
SG::WriteHandleKey< RPCSimHitCollection > m_simHitValidKey
SG::WriteHandleKey< RpcDigitContainer > m_outputDigitCollectionKey
StatusCode initializeRunDependentParameters()
Gaudi::Property< bool > m_ClusterSize_BIS78_fromCOOL
Gaudi::Property< bool > m_ClusterSize1_2uncorr
Gaudi::Property< bool > m_ignoreRunDepConfig
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Gaudi::Property< std::vector< double > > m_MeanClusterSizeTail_A
std::vector< std::unique_ptr< RPCSimHitCollection > > m_RPCHitCollList
SG::WriteHandleKey< MuonSimDataCollection > m_outputSDO_CollectionKey
SG::ReadCondHandleKey< RpcCondDbData > m_readKey
Gaudi::Property< std::vector< double > > m_MeanClusterSizeTail_C
std::map< Identifier, std::vector< MuonSimData::Deposit > > m_sdo_tmp_map
Gaudi::Property< std::vector< float > > m_OnlyPhiEff_C
Gaudi::Property< bool > m_validationSetup
Gaudi::Property< std::vector< double > > m_FracClusterSize1_C
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_detMgrKey
virtual StatusCode prepareEvent(const EventContext &ctx, const unsigned int) override final
When being run from PileUpToolsAlgs, this method is called at the start of the subevts loop.
Gaudi::Property< double > m_UncorrJitter_BIS78
virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
When being run from PileUpToolsAlgs, this method is called for each active bunch-crossing to process ...
double PropagationTime(const MuonGM::RpcReadoutElement *reEle, const Identifier &id, const Amg::Vector3D &globPos) const
Calculates the propagation time along the strip.
Gaudi::Property< std::vector< float > > m_OnlyPhiEff_A
Gaudi::Property< float > m_FracClusterSizeTail_BIS78
Gaudi::Property< std::vector< double > > m_FracClusterSizeTail_A
Gaudi::Property< float > m_OnlyEtaEff_BIS78
Gaudi::Property< std::vector< double > > m_FracClusterSize2_C
std::unique_ptr< TimedHitCollection< RPCSimHit > > m_thpcRPC
StatusCode getNextEvent(const EventContext &ctx)
Get next event and extract collection of hit collections:
Gaudi::Property< std::vector< float > > m_OnlyEtaEff_C
Gaudi::Property< std::string > m_RPC_TimeSchema
const RpcIdHelper * m_idHelper
static void UnPackMCTruth(double theWord, float &proptime, float &tof, float &posy, float &posz)
static double timeOverThreshold(CLHEP::HepRandomEngine *rndmEngine)
Gaudi::Property< float > m_CutMaxClusterSize
SG::ReadHandleKey< RPCSimHitCollection > m_hitsContainerKey
Gaudi::Property< float > m_OnlyPhiEff_BIS78
Gaudi::Property< bool > m_turnON_clustersize
Gaudi::Property< std::vector< float > > m_PhiAndEtaEff_A
Gaudi::Property< bool > m_RPCInfoFromDb
Gaudi::Property< double > m_rpc_time_shift
Gaudi::Property< float > m_FracClusterSize1_BIS78
Gaudi::Property< double > m_CorrJitter
Gaudi::Property< std::vector< float > > m_OnlyEtaEff_A
Gaudi::Property< bool > m_Efficiency_fromCOOL
Gaudi::Property< double > m_UncorrJitter
Calculates the position of the hit wrt to the strip panel this transformation is needed since the imp...
std::string m_inputHitCollectionName
StatusCode doDigitization(const EventContext &ctx, Collections_t &collections, MuonSimDataCollection *sdoContainer)
Digitization functionality shared with RPC_PileUpTool.
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
alternative interface which uses the PileUpMergeSvc to obtain all the required SubEvents.
Gaudi::Property< bool > m_onlyUseContainerName
Gaudi::Property< std::vector< float > > m_PhiAndEtaEff_C
Gaudi::Property< bool > m_Efficiency_BIS78_fromCOOL
Gaudi::Property< std::vector< double > > m_FracClusterSizeTail_C
Gaudi::Property< bool > m_BOG_BOF_DoubletR2_OFF
Gaudi::Property< bool > m_muonOnlySDOs
Gaudi::Property< bool > m_sdoAreOnlyDigits
Gaudi::Property< float > m_PhiAndEtaEff_BIS78
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
Definition GenParticle.h:20