ATLAS Offline Software
Loading...
Searching...
No Matches
ZDC_PileUpTool Class Reference

#include <ZDC_PileUpTool.h>

Inheritance diagram for ZDC_PileUpTool:
Collaboration diagram for ZDC_PileUpTool:

Public Member Functions

 ZDC_PileUpTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize () override final
void initializePbPb2015 ()
void initializeLHCf2022 ()
void initializePbPb2023 ()
virtual StatusCode finalize () override final
virtual StatusCode prepareEvent (const EventContext &ctx, const unsigned int nInputEvents) override final
 called before the subevts loop. Not (necessarily) able to access SubEvents
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
virtual StatusCode mergeEvent (const EventContext &ctx) override final
 return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase as FirstXing<=bunchXing<=LastXing
virtual StatusCode processAllSubEvents (const EventContext &ctx) override final

Private Member Functions

void fillContainer (TimedHitCollection< ZDC_SimFiberHit > &, CLHEP::HepRandomEngine *, xAOD::ZdcModuleContainer *)
void fillContainer (const ZDC_SimFiberHit_Collection *, CLHEP::HepRandomEngine *, xAOD::ZdcModuleContainer *)
TimedHitCollection< ZDC_SimFiberHitdoZDClightGuideCuts (const ZDC_SimFiberHit_Collection *hitCollection)
void createAndStoreWaveform (const ZDC_SimFiberHit &hit, CLHEP::HepRandomEngine *, xAOD::ZdcModuleContainer *)
void addEmptyWaveforms (xAOD::ZdcModuleContainer *zdcModuleContainer, CLHEP::HepRandomEngine *rndEngine)
std::vector< short unsigned int > generateWaveform (std::shared_ptr< ZDCWaveformSampler > wfSampler, float amplitude, float t0)
void SetDumps (bool, bool)

Private Attributes

ZDC_SimFiberHit_Collectionm_mergedFiberHitList {}
const ZdcIDm_ZdcID {}
std::unique_ptr< xAOD::ZdcModuleContainerm_ZdcModuleContainer
std::unique_ptr< xAOD::ZdcModuleAuxContainerm_ZdcModuleAuxContainer
ServiceHandle< PileUpMergeSvcm_mergeSvc {this, "mergeSvc", "PileUpMergeSvc", ""}
ServiceHandle< IAthRNGSvcm_randomSvc {this, "RndmSvc", "AthRNGSvc", ""}
Gaudi::Property< std::string > m_randomStreamName {this, "RandomStreamName", "ZDCRndEng", ""}
SG::ReadHandleKey< ZDC_SimFiberHit_Collectionm_SimFiberHitCollectionKey {this, "ZDC_SimFiberHit_CollectionName", "ZDC_SimFiberHit_Collection"}
SG::WriteHandleKey< xAOD::ZdcModuleContainerm_ZdcModuleContainerName {this, "ZdcModuleContainerName", "ZdcModules"}
SG::WriteHandleKey< xAOD::ZdcModuleContainerm_ZdcSumsContainerName {this, "ZdcSumsContainerName", "ZdcSums"}
Gaudi::Property< std::string > m_HitCollectionName
Gaudi::Property< std::string > m_outputContainerName
Gaudi::Property< std::string > m_configuration {this, "configuration" , "PbPb2023", "Named configuration to be used. Overwrites other properties if used" }
Gaudi::Property< int > m_Pedestal {this, "Pedestal" , 100 , "DC offset of the pulse in ADC" }
Gaudi::Property< int > m_numTimeBins {this, "MaxTimeBin" , 7 , "The number of time-slices after digitization(Typically 5 or 7)" }
Gaudi::Property< double > m_freqMHz {this, "freqMHz" , 40 , "Digitizer frequence in MHz" }
Gaudi::Property< double > m_zdct0 {this, "zdct0" , 40 , "Start time of the pulse in the digitization window" }
Gaudi::Property< double > m_rpdt0 {this, "rpdt0" , 40 , "Start time of the pulse in the digitization window" }
Gaudi::Property< double > m_zdcRiseTime {this, "zdcRiseTime" , 4 , "Rise time of the ZDC pulses" }
Gaudi::Property< double > m_zdcFallTime {this, "zdcFallTime" , 0.5 , "Fall time of the ZDC pulses" }
Gaudi::Property< double > m_rpdRiseTime {this, "rpdRiseTime" , 4 , "Rise time of the RPD pulses" }
Gaudi::Property< double > m_rpdFallTime {this, "rpdFallTime" , 0.5 , "Fall time of the RPD pulses" }
Gaudi::Property< double > m_qsfRiseTime {this, "qsfRiseTime" , 4 , "Rise time of the RPD pulses" }
Gaudi::Property< double > m_qsfFallTime {this, "qsfFallTime" , 4 , "Rise time of the RPD pulses" }
Gaudi::Property< double > m_qsfFilter {this, "qsfFilter" , 4 , "Rise time of the RPD pulses" }
Gaudi::Property< float > m_zdcAdcPerPhoton {this, "zdcAdcPerPhoton" , 0.000498 , "ADC counts per detected photon in the ZDCs" }
Gaudi::Property< bool > m_LTQuadStepFilt {this, "LTQuadStepFilt" , false , "Use LT Quad Step Filter waveform for ZDC channels" }
Gaudi::Property< bool > m_delayChannels {this, "delayChannels" , false , "Include delayed channels in the output" }
Gaudi::Property< bool > m_doRPD {this, "doRPD" , false , "Include RPD channels in the output" }
Gaudi::Property< bool > m_doBRAN {this, "doBRAN" , false , "Include BRAN channels in the output" }
Gaudi::Property< std::vector< float > > m_rpdAdcPerPhoton {this, "rpdAdcPerPhoton", {5.25 , 1.7}, "ADC counts per detected photon in the RPDs"}

structors and AlgTool implementation

virtual bool toProcess (int bunchXing) const override
 the method this base class helps implementing
