ATLAS Offline Software
Loading...
Searching...
No Matches
RpcDigitizationTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6//
7// RpcDigitizationTool
8// ------------
9// Authors:
10// Andrea Di Simone <Andrea.Di.Simone@cern.ch>
11// Gabriele Chiodini <gabriele.chiodini@le.infn.it>
12// Stefania Spagnolo <stefania.spagnolo@le.infn.it>
14
15// Tell clang to optimize assuming that FP operations may trap.
18
20
21// Inputs
22#include "GaudiKernel/SystemOfUnits.h"
23#include "GaudiKernel/PhysicalConstants.h"
25#include "GeoModelHelpers/TransformToStringConverter.h"
28
29// Geometry
34
35// run n. from geometry DB
40
41// Truth
45#include "GeoModelKernel/throwExcept.h"
46// Random Numbers
48#include "CLHEP/Random/RandExponential.h"
49#include "CLHEP/Random/RandFlat.h"
50#include "CLHEP/Random/RandGaussZiggurat.h"
51
52// Core includes
53#include <TString.h> // for Form
54
55#include <atomic>
56#include <fstream>
57#include <iostream>
58#include <sstream>
59#include <utility>
60
63
64// 12 charge points, 15 BetaGamma points, 180 efficiency points for fcp search
65namespace {
66 constexpr int N_Charge = 12;
67 constexpr int N_Velocity = 15;
68 constexpr std::array<double, N_Charge> Charge{0.1, 0.2, 0.3, 0.33, 0.4, 0.5, 0.6, 0.66, 0.7, 0.8, 0.9, 1.0};
69 constexpr std::array<double, N_Velocity> Velocity{0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 2.0, 3.0, 10.0, 100.0, 1000.0};
70 constexpr double Eff_garfield[N_Charge][N_Velocity] = {
71 {0.8648, 0.3476, 0.1407, 0.0618, 0.0368, 0.0234, 0.0150, 0.0120, 0.0096, 0.0079, 0.0038, 0.0041, 0.0035, 0.0049, 0.0054},
72 {0.9999, 0.9238, 0.6716, 0.4579, 0.3115, 0.2238, 0.1727, 0.1365, 0.1098, 0.0968, 0.0493, 0.0451, 0.0528, 0.0694, 0.0708},
73 {1.0000, 0.9978, 0.9517, 0.8226, 0.6750, 0.5611, 0.4674, 0.3913, 0.3458, 0.3086, 0.1818, 0.1677, 0.1805, 0.2307, 0.2421},
74 {1.0000, 0.9994, 0.9758, 0.8918, 0.7670, 0.6537, 0.5533, 0.4856, 0.4192, 0.3852, 0.2333, 0.2186, 0.2479, 0.2957, 0.2996},
75 {1.0000, 1.0000, 0.9972, 0.9699, 0.9022, 0.8200, 0.7417, 0.6660, 0.6094, 0.5622, 0.3846, 0.3617, 0.3847, 0.4578, 0.4583},
76 {1.0000, 1.0000, 0.9998, 0.9956, 0.9754, 0.9479, 0.9031, 0.8604, 0.8126, 0.7716, 0.5827, 0.5545, 0.5865, 0.6834, 0.6706},
77 {1.0000, 1.0000, 1.0000, 0.9997, 0.9968, 0.9876, 0.9689, 0.9464, 0.9221, 0.8967, 0.7634, 0.7385, 0.7615, 0.8250, 0.8309},
78 {1.0000, 1.0000, 1.0000, 1.0000, 0.9995, 0.9952, 0.9866, 0.9765, 0.9552, 0.9427, 0.8373, 0.8127, 0.8412, 0.8899, 0.8891},
79 {1.0000, 1.0000, 1.0000, 1.0000, 0.9995, 0.9981, 0.9918, 0.9803, 0.9754, 0.9602, 0.8730, 0.8564, 0.8746, 0.9178, 0.9261},
80 {1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 0.9993, 0.9990, 0.9951, 0.9935, 0.9886, 0.9419, 0.9277, 0.9422, 0.9686, 0.9700},
81 {1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 0.9998, 0.9996, 0.9980, 0.9966, 0.9786, 0.9718, 0.9748, 0.9875, 0.9882},
82 {1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 0.9998, 1.0000, 0.9991, 0.9988, 0.9913, 0.9872, 0.9917, 0.9970, 0.9964}};
83 bool
84 validIndex(int idx, int arraySize){
85 return (idx>=0) and (idx<arraySize);
86 }
87} // namespace
88
89using namespace MuonGM;
90namespace {
91 constexpr double SIG_VEL = 4.8;
92}
93
94
95RpcDigitizationTool::RpcDigitizationTool(const std::string& type, const std::string& name, const IInterface* pIID) :
96 PileUpToolBase(type, name, pIID) {}
97
98// member function implementation
99//--------------------------------------------
101 ATH_MSG_DEBUG("RpcDigitizationTool:: in initialize()");
102 ATH_MSG_DEBUG("Configuration RpcDigitizationTool ");
103
104 ATH_MSG_DEBUG("InputObjectName " << m_inputHitCollectionName);
105 ATH_MSG_DEBUG("OutputObjectName " << m_outputDigitCollectionKey.key());
106 ATH_MSG_DEBUG("OutputSDOName " << m_outputSDO_CollectionKey.key());
107 ATH_MSG_DEBUG("WindowLowerOffset " << m_timeWindowLowerOffset);
108 ATH_MSG_DEBUG("WindowUpperOffset " << m_timeWindowUpperOffset);
109 ATH_MSG_DEBUG("DeadTime " << m_deadTime);
110 ATH_MSG_DEBUG("RndmSvc " << m_rndmSvc);
111 ATH_MSG_DEBUG("PatchForRpcTime " << m_patch_for_rpc_time);
112 ATH_MSG_DEBUG("RpcTimeShift " << m_rpc_time_shift);
113 ATH_MSG_DEBUG("RPC_TimeSchema " << m_RPC_TimeSchema);
114 ATH_MSG_DEBUG("RPCSDOareRPCDigits " << m_sdoAreOnlyDigits);
115
116 ATH_MSG_DEBUG("IgnoreRunDependentConfig " << m_ignoreRunDepConfig);
117 ATH_MSG_DEBUG("turnON_efficiency " << m_turnON_efficiency);
118 ATH_MSG_DEBUG("Efficiency_fromCOOL " << m_Efficiency_fromCOOL);
119 ATH_MSG_DEBUG("Efficiency_BIS78_fromCOOL" << m_Efficiency_BIS78_fromCOOL);
120 ATH_MSG_DEBUG("turnON_clustersize " << m_turnON_clustersize);
121 ATH_MSG_DEBUG("ClusterSize_fromCOOL " << m_ClusterSize_fromCOOL);
122 ATH_MSG_DEBUG("ClusterSize_BIS78_fromCOOL" << m_ClusterSize_BIS78_fromCOOL);
123 ATH_MSG_DEBUG("FirstClusterSizeInTail " << m_FirstClusterSizeInTail);
124 ATH_MSG_DEBUG("ClusterSize1_2uncorr " << m_ClusterSize1_2uncorr);
125 ATH_MSG_DEBUG("BOG_BOF_DoubletR2_OFF " << m_BOG_BOF_DoubletR2_OFF);
126 ATH_MSG_DEBUG("CutMaxClusterSize " << m_CutMaxClusterSize);
127 ATH_MSG_DEBUG("CutProjectedTracks " << m_CutProjectedTracks);
128 ATH_MSG_DEBUG("ValidationSetup " << m_validationSetup);
129 ATH_MSG_DEBUG("IncludePileUpTruth " << m_includePileUpTruth);
130 ATH_MSG_DEBUG("VetoPileUpTruthLinks " << m_vetoPileUpTruthLinks);
131
132 ATH_CHECK(m_detMgrKey.initialize());
133 if (m_onlyUseContainerName) { ATH_CHECK(m_mergeSvc.retrieve()); }
134 ATH_CHECK(detStore()->retrieve(m_idHelper));
135 // check the identifiers
136
137 ATH_MSG_INFO("Max Number of RPC Gas Gaps for these Identifiers = " << m_idHelper->gasGapMax());
138
139 // check the input object name
140 if (m_hitsContainerKey.key().empty()) {
141 ATH_MSG_FATAL("Property InputObjectName not set !");
142 return StatusCode::FAILURE;
143 }
145 ATH_MSG_DEBUG("Input objects in container : '" << m_inputHitCollectionName << "'");
146
147 // Initialize ReadHandleKey
148 ATH_CHECK(m_hitsContainerKey.initialize());
149
150 // initialize the output WriteHandleKeys
154 ATH_MSG_DEBUG("Output digits: '" << m_outputDigitCollectionKey.key() << "'");
155
156 // set the configuration based on run1/run2
158
159 ATH_MSG_DEBUG("Ready to read parameters for cluster simulation from file");
160
161 ATH_CHECK(m_rndmSvc.retrieve());
162
163 // fill the taginfo information
165
167
169 // m_turnON_clustersize=false;
170 m_BOF_id = m_idHelper->stationNameIndex("BOF");
171 m_BOG_id = m_idHelper->stationNameIndex("BOG");
172 m_BOS_id = m_idHelper->stationNameIndex("BOS");
173 m_BIL_id = m_idHelper->stationNameIndex("BIL");
174 m_BIS_id = m_idHelper->stationNameIndex("BIS");
176
177 return StatusCode::SUCCESS;
178}
179
181 // TODO This should all be in a conditions Alg
182 // Retrieve geometry config information from the database (RUN1, RUN2, etc...)
183 SmartIF<IGeoModelSvc> geoModel{Gaudi::svcLocator()->service("GeoModelSvc")};
184 if ( !geoModel ) {
185 ATH_MSG_ERROR("Could not locate GeoModelSvc");
186 return StatusCode::FAILURE;
187 }
188
189 // check the DetDescr version
190 std::string atlasVersion = geoModel->atlasVersion();
191
192 SmartIF<IRDBAccessSvc> rdbAccess{Gaudi::svcLocator()->service("RDBAccessSvc")};
193 if ( !rdbAccess ) {
194 ATH_MSG_ERROR("Could not locate RDBAccessSvc");
195 return StatusCode::FAILURE;
196 }
197
198 enum DataPeriod {Unknown, Run1, Run2, Run3, Run4 };
199 DataPeriod run = Unknown;
200
201 std::string configVal = "";
202
203 IRDBRecordset_ptr atlasCommonRec = rdbAccess->getRecordsetPtr("AtlasCommon", atlasVersion, "ATLAS");
204 if (atlasCommonRec->size() == 0) {
205 run = Run1;
206 } else {
207 configVal = (*atlasCommonRec)[0]->getString("CONFIG");
208 ATH_MSG_INFO("From DD Database, Configuration is " << configVal);
209 if (configVal == "RUN1") {
210 run = Run1;
211 } else if (configVal == "RUN2") {
212 run = Run2;
213 } else if (configVal == "RUN3") {
214 run = Run3;
215 } else if (configVal == "RUN4") {
216 run = Run4;
217 }
218 if (run == DataPeriod::Unknown) {
219 ATH_MSG_FATAL("Unexpected value for geometry config read from the database: " << configVal);
220 return StatusCode::FAILURE;
221 }
222 }
223 if (run == Run3 && m_idHelper->gasGapMax() < 3)
224 ATH_MSG_WARNING("Run3, configVal = " << configVal << " and GasGapMax =" << m_idHelper->gasGapMax());
225
226 if (run == Run1)
227 ATH_MSG_INFO("From Geometry DB: MuonSpectrometer configuration is: RUN1 or MuonGeometry = R.06");
228 else if (run == Run2)
229 ATH_MSG_INFO("From Geometry DB: MuonSpectrometer configuration is: RUN2 or MuonGeometry = R.07");
230 else if (run == Run3)
231 ATH_MSG_INFO("From Geometry DB: MuonSpectrometer configuration is: RUN3 or MuonGeometry = R.09");
232 else if (run == Run4)
233 ATH_MSG_INFO("From Geometry DB: MuonSpectrometer configuration is: RUN4 or MuonGeometry = R.10");
234
235 if (m_ignoreRunDepConfig == false) {
237 m_Efficiency_fromCOOL = false;
239 m_RPCInfoFromDb = false;
240 m_kill_deadstrips = false;
241 if (run == Run1) {
242 // m_BOG_BOF_DoubletR2_OFF = true
243 // m_Efficiency_fromCOOL = true
244 // m_ClusterSize_fromCOOL = true
246 if (configVal == "RUN1") { // MC12 setup
249 m_RPCInfoFromDb = true;
250 m_kill_deadstrips = true;
252 }
253 } else {
254 // m_BOG_BOF_DoubletR2_OFF = false # do not turn off at digitization the hits in the dbR=2 chambers in the feet
255 // m_Efficiency_fromCOOL = false # use common average values in python conf.
256 // m_ClusterSize_fromCOOL = false # use common average values in python conf.
258 if (run == Run2) { // MC15c setup
261 m_RPCInfoFromDb = true;
262 m_kill_deadstrips = false;
264 } else {
265 ATH_MSG_INFO("Run3/4: configuration parameter not from COOL");
266 m_Efficiency_fromCOOL = false;
268 m_RPCInfoFromDb = false;
269 m_kill_deadstrips = false;
270 }
271 }
272 ATH_MSG_INFO("RPC Run1/2/3-dependent configuration is enforced");
273 } else {
274 ATH_MSG_WARNING("Run1/2/3-dependent configuration is bypassed; be careful with option settings");
275 }
276
277 ATH_MSG_DEBUG("......RPC Efficiency_fromCOOL " << m_Efficiency_fromCOOL);
278 ATH_MSG_DEBUG("......RPC ClusterSize_fromCOOL " << m_ClusterSize_fromCOOL);
279 ATH_MSG_DEBUG("......RPC BOG_BOF_DoubletR2_OFF " << m_BOG_BOF_DoubletR2_OFF);
280 ATH_MSG_DEBUG("......RPC RPCInfoFromDb " << m_RPCInfoFromDb);
281 ATH_MSG_DEBUG("......RPC KillDeadStrips " << m_kill_deadstrips);
282 ATH_MSG_DEBUG("......RPC CutProjectedTracks " << m_CutProjectedTracks);
283
284
285 return StatusCode::SUCCESS;
286}
287
288//--------------------------------------------
289StatusCode RpcDigitizationTool::prepareEvent(const EventContext& /*ctx*/, unsigned int) {
290 ATH_MSG_DEBUG("RpcDigitizationTool::in prepareEvent()");
291
292 // John's Hacks START
293 m_RPCHitCollList.clear();
294 m_thpcRPC = std::make_unique<TimedHitCollection<RPCSimHit>>();
295 // John's Hacks END
296
297 return StatusCode::SUCCESS;
298}
299
300//--------------------------------------------
301StatusCode RpcDigitizationTool::processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) {
302 ATH_MSG_DEBUG("RpcDigitizationTool::in processBunchXing()");
303
305 TimedHitCollList hitCollList;
306
307 if (!(m_mergeSvc->retrieveSubSetEvtData(m_inputHitCollectionName, hitCollList, bunchXing, bSubEvents, eSubEvents).isSuccess()) &&
308 hitCollList.empty()) {
309 ATH_MSG_ERROR("Could not fill TimedHitCollList");
310 return StatusCode::FAILURE;
311 } else {
312 ATH_MSG_VERBOSE(hitCollList.size() << " RPCSimHitCollection with key " << m_inputHitCollectionName << " found");
313 }
314
315 TimedHitCollList::iterator iColl(hitCollList.begin());
316 TimedHitCollList::iterator endColl(hitCollList.end());
317
318 // Iterating over the list of collections
319 for (; iColl != endColl; ++iColl) {
320 RPCSimHitCollection* hitCollPtr = new RPCSimHitCollection(*iColl->second);
321 PileUpTimeEventIndex timeIndex(iColl->first);
322
323 ATH_MSG_DEBUG("RPCSimHitCollection found with " << hitCollPtr->size() << " hits");
324 ATH_MSG_VERBOSE("time index info. time: " << timeIndex.time() << " index: " << timeIndex.index() << " type: " << timeIndex.type());
325
326 m_thpcRPC->insert(timeIndex, hitCollPtr);
327 m_RPCHitCollList.emplace_back(hitCollPtr);
328 }
329
330 return StatusCode::SUCCESS;
331}
332
333//--------------------------------------------
334// Get next event and extract collection of hit collections:
335StatusCode RpcDigitizationTool::getNextEvent(const EventContext& ctx) {
336 ATH_MSG_DEBUG("RpcDigitizationTool::getNextEvent()");
337
338 // initialize pointer
339 m_thpcRPC.reset();
340
341 // get the container(s)
343
344 // In case of single hits container just load the collection using read handles
347 if (!hitCollection.isValid()) {
348 ATH_MSG_ERROR("Could not get RPCSimHitCollection container " << hitCollection.name() << " from store "
349 << hitCollection.store());
350 return StatusCode::FAILURE;
351 }
352
353 // create a new hits collection
354 m_thpcRPC = std::make_unique<TimedHitCollection<RPCSimHit>>(1);
355 m_thpcRPC->insert(0, hitCollection.cptr());
356 ATH_MSG_DEBUG("RPCSimHitCollection found with " << hitCollection->size() << " hits");
357
358 return StatusCode::SUCCESS;
359 }
360 // this is a list<pair<time_t, DataLink<RPCSimHitCollection> > >
361 TimedHitCollList hitCollList;
362
363 if (!(m_mergeSvc->retrieveSubEvtsData(m_inputHitCollectionName, hitCollList).isSuccess())) {
364 ATH_MSG_ERROR("Could not fill TimedHitCollList");
365 return StatusCode::FAILURE;
366 }
367 if (hitCollList.empty()) {
368 ATH_MSG_ERROR("TimedHitCollList has size 0");
369 return StatusCode::FAILURE;
370 } else {
371 ATH_MSG_DEBUG(hitCollList.size() << " RPCSimHitCollections with key " << m_inputHitCollectionName << " found");
372 }
373
374 // create a new hits collection
375 m_thpcRPC = std::make_unique<TimedHitCollection<RPCSimHit>>();
376 // now merge all collections into one
377 TimedHitCollList::iterator iColl(hitCollList.begin());
378 TimedHitCollList::iterator endColl(hitCollList.end());
379 while (iColl != endColl) {
380 const RPCSimHitCollection* p_collection(iColl->second);
381 m_thpcRPC->insert(iColl->first, p_collection);
382 // if ( m_debug ) ATH_MSG_DEBUG ( "RPCSimHitCollection found with "
383 // << p_collection->size() << " hits" ); // loop on the hit collections
384 ++iColl;
385 }
386 return StatusCode::SUCCESS;
387}
388
389//--------------------------------------------
390StatusCode RpcDigitizationTool::mergeEvent(const EventContext& ctx) {
391 StatusCode status = StatusCode::SUCCESS;
392
393 ATH_MSG_DEBUG("RpcDigitizationTool::in mergeEvent()");
394 // create and record the Digit container in StoreGate
396 ATH_CHECK(digitContainer.record(std::make_unique<RpcDigitContainer>(m_idHelper->module_hash_max())));
397 ATH_MSG_DEBUG("RpcDigitContainer recorded in StoreGate.");
398
399 // Create and record the SDO container in StoreGate
401 ATH_CHECK(sdoContainer.record(std::make_unique<MuonSimDataCollection>()));
402 ATH_MSG_DEBUG("RpcSDOCollection recorded in StoreGate.");
403
405 m_sdo_tmp_map.clear();
407
408 Collections_t collections;
409 status = doDigitization(ctx, collections, sdoContainer.ptr());
410 if (status.isFailure()) { ATH_MSG_ERROR("doDigitization Failed"); }
411 for (size_t coll_hash = 0; coll_hash < collections.size(); ++coll_hash) {
412 if (collections[coll_hash]) {
413 ATH_CHECK( digitContainer->addCollection (collections[coll_hash].release(), coll_hash) );
414 }
415 }
416
417 // Clean-up
418 m_RPCHitCollList.clear();
419
420 return status;
421}
422
423//--------------------------------------------
424StatusCode RpcDigitizationTool::processAllSubEvents(const EventContext& ctx) {
425 StatusCode status = StatusCode::SUCCESS;
426
427 // merging of the hit collection in getNextEvent method
428
429 ATH_MSG_DEBUG("RpcDigitizationTool::in digitize()");
430
431 // create and record the Digit container in StoreGate
433 ATH_CHECK(digitContainer.record(std::make_unique<RpcDigitContainer>(m_idHelper->module_hash_max())));
434 ATH_MSG_DEBUG("RpcDigitContainer recorded in StoreGate.");
435
436 // Create and record the SDO container in StoreGate
438 ATH_CHECK(sdoContainer.record(std::make_unique<MuonSimDataCollection>()));
439 ATH_MSG_DEBUG("RpcSDOCollection recorded in StoreGate.");
440
442 m_sdo_tmp_map.clear();
444
445 if (!m_thpcRPC) {
446 status = getNextEvent(ctx);
447 if (StatusCode::FAILURE == status) {
448 ATH_MSG_INFO("There are no RPC hits in this event");
449 return status; // there are no hits in this event
450 }
451 }
452
453 Collections_t collections;
454 ATH_CHECK(doDigitization(ctx, collections, sdoContainer.ptr()));
455 for (size_t coll_hash = 0; coll_hash < collections.size(); ++coll_hash) {
456 if (collections[coll_hash]) {
457 ATH_CHECK( digitContainer->addCollection (collections[coll_hash].release(), coll_hash) );
458 }
459 }
460
461 return status;
462}
463
464//--------------------------------------------
465StatusCode RpcDigitizationTool::doDigitization(const EventContext& ctx,
466 Collections_t& collections,
467 MuonSimDataCollection* sdoContainer) {
468 ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this);
469 rngWrapper->setSeed(name(), ctx);
470 CLHEP::HepRandomEngine* rndmEngine = rngWrapper->getEngine(ctx);
471
472 const MuonGM::MuonDetectorManager* detMgr{nullptr};
473 ATH_CHECK(SG::get(detMgr, m_detMgrKey, ctx));
474
475
476 std::unique_ptr<RPCSimHitCollection> inputSimHitColl{std::make_unique<RPCSimHitCollection>("RPC_Hits")};
477
478
479 // get the iterator pairs for this DetEl
480 // iterate over hits
482
483 // Perform null check on m_thpcRPC
484 if (!m_thpcRPC) {
485 ATH_MSG_ERROR("m_thpcRPC is null");
486 return StatusCode::FAILURE;
487 }
488
489 struct SimDataContent {
490 Identifier channelId{};
491 std::vector<MuonSimData::Deposit> deposits;
492 Amg::Vector3D gpos{Amg::Vector3D::Zero()};
493 double simTime{0.};
494 };
495
496 while (m_thpcRPC->nextDetectorElement(i, e)) {
497 // to store the a single
498
499 std::map<Identifier, SimDataContent> channelSimDataMap;
500
501 // Loop over the hits:
502 while (i != e) {
503 ATH_MSG_DEBUG("RpcDigitizationTool::loop over the hits");
504
505 TimedHitPtr<RPCSimHit> phit(*i++);
506
507 // the hit
508 const RPCSimHit& hit(*phit);
509 // the hit id
510 const int idHit = hit.RPCid();
511 // the global time (G4 time + bunch time)
512 const double globalHitTime{hitTime(phit)};
513 // the G4 time or TOF from IP
514 const double G4Time{hit.globalTime()};
515 // the bunch time
516 const double bunchTime{globalHitTime - hit.globalTime()};
517
518 ATH_MSG_DEBUG("Global time " << globalHitTime << " G4 time " << G4Time << " Bunch time " << bunchTime);
519
520 if (!m_simHitValidKey.empty()) {
521 ATH_MSG_VERBOSE("Validation: globalHitTime, G4Time, BCtime = " << globalHitTime << " " << G4Time << " " << bunchTime);
522 inputSimHitColl->Emplace(idHit, globalHitTime, hit.localPosition(),
523 HepMcParticleLink::getRedirectedLink(phit->particleLink(), phit.eventId(), ctx), // This link should now correctly resolve to the TruthEvent McEventCollection in the main StoreGateSvc.
524 hit.postLocalPosition(),
525 hit.energyDeposit(), hit.stepLength(), hit.particleEncoding(), hit.kineticEnergy());
526 }
527
528 // convert sim id helper to offline id
529 const std::string stationName = m_muonHelper->GetStationName(idHit);
530 const int stationEta = m_muonHelper->GetZSector(idHit);
531 const int stationPhi = m_muonHelper->GetPhiSector(idHit);
532 const int doubletR = m_muonHelper->GetDoubletR(idHit);
533 const int doubletZ = m_muonHelper->GetDoubletZ(idHit);
534 const int doubletPhi = m_muonHelper->GetDoubletPhi(idHit);
535 int gasGap = m_muonHelper->GetGasGapLayer(idHit);
536
537 if (m_muonHelper->GetMeasuresPhi(idHit)) continue; // Skip phi strip . To be created after efficiency evaluation
538
539
540 bool isValid{false};
541 const Identifier elementID = m_idHelper->elementID(stationName,stationEta,stationPhi,doubletR, isValid);
542 if (!isValid) {
543 ATH_MSG_WARNING("Failed to construct the element ID from "<<stationName
544 <<", stationEta: "<<stationEta<<", stationPhi: "<<stationPhi<<", doubletR: "<<doubletR);
545 continue;
546 }
547 // construct Atlas identifier from components
548 ATH_MSG_DEBUG("creating id for hit in element:"
549 << " stationName " << stationName << " stationEta " << stationEta << " stationPhi " << stationPhi << " doubletR "
550 << doubletR << " doubletZ " << doubletZ << " doubletPhi " << doubletPhi << " gasGap " << gasGap);
551 const Identifier detElId{m_idHelper->channelID(elementID, doubletZ, doubletPhi, 1,0, 1, isValid)};
552 if (!isValid) {
553 continue;
554 }
555 const RpcReadoutElement* reEle = detMgr->getRpcReadoutElement(detElId);
557 if (false && reEle->rotatedRpcModule()) {
558 gasGap = gasGap == 1 ? 2 : 1;
559 }
560
561
562 bool isValidEta{false}, isValidPhi{false};
563 const Identifier idpaneleta = m_idHelper->channelID(elementID, doubletZ, doubletPhi, gasGap, 0, 1, isValidEta);
564 const Identifier idpanelphi = m_idHelper->channelID(elementID, doubletZ, doubletPhi, gasGap, 1, 1, isValidPhi);
565 if (!isValidEta || !isValidPhi) {
566 ATH_MSG_WARNING("Found an invalid identifier "
567 << " stationName " << stationName << " stationEta " << stationEta << " stationPhi " << stationPhi
568 << " doubletR " << doubletR << " doubletZ " << doubletZ << " doubletPhi " << doubletPhi << " gasGap "
569 << gasGap);
570 continue;
571 }
572 // loop on eta and phi to apply correlated efficiency between the two views
573
575 const double tmp_CorrJitter = m_idHelper->stationName(idpaneleta) < 2 ? m_CorrJitter_BIS78 : m_CorrJitter;
577 const double corrtimejitter = tmp_CorrJitter > 0.01 ?
578 CLHEP::RandGaussZiggurat::shoot(rndmEngine, 0., tmp_CorrJitter) : 0.; // correlated jitter
579 // handle here the special case where eta panel is dead => phi strip status (dead or eff.) cannot be resolved;
580 // measured panel eff. will be used in that case and no phi strip killing will happen
581
582
583 // Extrapolate the hit to the gas gap centre located at x=0
584 const Amg::Vector3D hitDir{(hit.postLocalPosition() - hit.localPosition()).unit()};
585 const Amg::Vector3D gapCentre = hit.localPosition() +
586 Amg::intersect<3>(hit.localPosition(), hitDir, Amg::Vector3D::UnitX(), 0).value_or(0) * hitDir;
587
588 std::array<int, 3> pcseta = physicalClusterSize(ctx, reEle, idpaneleta, gapCentre, rndmEngine); // set to one for new algorithms
589 ATH_MSG_VERBOSE("Simulated cluster on eta panel: size/first/last= " << pcseta[0] << "/" << pcseta[1] << "/" << pcseta[2]);
590 std::array<int, 3> pcsphi = physicalClusterSize(ctx, reEle, idpanelphi, gapCentre, rndmEngine); // set to one for new algorithms
591 ATH_MSG_VERBOSE("Simulated cluster on phi panel: size/first/last= " << pcsphi[0] << "/" << pcsphi[1] << "/" << pcsphi[2]);
592
593
594
595 // create Identifiers
596 const Identifier atlasRpcIdeta = m_idHelper->channelID(elementID, doubletZ, doubletPhi, gasGap, 0, pcseta[1], isValidEta);
597 const Identifier atlasRpcIdphi = m_idHelper->channelID(elementID, doubletZ, doubletPhi, gasGap, 1, pcsphi[1], isValidPhi);
598
599 const HepMcParticleLink particleLink = HepMcParticleLink::getRedirectedLink(phit->particleLink(), phit.eventId(), ctx); // This link should now correctly resolve to the TruthEvent McEventCollection in the main StoreGateSvc.
600 const auto [etaStripOn, phiStripOn] = detectionEfficiency(ctx, idpaneleta, idpanelphi, rndmEngine, particleLink);
601 ATH_MSG_DEBUG("SetPhiOn " << phiStripOn << " SetEtaOn " << etaStripOn);
602
603 for (bool imeasphi : {false, true}) {
604 if (!imeasphi && (!etaStripOn || !isValidEta)) continue;
605 if (imeasphi && (!phiStripOn || !isValidPhi)) continue;
606
607
608 // get Identifier and list of clusters for this projection
609 const Identifier& atlasId = !imeasphi ? atlasRpcIdeta : atlasRpcIdphi;
610 std::array<int, 3> pcs{!imeasphi ? pcseta : pcsphi};
611
612 ATH_MSG_DEBUG("SetOn: stationName " << stationName << " stationEta " << stationEta << " stationPhi " << stationPhi
613 << " doubletR " << doubletR << " doubletZ " << doubletZ << " doubletPhi " << doubletPhi
614 << " gasGap " << gasGap << " measphi " << imeasphi);
615
616 // pcs contains the cluster size, the first strip number and the last strip number of the cluster
617 pcs = TurnOnStrips(reEle, std::move(pcs), atlasId);
618 if (pcs[2] < 0){
619 continue;
620 }
621
622 ATH_MSG_DEBUG("Simulated cluster1: size/first/last= " << pcs[0] << "/" << pcs[1] << "/" << pcs[2]);
623
624
625 const Amg::Vector3D pos = fromSimHitToLayer(reEle, atlasId) * hit.localPosition();
626 const Amg::Vector3D gpos = reEle->transform(atlasId) * pos;
627
628 ATH_MSG_VERBOSE(" evt: "<<ctx.eventID().event_number()
629 <<" hit "<<m_idHelper->print_to_string(atlasId)
630 <<" local simHit "<<Amg::toString(hit.localPosition())
631 <<" corrected: "<<Amg::toString(pos)
632 <<" transform: "<<GeoTrf::toString(fromSimHitToLayer(reEle, atlasId))
633 <<" local strip: "<<Amg::toString(reEle->localToGlobalTransf(atlasId).inverse()*reEle->stripPos(atlasId))
634 <<" local strip (II): "<<Amg::toString(reEle->transform(atlasId).inverse()*reEle->stripPos(atlasId))
635 <<" global: "<<Amg::toString(gpos)
636 <<" strip Pos: "<<Amg::toString(reEle->stripPos(atlasId)));
637
638 // Calculate propagation time along readout strip in seconds
639 double proptime = PropagationTime(reEle, atlasId, gpos);
640
641 double tns = G4Time + proptime + corrtimejitter; // the time is in nanoseconds
642 ATH_MSG_VERBOSE("TOF+propagation time " << tns << " /s where proptime " << proptime << "/s");
643
644 double time = tns + bunchTime;
645 ATH_MSG_VERBOSE("final time in ns: BC+TOF+prop " << time << " /ns");
646
647 // pack propagation time along strip, bunch time and local hit position
648 long long int packedMCword = PackMCTruth(proptime, bunchTime, pos.y(), pos.z());
649 //cppcheck-suppress invalidPointerCast
650 double* b = reinterpret_cast<double*>(&packedMCword);
651
653 // create here deposit for MuonSimData
654 // MuonMCData first word is the packing of : proptime, bunchTime, posy, posz
655 // MuonMCData second word is the total hit time: bunchcTime+tof+proptime+correlatedJitter / ns
656 MuonSimData::Deposit deposit(particleLink, MuonMCData((*b), time)); // store tof+strip_propagation+corr.jitter
657 // MuonMCData((*b),G4Time+bunchTime+proptime )); // store tof+strip_propagation
658
659 // Do not store pile-up truth information
661 if (std::abs(hit.particleEncoding()) == 13 || hit.particleEncoding() == 0) {
662 if (channelSimDataMap.find(atlasId) == channelSimDataMap.end()) {
663 SimDataContent& content = channelSimDataMap[atlasId];
664 content.channelId = atlasId;
665 content.deposits.push_back(deposit);
666 content.gpos = reEle->transform(atlasId)*
667 fromSimHitToLayer(reEle,atlasId) * gapCentre;
668 content.simTime = hitTime(phit);
669 ATH_MSG_VERBOSE("adding SDO entry: r " << content.gpos.perp() << " z " << content.gpos.z());
670 }
671 }
672 }
673
674
675 //---------------------------------------------------------------------
676 // construct new digit and store it in the respective digit collection
677 // --------------------------------------------------------------------
678
679 // we create one digit-vector/deposit for each strip in the cluster
680 bool isValid{false};
681 for (int clus = pcs[1]; clus <= pcs[2]; ++clus) {
682 Identifier newId = m_idHelper->channelID(stationName, stationEta, stationPhi, doubletR, doubletZ,
683 doubletPhi, gasGap, imeasphi, clus, isValid);
684 if (!isValid) {
685 ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<< "Channel "<< stationName<<" "<<stationEta<<" "<<stationPhi<<" "<< doubletR<<" "<<doubletZ
686 <<" "<< doubletPhi<<" "<< gasGap <<" "<< imeasphi<<" "<< clus<<" is invalid");
687 continue;
688 }
689
690 if (!m_idHelper->valid(newId)) {
691 if (stationName.find("BI") != std::string::npos) {
692 ATH_MSG_WARNING("Temporary skipping creation of RPC digit for stationName="
693 << stationName << ", eta=" << stationEta << ", phi=" << stationPhi << ", doubletR=" << doubletR
694 << ", doubletZ=" << doubletZ << ", doubletPhi=" << doubletPhi << ", gasGap=" << gasGap
695 << ", measuresPhi=" << imeasphi << ", strip=" << clus << ", cf. ATLASRECTS-6124");
696 return StatusCode::SUCCESS;
697 } else {
698 ATH_MSG_ERROR("Created an invalid id, aborting!");
699 m_idHelper->print(newId);
700 return StatusCode::FAILURE;
701 }
702 }
703
707 // One identifier but several deposits // name m_sdo_tmp_map is wrong call it m_sdo_map
708 if (m_sdo_tmp_map.find(newId) == m_sdo_tmp_map.end()) {
709 std::vector<MuonSimData::Deposit> newdeps;
710 newdeps.push_back(deposit);
711 m_sdo_tmp_map.insert(std::map<Identifier, std::vector<MuonSimData::Deposit>>::value_type(newId, newdeps));
712 } else {
713 m_sdo_tmp_map[newId].push_back(deposit);
714 }
715 } // end for cluster
716 } // loop on eta and phi
717 } // end loop hits
718
719 if (m_muonOnlySDOs) {
720 for (auto it = channelSimDataMap.begin(); it != channelSimDataMap.end(); ++it) {
721 MuonSimData simData(it->second.deposits, 0);
722 simData.setPosition(it->second.gpos);
723 simData.setTime(it->second.simTime);
724 auto insertResult = sdoContainer->insert(std::make_pair(it->first, simData));
725 if (!insertResult.second)
726 ATH_MSG_WARNING("Attention: this sdo is not recorded, since the identifier already exists in the sdoContainer map");
727 }
728 }
729
730 } // end loop detector elements
731
733
734 std::map<Identifier, std::vector<MuonSimData::Deposit>>::iterator map_iter = m_sdo_tmp_map.begin();
735 ATH_MSG_DEBUG("Start the digit map loop");
736
737 for (; map_iter != m_sdo_tmp_map.end(); ++map_iter) {
738 // Identifier
739 const Identifier theId = (*map_iter).first;
740 ATH_MSG_DEBUG("in the map loop: id " << m_idHelper->show_to_string(theId));
741 // Deposit
742 const std::vector<MuonSimData::Deposit> theDeps = (*map_iter).second;
743
744 // store the SDO from the muon
745 MuonSimData::Deposit theMuon; // useful beacuse it sorts the digits in ascending time.
746 std::multimap<double, MuonSimData::Deposit> times; // extract here time info from deposits.
747
748 // loop on the vector deposit
749 for (unsigned int k = 0; k < theDeps.size(); k++) {
750 double time = theDeps[k].second.secondEntry();
751 times.insert(std::multimap<double, MuonSimData::Deposit>::value_type(time, theDeps[k]));
752 }
753
754 // now iterate again over the multimap entries and store digits after dead time applied
755
756 IdContext rpcContext = m_idHelper->module_context(); // work on chamber context
757
758 std::multimap<double, MuonSimData::Deposit>::iterator map_dep_iter = times.begin();
759
760 // loop to suppress digits too close in time (emulate Front-End and CMA dead time)
761 double last_time = -10000; // init to high value
762 for (; map_dep_iter != times.end(); ++map_dep_iter) {
763 double currTime = (*map_dep_iter).first;
764 ATH_MSG_VERBOSE("deposit with time " << currTime);
765
767 // store (before any cut: all G4 hits) in the SDO container
768 // Identifier sdo and digit are the same
769 if (sdoContainer->find(theId) != sdoContainer->end()) // Identifier exist -> increase deposit
770 {
771 std::map<Identifier, MuonSimData>::const_iterator it = sdoContainer->find(theId);
772 std::vector<MuonSimData::Deposit> deps = ((*it).second).getdeposits();
773 deps.push_back((*map_dep_iter).second);
774 } else // Identifier does not exist -> create (Id,deposit)
775 {
776 std::vector<MuonSimData::Deposit> deposits;
777 deposits.push_back((*map_dep_iter).second);
778 std::pair<std::map<Identifier, MuonSimData>::iterator, bool> insertResult =
779 sdoContainer->insert(std::make_pair(theId, MuonSimData(deposits, 0)));
780 if (!insertResult.second)
782 "Attention TEMP: this sdo is not recorded, since the identifier already exists in the sdoContainer map");
783 }
784 }
785 // apply dead time
786 if (std::abs(currTime - last_time) > (m_deadTime)) {
787 ATH_MSG_DEBUG("deposit with time " << currTime << " is distant enough from previous (if any) hit on teh same strip");
788 last_time = (*map_dep_iter).first;
789
790 // first add time jitter to the time:
791 double uncorrjitter = 0;
792 double tmp_UncorrJitter = m_UncorrJitter;
793 if (m_idHelper->stationName(theId) < 2) tmp_UncorrJitter = m_UncorrJitter_BIS78;
794 if (tmp_UncorrJitter > 0.01) uncorrjitter = CLHEP::RandGaussZiggurat::shoot(rndmEngine, 0., tmp_UncorrJitter);
795 // Historically patch for the cavern background
796 // Now we subtract TOF from IP to assume full time calibrated detector (t=0 for particle from IP at light speed)
797 // We add a time shift to emulate FE global offset
798
799 const RpcReadoutElement* ele = detMgr->getRpcReadoutElement(theId);
800 Amg::Vector3D posi = ele->stripPos(theId);
801 double tp = m_patch_for_rpc_time ? posi.mag() / Gaudi::Units::c_light : 0.;
802 // Calculate propagation time for a hit at the center of the strip, to be subtructed as well as the nominal TOF
803 double propTimeFromStripCenter = PropagationTime(ele, theId, posi);
804 double newDigit_time = currTime + uncorrjitter + m_rpc_time_shift - tp - propTimeFromStripCenter;
805
806 double digi_ToT = -1.; // Time over threshold, for Narrow-gap RPCs only
807 if (m_idHelper->stationName(theId) < 2) digi_ToT = timeOverThreshold(rndmEngine); //mn
808
809 ATH_MSG_VERBOSE("last_time=currTime " << last_time << " jitter " << uncorrjitter << " TOFcorrection " << tp << " shift "
810 << m_rpc_time_shift << " newDigit_time " << newDigit_time);
811
812 // Apply readout window (sensitive detector time window)
813 bool outsideDigitizationWindow = outsideWindow(newDigit_time);
814 if (outsideDigitizationWindow) {
815 ATH_MSG_VERBOSE("hit outside digitization window - do not produce digits");
816 ATH_MSG_DEBUG("Hit outside time window!!"
817 << " hit time (ns) = " << newDigit_time << " timeWindow = " << m_timeWindowLowerOffset << " / "
819
820 continue;
821 }
822 // ok, let's store this digit
823 // this is an accepted hit to become digit
824 last_time = (*map_dep_iter).first;
825
826 std::unique_ptr<RpcDigit> newDigit = std::make_unique<RpcDigit>(theId, newDigit_time, digi_ToT, false);
827
828 Identifier elemId = m_idHelper->elementID(theId);
829 RpcDigitCollection* digitCollection = nullptr;
830
831 IdentifierHash coll_hash;
832 if (m_idHelper->get_hash(elemId, coll_hash, &rpcContext)) {
833 ATH_MSG_ERROR("Unable to get RPC hash id from RPC Digit collection "
834 << "context begin_index = " << rpcContext.begin_index()
835 << " context end_index = " << rpcContext.end_index() << " the identifier is \n"<<elemId);
836 }
837
838 // make new digit
839 ATH_MSG_DEBUG("Digit Id = " << m_idHelper->show_to_string(theId) << " digit time " << newDigit_time);
840
841 // remember new collection.
842 if (coll_hash >= collections.size()) {
843 collections.resize (coll_hash+1);
844 }
845 digitCollection = collections[coll_hash].get();
846 if (!digitCollection) {
847 collections[coll_hash] = std::make_unique<RpcDigitCollection>(elemId, coll_hash);
848 digitCollection = collections[coll_hash].get();
849 }
850 digitCollection->push_back(std::move(newDigit));
851
853 // put SDO collection in StoreGate
854 if (sdoContainer->find(theId) != sdoContainer->end()) {
855 std::map<Identifier, MuonSimData>::const_iterator it = sdoContainer->find(theId);
856 std::vector<MuonSimData::Deposit> deps = ((*it).second).getdeposits();
857 deps.push_back((*map_dep_iter).second);
858 } else {
859 std::vector<MuonSimData::Deposit> deposits;
860 deposits.push_back((*map_dep_iter).second);
861 std::pair<std::map<Identifier, MuonSimData>::iterator, bool> insertResult =
862 sdoContainer->insert(std::make_pair(theId, MuonSimData(deposits, 0)));
863 if (!insertResult.second)
865 "Attention: this sdo is not recorded, since teh identifier already exists in the sdoContainer map");
866 }
867 }
868
869 } else
870 ATH_MSG_DEBUG("discarding digit due to dead time: " << (*map_dep_iter).first << " " << last_time);
871 }
872
873 } // loop to suppress digits too close in time ended
874
875 // reset the pointer if it not null
876 m_thpcRPC.reset();
877 if (!m_simHitValidKey.empty()) {
879 ATH_CHECK(validHandle.record(std::move(inputSimHitColl)));
880 }
881
882 return StatusCode::SUCCESS;
883}
885 const Identifier& layerId) const {
886
887 Amg::Vector3D lGasGapPos = reEle->localGasGapPos(layerId);
888 if (reEle->NphiStripPanels() != reEle->nGasGapPerLay()) {
889 lGasGapPos.y() =0.;
890 }
891
895 const bool flip = reEle->numberOfLayers() == 2 &&
896 (m_idHelper->gasGap(layerId) == 2) != reEle->rotatedRpcModule();
897 const Amg::Transform3D fromHitToGap{reEle->transform(layerId).inverse() *
898 reEle->absTransform() * Amg::getTranslate3D(lGasGapPos) *
899 (flip ? Amg::getRotateY3D(180.*Gaudi::Units::deg) : Amg::Isometry3D::Identity())};
900 ATH_MSG_VERBOSE("Transformation to go from hit to gap restframe "<<m_idHelper->print_to_string(layerId)
901 <<" "<<Amg::toString(fromHitToGap));
902 return fromHitToGap;
903}
904
905//--------------------------------------------
906std::array<int, 3> RpcDigitizationTool::physicalClusterSize(const EventContext& ctx,
907 const RpcReadoutElement* ele,
908 const Identifier& id,
909 const Amg::Vector3D& gapCentre,
910 CLHEP::HepRandomEngine* rndmEngine) const {
911
912
913 std::array<int, 3> result{};
914
915 const Amg::Vector3D position = fromSimHitToLayer(ele, id) * gapCentre;
916
917 const int doubletPhi = m_idHelper->doubletPhi(id);
918 const int gasGap = m_idHelper->gasGap(id);
919 const bool measuresPhi = m_idHelper->measuresPhi(id);
920 const double pitch= ele->StripPitch(measuresPhi);
921
922
923 const int nstrip = ele->stripNumber(position.block<2,1>(0,0), id);
924 const int numStrips = ele->Nstrips(measuresPhi);
925
926 result[1] = nstrip;
927 result[2] = nstrip;
928
929 if (nstrip < 1 || nstrip > numStrips) {
930 return make_array<int, 3>(-1);
931 }
932 const Amg::Vector3D locStripPos = ele->transform(id).inverse()*ele->stripPos(doubletPhi, gasGap, measuresPhi, nstrip);
933 float xstripnorm = (locStripPos -position).x() / pitch ;
934 result[0] = determineClusterSize(ctx, id, xstripnorm, rndmEngine);
935
936 //
937
938
939 if (m_turnON_clustersize == false) result[0] = 1;
940
941 return result;
942}
943
944//--------------------------------------------
946 std::array<int, 3>&& pcs,
947 const Identifier& id) const {
948
949
950 const int nstrips = ele->Nstrips(m_idHelper->measuresPhi(id));
951
952 if (pcs[0] == -2) {
953 pcs[1] = pcs[2] - 1;
954 } else if (pcs[0] == 2) {
955 pcs[2] = pcs[1] + 1;
956 } else if (pcs[0] > 2) {
957 pcs[1] = pcs[1] - pcs[0] / 2;
958 if (fmod(pcs[0], 2) == 0) pcs[1] = pcs[1] + 1;
959 pcs[2] = pcs[1] + pcs[0] - 1;
960 } else if (pcs[0] < -2) {
961 pcs[1] = pcs[1] + pcs[0] / 2;
962 pcs[2] = pcs[1] - pcs[0] - 1;
963 }
964
965 // cut the clusters at the beginning and at the end of the chamber
966
967 pcs[1] = std::clamp(pcs[1], 1, nstrips);
968 pcs[2] = std::clamp(pcs[2], 1, nstrips);
969
970 pcs[0] = pcs[2] - pcs[1] + 1;
971
972 return pcs;
973}
974
975//--------------------------------------------
977 const Identifier& id,
978 const Amg::Vector3D& globPos) const {
979
980 double distance{0.};
981 if (m_idHelper->measuresPhi(id)) {
982 distance = ele->distanceToPhiReadout(globPos);
983 } else {
984 distance = ele->distanceToEtaReadout(globPos);
985 }
986
987 // distance in mm, SIG_VEL in ns/m
988 return std::abs(distance * SIG_VEL * 1.e-3);
989}
990
991//--------------------------------------------
992long long int RpcDigitizationTool::PackMCTruth(float proptime, float bctime, float posy, float posz) const {
993 // start with proptime: it is usually ~ns. It comes in ns. We express it in ns/10. use only 8 bits
994 if (proptime < 0) {
995 ATH_MSG_WARNING("A poblem: packing a propagation time <0 " << proptime << " redefine it as 0");
996 proptime = 0.;
997 }
998 long long int new_proptime = int(proptime * 10) & 0xff;
999
1000 // now tof. it is ~100ns. comes in ns. express it in ns/10. 16 bits needed (0-32768)
1001 // now BC time: it is ~100ns. comes in ns. express it in ns/10. 16 bits needed (0-32768)
1002 // can be negative (=> add 300 ns)
1003
1004 long long int new_bctime = int((bctime + 300.) * 10.) & 0xffff;
1005
1006 // posy: ~1000mm comes in mm, write it in mm*10. need 16 bits (0-32768)
1007 // can be negative (=>add 1500 mm)
1008
1009 long long int new_posy = int((posy + 1500.) * 10.) & 0xffff;
1010
1011 // posz: ~1000mm comes in mm, write it in mm*10. need 16 bits (0-32768)
1012 // can be negative (=>add 1500 mm)
1013
1014 long long int new_posz = int((posz + 1500.) * 10.) & 0xffff;
1015
1016 return (new_proptime + (new_bctime << 8) + (new_posy << 24) + (new_posz << 40));
1017}
1018
1019//--------------------------------------------
1020void RpcDigitizationTool::UnPackMCTruth(double theWord, float& proptime, float& bctime, float& posy, float& posz) {
1021 // int64_t is just a shorter way of writing long long int
1022 using Repacker = union
1023
1024 {
1025 double dWord;
1026
1027 int64_t iWord;
1028 };
1029 Repacker MCTruth;
1030 MCTruth.dWord = theWord;
1031 proptime = ((MCTruth.iWord) & 0x00000000000000ffLL) / 10.;
1032 bctime = (((MCTruth.iWord) & 0x0000000000ffff00LL) >> 8) / 10.;
1033 posy = (((MCTruth.iWord) & 0x000000ffff000000LL) >> 24) / 10.;
1034 posz = (((MCTruth.iWord) & 0x00ffff0000000000LL) >> 40) / 10.;
1035
1036 //
1037 bctime = bctime - 300.;
1038 posy = posy - 1500.;
1039 posz = posz - 1500.;
1040}
1041
1042//--------------------------------------------
1044 // get TagInfoMgr
1045 SmartIF<ITagInfoMgr> tagInfoMgr{Gaudi::svcLocator()->service("TagInfoMgr")}; // Tag Info Manager
1046 if (!tagInfoMgr) { return StatusCode::FAILURE; }
1047
1048 std::string RpctimeSchema = "";
1049 std::stringstream RpctimeShift;
1050 RpctimeShift << (int)m_rpc_time_shift;
1051
1053 RpctimeSchema = "Datalike_TOFoff_TimeShift" + RpctimeShift.str() + "nsec";
1054 } else {
1055 RpctimeSchema = "G4like_TOFon_TimeShift" + RpctimeShift.str() + "nsec";
1056 }
1057
1058 StatusCode sc = tagInfoMgr->addTag(m_RPC_TimeSchema, RpctimeSchema);
1059
1060 if (sc.isFailure()) {
1061 ATH_MSG_WARNING(m_RPC_TimeSchema << " " << RpctimeSchema << " not added to TagInfo ");
1062 return sc;
1063 }
1064
1065 ATH_MSG_DEBUG(m_RPC_TimeSchema << " " << RpctimeSchema << " added to TagInfo ");
1066
1067 return StatusCode::SUCCESS;
1068}
1069
1070
1071//--------------------------------------------
1072std::pair<bool,bool> RpcDigitizationTool::detectionEfficiency(const EventContext& ctx,
1073 const Identifier& IdEta,
1074 const Identifier& IdPhi,
1075 CLHEP::HepRandomEngine* rndmEngine,
1076 const HepMcParticleLink& trkParticle) const {
1077
1078
1079
1080 ATH_MSG_DEBUG("RpcDigitizationTool::in DetectionEfficiency");
1081
1082 ATH_MSG_DEBUG("EtaPanelId to look for Eff is " << m_idHelper->show_to_string(IdEta));
1083 ATH_MSG_DEBUG("PhiPanelId to look for Eff is " << m_idHelper->show_to_string(IdPhi));
1084
1085
1086 // dead spacers are not simulated in GEANT4 => their effect must be emulated in the digitizer as an effective max. efficiency = 99%
1087 // (spacers are 1x1cm^2 over a grid of 10x10cm^2 =? geometrical ineff. introduced is 1% for normal incidence)
1088 float maxGeomEff{0.99}, PhiAndEtaEff{0.99}, OnlyEtaEff{0.f}, OnlyPhiEff{0.f};
1089
1090 // 2=BML,3=BMS,4=BOL,5=BOS,8=BMF,9=BOF,10=BOG
1091 int stationName = m_idHelper->stationName(IdEta);
1092 int stationEta = m_idHelper->stationEta(IdEta);
1093 int doubletR = m_idHelper->doubletR(IdEta);
1094
1095 // remove feet extension. driven by joboption
1096 if (m_BOG_BOF_DoubletR2_OFF && (stationName == m_BOF_id || stationName == m_BOG_id) && doubletR == 2) {
1097 return std::make_pair(false, false);
1098 }
1099
1100
1101 if (!m_turnON_efficiency) {
1102 return std::make_pair(true, true);
1103 }
1104 bool etaStripOn{true}, phiStripOn{true};
1105
1106 // int stripetadead = 0 ; // not used
1107 // int stripphidead = 0 ; // not used
1108
1109 unsigned int index = stationName - 2;
1110 // BML and BMS, BOL and BOS come first (stationName= 2 and 3, 4 and 5 -> index 0-3)
1111 if (stationName > 5 && stationName < 50) index = index - 2;
1112 // BMF, BOF and BOG are 8,9,10 => must be 4,5 and 6
1113 else if (stationName > 50)
1114 index = index - 44;
1115 // BME and BOE 53 and 54 are at indices 7 and 8
1116
1117 if (!m_Efficiency_fromCOOL && stationName >= 2) {
1118 if (index > m_PhiAndEtaEff_A.size() || index > m_OnlyEtaEff_A.size() || index > m_OnlyPhiEff_A.size()) {
1119 THROW_EXCEPTION("Index out of array in Detection Efficiency SideA " << index << " stationName = " << stationName);
1120 }
1121
1122 PhiAndEtaEff = m_PhiAndEtaEff_A[index];
1123 OnlyEtaEff = m_OnlyEtaEff_A[index];
1124 OnlyPhiEff = m_OnlyPhiEff_A[index];
1125
1126 if (stationEta < 0) {
1127 if (index > m_PhiAndEtaEff_C.size() || index > m_OnlyEtaEff_C.size() || index > m_OnlyPhiEff_C.size()) {
1128 THROW_EXCEPTION("Index out of array in Detection Efficiency SideC " << index << " stationName = " << stationName);
1129 }
1130 PhiAndEtaEff = m_PhiAndEtaEff_C[index];
1131 OnlyEtaEff = m_OnlyEtaEff_C[index];
1132 OnlyPhiEff = m_OnlyPhiEff_C[index];
1133 }
1134 } else if (stationName < 2 && (!m_Efficiency_fromCOOL || !m_Efficiency_BIS78_fromCOOL)) { // BIS
1135 PhiAndEtaEff = m_PhiAndEtaEff_BIS78;
1136 OnlyEtaEff = m_OnlyEtaEff_BIS78;
1137 OnlyPhiEff = m_OnlyPhiEff_BIS78;
1138 } else { // Efficiency from Cool
1139
1140 const RpcCondDbData* readCdo{nullptr};
1141 if(!SG::get(readCdo,m_readKey, ctx).isSuccess()){
1142 THROW_EXCEPTION("Failed to retrieve conditions object");
1143 }
1144
1145 ATH_MSG_DEBUG("Efficiencies and cluster size + dead strips will be extracted from COOL");
1146
1147 double FracDeadStripEta{0.}, FracDeadStripPhi{0.};
1148 double EtaPanelEfficiency{1.}, PhiPanelEfficiency{1.}, GapEfficiency{1.};
1149 int RPC_ProjectedTracksEta = 0;
1150
1151 std::optional<double> fracDeadStripEtaFromCOOL = readCdo->getFracDeadStrip(IdEta);
1152 std::optional<double> fracDeadStripPhiFromCOOL = readCdo->getFracDeadStrip(IdPhi);
1153
1154 bool noEntryInDb = !fracDeadStripEtaFromCOOL || !fracDeadStripPhiFromCOOL;
1155
1156 FracDeadStripEta = fracDeadStripEtaFromCOOL.value_or(0.);
1157 FracDeadStripPhi = fracDeadStripPhiFromCOOL.value_or(0.);
1158 RPC_ProjectedTracksEta = readCdo->getProjectedTrack(IdEta).value_or(0);
1159
1160 EtaPanelEfficiency = readCdo->getEfficiency(IdEta).value_or(1.);
1161 PhiPanelEfficiency = readCdo->getEfficiency(IdPhi).value_or(1.);
1162 GapEfficiency = readCdo->getGapEfficiency(IdEta).value_or(1.);
1163
1164 if (std::abs(FracDeadStripEta - 1.) < 0.001) {
1165 ATH_MSG_DEBUG("Watch out: SPECIAL CASE: Read from Cool: FracDeadStripEta/Phi "
1166 << FracDeadStripEta << "/" << FracDeadStripPhi << " RPC_ProjectedTracksEta " << RPC_ProjectedTracksEta
1167 << " Eta/PhiPanelEfficiency " << EtaPanelEfficiency << "/" << PhiPanelEfficiency << " gapEff " << GapEfficiency
1168 << " for gas gap " << m_idHelper->show_to_string(IdEta) << " id " << IdEta.get_identifier32().get_compact());
1169 // dead eta panel => cannot determine the strip status for phi strips
1170 // FracDeadStripPhi must be reset to 0. and undefinedPhiStripStatus = true
1171 FracDeadStripPhi = 0.;
1172 ATH_MSG_VERBOSE("Watch out: SPECIAL CASE: Resetting FracDeadStripPhi " << FracDeadStripPhi << " ignoring phi dead strips ");
1173 }
1174
1175 // special test
1176 // here redefining the efficiencies:
1177 // EtaPanelEfficiency = 0.92;
1178 // PhiPanelEfficiency = 0.85;
1179 // GapEfficiency = 0.97;
1180 bool changing = false;
1181 ATH_MSG_DEBUG("Read from Cool: FracDeadStripEta/Phi " << FracDeadStripEta << "/" << FracDeadStripPhi << " RPC_ProjectedTracksEta "
1182 << RPC_ProjectedTracksEta << " Eta/PhiPanelEfficiency " << EtaPanelEfficiency
1183 << "/" << PhiPanelEfficiency << " gapEff " << GapEfficiency);
1184 // if ((1.-FracDeadStripEta)<EtaPanelEfficiency)
1185 if ((maxGeomEff - FracDeadStripEta) - EtaPanelEfficiency < -0.011) {
1186 ATH_MSG_DEBUG("Ineff. from dead strips on Eta Panel larger that measured efficiency: deadFrac="
1187 << FracDeadStripEta << " Panel Eff=" << EtaPanelEfficiency << " for Panel " << m_idHelper->show_to_string(IdEta));
1188 ATH_MSG_DEBUG("... see the corresponding report from RpcDetectorStatusDbTool");
1189 // EtaPanelEfficiency = 1.-FracDeadStripEta;
1190 EtaPanelEfficiency = maxGeomEff - FracDeadStripEta;
1191 changing = true;
1192 }
1193 // if ((1.-FracDeadStripPhi)<PhiPanelEfficiency)
1194 if ((maxGeomEff - FracDeadStripPhi) - PhiPanelEfficiency < -0.011) {
1195 ATH_MSG_DEBUG("Ineff. from dead strips on Phi Panel larger that measured efficiency: deadFrac="
1196 << FracDeadStripPhi << " Panel Eff=" << PhiPanelEfficiency << " for Panel " << m_idHelper->show_to_string(IdPhi));
1197 ATH_MSG_DEBUG("... see the corresponding report among the warnings of RpcDetectorStatusDbTool");
1198 // PhiPanelEfficiency = 1.-FracDeadStripPhi;
1199 PhiPanelEfficiency = maxGeomEff - FracDeadStripPhi;
1200 changing = true;
1201 }
1202 // if ((1.-FracDeadStripEta*FracDeadStripPhi)<GapEfficiency)
1203 if ((maxGeomEff - FracDeadStripEta * FracDeadStripPhi) - GapEfficiency < -0.011) {
1204 ATH_MSG_DEBUG("Ineff. from dead strips on Eta/Phi Panels larger that measured EtaORPhi efficiency: deadFrac="
1205 << FracDeadStripEta * FracDeadStripPhi << " EtaORPhi Eff=" << GapEfficiency << " for GasGap "
1206 << m_idHelper->show_to_string(IdEta));
1207 ATH_MSG_DEBUG("... see the corresponding report among the warnings of RpcDetectorStatusDbTool");
1208 // GapEfficiency = 1.-FracDeadStripEta*FracDeadStripPhi;
1209 GapEfficiency = maxGeomEff - FracDeadStripEta * FracDeadStripPhi;
1210 changing = true;
1211 }
1212 if (changing)
1213 ATH_MSG_DEBUG("Rinormalized Values from Cool: FracDeadStripEta/Phi "
1214 << FracDeadStripEta << "/" << FracDeadStripPhi << " RPC_ProjectedTracksEta " << RPC_ProjectedTracksEta
1215 << " Eta/PhiPanelEfficiency " << EtaPanelEfficiency << "/" << PhiPanelEfficiency << " gapEff " << GapEfficiency);
1216
1217 // gabriele //..stefania - if there are dead strips renormalize the eff. to the active area
1218 if (m_kill_deadstrips) {
1219 if ((FracDeadStripEta > 0.0 && FracDeadStripEta < 1.0) || (FracDeadStripPhi > 0.0 && FracDeadStripPhi < 1.0) || (noEntryInDb)) {
1220 EtaPanelEfficiency = EtaPanelEfficiency / (maxGeomEff - FracDeadStripEta);
1221 PhiPanelEfficiency = PhiPanelEfficiency / (maxGeomEff - FracDeadStripPhi);
1222 GapEfficiency = GapEfficiency / (maxGeomEff - FracDeadStripEta * FracDeadStripPhi);
1223
1224 if (EtaPanelEfficiency > maxGeomEff) EtaPanelEfficiency = maxGeomEff;
1225 if (PhiPanelEfficiency > maxGeomEff) PhiPanelEfficiency = maxGeomEff;
1226 if (GapEfficiency > maxGeomEff) GapEfficiency = maxGeomEff;
1227
1228 if (EtaPanelEfficiency > GapEfficiency) GapEfficiency = EtaPanelEfficiency;
1229 if (PhiPanelEfficiency > GapEfficiency) GapEfficiency = PhiPanelEfficiency;
1230 ATH_MSG_DEBUG("Eff Redefined (to correct for deadfrac): FracDeadStripEta/Phi "
1231 << " Eta/PhiPanelEfficiency " << EtaPanelEfficiency << "/" << PhiPanelEfficiency << " gapEff "
1232 << GapEfficiency);
1233 }
1234 }
1235
1236 // values from COOLDB (eventually overwritten later)
1237 PhiAndEtaEff = float(EtaPanelEfficiency + PhiPanelEfficiency - GapEfficiency);
1238 if (PhiAndEtaEff < 0.) PhiAndEtaEff = 0.;
1239 OnlyEtaEff = float(EtaPanelEfficiency - PhiAndEtaEff);
1240 if (OnlyEtaEff < 0.) OnlyEtaEff = 0.;
1241 OnlyPhiEff = float(PhiPanelEfficiency - PhiAndEtaEff);
1242 if (OnlyPhiEff < 0.) OnlyPhiEff = 0.;
1243
1244 // special patch to be true only when m_Efficiency_fromCOOL=true and /RPC/DQMF/ELEMENT_STATUS tag is
1245 // RPCDQMFElementStatus_2012_Jaunuary_26
1246 bool applySpecialPatch = false;
1248 if (m_idHelper->stationName(IdEta) == 3)
1249 {
1250 if (std::abs(m_idHelper->stationEta(IdEta)) == 6 && m_idHelper->doubletR(IdEta) == 1 &&
1251 m_idHelper->doubletZ(IdEta) == 2 && m_idHelper->doubletPhi(IdEta) == 1) {
1252 applySpecialPatch = true;
1254 "Applying special patch for BMS at |eta|=6 lowPt plane -dbbZ=2 and dbPhi=1 ... will use default eff. for Id "
1255 << m_idHelper->show_to_string(IdEta));
1257 "Applying special patch: THIS HAS TO BE DONE IF /RPC/DQMF/ELEMENT_STATUS tag is "
1258 "RPCDQMFElementStatus_2012_Jaunuary_2");
1259 }
1260 }
1261 }
1262
1263 // if projected tracks number too low or inconsistent values get efficiencies from joboption and overwrite previous values
1264 if (applySpecialPatch || RPC_ProjectedTracksEta < m_CutProjectedTracks || RPC_ProjectedTracksEta > 10000000 ||
1265 EtaPanelEfficiency > 1 || EtaPanelEfficiency < 0 || PhiPanelEfficiency > 1 || PhiPanelEfficiency < 0 || GapEfficiency > 1 ||
1266 GapEfficiency < 0) {
1267 if (index > m_PhiAndEtaEff_A.size() || index > m_OnlyEtaEff_A.size() || index > m_OnlyPhiEff_A.size()) {
1268 THROW_EXCEPTION("Index out of array in Detection Efficiency SideA COOLDB" << index << " stationName = " << stationName);
1269 }
1270 if (RPC_ProjectedTracksEta < m_CutProjectedTracks)
1271 ATH_MSG_DEBUG("# of proj tracks = " << RPC_ProjectedTracksEta << " < cut = " << m_CutProjectedTracks
1272 << " resetting eff. from cool with default(python) values ");
1273
1274 PhiAndEtaEff = m_PhiAndEtaEff_A[index];
1275 OnlyEtaEff = m_OnlyEtaEff_A[index];
1276 OnlyPhiEff = m_OnlyPhiEff_A[index];
1277
1278 if (stationEta < 0) {
1279 if (index > m_PhiAndEtaEff_C.size() || index > m_OnlyEtaEff_C.size() || index > m_OnlyPhiEff_C.size()) {
1280 THROW_EXCEPTION("Index out of array in Detection Efficiency SideC COOLDB" << index << " stationName = " << stationName);
1281 }
1282 PhiAndEtaEff = m_PhiAndEtaEff_C[index];
1283 OnlyEtaEff = m_OnlyEtaEff_C[index];
1284 OnlyPhiEff = m_OnlyPhiEff_C[index];
1285 }
1286
1287 // if (m_applyEffThreshold) {
1288 // gabriele Set efficiency from dead strip fraction instead of nominal value
1289 float effgap = PhiAndEtaEff + OnlyEtaEff + OnlyPhiEff;
1290 float s_EtaPanelEfficiency = 1. - FracDeadStripEta;
1291 float s_PhiPanelEfficiency = 1. - FracDeadStripPhi;
1292 float s_PhiAndEtaEff = s_EtaPanelEfficiency * s_PhiPanelEfficiency / effgap;
1293 if (s_PhiAndEtaEff < PhiAndEtaEff) PhiAndEtaEff = s_PhiAndEtaEff;
1294 float s_OnlyEtaEff = s_EtaPanelEfficiency - PhiAndEtaEff;
1295 float s_OnlyPhiEff = s_PhiPanelEfficiency - PhiAndEtaEff;
1296
1297 if (s_OnlyEtaEff < OnlyEtaEff) OnlyEtaEff = s_OnlyEtaEff;
1298 if (s_OnlyPhiEff < OnlyPhiEff) OnlyPhiEff = s_OnlyPhiEff;
1299 // }
1300 }
1301
1302 float VolEff = PhiAndEtaEff + OnlyEtaEff + OnlyPhiEff;
1303 if (VolEff > maxGeomEff) {
1304 PhiAndEtaEff = (PhiAndEtaEff / VolEff) * maxGeomEff;
1305 OnlyEtaEff = (OnlyEtaEff / VolEff) * maxGeomEff;
1306 OnlyPhiEff = (OnlyPhiEff / VolEff) * maxGeomEff;
1307 }
1308
1309 } // End eff from COOL
1310
1311 // Efficiency correction factor for fractional-charged particles(added by Quanyin Li: quli@cern.ch)
1312 // link to truth particles and calculate the charge and betagamma
1313 HepMC::ConstGenParticlePtr genparticle = trkParticle.cptr();
1314 if (genparticle) {
1315 // only apply efficiency correction to fractional-charged particles based on pdgId betagamma
1316 if (MC::isGenericMultichargedParticle(genparticle)) {
1317 const double eff_sf = FCPEfficiency(genparticle);
1318 // Apply scale factor to the 3 Eff.
1319 PhiAndEtaEff = PhiAndEtaEff * eff_sf;
1320 OnlyEtaEff = OnlyEtaEff * eff_sf;
1321 OnlyPhiEff = OnlyPhiEff * eff_sf;
1322 }
1323 }
1324
1325 float I0 = PhiAndEtaEff;
1326 float I1 = PhiAndEtaEff + OnlyEtaEff;
1327 float ITot = PhiAndEtaEff + OnlyEtaEff + OnlyPhiEff;
1328
1329 float GapEff = ITot ;
1330 float PhiEff = PhiAndEtaEff + OnlyPhiEff;
1331 float EtaEff = PhiAndEtaEff + OnlyEtaEff;
1332
1333 ATH_MSG_DEBUG("DetectionEfficiency: Final Efficiency Values applied for "
1334 << m_idHelper->show_to_string(IdEta) << " are " << PhiAndEtaEff << "=PhiAndEtaEff " << OnlyEtaEff
1335 << "=OnlyEtaEff " << OnlyPhiEff << "=OnlyPhiEff " << GapEff << "=GapEff " << EtaEff << "=EtaEff " << PhiEff
1336 << "=PhiEff ");
1337
1338 float rndmEff = CLHEP::RandFlat::shoot(rndmEngine, 1);
1339
1340 if (rndmEff < I0) {
1341 phiStripOn = true;
1342 etaStripOn = true;
1343 } else if ((I0 <= rndmEff) && (rndmEff < I1)) {
1344 phiStripOn = false;
1345 etaStripOn = true;
1346 } else if ((I1 <= rndmEff) && (rndmEff <= ITot)) {
1347 phiStripOn = true;
1348 etaStripOn = false;
1349 } else {
1350 phiStripOn = false;
1351 etaStripOn = false;
1352 }
1353
1354 return std::make_pair(etaStripOn, phiStripOn);
1355}
1356
1357//--------------------------------------------
1359 const Identifier& idRpcStrip,
1360 double xstripnorm,
1361 CLHEP::HepRandomEngine* rndmEngine) const {
1362 ATH_MSG_DEBUG("RpcDigitizationTool::in determineClusterSize");
1363
1364 ATH_MSG_DEBUG("Digit Id = " << m_idHelper->show_to_string(idRpcStrip));
1365
1366 int ClusterSize = 1;
1367
1368 double FracClusterSize1{1.}, FracClusterSize2{0.}, MeanClusterSize{1.},
1369 FracClusterSizeTail{0.}, MeanClusterSizeTail{1.},
1370 FracClusterSize2norm{0.};
1371
1372 // 2=BML,3=BMS,4=BOL,5=BOS,8=BMF,9=BOF,10=BOG
1373 int stationName = m_idHelper->stationName(idRpcStrip);
1374 int stationEta = m_idHelper->stationEta(idRpcStrip);
1375 int measuresPhi = m_idHelper->measuresPhi(idRpcStrip);
1376
1377 unsigned int index = stationName - 2;
1378 // BML and BMS, BOL and BOS come first (stationName= 2 and 3, 4 and 5 -> index 0-3)
1379 if (stationName > 5 && stationName < 50) index = index - 2;
1380 // BMF, BOF and BOG are 8,9,10 => must be 4,5 and 6
1381 else if (stationName > 50)
1382 index = index - 44;
1383 // BME and BOE 53 and 54 are at indices 7 and 8
1384
1385 if (!m_ClusterSize_fromCOOL && stationName >= 2) {
1386 index += m_FracClusterSize1_A.size() / 2 * measuresPhi;
1387 if (index >= m_FracClusterSize1_A.size() ||
1388 index >= m_FracClusterSize2_A.size() ||
1389 index >= m_FracClusterSizeTail_A.size() ||
1390 index >= m_MeanClusterSizeTail_A.size()) {
1391 ATH_MSG_ERROR("Index out of array in determineClusterSize SideA " << index << " statName " << stationName);
1392 return 1;
1393 }
1394 FracClusterSize1 = m_FracClusterSize1_A[index];
1395 FracClusterSize2 = m_FracClusterSize2_A[index];
1396 FracClusterSizeTail = m_FracClusterSizeTail_A[index];
1397 MeanClusterSizeTail = m_MeanClusterSizeTail_A[index];
1398
1399 if (stationEta < 0) {
1400 index += m_FracClusterSize1_C.size() / 2 * measuresPhi - m_FracClusterSize1_A.size() / 2 * measuresPhi;
1401 if (index >= m_FracClusterSize1_C.size() ||
1402 index >= m_FracClusterSize2_C.size() ||
1403 index >= m_FracClusterSizeTail_C.size() ||
1404 index >= m_MeanClusterSizeTail_C.size()) {
1405 ATH_MSG_ERROR("Index out of array in determineClusterSize SideC " << index << " statName " << stationName);
1406 return 1;
1407 }
1408 FracClusterSize1 = m_FracClusterSize1_C[index];
1409 FracClusterSize2 = m_FracClusterSize2_C[index];
1410 FracClusterSizeTail = m_FracClusterSizeTail_C[index];
1411 MeanClusterSizeTail = m_MeanClusterSizeTail_C[index];
1412 }
1413 } else if (stationName < 2 && (!m_ClusterSize_fromCOOL || !m_ClusterSize_BIS78_fromCOOL)) { // BIS78
1414 FracClusterSize1 = m_FracClusterSize1_BIS78;
1415 FracClusterSize2 = m_FracClusterSize2_BIS78;
1416 FracClusterSizeTail = m_FracClusterSizeTail_BIS78;
1417 MeanClusterSizeTail = m_MeanClusterSizeTail_BIS78;
1418 } else { // Cluster size from COOL
1419 const RpcCondDbData* readCdo{nullptr};
1420 SG::get(readCdo, m_readKey, ctx).ignore();
1421
1422 Identifier Id = m_idHelper->panelID(idRpcStrip);
1423
1424 int RPC_ProjectedTracks = readCdo->getProjectedTrack(Id).value_or(0);
1425 FracClusterSize1 = readCdo->getFracClusterSize1(Id).value_or(1.);
1426 FracClusterSize2 = readCdo->getFracClusterSize2(Id).value_or(0.);
1427 MeanClusterSize = readCdo->getMeanClusterSize(Id).value_or(1.);
1428
1429
1430 ATH_MSG_DEBUG("FracClusterSize1 and 2 " << FracClusterSize1 << " " << FracClusterSize2);
1431
1432 FracClusterSizeTail = 1. - FracClusterSize1 - FracClusterSize2;
1433
1434 MeanClusterSizeTail = MeanClusterSize - FracClusterSize1 - 2 * FracClusterSize2;
1435
1436 ATH_MSG_DEBUG("MeanClusterSizeTail and FracClusterSizeTail " << MeanClusterSizeTail << " " << FracClusterSizeTail);
1437
1438 // if clustersize have anomalous values set to the average cluster size from joboption
1439 if (RPC_ProjectedTracks < m_CutProjectedTracks || RPC_ProjectedTracks > 10000000 || MeanClusterSize > m_CutMaxClusterSize ||
1440 MeanClusterSize <= 1 || FracClusterSizeTail < 0 || FracClusterSize1 < 0 || FracClusterSize2 < 0 || FracClusterSizeTail > 1 ||
1441 FracClusterSize1 > 1 || FracClusterSize2 > 1) {
1442 if (stationName >= 2) {
1443 index += m_FracClusterSize1_A.size() / 2 * measuresPhi;
1444 if (index >= m_FracClusterSize1_A.size() ||
1445 index >= m_FracClusterSize2_A.size() ||
1446 index >= m_FracClusterSizeTail_A.size() ||
1447 index >= m_MeanClusterSizeTail_A.size()) {
1448 ATH_MSG_ERROR("Index out of array in determineClusterSize SideA " << index << " statName " << stationName);
1449 return 1;
1450 }
1451 FracClusterSize1 = m_FracClusterSize1_A[index];
1452 FracClusterSize2 = m_FracClusterSize2_A[index];
1453 FracClusterSizeTail = m_FracClusterSizeTail_A[index];
1454 MeanClusterSizeTail = m_MeanClusterSizeTail_A[index];
1455
1456 if (stationEta < 0) {
1457 index += m_FracClusterSize1_C.size() / 2 * measuresPhi - m_FracClusterSize1_A.size() / 2 * measuresPhi;
1458 if (index > m_FracClusterSize1_C.size() || index > m_FracClusterSize2_C.size() ||
1460 ATH_MSG_ERROR("Index out of array in determineClusterSize SideC " << index << " statName " << stationName);
1461 return 1;
1462 }
1463
1464 FracClusterSize1 = m_FracClusterSize1_C[index];
1465 FracClusterSize2 = m_FracClusterSize2_C[index];
1466 FracClusterSizeTail = m_FracClusterSizeTail_C[index];
1467 MeanClusterSizeTail = m_MeanClusterSizeTail_C[index];
1468 }
1469 } else {
1470 FracClusterSize1 = m_FracClusterSize1_BIS78;
1471 FracClusterSize2 = m_FracClusterSize2_BIS78;
1472 FracClusterSizeTail = m_FracClusterSizeTail_BIS78;
1473 MeanClusterSizeTail = m_MeanClusterSizeTail_BIS78;
1474 }
1475 }
1476 }
1477 FracClusterSize1 = std::min(FracClusterSize1, 1.);
1478 FracClusterSize2 = std::min(FracClusterSize2, 1.);
1479 FracClusterSizeTail = std::min(FracClusterSizeTail, 1.);
1480 float FracTot = FracClusterSize1 + FracClusterSize2 + FracClusterSizeTail;
1481 if (FracTot != 1. && FracTot > 0) {
1482 FracClusterSize1 = FracClusterSize1 / FracTot;
1483 FracClusterSize2 = FracClusterSize2 / FracTot;
1484 FracClusterSizeTail = FracClusterSizeTail / FracTot;
1485 }
1486 if (MeanClusterSizeTail < 0 || MeanClusterSizeTail > 10) MeanClusterSizeTail = 1;
1487
1488 ATH_MSG_VERBOSE("ClusterSize Final " << FracClusterSize1 << " FracClusterSize1 " << FracClusterSize2 << " FracClusterSize2 "
1489 << FracClusterSizeTail << " " << FracClusterSizeTail << " MeanClusterSizeTail "
1490 << MeanClusterSizeTail);
1491
1492 float FracClusterSize1plus2 = FracClusterSize1 + FracClusterSize2;
1493 float ITot = FracClusterSize1 + FracClusterSize2 + FracClusterSizeTail;
1494
1495 if (FracClusterSize1plus2 != 0) {
1496 // FracClusterSize1norm = FracClusterSize1 / FracClusterSize1plus2 ; // not used
1497 FracClusterSize2norm = FracClusterSize2 / FracClusterSize1plus2;
1498 }
1499
1500 float rndmCS = CLHEP::RandFlat::shoot(rndmEngine, ITot);
1501
1502 if (stationName >= 2) { // Legacy RPCs
1503 // Expanded CS2 of 1.3 to match average CS1 and CS2 (to be investigate)
1504 if (rndmCS < FracClusterSize1plus2) {
1505 // deterministic assignment of CS 1 or 2
1506 if (xstripnorm <= FracClusterSize2norm / 2. * 1.3) {
1507 ClusterSize = -2;
1508 } else if ((1.0 - FracClusterSize2norm / 2. * 1.3) <= xstripnorm) {
1509 ClusterSize = 2;
1510 } else {
1511 ClusterSize = 1;
1512 }
1514 float rndmCS1_2 = CLHEP::RandFlat::shoot(rndmEngine, 1);
1515 ClusterSize = 1 + (rndmCS1_2 < FracClusterSize2norm);
1516 }
1517
1518 } else if ((FracClusterSize1plus2 <= rndmCS) && (rndmCS <= ITot)) {
1519 ClusterSize = m_FirstClusterSizeInTail;
1520 ClusterSize += int(CLHEP::RandExponential::shoot(rndmEngine, MeanClusterSizeTail));
1521 float rndmLR = CLHEP::RandFlat::shoot(rndmEngine, 1.0);
1522 if (rndmLR > 0.5) ClusterSize = -ClusterSize;
1523 } else {
1524 ClusterSize = 1;
1525 }
1526
1527 } else { // NRPCs
1528 if (rndmCS < FracClusterSize1) {
1529 ClusterSize = 1;
1530 } else if (rndmCS < FracClusterSize1 + FracClusterSize2) {
1531 ClusterSize = 2;
1532 } else {
1533 ClusterSize = int(CLHEP::RandExponential::shoot(rndmEngine, MeanClusterSizeTail));
1534 }
1535 ClusterSize = std::max(ClusterSize, 1);
1536 if (ClusterSize > 1) {
1537 float rndmLR = CLHEP::RandFlat::shoot(rndmEngine, 1.0);
1538 if (rndmLR > 0.5) ClusterSize = -ClusterSize;
1539 }
1540 }
1541
1542 // negative CS correspond to left asymmetric cluster with respect to nstrip
1543 return ClusterSize;
1544}
1546 double qcharge = 1.;
1547 const int particlePdgId = genParticle->pdg_id();
1548 // charge calculation
1549 qcharge = (static_cast<double>((std::abs(particlePdgId) / 1000) % 100)) / (static_cast<double>((std::abs(particlePdgId) / 10) % 100));
1550 qcharge = ((static_cast<double>((static_cast<int>(qcharge * 100))))) / 100;
1551 if (particlePdgId < 0.0) qcharge = -qcharge;
1552 // BetaGamma calculation
1553 const double QPx = genParticle->momentum().px();
1554 const double QPy = genParticle->momentum().py();
1555 const double QPz = genParticle->momentum().pz();
1556 const double QE = genParticle->momentum().e();
1557 const double QM2 = std::pow(QE, 2) - std::pow(QPx, 2) - std::pow(QPy, 2) - std::pow(QPz, 2);
1558 const double QP = std::hypot(QPx, QPy, QPz);
1559 const double QM = QM2 >=0 ? std::sqrt(QM2) : -1.;
1560
1561 const double qbetagamma = QM > 0. ? QP / QM : -1.;
1562
1563 // find the i in the array
1564 int i_e = -1;
1565 for (int i = 0; i < 12; i++) {
1566 if (Charge[i] == std::abs(qcharge)) {
1567 i_e = i;
1568 break;
1569 }
1570 }
1571 int i_v = -99, j_v = 99;
1572 if (qbetagamma != -1) {
1573 for (int i = 0; i < 15; i++) {
1574 if (Velocity[i] <= qbetagamma) { i_v = i; }
1575 }
1576 for (int i = 14; i >= 0; i--) {
1577 if (Velocity[i] >= qbetagamma) { j_v = i; }
1578 }
1579 }
1580 // calculate the efficiency according to charge and velocity. Using linear function to calculate efficiency of a specific velocity
1581 // between velocity1 and velocity2
1582 double eff_fcp = 1.0, eff_muon = 1.0;
1583 if (i_e >= 0 && i_e <= 11) {
1584 if (validIndex(j_v, N_Velocity) && validIndex(i_v, N_Velocity) && (j_v - i_v) == 1) {
1585 const double delta_v = Velocity[i_v] - Velocity[j_v];
1586 eff_fcp = (Eff_garfield[i_e][i_v] - Eff_garfield[i_e][j_v]) / delta_v * qbetagamma +
1587 (Eff_garfield[i_e][j_v] * Velocity[i_v] - Eff_garfield[i_e][i_v] * Velocity[j_v]) / delta_v;
1588 eff_muon = (Eff_garfield[11][i_v] - Eff_garfield[11][j_v]) / delta_v * qbetagamma +
1589 (Eff_garfield[11][j_v] * Velocity[i_v] - Eff_garfield[11][i_v] * Velocity[j_v]) / delta_v;
1590 } else if (i_v == 14 && j_v == 99) {
1591 eff_fcp = Eff_garfield[i_e][14];
1592 eff_muon = Eff_garfield[11][14];
1593 } else if (i_v == -99 && j_v == 0) {
1594 eff_fcp = Eff_garfield[i_e][0];
1595 eff_muon = Eff_garfield[11][0];
1596 } else {
1597 ATH_MSG_WARNING("Wrong particle with unknown velocity! Scale factor is set to be 1.");
1598 }
1599 } else {
1600 ATH_MSG_WARNING("Wrong particle with unknown charge! Scale factor is set to be 1.");
1601 }
1602 // A scale factor is calculated by efficiency of fcp / efficiency of muon(charge==1.0
1603 const double eff_SF = eff_fcp / eff_muon;
1604 return eff_SF;
1605}
1606
1607double RpcDigitizationTool::timeOverThreshold(CLHEP::HepRandomEngine* rndmEngine) {
1608 //mn Time-over-threshold modeled as a narrow and a wide gaussian
1609 //mn based on the fit documented in https://its.cern.ch/jira/browse/ATLASRECTS-7820
1610 constexpr double tot_mean_narrow = 16.;
1611 constexpr double tot_sigma_narrow = 2.;
1612 constexpr double tot_mean_wide = 15.;
1613 constexpr double tot_sigma_wide = 4.5;
1614
1615 double thetot = 0.;
1616
1617 if (CLHEP::RandFlat::shoot(rndmEngine)<0.75) {
1618 thetot = CLHEP::RandGaussZiggurat::shoot(rndmEngine, tot_mean_narrow, tot_sigma_narrow);
1619 } else {
1620 thetot = CLHEP::RandGaussZiggurat::shoot(rndmEngine, tot_mean_wide, tot_sigma_wide);
1621 }
1622
1623 return (thetot > 0.) ? thetot : 0.;
1624}
float hitTime(const AFP_SIDSimHit &hit)
constexpr std::array< T, N > make_array(const T &def_val)
Helper function to initialize in-place arrays with non-zero values.
Definition ArrayHelper.h:10
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_INFO(x,...)
#define ATH_MSG_FATAL(x,...)
ATLAS-specific HepMC functions.
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition IPileUpTool.h:22
Definition of the abstract IRDBAccessSvc interface.
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition of the abstract IRDBRecord interface.
Definition of the abstract IRDBRecordset interface.
bool hit(const Container &ids, int pdgId)
static Double_t sc
AtlasHitsVector< RPCSimHit > RPCSimHitCollection
struct TBPatternUnitContext Unknown
#define x
A wrapper class for event-slot-local random engines.
Definition RNGWrapper.h:56
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition RNGWrapper.h:154
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition RNGWrapper.h:108
size_type size() const
const T * get(size_type n) const
Access an element, as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
virtual unsigned int size() const =0
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition IdContext.h:26
size_type begin_index() const
Definition IdContext.h:45
size_type end_index() const
Definition IdContext.h:46
value_type get_compact() const
Get the compact id.
This is a "hash" representation of an Identifier.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
virtual const Amg::Transform3D & transform() const override
Return local to global transform.
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
const RpcReadoutElement * getRpcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
int nGasGapPerLay() const
returns the number of gasgaps
int NphiStripPanels() const
returns the number of phi strip panels (1 or 2)
virtual int stripNumber(const Amg::Vector2D &pos, const Identifier &id) const override final
strip number corresponding to local position.
Amg::Vector3D localGasGapPos(const Identifier &id) const
Returns the position of the gasGap w.r.t. rest frame of the chamber.
Amg::Transform3D localToGlobalTransf(const Identifier &id) const
int Nstrips(bool measphi) const
returns the number of strips for the phi or eta plane
virtual int numberOfLayers(bool measphi=true) const override final
number of layers in phi/eta projection, same for eta/phi planes
double StripPitch(bool measphi) const
returns the strip pitch for the phi or eta plane
std::pair< HepMcParticleLink, MuonMCData > Deposit
Definition MuonSimData.h:66
Gaudi::Property< int > m_vetoPileUpTruthLinks
PileUpToolBase(const std::string &type, const std::string &name, const IInterface *parent)
std::optional< double > getFracClusterSize2(const Identifier &) const
std::optional< int > getProjectedTrack(const Identifier &) const
std::optional< double > getFracDeadStrip(const Identifier &) const
std::optional< double > getFracClusterSize1(const Identifier &) const
std::optional< double > getGapEfficiency(const Identifier &) const
std::optional< double > getEfficiency(const Identifier &) const
std::optional< double > getMeanClusterSize(const Identifier &) const
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
static const RpcHitIdHelper * GetHelper(unsigned int nGasGaps=2)
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
std::string store() const
Return the name of the store holding the object we are proxying.
const std::string & name() const
Return the StoreGate ID for the referenced object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
TimedVector::const_iterator const_iterator
a smart pointer to a hit that also provides access to the extended timing info of the host event.
Definition TimedHitPtr.h:18
unsigned short eventId() const
the index of the component event in PileUpEventInfo.
Definition TimedHitPtr.h:47
constexpr bool simData
Definition constants.h:36
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Amg::Isometry3D getTranslate3D(const double X, const double Y, const double Z)
: Returns a shift transformation along an arbitrary axis
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
Amg::Isometry3D getRotateY3D(double angle)
Rotate the coordinate system by an angle around the z-axis.
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
Definition GenParticle.h:20
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.
bool isGenericMultichargedParticle(const T &p)
In addition, there is a need to identify ”Q-ball” and similar very exotic (multi-charged) particles w...
Ensure that the Athena extensions are properly loaded.
Definition GeoMuonHits.h:27
USAGE: openCoraCool.exe "COOLONL_SCT/COMP200".
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition index.py:1
std::list< value_t > type
type of the collection of timed data object
a struct encapsulating the identifier of a pile-up event
index_type index() const
the index of the component event in PileUpEventInfo
PileUpType type() const
the pileup type - minbias, cavern, beam halo, signal?
time_type time() const
bunch xing time in ns
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10
Tell the compiler to optimize assuming that FP may trap.
#define CXXUTILS_TRAPPING_FP
Definition trapping_fp.h:24
int run(int argc, char *argv[])