ATLAS Offline Software
ZDC_PileUpTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ZDC_DIGITIZATION_TOOL_H
6 #define ZDC_DIGITIZATION_TOOL_H
7 
9 #include "Gaudi/Property.h"
10 #include "GaudiKernel/ServiceHandle.h"
11 #include "GaudiKernel/ITHistSvc.h"
16 #include "ZdcIdentifier/ZdcID.h"
17 #include "xAODForward/ZdcModule.h"
22 
23 #include <vector>
24 #include <string>
25 
26 namespace CLHEP {
27  class HepRandomEngine;
28 }
29 
31 
33 
34 public:
35 
36  ZDC_PileUpTool(const std::string& type,
37  const std::string& name,
38  const IInterface* parent);
39 
40  virtual StatusCode initialize() override final;
41  void initializePbPb2015();
42  void initializeLHCf2022();
43  void initializePbPb2023();
44  virtual StatusCode finalize() override final { return StatusCode::SUCCESS; }
45 
47  virtual StatusCode prepareEvent(const EventContext& ctx,const unsigned int nInputEvents) override final;
48 
50  virtual StatusCode processBunchXing( int bunchXing,
51  SubEventIterator bSubEvents,
52  SubEventIterator eSubEvents
53  ) override final;
56  // virtual bool toProcess(int bunchXing) const;
57 
59  virtual StatusCode mergeEvent(const EventContext& ctx) override final;
60  virtual StatusCode processAllSubEvents(const EventContext& ctx) override final;
61 
62  private:
63 
65  void fillContainer(const ZDC_SimFiberHit_Collection*, CLHEP::HepRandomEngine*, xAOD::ZdcModuleContainer*);
67  void createAndStoreWaveform(const ZDC_SimFiberHit &hit, CLHEP::HepRandomEngine*, xAOD::ZdcModuleContainer*);
68  void addEmptyWaveforms(xAOD::ZdcModuleContainer *zdcModuleContainer, CLHEP::HepRandomEngine* rndEngine);
69  std::vector<short unsigned int> generateWaveform(std::shared_ptr<ZDCWaveformSampler> wfSampler, float amplitude, float t0);
70 
71  void SetDumps(bool, bool);
72 
74  const ZdcID* m_ZdcID;
75  std::unique_ptr<xAOD::ZdcModuleContainer> m_ZdcModuleContainer;
76  std::unique_ptr<xAOD::ZdcModuleAuxContainer> m_ZdcModuleAuxContainer;
77 
78  ServiceHandle<PileUpMergeSvc> m_mergeSvc{this, "mergeSvc", "PileUpMergeSvc", ""};
79  ServiceHandle<IAthRNGSvc> m_randomSvc{this, "RndmSvc", "AthRNGSvc", ""};
80  Gaudi::Property<std::string> m_randomStreamName{this, "RandomStreamName", "ZDCRndEng", ""};
81 
82  SG::ReadHandleKey<ZDC_SimFiberHit_Collection> m_SimFiberHitCollectionKey{this, "ZDC_SimFiberHit_CollectionName", "ZDC_SimFiberHit_Collection"};
83  SG::WriteHandleKey<xAOD::ZdcModuleContainer> m_ZdcModuleContainerName{this, "ZdcModuleContainerName", "ZdcModules"};
84  SG::WriteHandleKey<xAOD::ZdcModuleContainer> m_ZdcSumsContainerName{this, "ZdcSumsContainerName", "ZdcSums"};
85 
86  Gaudi::Property<std::string> m_HitCollectionName{this, "HitCollectionName" , "ZDC_SimFiberHit_Collection",
87  "Name of the input Collection of the simulation Hits"};
88  Gaudi::Property<std::string> m_outputContainerName{this, "OutputContainerName" , "ZDC_SimModuleContainer",
89  "Name of the output ZDC module container"};
90 
91  Gaudi::Property<std::string> m_configuration {this, "configuration" , "PbPb2023", "Named configuration to be used. Overwrites other properties if used" };
92  Gaudi::Property<int > m_Pedestal {this, "Pedestal" , 100 , "DC offset of the pulse in ADC" };
93  Gaudi::Property<int > m_numTimeBins {this, "MaxTimeBin" , 7 , "The number of time-slices after digitization(Typically 5 or 7)" };
94  Gaudi::Property<double> m_freqMHz {this, "freqMHz" , 40 , "Digitizer frequence in MHz" };
95  Gaudi::Property<double> m_zdct0 {this, "zdct0" , 40 , "Start time of the pulse in the digitization window" };
96  Gaudi::Property<double> m_rpdt0 {this, "rpdt0" , 40 , "Start time of the pulse in the digitization window" };
97  Gaudi::Property<double> m_zdcRiseTime {this, "zdcRiseTime" , 4 , "Rise time of the ZDC pulses" };
98  Gaudi::Property<double> m_zdcFallTime {this, "zdcFallTime" , 0.5 , "Fall time of the ZDC pulses" };
99  Gaudi::Property<double> m_rpdRiseTime {this, "rpdRiseTime" , 4 , "Rise time of the RPD pulses" };
100  Gaudi::Property<double> m_rpdFallTime {this, "rpdFallTime" , 0.5 , "Fall time of the RPD pulses" };
101  Gaudi::Property<double> m_qsfRiseTime {this, "qsfRiseTime" , 4 , "Rise time of the RPD pulses" };
102  Gaudi::Property<double> m_qsfFallTime {this, "qsfFallTime" , 4 , "Rise time of the RPD pulses" };
103  Gaudi::Property<double> m_qsfFilter {this, "qsfFilter" , 4 , "Rise time of the RPD pulses" };
104  Gaudi::Property<float > m_zdcAdcPerPhoton {this, "zdcAdcPerPhoton" , 0.000498 , "ADC counts per detected photon in the ZDCs" };
105  Gaudi::Property<bool > m_LTQuadStepFilt {this, "LTQuadStepFilt" , false , "Use LT Quad Step Filter waveform for ZDC channels" };
106  Gaudi::Property<bool > m_delayChannels {this, "delayChannels" , false , "Include delayed channels in the output" };
107  Gaudi::Property<bool > m_doRPD {this, "doRPD" , false , "Include RPD channels in the output" };
108  Gaudi::Property<bool > m_doBRAN {this, "doBRAN" , false , "Include BRAN channels in the output" };
109  Gaudi::Property<std::vector< float> > m_rpdAdcPerPhoton {this, "rpdAdcPerPhoton", {5.25 , 1.7}, "ADC counts per detected photon in the RPDs"};
110 
111 };
112 
113 #endif
ZDC_PileUpTool::m_outputContainerName
Gaudi::Property< std::string > m_outputContainerName
Definition: ZDC_PileUpTool.h:88
ZDC_PileUpTool::m_ZdcModuleContainer
std::unique_ptr< xAOD::ZdcModuleContainer > m_ZdcModuleContainer
Definition: ZDC_PileUpTool.h:75
ZDC_PileUpTool::m_ZdcModuleAuxContainer
std::unique_ptr< xAOD::ZdcModuleAuxContainer > m_ZdcModuleAuxContainer
Definition: ZDC_PileUpTool.h:76
ZDC_PileUpTool::m_randomStreamName
Gaudi::Property< std::string > m_randomStreamName
Definition: ZDC_PileUpTool.h:80
ZDC_PileUpTool::processAllSubEvents
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
Definition: ZDC_PileUpTool.cxx:115
ZDC_PileUpTool::createAndStoreWaveform
void createAndStoreWaveform(const ZDC_SimFiberHit &hit, CLHEP::HepRandomEngine *, xAOD::ZdcModuleContainer *)
Definition: ZDC_PileUpTool.cxx:364
ZDC_PileUpTool::m_configuration
Gaudi::Property< std::string > m_configuration
Definition: ZDC_PileUpTool.h:91
ZDC_PileUpTool::prepareEvent
virtual StatusCode prepareEvent(const EventContext &ctx, const unsigned int nInputEvents) override final
called before the subevts loop. Not (necessarily) able to access SubEvents
Definition: ZDC_PileUpTool.cxx:190
ZDC_PileUpTool
Definition: ZDC_PileUpTool.h:32
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
ZDC_PileUpTool::m_zdct0
Gaudi::Property< double > m_zdct0
Definition: ZDC_PileUpTool.h:95
ZDCWaveformSampler.h
TimedFiberHitCollList
PileUpMergeSvc::TimedList< ZDC_SimFiberHit_Collection >::type TimedFiberHitCollList
Definition: ZDC_PileUpTool.h:30
ZDC_PileUpTool::generateWaveform
std::vector< short unsigned int > generateWaveform(std::shared_ptr< ZDCWaveformSampler > wfSampler, float amplitude, float t0)
Definition: ZDC_PileUpTool.cxx:434
SG::ReadHandleKey< ZDC_SimFiberHit_Collection >
ZDC_PileUpTool::m_zdcFallTime
Gaudi::Property< double > m_zdcFallTime
Definition: ZDC_PileUpTool.h:98
ZDC_PileUpTool::m_numTimeBins
Gaudi::Property< int > m_numTimeBins
Definition: ZDC_PileUpTool.h:93
ZDC_PileUpTool::m_zdcRiseTime
Gaudi::Property< double > m_zdcRiseTime
Definition: ZDC_PileUpTool.h:97
ZDC_PileUpTool::m_rpdFallTime
Gaudi::Property< double > m_rpdFallTime
Definition: ZDC_PileUpTool.h:100
PileUpMergeSvc::TimedList::type
std::list< value_t > type
type of the collection of timed data object
Definition: PileUpMergeSvc.h:75
ZdcModuleAuxContainer.h
ZDC_PileUpTool::m_qsfFallTime
Gaudi::Property< double > m_qsfFallTime
Definition: ZDC_PileUpTool.h:102
ZDC_PileUpTool::m_zdcAdcPerPhoton
Gaudi::Property< float > m_zdcAdcPerPhoton
Definition: ZDC_PileUpTool.h:104
ZDC_PileUpTool::m_mergedFiberHitList
ZDC_SimFiberHit_Collection * m_mergedFiberHitList
Definition: ZDC_PileUpTool.h:73
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
ZDC_PileUpTool::m_HitCollectionName
Gaudi::Property< std::string > m_HitCollectionName
Definition: ZDC_PileUpTool.h:86
ZDC_PileUpTool::initializePbPb2015
void initializePbPb2015()
Definition: ZDC_PileUpTool.cxx:65
ZDC_PileUpTool::m_ZdcModuleContainerName
SG::WriteHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleContainerName
Definition: ZDC_PileUpTool.h:83
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CLHEP
STD'S.
Definition: IAtRndmGenSvc.h:19
ZDC_PileUpTool::m_doRPD
Gaudi::Property< bool > m_doRPD
Definition: ZDC_PileUpTool.h:107
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TimedHitCollection.h
ZDC_PileUpTool::processBunchXing
virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
called for each active bunch-crossing to process current SubEvents bunchXing is in ns
Definition: ZDC_PileUpTool.cxx:209
ZDC_PileUpTool::fillContainer
void fillContainer(TimedHitCollection< ZDC_SimFiberHit > &, CLHEP::HepRandomEngine *, xAOD::ZdcModuleContainer *)
Definition: ZDC_PileUpTool.cxx:253
ZDC_PileUpTool::initializePbPb2023
void initializePbPb2023()
Definition: ZDC_PileUpTool.cxx:96
ZDC_PileUpTool::SetDumps
void SetDumps(bool, bool)
ZDC_PileUpTool::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Definition: ZDC_PileUpTool.h:78
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
ZDC_PileUpTool::m_SimFiberHitCollectionKey
SG::ReadHandleKey< ZDC_SimFiberHit_Collection > m_SimFiberHitCollectionKey
Definition: ZDC_PileUpTool.h:82
ZDC_PileUpTool::doZDClightGuideCuts
TimedHitCollection< ZDC_SimFiberHit > doZDClightGuideCuts(const ZDC_SimFiberHit_Collection *hitCollection)
Definition: ZDC_PileUpTool.cxx:314
ZDC_SimFiberHit.h
PileUpToolBase
Definition: PileUpToolBase.h:18
ZDC_PileUpTool::m_freqMHz
Gaudi::Property< double > m_freqMHz
Definition: ZDC_PileUpTool.h:94
ZDC_PileUpTool::ZDC_PileUpTool
ZDC_PileUpTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: ZDC_PileUpTool.cxx:22
ZDC_PileUpTool::m_LTQuadStepFilt
Gaudi::Property< bool > m_LTQuadStepFilt
Definition: ZDC_PileUpTool.h:105
ZDC_SimFiberHit_Collection.h
ZDC_PileUpTool::initialize
virtual StatusCode initialize() override final
Definition: ZDC_PileUpTool.cxx:29
ZDC_PileUpTool::addEmptyWaveforms
void addEmptyWaveforms(xAOD::ZdcModuleContainer *zdcModuleContainer, CLHEP::HepRandomEngine *rndEngine)
Definition: ZDC_PileUpTool.cxx:273
ZDC_PileUpTool::m_qsfRiseTime
Gaudi::Property< double > m_qsfRiseTime
Definition: ZDC_PileUpTool.h:101
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ZDC_PileUpTool::m_rpdAdcPerPhoton
Gaudi::Property< std::vector< float > > m_rpdAdcPerPhoton
Definition: ZDC_PileUpTool.h:109
ZDC_PileUpTool::m_randomSvc
ServiceHandle< IAthRNGSvc > m_randomSvc
Definition: ZDC_PileUpTool.h:79
ZdcID.h
ZdcModule.h
ZDC_PileUpTool::m_rpdRiseTime
Gaudi::Property< double > m_rpdRiseTime
Definition: ZDC_PileUpTool.h:99
PileUpMergeSvc.h
the preferred mechanism to access information from the different event stores in a pileup job.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ZDC_PileUpTool::m_rpdt0
Gaudi::Property< double > m_rpdt0
Definition: ZDC_PileUpTool.h:96
ZDC_PileUpTool::m_ZdcSumsContainerName
SG::WriteHandleKey< xAOD::ZdcModuleContainer > m_ZdcSumsContainerName
Definition: ZDC_PileUpTool.h:84
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
ZDC_PileUpTool::m_Pedestal
Gaudi::Property< int > m_Pedestal
Definition: ZDC_PileUpTool.h:92
ZDC_SimFiberHit
Definition: ZDC_SimFiberHit.h:11
ZDC_PileUpTool::m_delayChannels
Gaudi::Property< bool > m_delayChannels
Definition: ZDC_PileUpTool.h:106
ZDC_SimFiberHit_Collection
Definition: ZDC_SimFiberHit_Collection.h:16
ZDC_PileUpTool::initializeLHCf2022
void initializeLHCf2022()
Definition: ZDC_PileUpTool.cxx:80
ZDC_PileUpTool::m_doBRAN
Gaudi::Property< bool > m_doBRAN
Definition: ZDC_PileUpTool.h:108
PileUpToolBase.h
helper base class IPileUpTool::toProcess().
ZdcID
Definition: ZdcID.h:25
ZdcModuleContainer.h
ZDC_PileUpTool::m_ZdcID
const ZdcID * m_ZdcID
Definition: ZDC_PileUpTool.h:74
TimedHitCollection
Definition: TimedHitCollection.h:15
ZDC_PileUpTool::finalize
virtual StatusCode finalize() override final
Definition: ZDC_PileUpTool.h:44
ZDC_PileUpTool::mergeEvent
virtual StatusCode mergeEvent(const EventContext &ctx) override final
return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase...
Definition: ZDC_PileUpTool.cxx:240
IAthRNGSvc.h
ServiceHandle< PileUpMergeSvc >
ZDC_PileUpTool::m_qsfFilter
Gaudi::Property< double > m_qsfFilter
Definition: ZDC_PileUpTool.h:103