virtual bool filterPassed () const override
 dummy implementation of passing filter
virtual void resetFilter () override
 dummy implementation of filter reset
Gaudi::Property< int > m_firstXing
Gaudi::Property< int > m_lastXing
Gaudi::Property< int > m_vetoPileUpTruthLinks
bool m_filterPassed {true}

Detailed Description

Definition at line 34 of file ZDC_PileUpTool.h.

Constructor & Destructor Documentation

◆ ZDC_PileUpTool()

ZDC_PileUpTool::ZDC_PileUpTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 24 of file ZDC_PileUpTool.cxx.

26 :
27 PileUpToolBase(type, name, parent)
28{
29}
PileUpToolBase(const std::string &type, const std::string &name, const IInterface *parent)

Member Function Documentation

◆ addEmptyWaveforms()

void ZDC_PileUpTool::addEmptyWaveforms ( xAOD::ZdcModuleContainer * zdcModuleContainer,
CLHEP::HepRandomEngine * rndEngine )
private

Definition at line 275 of file ZDC_PileUpTool.cxx.

275 {
276 //Initialize bools to keep track of what modules/channels we have seen
277 bool zdcFound[2][4] = {{}};
278 bool rpdFound[2][16] = {{}};
279 bool branFound[2] = {};
280 for(auto module : *zdcModuleContainer){
281 int iside = (module->zdcSide() == -1) ? 0 : 1;
282 int mod = module->zdcModule();
283 if(mod < 4){ //ZDC
284 zdcFound[iside][mod] = true;
285 ATH_MSG_DEBUG("ZDC_PileUpTool::addEmptyWaveforms Found ZDC side " << module->zdcSide() << " module " << mod);
286 }else if(mod == 4){ //RPD
287 rpdFound[iside][module->zdcChannel()] = true;
288 ATH_MSG_DEBUG("ZDC_PileUpTool::addEmptyWaveforms Found RPD side " << module->zdcSide() << " channel " << module->zdcChannel());
289 }else{//BRAN
290 branFound[iside] = true;
291 ATH_MSG_DEBUG("ZDC_PileUpTool::addEmptyWaveforms Found BRAN side " << module->zdcSide() );
292 }
293 }
294
295 for(int iside : {0,1}){
296 int side = (iside == 0) ? -1 : 1;
297 for(int mod = 0; mod < 4; mod++){
298 if(!zdcFound[iside][mod]){
299 ATH_MSG_DEBUG("ZDC_PileUpTool::addEmptyWaveforms Creating empty waveform for ZDC side " << side << " module " << mod);
300 createAndStoreWaveform(ZDC_SimFiberHit( m_ZdcID->channel_id(side, mod, ZdcIDType::SINGLECHANNEL, 0), 0, 0), rndEngine, zdcModuleContainer);
301 }
302 }
303 for(int channel = 0; channel < 16; channel++){
304 if(!rpdFound[iside][channel] && m_doRPD){
305 ATH_MSG_DEBUG("ZDC_PileUpTool::addEmptyWaveforms Creating empty waveform for RPD side " << side << " channel " << channel);
306 createAndStoreWaveform(ZDC_SimFiberHit( m_ZdcID->channel_id(side, 4, ZdcIDType::MULTICHANNEL, channel), 0, 0), rndEngine, zdcModuleContainer);
307 }
308 }
309 if(!branFound[iside] && m_doBRAN){
310 ATH_MSG_DEBUG("ZDC_PileUpTool::addEmptyWaveforms Creating empty waveform for BRAN side " << side );
311 createAndStoreWaveform(ZDC_SimFiberHit( m_ZdcID->channel_id(side, 5, ZdcIDType::SINGLECHANNEL, 0), 0, 0), rndEngine, zdcModuleContainer);
312 }
313 }
314}
#define ATH_MSG_DEBUG(x)
@ SINGLECHANNEL
Definition ZdcID.h:21
@ MULTICHANNEL
Definition ZdcID.h:21
void createAndStoreWaveform(const ZDC_SimFiberHit &hit, CLHEP::HepRandomEngine *, xAOD::ZdcModuleContainer *)
Gaudi::Property< bool > m_doRPD
Gaudi::Property< bool > m_doBRAN
const ZdcID * m_ZdcID

◆ createAndStoreWaveform()

void ZDC_PileUpTool::createAndStoreWaveform ( const ZDC_SimFiberHit & hit,
CLHEP::HepRandomEngine * rndEngine,
xAOD::ZdcModuleContainer * zdcModuleContainer )
private

Definition at line 366 of file ZDC_PileUpTool.cxx.

