|
ATLAS Offline Software
|
Go to the documentation of this file.
17 #include "CLHEP/Random/RandomEngine.h"
18 #include "CLHEP/Random/RandFlat.h"
19 #include "CLHEP/Random/RandGaussQ.h"
20 #include "CLHEP/Random/RandPoissonQ.h"
23 const std::string&
name,
24 const IInterface*
parent) :
33 const ZdcID* zdcId =
nullptr;
35 ATH_MSG_ERROR(
"execute: Could not retrieve ZdcID object from the detector store");
36 return StatusCode::FAILURE;
62 return StatusCode::SUCCESS;
121 CLHEP::HepRandomEngine* rngEngine = rngWrapper->
getEngine(ctx);
128 if (!hitCollection.
isValid()) {
129 ATH_MSG_ERROR(
"Could not get ZDC_SimFiberHit_Collection container " << hitCollection.
name() <<
" from store " << hitCollection.
store());
130 return StatusCode::FAILURE;
132 ATH_MSG_DEBUG(
"ZDC_SimFiberHitHitCollection found with " << hitCollection->
size() <<
" hits");
144 moduleContainer->setStore( moduleAuxContainer.get() );
156 fillContainer(thpcZDC_Fiber, rngEngine, moduleContainer.get());
164 sumsContainer->setStore( sumsAuxContainer.get() );
167 for (
int iside : {-1, 1}){
171 LucrodTriggerSideAmpAcc (*new_sum) = 42;
182 ATH_CHECK( moduleContainerH.record (std::move(moduleContainer), std::move(moduleAuxContainer)) );
185 ATH_CHECK( sumsContainerH.record (std::move(sumsContainer), std::move(sumsAuxContainer)) );
187 return StatusCode::SUCCESS;
192 ATH_MSG_DEBUG (
"ZDC_PileUpTool::prepareEvent() called for " << nInputEvents <<
" input events" );
205 return StatusCode::SUCCESS;
212 ATH_MSG_DEBUG (
"ZDC_PileUpTool::processBunchXing() " << bunchXing );
214 for (; iEvt!=eSubEvents; ++iEvt) {
217 <<
" bunch crossing : " << bunchXing
218 <<
" time offset : " << iEvt->time()
219 <<
" event number : " << iEvt->ptr()->eventNumber()
220 <<
" run number : " << iEvt->ptr()->runNumber());
225 ATH_MSG_ERROR (
"SubEvent ZDC_SimFiberHit_Collection not found in StoreGate " << seStore.name() );
226 return StatusCode::FAILURE;
228 ATH_MSG_DEBUG (
"ZDC_SimFiberHit_Collection found with " << tmpColl->
size() <<
" hits" );
236 return StatusCode::SUCCESS;
244 CLHEP::HepRandomEngine* rngEngine = rngWrapper->
getEngine(ctx);
250 return StatusCode::SUCCESS;
267 for (;
it != itend; ++
it) {
275 bool zdcFound[2][4] = {{}};
276 bool rpdFound[2][16] = {{}};
277 bool branFound[2] = {};
278 for(
auto module : *zdcModuleContainer){
279 int iside = (
module->zdcSide() == -1) ? 0 : 1;
282 zdcFound[iside][
mod] =
true;
283 ATH_MSG_DEBUG(
"ZDC_PileUpTool::addEmptyWaveforms Found ZDC side " <<
module->zdcSide() <<
" module " <<
mod);
285 rpdFound[iside][
module->zdcChannel()] =
true;
286 ATH_MSG_DEBUG(
"ZDC_PileUpTool::addEmptyWaveforms Found RPD side " <<
module->zdcSide() <<
" channel " <<
module->zdcChannel());
288 branFound[iside] =
true;
293 for(
int iside : {0,1}){
294 int side = (iside == 0) ? -1 : 1;
296 if(!zdcFound[iside][
mod]){
297 ATH_MSG_DEBUG(
"ZDC_PileUpTool::addEmptyWaveforms Creating empty waveform for ZDC side " <<
side <<
" module " <<
mod);
303 ATH_MSG_DEBUG(
"ZDC_PileUpTool::addEmptyWaveforms Creating empty waveform for RPD side " <<
side <<
" channel " <<
channel);
308 ATH_MSG_DEBUG(
"ZDC_PileUpTool::addEmptyWaveforms Creating empty waveform for BRAN side " <<
side );
327 newCollection->
Insert(hit);
346 for(
int side : {0,1}){
358 newTimedCollection.
insert(0.0, newCollection);
360 return newTimedCollection;
380 zdcModuleContainer->
back()->setZdcId(
id.get_identifier32().get_compact());
381 zdcModuleContainer->
back()->setZdcSide(
side);
382 zdcModuleContainer->
back()->setZdcModule(
module);
384 zdcModuleContainer->
back()->setZdcChannel(
channel);
392 float amplitude = 0,
t0 = 0;
393 bool doHighGain =
true;
394 std::shared_ptr<ZDCWaveformBase> waveformPtr;
395 std::shared_ptr<ZDCWaveformSampler> wfSampler;
435 std::vector<unsigned int> wf = wfSampler->
Generate(amplitude,
t0);
436 std::vector<short unsigned int> retVal;
438 retVal.push_back(wf[
sample]);
def retrieve(aClass, aKey=None)
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
const_pointer_type cptr()
Dereference the pointer.
Auxiliary store for xAOD::ZdcModuleContainer_v2.
Helper class to provide type-safe access to aux data.
const std::string & name() const
Return the StoreGate ID for the referenced object.
int module(const Identifier &id) const
std::vector< ALFA_RawData_p1 > t0
Class containing ZDC Module information.
#define ATH_MSG_VERBOSE(x)
ZDC_SimFiberHit_Collection::const_iterator ZDC_SimFiberHit_ConstIterator
const_iterator begin() const
void setWaveform(const std::string &, const std::vector< uint16_t > &)
bool nextDetectorElement(const_iterator &b, const_iterator &e)
sets an iterator range with the hits of current detector element returns a bool when done
CONT::const_iterator const_iterator
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
Identifier channel_id(int side, int module, int type, int channel) const
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
The Athena Transient Store API.
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="")
void insert(const PileUpTimeEventIndex &timeEventIndex, const AtlasHitsVector< HIT > *inputCollection)
::StatusCode StatusCode
StatusCode definition for legacy code.
std::string store() const
Return the name of the store holding the object we are proxying.
void Add(int nphot, double edep)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
const T * back() const
Access the last element in the collection as an rvalue.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
std::unique_ptr< base_value_type > unique_type
Type of a unique_ptr that can be used to insert elements into this container.
A wrapper class for event-slot-local random engines.
Helper class to provide type-safe access to aux data.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
the preferred mechanism to access information from the different event stores in a pileup job.
const_iterator end() const
int side(const Identifier &id) const
Values of different levels (failure returns 0)
TimedVector::const_iterator const_iterator
int type(const Identifier &id) const
std::string ZdcModuleToString(const xAOD::ZdcModule &zm)
void push_back(const T &t)
int channel(const Identifier &id) const