|
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;
139 for (
int iMod=0; iMod<8; ++iMod) {
143 for (
int iGain=0; iGain<2; ++iGain) {
148 fillRDO(iGain*8+iMod,p1x,p1w,p2x,p2w);
158 ATH_MSG_DEBUG (
"prepareEvent() called for " << nInputEvents <<
" input events" );
162 return StatusCode::SUCCESS;
177 if (!hitCollection.
isValid()) {
178 ATH_MSG_ERROR(
"Could not get BCM SiHitCollection container " << hitCollection.
name() <<
179 " from store " << hitCollection.
store());
180 return StatusCode::FAILURE;
182 const unsigned int evtIndex = 0;
183 const double time = 0.0;
184 ATH_MSG_DEBUG (
"SiHitCollection found with " << hitCollection->
size() <<
" hits" );
186 for (
const auto& siHit : *hitCollection) {
193 TimedHitCollList hitCollList;
196 return StatusCode::FAILURE;
204 for (; iColl != endColl; ++iColl) {
206 const unsigned int evtIndex = (iColl->first).
index();
207 const double time = (iColl->first).
time();
210 for (
const auto& siHit : *tmpColl) {
218 return StatusCode::SUCCESS;
228 const EventContext &ctx = Gaudi::Hive::currentContext();
233 for (; iEvt!=eSubEvents; ++iEvt) {
236 <<
" bunch crossing : " << bunchXing
237 <<
" time offset : " << iEvt->time()
238 <<
" event number : " << iEvt->ptr()->eventNumber()
239 <<
" run number : " << iEvt->ptr()->runNumber()
252 return StatusCode::SUCCESS;
264 return StatusCode::SUCCESS;
276 float xStep, yStep, rStep, r0Step, effStep;
277 for (
int iStep=0; iStep<10; ++iStep) {
278 xStep = startPos.x()+iStep*(endPos.x()-startPos.x())/9;
279 yStep = startPos.y()+iStep*(endPos.y()-startPos.y())/9;
280 if (xStep==0 && yStep==0) effStep = 1.;
282 rStep = sqrt(
pow(xStep,2)+
pow(yStep,2));
286 calcEner+= 0.1*simEner*effStep;
296 std::vector<float> analog(64,0);
297 for (
unsigned int iHit=0; iHit<enerVect.size(); ++iHit) {
298 float enerDep = enerVect.at(iHit);
299 float hitTime = timeVect.at(iHit);
302 float slopeup = signalMax/5;
303 float slopedown = signalMax/10;
304 int iBin = startBin-1;
306 if (iBin>=0 && startBin<64) {
307 while (
signal>=0 && iBin<64) {
310 if (iBin > startBin+4)
signal -= slopeup+slopedown;
323 for (
float & iBin : analog) iBin+=CLHEP::RandGaussZiggurat::shoot(randomEngine,0.,
m_modNoise[iMod]);
331 std::bitset<64> digital;
333 float factor = iChan<8 ? 1./13 : 12./13;
334 for (
int iBin=0; iBin<64; ++iBin)
335 if (analog[iBin]*factor>
m_ninoThr[iChan%8]) digital.set(iBin);
345 for (
int iSamp=2; iSamp<63; iSamp++) {
346 if (digital[iSamp-2] && digital[iSamp-1] && !digital[iSamp] && digital[iSamp+1]) digital[iSamp] = 1;
347 if (digital[iSamp-2] && !digital[iSamp-1] && digital[iSamp] && digital[iSamp+1]) digital[iSamp-1] = 1;
350 if (digital[0] && !digital[1]) digital[0] = 0;
351 for (
int iSamp=1; iSamp<63; iSamp++) {
352 if (!digital[iSamp-1] && digital[iSamp] && !digital[iSamp+1]) digital[iSamp] = 0;
354 if (!digital[62] && digital[63]) digital[63] = 0;
362 p1x = 0; p1w = 0; p2x = 0; p2w = 0;
364 if (!digital.count())
return;
366 bool p1done =
false, p2done =
false;
bool ignorepulse =
false;
367 if (digital[0] && digital[1]) ignorepulse =
true;
368 else if (!digital[0] && digital[1] && digital[2]) p1x = 1;
369 for (
int iBin=2; iBin<63; iBin++) {
370 if (!digital[iBin-2] && !digital[iBin-1] && digital[iBin] && digital[iBin+1]) {
371 if (!p1done && !p2done) p1x = iBin;
372 else if (p1done && !p2done) p2x = iBin;
374 else if (digital[iBin-2] && digital[iBin-1] && !digital[iBin] && !digital[iBin+1]) {
376 if (!p1done && !p2done) {
386 else if (p1done && !p2done) {
389 if (p2w >= 32) p2w = 31;
392 else ignorepulse =
false;
395 if (digital[61] && digital[62] && !digital[63]) {
397 if (!p1done && !p2done) {
407 else if (p1done && !p2done) {
410 if (p2w >= 32) p2w = 31;
413 else ignorepulse =
false;
415 else if (digital[62] && digital[63]) {
417 if (!p1done && !p2done) {
420 if (64 - p1x >= 32) {
427 else if (p1done && !p2done) {
430 if (64 - p2x >= 32) p2w = 31;
433 else ignorepulse =
false;
444 bool collExists =
false;
447 for (; it_coll!=it_collE; ++it_coll) {
448 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.
bool isSingleParticle(const T &p)
Identify a particlegun particle.
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)
HepGeom::Point3D< double > localStartPosition() const
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.