ATLAS Offline Software
ZDC_PileUpTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ZDC_DIGITIZATION_TOOL_H
6 #define ZDC_DIGITIZATION_TOOL_H
7 
9 #include "Gaudi/Property.h"
10 #include "GaudiKernel/ServiceHandle.h"
11 
19 
20 #include <vector>
21 #include <string>
22 #include <memory>
23 
24 
25 class ZdcID;
26 class ZDCWaveformSampler;
27 
28 namespace CLHEP {
29  class HepRandomEngine;
30 }
31 
33 
35 
36 public:
37 
38  ZDC_PileUpTool(const std::string& type,
39  const std::string& name,
40  const IInterface* parent);
41 
42  virtual StatusCode initialize() override final;
43  void initializePbPb2015();
44  void initializeLHCf2022();
45  void initializePbPb2023();
46  virtual StatusCode finalize() override final { return StatusCode::SUCCESS; }
47 
49  virtual StatusCode prepareEvent(const EventContext& ctx,const unsigned int nInputEvents) override final;
50 
52  virtual StatusCode processBunchXing( int bunchXing,
53  SubEventIterator bSubEvents,
54  SubEventIterator eSubEvents
55  ) override final;
58  // virtual bool toProcess(int bunchXing) const;
59 
61  virtual StatusCode mergeEvent(const EventContext& ctx) override final;
62  virtual StatusCode processAllSubEvents(const EventContext& ctx) override final;
63 
64  private:
65 
67  void fillContainer(const ZDC_SimFiberHit_Collection*, CLHEP::HepRandomEngine*, xAOD::ZdcModuleContainer*);
69  void createAndStoreWaveform(const ZDC_SimFiberHit &hit, CLHEP::HepRandomEngine*, xAOD::ZdcModuleContainer*);
70  void addEmptyWaveforms(xAOD::ZdcModuleContainer *zdcModuleContainer, CLHEP::HepRandomEngine* rndEngine);
71  std::vector<short unsigned int> generateWaveform(std::shared_ptr<ZDCWaveformSampler> wfSampler, float amplitude, float t0);
72 
73  void SetDumps(bool, bool);
74 
76  const ZdcID* m_ZdcID{};
77  std::unique_ptr<xAOD::ZdcModuleContainer> m_ZdcModuleContainer;
78  std::unique_ptr<xAOD::ZdcModuleAuxContainer> m_ZdcModuleAuxContainer;
79 
80  ServiceHandle<PileUpMergeSvc> m_mergeSvc{this, "mergeSvc", "PileUpMergeSvc", ""};
81  ServiceHandle<IAthRNGSvc> m_randomSvc{this, "RndmSvc", "AthRNGSvc", ""};
82  Gaudi::Property<std::string> m_randomStreamName{this, "RandomStreamName", "ZDCRndEng", ""};
83 
84  SG::ReadHandleKey<ZDC_SimFiberHit_Collection> m_SimFiberHitCollectionKey{this, "ZDC_SimFiberHit_CollectionName", "ZDC_SimFiberHit_Collection"};
85  SG::WriteHandleKey<xAOD::ZdcModuleContainer> m_ZdcModuleContainerName{this, "ZdcModuleContainerName", "ZdcModules"};
86  SG::WriteHandleKey<xAOD::ZdcModuleContainer> m_ZdcSumsContainerName{this, "ZdcSumsContainerName", "ZdcSums"};
87 
88  Gaudi::Property<std::string> m_HitCollectionName{this, "HitCollectionName" , "ZDC_SimFiberHit_Collection",
89  "Name of the input Collection of the simulation Hits"};
90  Gaudi::Property<std::string> m_outputContainerName{this, "OutputContainerName" , "ZDC_SimModuleContainer",
91  "Name of the output ZDC module container"};
92 
93  Gaudi::Property<std::string> m_configuration {this, "configuration" , "PbPb2023", "Named configuration to be used. Overwrites other properties if used" };
94  Gaudi::Property<int > m_Pedestal {this, "Pedestal" , 100 , "DC offset of the pulse in ADC" };
95  Gaudi::Property<int > m_numTimeBins {this, "MaxTimeBin" , 7 , "The number of time-slices after digitization(Typically 5 or 7)" };
96  Gaudi::Property<double> m_freqMHz {this, "freqMHz" , 40 , "Digitizer frequence in MHz" };
97  Gaudi::Property<double> m_zdct0 {this, "zdct0" , 40 , "Start time of the pulse in the digitization window" };
98  Gaudi::Property<double> m_rpdt0 {this, "rpdt0" , 40 , "Start time of the pulse in the digitization window" };
99  Gaudi::Property<double> m_zdcRiseTime {this, "zdcRiseTime" , 4 , "Rise time of the ZDC pulses" };
100  Gaudi::Property<double> m_zdcFallTime {this, "zdcFallTime" , 0.5 , "Fall time of the ZDC pulses" };
101  Gaudi::Property<double> m_rpdRiseTime {this, "rpdRiseTime" , 4 , "Rise time of the RPD pulses" };
102  Gaudi::Property<double> m_rpdFallTime {this, "rpdFallTime" , 0.5 , "Fall time of the RPD pulses" };
103  Gaudi::Property<double> m_qsfRiseTime {this, "qsfRiseTime" , 4 , "Rise time of the RPD pulses" };
104  Gaudi::Property<double> m_qsfFallTime {this, "qsfFallTime" , 4 , "Rise time of the RPD pulses" };
105  Gaudi::Property<double> m_qsfFilter {this, "qsfFilter" , 4 , "Rise time of the RPD pulses" };
106  Gaudi::Property<float > m_zdcAdcPerPhoton {this, "zdcAdcPerPhoton" , 0.000498 , "ADC counts per detected photon in the ZDCs" };
107  Gaudi::Property<bool > m_LTQuadStepFilt {this, "LTQuadStepFilt" , false , "Use LT Quad Step Filter waveform for ZDC channels" };
108  Gaudi::Property<bool > m_delayChannels {this, "delayChannels" , false , "Include delayed channels in the output" };
109  Gaudi::Property<bool > m_doRPD {this, "doRPD" , false , "Include RPD channels in the output" };
110  Gaudi::Property<bool > m_doBRAN {this, "doBRAN" , false , "Include BRAN channels in the output" };
111  Gaudi::Property<std::vector< float> > m_rpdAdcPerPhoton {this, "rpdAdcPerPhoton", {5.25 , 1.7}, "ADC counts per detected photon in the RPDs"};
112 
113 };
114 
115 #endif
ZDC_PileUpTool::m_outputContainerName
Gaudi::Property< std::string > m_outputContainerName
Definition: ZDC_PileUpTool.h:90
ZDC_PileUpTool::m_ZdcModuleContainer
std::unique_ptr< xAOD::ZdcModuleContainer > m_ZdcModuleContainer
Definition: ZDC_PileUpTool.h:77
ZDC_PileUpTool::m_ZdcModuleAuxContainer
std::unique_ptr< xAOD::ZdcModuleAuxContainer > m_ZdcModuleAuxContainer
Definition: ZDC_PileUpTool.h:78
ZDC_PileUpTool::m_randomStreamName
Gaudi::Property< std::string > m_randomStreamName
Definition: ZDC_PileUpTool.h:82
ZDC_PileUpTool::processAllSubEvents
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
Definition: ZDC_PileUpTool.cxx:117
ZDC_PileUpTool::createAndStoreWaveform
void createAndStoreWaveform(const ZDC_SimFiberHit &hit, CLHEP::HepRandomEngine *, xAOD::ZdcModuleContainer *)
Definition: ZDC_PileUpTool.cxx:366
ZDC_PileUpTool::m_configuration
Gaudi::Property< std::string > m_configuration
Definition: ZDC_PileUpTool.h:93
ZDCWaveformSampler
Definition: ZDCWaveformSampler.h:25
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:192
ZDC_PileUpTool
Definition: ZDC_PileUpTool.h:34
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:97
TimedFiberHitCollList
PileUpMergeSvc::TimedList< ZDC_SimFiberHit_Collection >::type TimedFiberHitCollList
Definition: ZDC_PileUpTool.h:32
ZDC_PileUpTool::generateWaveform
std::vector< short unsigned int > generateWaveform(std::shared_ptr< ZDCWaveformSampler > wfSampler, float amplitude, float t0)
Definition: ZDC_PileUpTool.cxx:436
SG::ReadHandleKey< ZDC_SimFiberHit_Collection >
ZDC_PileUpTool::m_zdcFallTime
Gaudi::Property< double > m_zdcFallTime
Definition: ZDC_PileUpTool.h:100
ZDC_PileUpTool::m_numTimeBins
Gaudi::Property< int > m_numTimeBins
Definition: ZDC_PileUpTool.h:95
ZDC_PileUpTool::m_zdcRiseTime
Gaudi::Property< double > m_zdcRiseTime
Definition: ZDC_PileUpTool.h:99
ZDC_PileUpTool::m_rpdFallTime
Gaudi::Property< double > m_rpdFallTime
Definition: ZDC_PileUpTool.h:102
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:104
ZDC_PileUpTool::m_zdcAdcPerPhoton
Gaudi::Property< float > m_zdcAdcPerPhoton
Definition: ZDC_PileUpTool.h:106
ZDC_PileUpTool::m_mergedFiberHitList
ZDC_SimFiberHit_Collection * m_mergedFiberHitList
Definition: ZDC_PileUpTool.h:75
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:88
ZDC_PileUpTool::initializePbPb2015
void initializePbPb2015()
Definition: ZDC_PileUpTool.cxx:67
ZDC_PileUpTool::m_ZdcModuleContainerName
SG::WriteHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleContainerName
Definition: ZDC_PileUpTool.h:85
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:109
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:211
ZDC_PileUpTool::fillContainer
void fillContainer(TimedHitCollection< ZDC_SimFiberHit > &, CLHEP::HepRandomEngine *, xAOD::ZdcModuleContainer *)
Definition: ZDC_PileUpTool.cxx:255
ZDC_PileUpTool::initializePbPb2023
void initializePbPb2023()
Definition: ZDC_PileUpTool.cxx:98
ZDC_PileUpTool::SetDumps
void SetDumps(bool, bool)
ZDC_PileUpTool::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Definition: ZDC_PileUpTool.h:80
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
ZDC_PileUpTool::m_SimFiberHitCollectionKey
SG::ReadHandleKey< ZDC_SimFiberHit_Collection > m_SimFiberHitCollectionKey
Definition: ZDC_PileUpTool.h:84
ZDC_PileUpTool::doZDClightGuideCuts
TimedHitCollection< ZDC_SimFiberHit > doZDClightGuideCuts(const ZDC_SimFiberHit_Collection *hitCollection)
Definition: ZDC_PileUpTool.cxx:316
ZDC_SimFiberHit.h
PileUpToolBase
Definition: PileUpToolBase.h:18
ZDC_PileUpTool::m_freqMHz
Gaudi::Property< double > m_freqMHz
Definition: ZDC_PileUpTool.h:96
ZDC_PileUpTool::ZDC_PileUpTool
ZDC_PileUpTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: ZDC_PileUpTool.cxx:24
ZDC_PileUpTool::m_LTQuadStepFilt
Gaudi::Property< bool > m_LTQuadStepFilt
Definition: ZDC_PileUpTool.h:107
ZDC_SimFiberHit_Collection.h
ZDC_PileUpTool::initialize
virtual StatusCode initialize() override final
Definition: ZDC_PileUpTool.cxx:31
ZDC_PileUpTool::addEmptyWaveforms
void addEmptyWaveforms(xAOD::ZdcModuleContainer *zdcModuleContainer, CLHEP::HepRandomEngine *rndEngine)
Definition: ZDC_PileUpTool.cxx:275
ZDC_PileUpTool::m_qsfRiseTime
Gaudi::Property< double > m_qsfRiseTime
Definition: ZDC_PileUpTool.h:103
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ZDC_PileUpTool::m_rpdAdcPerPhoton
Gaudi::Property< std::vector< float > > m_rpdAdcPerPhoton
Definition: ZDC_PileUpTool.h:111
ZDC_PileUpTool::m_randomSvc
ServiceHandle< IAthRNGSvc > m_randomSvc
Definition: ZDC_PileUpTool.h:81
ZDC_PileUpTool::m_rpdRiseTime
Gaudi::Property< double > m_rpdRiseTime
Definition: ZDC_PileUpTool.h:101
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:98
ZDC_PileUpTool::m_ZdcSumsContainerName
SG::WriteHandleKey< xAOD::ZdcModuleContainer > m_ZdcSumsContainerName
Definition: ZDC_PileUpTool.h:86
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:94
ZDC_SimFiberHit
Definition: ZDC_SimFiberHit.h:11
ZDC_PileUpTool::m_delayChannels
Gaudi::Property< bool > m_delayChannels
Definition: ZDC_PileUpTool.h:108
ZDC_SimFiberHit_Collection
Definition: ZDC_SimFiberHit_Collection.h:16
ZDC_PileUpTool::initializeLHCf2022
void initializeLHCf2022()
Definition: ZDC_PileUpTool.cxx:82
ZDC_PileUpTool::m_doBRAN
Gaudi::Property< bool > m_doBRAN
Definition: ZDC_PileUpTool.h:110
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:76
TimedHitCollection
Definition: TimedHitCollection.h:15
ZDC_PileUpTool::finalize
virtual StatusCode finalize() override final
Definition: ZDC_PileUpTool.h:46
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:242
IAthRNGSvc.h
ServiceHandle< PileUpMergeSvc >
ZDC_PileUpTool::m_qsfFilter
Gaudi::Property< double > m_qsfFilter
Definition: ZDC_PileUpTool.h:105