 |
ATLAS Offline Software
|
Go to the documentation of this file.
13 #include "CLHEP/Random/RandomEngine.h"
14 #include "CLHEP/Random/RandGaussZiggurat.h"
29 declareProperty(
"ModNoise",
m_modNoise,
"RMS noise averaged over modules");
30 declareProperty(
"ModSignal",
m_modSignal,
"Average MIP signal in modules");
31 declareProperty(
"NinoThr",
m_ninoThr,
"NINO threshold voltage");
51 return StatusCode::FAILURE;
65 return StatusCode::SUCCESS;
75 ATH_CHECK(outputContainer.
record(std::make_unique<BCM_RDO_Container>()));
76 if (!outputContainer.
isValid()) {
77 ATH_MSG_ERROR(
"Could not record output BCM RDO container " << outputContainer.
name() <<
" to store " << outputContainer.
store());
78 return StatusCode::FAILURE;
81 ATH_MSG_DEBUG(
"Recorded output BCM RDO container " << outputContainer.
name() <<
" in store " << outputContainer.
store());
86 ATH_CHECK(outputSDOContainer.
record(std::make_unique<InDetSimDataCollection>()));
87 if (!outputSDOContainer.
isValid()) {
88 ATH_MSG_ERROR(
"Could not record output BCM SDO container " << outputSDOContainer.
name() <<
" to store " << outputSDOContainer.
store());
89 return StatusCode::FAILURE;
92 ATH_MSG_DEBUG(
"Recorded output BCM SDO container " << outputSDOContainer.
name() <<
" in store " << outputSDOContainer.
store());
97 for (
unsigned int iMod=0; iMod<8; ++iMod) {
103 return StatusCode::SUCCESS;
138 for (
int iMod=0; iMod<8; ++iMod) {
142 for (
int iGain=0; iGain<2; ++iGain) {
147 fillRDO(iGain*8+iMod,p1x,p1w,p2x,p2w);
157 ATH_MSG_DEBUG (
"prepareEvent() called for " << nInputEvents <<
" input events" );
161 return StatusCode::SUCCESS;
176 if (!hitCollection.
isValid()) {
177 ATH_MSG_ERROR(
"Could not get BCM SiHitCollection container " << hitCollection.
name() <<
178 " from store " << hitCollection.
store());
179 return StatusCode::FAILURE;
181 const unsigned int evtIndex = 0;
182 const double time = 0.0;
183 ATH_MSG_DEBUG (
"SiHitCollection found with " << hitCollection->
size() <<
" hits" );
185 for (
const auto& siHit : *hitCollection) {
192 TimedHitCollList hitCollList;
195 return StatusCode::FAILURE;
203 for (; iColl != endColl; ++iColl) {
205 const unsigned int evtIndex = (iColl->first).
index();
206 const double time = (iColl->first).
time();
209 for (
const auto& siHit : *tmpColl) {
217 return StatusCode::SUCCESS;
227 const EventContext &ctx = Gaudi::Hive::currentContext();
232 for (; iEvt!=eSubEvents; ++iEvt) {
235 <<
" bunch crossing : " << bunchXing
236 <<
" time offset : " << iEvt->time()
237 <<
" event number : " << iEvt->ptr()->eventNumber()
238 <<
" run number : " << iEvt->ptr()->runNumber()
251 return StatusCode::SUCCESS;
263 return StatusCode::SUCCESS;
275 float xStep, yStep, rStep, r0Step, effStep;
276 for (
int iStep=0; iStep<10; ++iStep) {
277 xStep = startPos.x()+iStep*(endPos.x()-startPos.x())/9;
278 yStep = startPos.y()+iStep*(endPos.y()-startPos.y())/9;
279 if (xStep==0 && yStep==0) effStep = 1.;
281 rStep = sqrt(
pow(xStep,2)+
pow(yStep,2));
285 calcEner+= 0.1*simEner*effStep;
295 std::vector<float> analog(64,0);
296 for (
unsigned int iHit=0; iHit<enerVect.size(); ++iHit) {
297 float enerDep = enerVect.at(iHit);
298 float hitTime = timeVect.at(iHit);
301 float slopeup = signalMax/5;
302 float slopedown = signalMax/10;
303 int iBin = startBin-1;
305 if (iBin>=0 && startBin<64) {
306 while (
signal>=0 && iBin<64) {
309 if (iBin > startBin+4)
signal -= slopeup+slopedown;
322 for (
float & iBin : analog) iBin+=CLHEP::RandGaussZiggurat::shoot(randomEngine,0.,
m_modNoise[iMod]);
330 std::bitset<64> digital;
332 float factor = iChan<8 ? 1./13 : 12./13;
333 for (
int iBin=0; iBin<64; ++iBin)
334 if (analog[iBin]*factor>
m_ninoThr[iChan%8]) digital.set(iBin);
344 for (
int iSamp=2; iSamp<63; iSamp++) {
345 if (digital[iSamp-2] && digital[iSamp-1] && !digital[iSamp] && digital[iSamp+1]) digital[iSamp] = 1;
346 if (digital[iSamp-2] && !digital[iSamp-1] && digital[iSamp] && digital[iSamp+1]) digital[iSamp-1] = 1;
349 if (digital[0] && !digital[1]) digital[0] = 0;
350 for (
int iSamp=1; iSamp<63; iSamp++) {
351 if (!digital[iSamp-1] && digital[iSamp] && !digital[iSamp+1]) digital[iSamp] = 0;
353 if (!digital[62] && digital[63]) digital[63] = 0;
361 p1x = 0; p1w = 0; p2x = 0; p2w = 0;
363 if (!digital.count())
return;
365 bool p1done =
false, p2done =
false;
bool ignorepulse =
false;
366 if (digital[0] && digital[1]) ignorepulse =
true;
367 else if (!digital[0] && digital[1] && digital[2]) p1x = 1;
368 for (
int iBin=2; iBin<63; iBin++) {
369 if (!digital[iBin-2] && !digital[iBin-1] && digital[iBin] && digital[iBin+1]) {
370 if (!p1done && !p2done) p1x = iBin;
371 else if (p1done && !p2done) p2x = iBin;
373 else if (digital[iBin-2] && digital[iBin-1] && !digital[iBin] && !digital[iBin+1]) {
375 if (!p1done && !p2done) {
385 else if (p1done && !p2done) {
388 if (p2w >= 32) p2w = 31;
391 else ignorepulse =
false;
394 if (digital[61] && digital[62] && !digital[63]) {
396 if (!p1done && !p2done) {
406 else if (p1done && !p2done) {
409 if (p2w >= 32) p2w = 31;
412 else ignorepulse =
false;
414 else if (digital[62] && digital[63]) {
416 if (!p1done && !p2done) {
419 if (64 - p1x >= 32) {
426 else if (p1done && !p2done) {
429 if (64 - p2x >= 32) p2w = 31;
432 else ignorepulse =
false;
443 bool collExists =
false;
446 for (; it_coll!=it_collE; ++it_coll) {
447 if ((*it_coll)->getChannel()==
chan) {
JetConstituentVector::iterator iterator
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
HepGeom::Point3D< double > localEndPosition() const
const std::string & name() const
Return the StoreGate ID for the referenced object.
#define ATH_MSG_VERBOSE(x)
const_iterator begin() const
int id() const
Return the id of the target particle.
CONT::const_iterator const_iterator
std::list< value_t > type
type of the collection of timed data object
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
a link optimized in size for a GenParticle in a McEventCollection
The Athena Transient Store API.
(Non-const) Iterator class for DataVector/DataList.
::StatusCode StatusCode
StatusCode definition for legacy code.
pointer_type ptr()
Dereference the pointer.
std::string store() const
Return the name of the store holding the object we are proxying.
const HepMcParticleLink & particleLink() const
#define CHECK(...)
Evaluate an expression and check for errors.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
double energyLoss() const
virtual bool isValid() override final
Can the handle be successfully dereferenced?
A wrapper class for event-slot-local random engines.
Helpers for checking error return status codes and reporting errors.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
static HepMcParticleLink getRedirectedLink(const HepMcParticleLink &particleLink, uint32_t eventIndex, const EventContext &ctx)
Return a HepMcParticleLink pointing at the same particle, but in a different GenEvent.
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
def time(flags, cells_name, *args, **kw)
const_iterator end() const
float hitTime(const AFP_SIDSimHit &hit)
constexpr int pow(int base, int exp) noexcept
HepGeom::Point3D< double > localStartPosition() const
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.