366 {
367 Identifier id = hit.getID( );
368 int side = m_ZdcID->side(id);
369 int module = m_ZdcID->module(id);
370 int channel = m_ZdcID->channel(id);
371
372 if(module == 4 && !m_doRPD) return;
373 if(module == 5 && !m_doBRAN) return;
374
375 //Here we have to switch the type of the RPD from ACTIVE to MULTICHANNEL
376 //TODO: Either change the channel numbering in the geometry, or the analysis
377 if(module == 4) id = m_ZdcID->channel_id(side,module,ZdcIDType::MULTICHANNEL,channel);
378
379 //Create a new ZdcModule to store the waveforms
380 xAOD::ZdcModule* zdc = new xAOD::ZdcModule();
381 zdcModuleContainer->push_back(xAOD::ZdcModuleContainer::unique_type(zdc));
382 zdcModuleContainer->back()->setZdcId(id.get_identifier32().get_compact());
383 zdcModuleContainer->back()->setZdcSide(side);
384 zdcModuleContainer->back()->setZdcModule(module);
385 zdcModuleContainer->back()->setZdcType(m_ZdcID->type(id));
386 zdcModuleContainer->back()->setZdcChannel(channel);
387
388 ATH_MSG_DEBUG( "Digitizing Side " << side <<
389 " Module " << module <<
390 " Channel " << channel <<
391 ", whith " << hit.getNPhotons() << " photons" );
392
393 uint iSide = (side == -1) ? 0 : 1;
394 float amplitude = 0, t0 = 0;
395 bool doHighGain = true;
396 std::shared_ptr<ZDCWaveformBase> waveformPtr;
397 std::shared_ptr<ZDCWaveformSampler> wfSampler;
398
399 if(module < 4){//It's a ZDC channel
400 amplitude = CLHEP::RandPoissonQ::shoot(rndEngine, hit.getNPhotons())*m_zdcAdcPerPhoton;
401
402 if(m_LTQuadStepFilt){
403 waveformPtr = std::make_shared<ZDCWaveformLTLinStep>("zdc",m_qsfRiseTime,m_qsfFallTime,m_qsfFilter);
404 }else{
405 waveformPtr = std::make_shared<ZDCWaveformFermiExp>("zdc",m_zdcRiseTime,m_zdcFallTime);
406 }
407 wfSampler = std::make_shared<ZDCWaveformSampler>(m_freqMHz, 0, m_numTimeBins, 12, m_Pedestal, waveformPtr);
408 t0 = m_zdct0;
409
410 }else{ //It's an RPD channel
411 // ATH_MSG_INFO("Digitizing RPD " << side << ", channel " << channel << " with " << hit.getNPhotons() << " and " << m_rpdAdcPerPhoton[iSide] << " amplification");
412 amplitude = CLHEP::RandPoissonQ::shoot(rndEngine, hit.getNPhotons())*m_rpdAdcPerPhoton[iSide];
413 waveformPtr = std::make_shared<ZDCWaveformFermiExp>("rpd",m_rpdRiseTime,m_rpdFallTime);
414 wfSampler = std::make_shared<ZDCWaveformSampler>(m_freqMHz, 0, m_numTimeBins, 12, m_Pedestal, waveformPtr);
415 t0 = m_rpdt0;
416 doHighGain = false;
417 }
418
419 //Record the number of photons that lead to this waveform
420 SG::Accessor<unsigned int> nPhotonsAcc ("nPhotons");
421 nPhotonsAcc (*zdc) = hit.getNPhotons();
422
423 //Generate in time waveforms
424 zdc->setWaveform("g0data", generateWaveform(wfSampler, amplitude, t0));
425 if(doHighGain) zdc->setWaveform("g1data", generateWaveform(wfSampler, 10*amplitude, t0));
426
427 //Generate delayed waveforms
428 if(m_delayChannels){
429 float timeBinWidth = 1000.0/m_freqMHz;
430 zdc->setWaveform("g0d1data", generateWaveform(wfSampler, 10*amplitude, t0+timeBinWidth/2));
431 if(doHighGain) zdc->setWaveform("g1d1data", generateWaveform(std::move(wfSampler), 10*amplitude, t0+timeBinWidth/2));
432 }
433
434}
unsigned int uint
static Double_t t0
const T * back() const
Access the last element in the collection as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
std::unique_ptr< base_value_type > unique_type
Definition DataVector.h:829
Gaudi::Property< double > m_zdcRiseTime
Gaudi::Property< double > m_zdcFallTime
std::vector< short unsigned int > generateWaveform(std::shared_ptr< ZDCWaveformSampler > wfSampler, float amplitude, float t0)
Gaudi::Property< double > m_freqMHz
Gaudi::Property< double > m_rpdRiseTime
Gaudi::Property< double > m_rpdt0
Gaudi::Property< bool > m_LTQuadStepFilt
Gaudi::Property< double > m_qsfFallTime
Gaudi::Property< int > m_numTimeBins
Gaudi::Property< double > m_rpdFallTime
Gaudi::Property< bool > m_delayChannels
Gaudi::Property< double > m_qsfRiseTime
Gaudi::Property< double > m_qsfFilter
Gaudi::Property< double > m_zdct0
Gaudi::Property< float > m_zdcAdcPerPhoton
Gaudi::Property< std::vector< float > > m_rpdAdcPerPhoton
Gaudi::Property< int > m_Pedestal
int getNPhotons() const
Identifier getID() const
void setWaveform(const std::string &, const std::vector< uint16_t > &)
ZdcModule_v1 ZdcModule
Definition ZdcModule.h:15

◆ doZDClightGuideCuts()

TimedHitCollection< ZDC_SimFiberHit > ZDC_PileUpTool::doZDClightGuideCuts ( const ZDC_SimFiberHit_Collection * hitCollection)
private

Definition at line 316 of file ZDC_PileUpTool.cxx.

