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 template <class CondType> StatusCode retrieveCondData(const EventContext& ctx,
93 const CondType* & condPtr) const;
94 using Collections_t = std::vector<std::unique_ptr<RpcDigitCollection> >;
96 StatusCode getNextEvent(const EventContext& ctx);
98 StatusCode doDigitization(const EventContext& ctx, Collections_t& collections, MuonSimDataCollection* sdoContainer);
100 StatusCode fillTagInfo();
102 long long int PackMCTruth(float proptime, float tof, float posx, float posz) const;
104 static void UnPackMCTruth(double theWord, float& proptime, float& tof, float& posy, float& posz) ;
108 std::array<int, 3> physicalClusterSize(const EventContext& ctx,
109 const MuonGM::RpcReadoutElement* reEle,
110 const Identifier& id,
111 const Amg::Vector3D& posAtCentre,
112 CLHEP::HepRandomEngine* rndmEngine) const;
116 std::array<int, 3> TurnOnStrips(const MuonGM::RpcReadoutElement* reEle,
117 std::array<int, 3>&& pcs,
118 const Identifier& id) const;
120 double PropagationTime(const MuonGM::RpcReadoutElement* reEle,
121 const Identifier& id,
122 const Amg::Vector3D& globPos) const;
126 Gaudi::Property<double> m_UncorrJitter{this, "UncorrJitter", 1.5, "jitter uncorrelated between eta and phi"};
127 Gaudi::Property<double> m_CorrJitter{this, "CorrJitter", 0.0, "jitter correlated between eta and phi"};
128
129 Gaudi::Property<double> m_UncorrJitter_BIS78{this, "UncorrJitter_BIS78", 0.3, "jitter uncorrelated between eta and phi BIS78"};
130 Gaudi::Property<double> m_CorrJitter_BIS78{this, "CorrJitter_BIS78", 0.0, "jitter correlated between eta and phi BIS78"};
131
132
135 const Identifier& layerId) const;
136
137
138 // pile-up
139 bool outsideWindow(double time) const;
140 Gaudi::Property<double> m_timeWindowLowerOffset{this, "WindowLowerOffset", -100., "digitization window lower limit"};
141 Gaudi::Property<double> m_timeWindowUpperOffset{this, "WindowUpperOffset", +150., "digitization window lower limit"};
142
144 std::pair<bool, bool> detectionEfficiency(const EventContext& ctx,
145 const Identifier& ideta,
146 const Identifier& idphi,
147 CLHEP::HepRandomEngine* rndmEngine,
148 const HepMcParticleLink& trkParticle) const;
149
150
151 double FCPEfficiency(const HepMC::ConstGenParticlePtr& genParticle) const;
153 int determineClusterSize(const EventContext& ctx,
154 const Identifier& id,
155 double xstripnorm,
156 CLHEP::HepRandomEngine* rndmEngine) const;
157
158 SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_detMgrKey {this, "DetectorManagerKey", "MuonDetectorManager",
159 "Key of input MuonDetectorManager condition data"};
162 std::vector<std::unique_ptr<RPCSimHitCollection>> m_RPCHitCollList;
163 std::unique_ptr<TimedHitCollection<RPCSimHit>> m_thpcRPC{};
164 SG::ReadCondHandleKey<RpcCondDbData> m_readKey{this, "ReadKey", "RpcCondDbData", "Key of RpcCondDbData"};
165 std::map<Identifier, std::vector<MuonSimData::Deposit>> m_sdo_tmp_map;
166 Gaudi::Property<int> m_deadTime{this, "DeadTime", 100., "dead time"};
167 Gaudi::Property<bool> m_patch_for_rpc_time{this, "PatchForRpcTime", false, ""};
168 Gaudi::Property<double> m_rpc_time_shift{this, "PatchForRpcTimeShift", 12.5,
169 "shift rpc digit time to match hardware time calibration: Zmumu muons are at the center of "
170 "BC0, i.e. at 12.5ns+BC0shift w.r.t. RPC readout (BC0shift=2x3.125)"};
171
172 Gaudi::Property<bool> m_validationSetup{this, "ValidationSetup", false, ""};
173 Gaudi::Property<bool> m_includePileUpTruth{this, "IncludePileUpTruth", true, "pileup truth veto"};
174
175 Gaudi::Property<bool> m_turnON_efficiency{this, "turnON_efficiency", true, ""};
176 Gaudi::Property<bool> m_kill_deadstrips{this, "KillDeadStrips", false, ""}; // gabriele
177 Gaudi::Property<bool> m_turnON_clustersize{this, "turnON_clustersize", true, ""};
178 Gaudi::Property<int> m_FirstClusterSizeInTail{this, "FirstClusterSizeInTail", 3, ""};
179
180 Gaudi::Property<std::vector<float>> m_PhiAndEtaEff_A{this, "PhiAndEtaEff_A", {}, ""};
181 Gaudi::Property<std::vector<float>> m_OnlyPhiEff_A{this, "OnlyPhiEff_A", {}, ""};
182 Gaudi::Property<std::vector<float>> m_OnlyEtaEff_A{this, "OnlyEtaEff_A", {}, ""};
183 Gaudi::Property<std::vector<float>> m_PhiAndEtaEff_C{this, "PhiAndEtaEff_C", {}, ""};
184 Gaudi::Property<std::vector<float>> m_OnlyPhiEff_C{this, "OnlyPhiEff_C", {}, ""};
185 Gaudi::Property<std::vector<float>> m_OnlyEtaEff_C{this, "OnlyEtaEff_C", {}, ""};
186
187 Gaudi::Property<float> m_PhiAndEtaEff_BIS78{this, "PhiAndEtaEff_BIS78", 0.93, ""};
188 Gaudi::Property<float> m_OnlyEtaEff_BIS78{this, "OnlyEtaEff_BIS78", 0.96, ""};
189 Gaudi::Property<float> m_OnlyPhiEff_BIS78{this, "OnlyPhiEff_BIS78", 0.96, ""};
190
191 Gaudi::Property<std::vector<double>> m_FracClusterSize1_A{this, "FracClusterSize1_A", {}, ""};
192 Gaudi::Property<std::vector<double>> m_FracClusterSize2_A{this, "FracClusterSize2_A", {}, ""};
193 Gaudi::Property<std::vector<double>> m_FracClusterSizeTail_A{this, "FracClusterSizeTail_A", {}, ""};
194 Gaudi::Property<std::vector<double>> m_MeanClusterSizeTail_A{this, "MeanClusterSizeTail_A", {}, ""};
195
196 Gaudi::Property<std::vector<double>> m_FracClusterSize1_C{this, "FracClusterSize1_C", {}, ""};
197 Gaudi::Property<std::vector<double>> m_FracClusterSize2_C{this, "FracClusterSize2_C", {}, ""};
198 Gaudi::Property<std::vector<double>> m_FracClusterSizeTail_C{this, "FracClusterSizeTail_C", {}, ""};
199 Gaudi::Property<std::vector<double>> m_MeanClusterSizeTail_C{this, "MeanClusterSizeTail_C", {}, ""};
200
201 Gaudi::Property<float> m_FracClusterSize1_BIS78{this, "FracClusterSize1_BIS78", 0.60, ""};
202 Gaudi::Property<float> m_FracClusterSize2_BIS78{this, "FracClusterSize2_BIS78", 0.35, ""};
203 Gaudi::Property<float> m_FracClusterSizeTail_BIS78{this, "FracClusterSizeTail_BIA78", 0.05, ""};
204 Gaudi::Property<float> m_MeanClusterSizeTail_BIS78{this, "MeanClusterSizeTail_BIA78", 3.5, ""};
205
206
207
208 Gaudi::Property<bool> m_muonOnlySDOs{this, "MuonOnlySDOs", true, ""};
209
210 static double timeOverThreshold(CLHEP::HepRandomEngine* rndmEngine) ;
211
212protected:
213 ServiceHandle<PileUpMergeSvc> m_mergeSvc{this, "PileUpMergeSvc", "PileUpMergeSvc", "Pile up service"};
214 Gaudi::Property<bool> m_onlyUseContainerName{this, "OnlyUseContainerName", true,
215 "Don't use the ReadHandleKey directly. Just extract the container name from it."};
216 SG::ReadHandleKey<RPCSimHitCollection> m_hitsContainerKey{this, "InputObjectName", "RPC_Hits", "name of the input object"};
219 this, "OutputObjectName", "RPC_DIGITS", "WriteHandleKey for Output RpcDigitContainer"}; // name of the output digits
221 this, "OutputSDOName", "RPC_SDO", "WriteHandleKey for Output MuonSimDataCollection"}; // name of the output SDOs
222
223 SG::WriteHandleKey<RPCSimHitCollection> m_simHitValidKey{this, "SimHitValidationKey", "InputRpcHits"};
224 ServiceHandle<IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""}; // Random number service
225
226 Gaudi::Property<std::string> m_RPC_TimeSchema{this, "RPC_TimeSchema", "RPC_TimeSchema", "Tag info name of Rpc Time Info"};
227 Gaudi::Property<bool> m_sdoAreOnlyDigits{this, "RPCSDOareRPCDigits", true,
228 "decide is SDO deposits are saved for all G4 hits or only for those accepted as digits"};
229
230 Gaudi::Property<bool> m_Efficiency_fromCOOL{this, "Efficiency_fromCOOL", false, "Read efficiency from CoolDB"};
231 Gaudi::Property<bool> m_EfficiencyPatchForBMShighEta{this, "EfficiencyPatchForBMShighEta", false,
232 "special patch to be true only when m_Efficiency_fromCOOL=true and "
233 "/RPC/DQMF/ELEMENT_STATUS tag is RPCDQMFElementStatus_2012_Jaunuary_26"};
234 Gaudi::Property<bool> m_ClusterSize_fromCOOL{this, "ClusterSize_fromCOOL", false, "Read cluster size from CoolDB"};
235 Gaudi::Property<bool> m_ClusterSize1_2uncorr{this, "ClusterSize1_2uncorr", false,
236 "Cluster size 1 and 2 not correlated to track position"};
237 Gaudi::Property<bool> m_BOG_BOF_DoubletR2_OFF{this, "Force_BOG_BOF_DoubletR2_OFF", false, "Turn-off BOG and BOF with DoubletR=2"};
238 Gaudi::Property<bool> m_ignoreRunDepConfig{this, "IgnoreRunDependentConfig", false,
239 "true if we want to force the RUN1/RUN2 dependent options"};
240 Gaudi::Property<bool> m_Efficiency_BIS78_fromCOOL{this, "Efficiency_BIS78_fromCOOL", false, " read BIS78 Efficiency from COOL DB"};
241 Gaudi::Property<bool> m_ClusterSize_BIS78_fromCOOL{this, "ClusterSize_BIS78_fromCOOL", false, " read BIS78 Cluster Size from COOL DB"};
242
243
244 Gaudi::Property<bool> m_RPCInfoFromDb{this, "RPCInfoFromDb", false, ""};
245 Gaudi::Property<float> m_CutMaxClusterSize{this, "CutMaxClusterSize", 5.0, ""};
246 Gaudi::Property<int> m_CutProjectedTracks{this, "CutProjectedTracks", 100, ""};
247
248 int m_BOF_id{-1};
249 int m_BOG_id{-1};
250 int m_BOS_id{-1};
251
252 int m_BIL_id{-1};
253 int m_BIS_id{-1};
254
255};
256
257inline bool RpcDigitizationTool::outsideWindow(double time) const {
258 return time < m_timeWindowLowerOffset || time > m_timeWindowUpperOffset;
259}
260#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.
StatusCode retrieveCondData(const EventContext &ctx, const SG::ReadCondHandleKey< CondType > &key, const CondType *&condPtr) const
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
const GenParticle * ConstGenParticlePtr
Definition GenParticle.h:38