316 {
317
318 ZDC_SimFiberHit* newHits[2][4] = {{nullptr}};
319 ZDC_SimFiberHit_Collection* newCollection = new ZDC_SimFiberHit_Collection("ZDC_SimFiberHit_Collection_Temp");
320
321 for(ZDC_SimFiberHit hit : *hitCollection){
322 Identifier id = hit.getID();
323 //Translate side from -1,1 to 0,1 to index ZDC hits
324 int side = (m_ZdcID->side( id ) < 0 ) ? 0 : 1;
325 int module = m_ZdcID->module( id );
326
327 //ZDCs are module 0-3, just insert this hit unmodified and move on
328 if(module > 3){
329 newCollection->Insert(hit);
330 continue;
331 }
332
333 //TODO: Implement a method to get the efficiency of this location to multiply hit.getNphotons() and hit.getEdep()
334 //based on the channel retrieved by m_ZdcID->channel( id ) and some efficiency map
335 float efficiency = 1.0; //For now we will just use 100% efficiency
336
337 if(!newHits[side][module]){
338 //The module hasn't been seen yet, create a new hit with values modified by the efficiency factor
339 //The ID is modified because we initially used channel to denote the position of the rods for these efficiency cuts
340 //Now that that's done, we make sure the type is SINGLECHANNEL and the channel is 0
341 newHits[side][module] = new ZDC_SimFiberHit(m_ZdcID->channel_id(m_ZdcID->side(id), module, ZdcIDType::SINGLECHANNEL, 0), efficiency * hit.getNPhotons(), efficiency * hit.getEdep());
342 }else{
343 //The module has been seen, add the photons and energy from this new hit to it
344 newHits[side][module]->Add( efficiency*hit.getNPhotons(), efficiency*hit.getEdep());
345 }
346 }//end loop over hits
347
348 for(int side : {0,1}){
349 for(int module = 0; module < 4; module++){
350 //Make sure the hit exists before attempting to insert it
351 //If it doesn't we will take care of this module in addEmptyWaveforms
352 if(newHits[side][module]){
353 newCollection->Insert(*(newHits[side][module]));
354 }
355 }
356 }
357
358 //Now insert one hit per detector in the new collection
359 TimedHitCollection<ZDC_SimFiberHit> newTimedCollection;
360 newTimedCollection.insert(0.0, newCollection);
361 //coverity[leaked_storage]
362 return newTimedCollection;
363}
void Insert(const T &h)
void insert(const PileUpTimeEventIndex &timeEventIndex, const AtlasHitsVector< HIT > *inputCollection)
void Add(int nphot, double edep)
void efficiency(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")

◆ fillContainer() [1/2]

void ZDC_PileUpTool::fillContainer ( const ZDC_SimFiberHit_Collection * ZDC_SimFiberHit_Collection,
CLHEP::HepRandomEngine * rndEngine,
xAOD::ZdcModuleContainer * zdcModuleContainer )
private

Definition at line 265 of file ZDC_PileUpTool.cxx.

265 {
266 ZDC_SimFiberHit_ConstIterator it = ZDC_SimFiberHit_Collection->begin();
267 ZDC_SimFiberHit_ConstIterator itend = ZDC_SimFiberHit_Collection->end();
268
269 for (; it != itend; ++it) {
270 createAndStoreWaveform(*it, rndEngine, zdcModuleContainer);
271 }
272 addEmptyWaveforms(zdcModuleContainer, rndEngine);
273}
ZDC_SimFiberHit_Collection::const_iterator ZDC_SimFiberHit_ConstIterator
const_iterator begin() const
const_iterator end() const
void addEmptyWaveforms(xAOD::ZdcModuleContainer *zdcModuleContainer, CLHEP::HepRandomEngine *rndEngine)

◆ fillContainer() [2/2]

void ZDC_PileUpTool::fillContainer ( TimedHitCollection< ZDC_SimFiberHit > & thpczdc,
CLHEP::HepRandomEngine * rndEngine,
xAOD::ZdcModuleContainer * zdcModuleContainer )
private

Definition at line 255 of file ZDC_PileUpTool.cxx.

255 {
256 TimedHitCollection<ZDC_SimFiberHit> thpc = thpczdc;
258 while (thpc.nextDetectorElement(i, e)) for (it = i; it != e; ++it) {
259 createAndStoreWaveform(*(*it), rndEngine, zdcModuleContainer);
260 }
261 addEmptyWaveforms(zdcModuleContainer, rndEngine);
262}
bool nextDetectorElement(const_iterator &b, const_iterator &e)
sets an iterator range with the hits of current detector element returns a bool when done
TimedVector::const_iterator const_iterator

◆ filterPassed()

virtual bool PileUpToolBase::filterPassed ( ) const
inlineoverridevirtualinherited

dummy implementation of passing filter

Definition at line 49 of file PileUpToolBase.h.

49{ return m_filterPassed; }

◆ finalize()

virtual StatusCode ZDC_PileUpTool::finalize ( )
inlinefinaloverridevirtual

Definition at line 46 of file ZDC_PileUpTool.h.

46{ return StatusCode::SUCCESS; }

◆ generateWaveform()

std::vector< short unsigned int > ZDC_PileUpTool::generateWaveform ( std::shared_ptr< ZDCWaveformSampler > wfSampler,
float amplitude,
float t0 )
private

Definition at line 436 of file ZDC_PileUpTool.cxx.

436 {
437 std::vector<unsigned int> wf = wfSampler->Generate(amplitude, t0);
438 std::vector<short unsigned int> retVal;
439 for(uint sample = 0; sample < wf.size(); sample++){
440 retVal.push_back(wf[sample]);
441 }
442 return retVal;
443}

◆ initialize()

StatusCode ZDC_PileUpTool::initialize ( )
finaloverridevirtual

Reimplemented from PileUpToolBase.

Definition at line 31 of file ZDC_PileUpTool.cxx.

31 {
32
33 ATH_MSG_DEBUG ( "ZDC_PileUpTool::initialize() called" );
34
35 const ZdcID* zdcId = nullptr;
36 if (detStore()->retrieve( zdcId ).isFailure() ) {
37 ATH_MSG_ERROR("execute: Could not retrieve ZdcID object from the detector store");
38 return StatusCode::FAILURE;
39 }
40 else {
41 ATH_MSG_DEBUG("execute: retrieved ZdcID");
42 }
43 m_ZdcID = zdcId;
44
45 ATH_CHECK(m_randomSvc.retrieve());
46 ATH_MSG_DEBUG ( "Retrieved RandomNumber Service" );
47
51
52 ATH_MSG_INFO("ZDC_PileUpTool configuration = " << m_configuration);
53
54 if(m_configuration == "PbPb2015"){
56 }else if(m_configuration == "LHCf2022"){
58 }else if(m_configuration == "PbPb2023"){
60 }
61
62 m_mergedFiberHitList = new ZDC_SimFiberHit_Collection("mergedFiberHitList");
63
64 return StatusCode::SUCCESS;
65}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
SG::ReadHandleKey< ZDC_SimFiberHit_Collection > m_SimFiberHitCollectionKey
SG::WriteHandleKey< xAOD::ZdcModuleContainer > m_ZdcSumsContainerName
SG::WriteHandleKey< xAOD::ZdcModuleContainer > m_ZdcModuleContainerName
Gaudi::Property< std::string > m_configuration
ServiceHandle< IAthRNGSvc > m_randomSvc
ZDC_SimFiberHit_Collection * m_mergedFiberHitList
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ initializeLHCf2022()

void ZDC_PileUpTool::initializeLHCf2022 ( )

Definition at line 82 of file ZDC_PileUpTool.cxx.

82 {
83
84 m_Pedestal = 100;
85 m_numTimeBins = 24;
86 m_freqMHz = 320;
87 m_delayChannels = false;
88 m_LTQuadStepFilt = false;
89 m_doRPD = false;
90 m_doBRAN = false;
91 m_zdct0 = 28;
92 m_rpdt0 = 28;
93 m_zdcRiseTime = 1;
94 m_zdcFallTime = 5.5;
95 m_zdcAdcPerPhoton = 0.000498;
96}

◆ initializePbPb2015()

void ZDC_PileUpTool::initializePbPb2015 ( )

Definition at line 67 of file ZDC_PileUpTool.cxx.

67 {
68
69 m_Pedestal = 100;
70 m_numTimeBins = 7;
71 m_freqMHz = 80;
72 m_delayChannels = true;
73 m_LTQuadStepFilt = true;
74 m_doRPD = false;
75 m_doBRAN = false;
76 m_zdct0 = 28;
77 m_qsfRiseTime = 0.5;
78 m_qsfFallTime = 11;
79 m_qsfFilter = 15;
80}

◆ initializePbPb2023()

void ZDC_PileUpTool::initializePbPb2023 ( )

Definition at line 98 of file ZDC_PileUpTool.cxx.

98 {
99
100 m_Pedestal = 100;
101 m_numTimeBins = 24;
102 m_freqMHz = 320;
103 m_delayChannels = false;
104 m_LTQuadStepFilt = false;
105 m_doRPD = true;
106 m_doBRAN = true;
107 m_zdct0 = 31.2;
108 m_rpdt0 = 27.9;
109 m_zdcRiseTime = 1.1;
110 m_zdcFallTime = 4.5;
111 m_rpdRiseTime = 0.8;
112 m_rpdFallTime = 15;
113 m_zdcAdcPerPhoton = 0.000498;
114 m_rpdAdcPerPhoton = {5.25 , 1.7};
115}

◆ mergeEvent()

StatusCode ZDC_PileUpTool::mergeEvent ( const EventContext & ctx)
finaloverridevirtual

return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase as FirstXing<=bunchXing<=LastXing

called at the end of the subevts loop. Not (necessarily) able to access SubEvents

Definition at line 242 of file ZDC_PileUpTool.cxx.

242 {
243
244 ATHRNG::RNGWrapper* rngWrapper = m_randomSvc->getEngine(this, m_randomStreamName);
245 rngWrapper->setSeed( m_randomStreamName, ctx );
246 CLHEP::HepRandomEngine* rngEngine = rngWrapper->getEngine(ctx);
248
249 SG::WriteHandle<xAOD::ZdcModuleContainer> moduleContainerH (m_ZdcModuleContainerName, ctx);
250 ATH_CHECK( moduleContainerH.record (std::move(m_ZdcModuleContainer), std::move(m_ZdcModuleAuxContainer)) );
251
252 return StatusCode::SUCCESS;
253}
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition RNGWrapper.h:169
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition RNGWrapper.h:134
Gaudi::Property< std::string > m_randomStreamName
std::unique_ptr< xAOD::ZdcModuleAuxContainer > m_ZdcModuleAuxContainer
void fillContainer(TimedHitCollection< ZDC_SimFiberHit > &, CLHEP::HepRandomEngine *, xAOD::ZdcModuleContainer *)
std::unique_ptr< xAOD::ZdcModuleContainer > m_ZdcModuleContainer

◆ prepareEvent()

StatusCode ZDC_PileUpTool::prepareEvent ( const EventContext & ctx,
const unsigned int nInputEvents )
finaloverridevirtual

called before the subevts loop. Not (necessarily) able to access SubEvents

Definition at line 192 of file ZDC_PileUpTool.cxx.

192 {
193
194 ATH_MSG_DEBUG ( "ZDC_PileUpTool::prepareEvent() called for " << nInputEvents << " input events" );
195
196 m_ZdcModuleContainer = std::make_unique<xAOD::ZdcModuleContainer>();
197 m_ZdcModuleAuxContainer = std::make_unique<xAOD::ZdcModuleAuxContainer>();
199
204
205 m_mergedFiberHitList->clear();
206
207 return StatusCode::SUCCESS;
208}
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572

◆ processAllSubEvents()

StatusCode ZDC_PileUpTool::processAllSubEvents ( const EventContext & ctx)
finaloverridevirtual

Reimplemented from PileUpToolBase.

Definition at line 117 of file ZDC_PileUpTool.cxx.

117 {
118
119 ATH_MSG_DEBUG ( "ZDC_PileUpTool::processAllSubEvents()" );
120
121 ATHRNG::RNGWrapper* rngWrapper = m_randomSvc->getEngine(this, m_randomStreamName);
122 rngWrapper->setSeed( m_randomStreamName, ctx );
123 CLHEP::HepRandomEngine* rngEngine = rngWrapper->getEngine(ctx);
124
125 /******************************************
126 * retrieve the hit collection list (input)
127 ******************************************/
128
129 SG::ReadHandle<ZDC_SimFiberHit_Collection> hitCollection(m_SimFiberHitCollectionKey, ctx);
130 if (!hitCollection.isValid()) {
131 ATH_MSG_ERROR("Could not get ZDC_SimFiberHit_Collection container " << hitCollection.name() << " from store " << hitCollection.store());
132 return StatusCode::FAILURE;
133 }
134 ATH_MSG_DEBUG("ZDC_SimFiberHitHitCollection found with " << hitCollection->size() << " hits");
135
136 /******************************************
137 * Do light guide efficiency cuts on the ZDCs
138 ******************************************/
139 TimedHitCollection<ZDC_SimFiberHit> thpcZDC_Fiber = doZDClightGuideCuts(hitCollection.cptr());
140
141 /******************************************
142 * Create the output container
143 ******************************************/
144 std::unique_ptr<xAOD::ZdcModuleContainer> moduleContainer( new xAOD::ZdcModuleContainer());
145 std::unique_ptr<xAOD::ZdcModuleAuxContainer> moduleAuxContainer( new xAOD::ZdcModuleAuxContainer() );
146 moduleContainer->setStore( moduleAuxContainer.get() );
147
150 if(m_delayChannels){
153 }
154
155 /******************************************
156 * Create the waveforms
157 ******************************************/
158 fillContainer(thpcZDC_Fiber, rngEngine, moduleContainer.get());
159
160
161 /******************************************
162 * Create the zdcSums container
163 ******************************************/
164 std::unique_ptr<xAOD::ZdcModuleContainer> sumsContainer( new xAOD::ZdcModuleContainer());
165 std::unique_ptr<xAOD::ZdcModuleAuxContainer> sumsAuxContainer( new xAOD::ZdcModuleAuxContainer() );
166 sumsContainer->setStore( sumsAuxContainer.get() );
167
168 static const SG::Accessor<uint16_t> LucrodTriggerSideAmpAcc ("LucrodTriggerSideAmp");
169 for (int iside : {-1, 0, 1}){
170 xAOD::ZdcModule* new_sum = new xAOD::ZdcModule();
171 sumsContainer->push_back(xAOD::ZdcModuleContainer::unique_type(new_sum));
172 new_sum->setZdcSide(iside);
173 LucrodTriggerSideAmpAcc (*new_sum) = 42;
174 }
175
176 /******************************************
177 * Write the output
178 ******************************************/
179
180 //Print the module contents
181 ATH_MSG_DEBUG( ZdcModuleToString(*moduleContainer) );
182
183 auto moduleContainerH = SG::makeHandle( m_ZdcModuleContainerName, ctx );
184 ATH_CHECK( moduleContainerH.record (std::move(moduleContainer), std::move(moduleAuxContainer)) );
185
186 auto sumsContainerH = SG::makeHandle( m_ZdcSumsContainerName, ctx );
187 ATH_CHECK( sumsContainerH.record (std::move(sumsContainer), std::move(sumsAuxContainer)) );
188
189 return StatusCode::SUCCESS;
190}
std::string ZdcModuleToString(const xAOD::ZdcModule &zm)
TimedHitCollection< ZDC_SimFiberHit > doZDClightGuideCuts(const ZDC_SimFiberHit_Collection *hitCollection)
void setZdcSide(int)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
ZdcModuleContainer_v1 ZdcModuleContainer
ZdcModuleAuxContainer_v2 ZdcModuleAuxContainer

◆ processBunchXing()

StatusCode ZDC_PileUpTool::processBunchXing ( int bunchXing,
SubEventIterator bSubEvents,
SubEventIterator eSubEvents )
finaloverridevirtual

called for each active bunch-crossing to process current SubEvents bunchXing is in ns

Reimplemented from PileUpToolBase.

Definition at line 211 of file ZDC_PileUpTool.cxx.

213 {
214 ATH_MSG_DEBUG ( "ZDC_PileUpTool::processBunchXing() " << bunchXing );
215 SubEventIterator iEvt = bSubEvents;
216 for (; iEvt!=eSubEvents; ++iEvt) {
217 StoreGateSvc& seStore = *iEvt->ptr()->evtStore();
218 ATH_MSG_VERBOSE("SubEvt StoreGate " << seStore.name() << " :"
219 << " bunch crossing : " << bunchXing
220 << " time offset : " << iEvt->time()
221 << " event number : " << iEvt->ptr()->eventNumber()
222 << " run number : " << iEvt->ptr()->runNumber());
223
224 const ZDC_SimFiberHit_Collection* tmpColl = 0;
225
226 if (!seStore.retrieve(tmpColl, m_HitCollectionName).isSuccess()) {
227 ATH_MSG_ERROR ( "SubEvent ZDC_SimFiberHit_Collection not found in StoreGate " << seStore.name() );
228 return StatusCode::FAILURE;
229 }
230 ATH_MSG_DEBUG ( "ZDC_SimFiberHit_Collection found with " << tmpColl->size() << " hits" );
231
234
235 for (; it!=end; ++it) m_mergedFiberHitList->push_back(*it);
236 }
237
238 return StatusCode::SUCCESS;
239}
#define ATH_MSG_VERBOSE(x)
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition IPileUpTool.h:22
size_type size() const
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
Gaudi::Property< std::string > m_HitCollectionName

◆ resetFilter()

virtual void PileUpToolBase::resetFilter ( )
inlineoverridevirtualinherited

dummy implementation of filter reset

Reimplemented in MergeTruthJetsTool.

Definition at line 51 of file PileUpToolBase.h.

51{ m_filterPassed=true; }

◆ SetDumps()

void ZDC_PileUpTool::SetDumps ( bool ,
bool  )
private

◆ toProcess()

virtual bool PileUpToolBase::toProcess ( int bunchXing) const
inlineoverridevirtualinherited

the method this base class helps implementing

Reimplemented in MergeHijingParsTool, and MergeTrackRecordCollTool.

Definition at line 32 of file PileUpToolBase.h.

32 {
33 //closed interval [m_firstXing,m_lastXing]
34 return !((m_firstXing > bunchXing) || (bunchXing > m_lastXing));
35 }
Gaudi::Property< int > m_firstXing
Gaudi::Property< int > m_lastXing

Member Data Documentation

◆ m_configuration

Gaudi::Property<std::string> ZDC_PileUpTool::m_configuration {this, "configuration" , "PbPb2023", "Named configuration to be used. Overwrites other properties if used" }
private

Definition at line 93 of file ZDC_PileUpTool.h.

93{this, "configuration" , "PbPb2023", "Named configuration to be used. Overwrites other properties if used" };

◆ m_delayChannels

Gaudi::Property<bool > ZDC_PileUpTool::m_delayChannels {this, "delayChannels" , false , "Include delayed channels in the output" }
private

Definition at line 108 of file ZDC_PileUpTool.h.

108{this, "delayChannels" , false , "Include delayed channels in the output" };

◆ m_doBRAN

Gaudi::Property<bool > ZDC_PileUpTool::m_doBRAN {this, "doBRAN" , false , "Include BRAN channels in the output" }
private

Definition at line 110 of file ZDC_PileUpTool.h.

110{this, "doBRAN" , false , "Include BRAN channels in the output" };

◆ m_doRPD

Gaudi::Property<bool > ZDC_PileUpTool::m_doRPD {this, "doRPD" , false , "Include RPD channels in the output" }
private

Definition at line 109 of file ZDC_PileUpTool.h.

109{this, "doRPD" , false , "Include RPD channels in the output" };

◆ m_filterPassed

bool PileUpToolBase::m_filterPassed {true}
protectedinherited

Definition at line 60 of file PileUpToolBase.h.

60{true};

◆ m_firstXing

Gaudi::Property<int> PileUpToolBase::m_firstXing
protectedinherited
Initial value:
{this, "FirstXing", -999,
"First bunch-crossing in which det is live"}

Definition at line 54 of file PileUpToolBase.h.

54 {this, "FirstXing", -999,
55 "First bunch-crossing in which det is live"};

◆ m_freqMHz

Gaudi::Property<double> ZDC_PileUpTool::m_freqMHz {this, "freqMHz" , 40 , "Digitizer frequence in MHz" }
private

Definition at line 96 of file ZDC_PileUpTool.h.

96{this, "freqMHz" , 40 , "Digitizer frequence in MHz" };

◆ m_HitCollectionName

Gaudi::Property<std::string> ZDC_PileUpTool::m_HitCollectionName
private
Initial value:
{this, "HitCollectionName" , "ZDC_SimFiberHit_Collection",
"Name of the input Collection of the simulation Hits"}

Definition at line 88 of file ZDC_PileUpTool.h.

88 {this, "HitCollectionName" , "ZDC_SimFiberHit_Collection",
89 "Name of the input Collection of the simulation Hits"};

◆ m_lastXing

Gaudi::Property<int> PileUpToolBase::m_lastXing
protectedinherited
Initial value:
{this, "LastXing", 999,
"Last bunch-crossing in which det is live"}

Definition at line 56 of file PileUpToolBase.h.

56 {this, "LastXing", 999,
57 "Last bunch-crossing in which det is live"};

◆ m_LTQuadStepFilt

Gaudi::Property<bool > ZDC_PileUpTool::m_LTQuadStepFilt {this, "LTQuadStepFilt" , false , "Use LT Quad Step Filter waveform for ZDC channels" }
private

Definition at line 107 of file ZDC_PileUpTool.h.

107{this, "LTQuadStepFilt" , false , "Use LT Quad Step Filter waveform for ZDC channels" };

◆ m_mergedFiberHitList

ZDC_SimFiberHit_Collection* ZDC_PileUpTool::m_mergedFiberHitList {}
private

Definition at line 75 of file ZDC_PileUpTool.h.

75{};

◆ m_mergeSvc

ServiceHandle<PileUpMergeSvc> ZDC_PileUpTool::m_mergeSvc {this, "mergeSvc", "PileUpMergeSvc", ""}
private

Definition at line 80 of file ZDC_PileUpTool.h.

80{this, "mergeSvc", "PileUpMergeSvc", ""};

◆ m_numTimeBins

Gaudi::Property<int > ZDC_PileUpTool::m_numTimeBins {this, "MaxTimeBin" , 7 , "The number of time-slices after digitization(Typically 5 or 7)" }
private

Definition at line 95 of file ZDC_PileUpTool.h.

95{this, "MaxTimeBin" , 7 , "The number of time-slices after digitization(Typically 5 or 7)" };

◆ m_outputContainerName

Gaudi::Property<std::string> ZDC_PileUpTool::m_outputContainerName
private
Initial value:
{this, "OutputContainerName" , "ZDC_SimModuleContainer",
"Name of the output ZDC module container"}

Definition at line 90 of file ZDC_PileUpTool.h.

90 {this, "OutputContainerName" , "ZDC_SimModuleContainer",
91 "Name of the output ZDC module container"};

◆ m_Pedestal

Gaudi::Property<int > ZDC_PileUpTool::m_Pedestal {this, "Pedestal" , 100 , "DC offset of the pulse in ADC" }
private

Definition at line 94 of file ZDC_PileUpTool.h.

94{this, "Pedestal" , 100 , "DC offset of the pulse in ADC" };

◆ m_qsfFallTime

Gaudi::Property<double> ZDC_PileUpTool::m_qsfFallTime {this, "qsfFallTime" , 4 , "Rise time of the RPD pulses" }
private

Definition at line 104 of file ZDC_PileUpTool.h.

104{this, "qsfFallTime" , 4 , "Rise time of the RPD pulses" };

◆ m_qsfFilter

Gaudi::Property<double> ZDC_PileUpTool::m_qsfFilter {this, "qsfFilter" , 4 , "Rise time of the RPD pulses" }
private

Definition at line 105 of file ZDC_PileUpTool.h.

105{this, "qsfFilter" , 4 , "Rise time of the RPD pulses" };

◆ m_qsfRiseTime

Gaudi::Property<double> ZDC_PileUpTool::m_qsfRiseTime {this, "qsfRiseTime" , 4 , "Rise time of the RPD pulses" }
private

Definition at line 103 of file ZDC_PileUpTool.h.

103{this, "qsfRiseTime" , 4 , "Rise time of the RPD pulses" };

◆ m_randomStreamName

Gaudi::Property<std::string> ZDC_PileUpTool::m_randomStreamName {this, "RandomStreamName", "ZDCRndEng", ""}
private

Definition at line 82 of file ZDC_PileUpTool.h.

82{this, "RandomStreamName", "ZDCRndEng", ""};

◆ m_randomSvc

ServiceHandle<IAthRNGSvc> ZDC_PileUpTool::m_randomSvc {this, "RndmSvc", "AthRNGSvc", ""}
private

Definition at line 81 of file ZDC_PileUpTool.h.

81{this, "RndmSvc", "AthRNGSvc", ""};

◆ m_rpdAdcPerPhoton

Gaudi::Property<std::vector< float> > ZDC_PileUpTool::m_rpdAdcPerPhoton {this, "rpdAdcPerPhoton", {5.25 , 1.7}, "ADC counts per detected photon in the RPDs"}
private

Definition at line 111 of file ZDC_PileUpTool.h.

111{this, "rpdAdcPerPhoton", {5.25 , 1.7}, "ADC counts per detected photon in the RPDs"};

◆ m_rpdFallTime

Gaudi::Property<double> ZDC_PileUpTool::m_rpdFallTime {this, "rpdFallTime" , 0.5 , "Fall time of the RPD pulses" }
private

Definition at line 102 of file ZDC_PileUpTool.h.

102{this, "rpdFallTime" , 0.5 , "Fall time of the RPD pulses" };

◆ m_rpdRiseTime

Gaudi::Property<double> ZDC_PileUpTool::m_rpdRiseTime {this, "rpdRiseTime" , 4 , "Rise time of the RPD pulses" }
private

Definition at line 101 of file ZDC_PileUpTool.h.

101{this, "rpdRiseTime" , 4 , "Rise time of the RPD pulses" };

◆ m_rpdt0

Gaudi::Property<double> ZDC_PileUpTool::m_rpdt0 {this, "rpdt0" , 40 , "Start time of the pulse in the digitization window" }
private

Definition at line 98 of file ZDC_PileUpTool.h.

98{this, "rpdt0" , 40 , "Start time of the pulse in the digitization window" };

◆ m_SimFiberHitCollectionKey

SG::ReadHandleKey<ZDC_SimFiberHit_Collection> ZDC_PileUpTool::m_SimFiberHitCollectionKey {this, "ZDC_SimFiberHit_CollectionName", "ZDC_SimFiberHit_Collection"}
private

Definition at line 84 of file ZDC_PileUpTool.h.

84{this, "ZDC_SimFiberHit_CollectionName", "ZDC_SimFiberHit_Collection"};

◆ m_vetoPileUpTruthLinks

Gaudi::Property<int> PileUpToolBase::m_vetoPileUpTruthLinks
protectedinherited
Initial value:
{this, "VetoPileUpTruthLinks", true,
"Ignore links to suppressed pile-up truth"}

Definition at line 58 of file PileUpToolBase.h.

58 {this, "VetoPileUpTruthLinks", true,
59 "Ignore links to suppressed pile-up truth"};

◆ m_zdcAdcPerPhoton

Gaudi::Property<float > ZDC_PileUpTool::m_zdcAdcPerPhoton {this, "zdcAdcPerPhoton" , 0.000498 , "ADC counts per detected photon in the ZDCs" }
private

Definition at line 106 of file ZDC_PileUpTool.h.

106{this, "zdcAdcPerPhoton" , 0.000498 , "ADC counts per detected photon in the ZDCs" };

◆ m_zdcFallTime

Gaudi::Property<double> ZDC_PileUpTool::m_zdcFallTime {this, "zdcFallTime" , 0.5 , "Fall time of the ZDC pulses" }
private

Definition at line 100 of file ZDC_PileUpTool.h.

100{this, "zdcFallTime" , 0.5 , "Fall time of the ZDC pulses" };

◆ m_ZdcID

const ZdcID* ZDC_PileUpTool::m_ZdcID {}
private

Definition at line 76 of file ZDC_PileUpTool.h.

76{};

◆ m_ZdcModuleAuxContainer

std::unique_ptr<xAOD::ZdcModuleAuxContainer> ZDC_PileUpTool::m_ZdcModuleAuxContainer
private

Definition at line 78 of file ZDC_PileUpTool.h.

◆ m_ZdcModuleContainer

std::unique_ptr<xAOD::ZdcModuleContainer> ZDC_PileUpTool::m_ZdcModuleContainer
private

Definition at line 77 of file ZDC_PileUpTool.h.

◆ m_ZdcModuleContainerName

SG::WriteHandleKey<xAOD::ZdcModuleContainer> ZDC_PileUpTool::m_ZdcModuleContainerName {this, "ZdcModuleContainerName", "ZdcModules"}
private

Definition at line 85 of file ZDC_PileUpTool.h.

85{this, "ZdcModuleContainerName", "ZdcModules"};

◆ m_zdcRiseTime

Gaudi::Property<double> ZDC_PileUpTool::m_zdcRiseTime {this, "zdcRiseTime" , 4 , "Rise time of the ZDC pulses" }
private

Definition at line 99 of file ZDC_PileUpTool.h.

99{this, "zdcRiseTime" , 4 , "Rise time of the ZDC pulses" };

◆ m_ZdcSumsContainerName

SG::WriteHandleKey<xAOD::ZdcModuleContainer> ZDC_PileUpTool::m_ZdcSumsContainerName {this, "ZdcSumsContainerName", "ZdcSums"}
private

Definition at line 86 of file ZDC_PileUpTool.h.

86{this, "ZdcSumsContainerName", "ZdcSums"};

◆ m_zdct0

Gaudi::Property<double> ZDC_PileUpTool::m_zdct0 {this, "zdct0" , 40 , "Start time of the pulse in the digitization window" }
private

Definition at line 97 of file ZDC_PileUpTool.h.

97{this, "zdct0" , 40 , "Start time of the pulse in the digitization window" };

The documentation for this class was generated from the following files: