|
ATLAS Offline Software
|
Pileup tool for BCM digitization.
More...
#include <BCM_DigitizationTool.h>
|
StatusCode | createOutputContainers (const EventContext &ctx) |
| Create the RDO and SDO containers. More...
|
|
void | processSiHit (const SiHit ¤tHit, double eventTime, unsigned int evtIndex, const EventContext &ctx) |
|
void | createRDOsAndSDOs (const EventContext &ctx) |
|
float | computeEnergy (float simEner, const HepGeom::Point3D< double > &startPos, const HepGeom::Point3D< double > &endPos) |
| Compute energy deposit depending on hit position. More...
|
|
std::vector< float > | createAnalog (int mod, const std::vector< float > &enerVect, const std::vector< float > &timeVect) |
| Fill in hit pulses on analog waveform. More...
|
|
void | addNoise (int mod, std::vector< float > &analog, CLHEP::HepRandomEngine *randomEngine) |
| Add noise to analog waveform. More...
|
|
std::bitset< 64 > | applyThreshold (int chan, const std::vector< float > &analog) |
| Do ToT digitization. More...
|
|
void | fillRDO (unsigned int chan, int p1x, int p1w, int p2x, int p2w) |
| Create raw data object and put it in the container. More...
|
|
|
static void | applyFilter (std::bitset< 64 > &digital) |
| Apply hole and spike filter to digital waveform. More...
|
|
static void | findPulses (const std::bitset< 64 > &digital, int &p1x, int &p1w, int &p2x, int &p2w) |
| Find first two pulses on digital waveform. More...
|
|
|
std::vector< float > | m_modNoise |
| RMS Gaussian noise. More...
|
|
std::vector< float > | m_modSignal |
| Most probable MIP signal. More...
|
|
std::vector< float > | m_ninoThr |
| NINO threshold. More...
|
|
Gaudi::Property< float > | m_mipDeposit {this, "MIPDeposit", 0.0f, "Most probable MIP deposit in BCM pad"} |
|
Gaudi::Property< float > | m_effPrmDistance {this, "EffDistanceParam", 0.0f, "Distance parameter for efficiency calculation"} |
|
Gaudi::Property< float > | m_effPrmSharpness {this, "EffSharpnessParam", 0.0f, "Sharpness parameter for efficiency calculation"} |
|
Gaudi::Property< float > | m_timeDelay {this, "TimeDelay", 0.0f, "Pulse time delay"} |
|
BooleanProperty | m_onlyUseContainerName {this, "OnlyUseContainerName", true, "Don't use the ReadHandleKey directly. Just extract the container name from it."} |
|
SG::ReadHandleKey< SiHitCollection > | m_hitsContainerKey {this, "HitCollName", "BCMHits", "Input simulation hits collection name"} |
|
std::string | m_inputObjectName {""} |
|
SG::WriteHandleKey< BCM_RDO_Container > | m_outputKey {this, "OutputRDOKey", "BCM_RDOs", ""} |
|
SG::WriteHandleKey< InDetSimDataCollection > | m_outputSDOKey {this, "OutputSDOKey", "BCM_SDO_Map", ""} |
|
BCM_RDO_Container * | m_rdoContainer {} |
| Output RDO container. More...
|
|
InDetSimDataCollection * | m_simDataCollMap {} |
| Output SDO map. More...
|
|
ServiceHandle< PileUpMergeSvc > | m_mergeSvc {this, "MergeSvc", "PileUpMergeSvc", "Merge service used in digitization"} |
|
ServiceHandle< IAthRNGSvc > | m_rndmGenSvc {this, "RndmSvc", "AthRNGSvc", ""} |
| Random number service. More...
|
|
std::vector< float > | m_enerVect [8] |
| G4 hit energies, weighted. More...
|
|
std::vector< float > | m_timeVect [8] |
| G4 hit times. More...
|
|
std::vector< InDetSimData::Deposit > | m_depositVect [8] |
| Deposit vectors for SDO map. More...
|
|
Pileup tool for BCM digitization.
Definition at line 34 of file BCM_DigitizationTool.h.
◆ BCM_DigitizationTool()
BCM_DigitizationTool::BCM_DigitizationTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
Constructor with parameters.
Definition at line 26 of file BCM_DigitizationTool.cxx.
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");
◆ addNoise()
void BCM_DigitizationTool::addNoise |
( |
int |
mod, |
|
|
std::vector< float > & |
analog, |
|
|
CLHEP::HepRandomEngine * |
randomEngine |
|
) |
| |
|
private |
Add noise to analog waveform.
Definition at line 321 of file BCM_DigitizationTool.cxx.
323 for (
float & iBin : analog) iBin+=CLHEP::RandGaussZiggurat::shoot(randomEngine,0.,
m_modNoise[iMod]);
◆ applyFilter()
void BCM_DigitizationTool::applyFilter |
( |
std::bitset< 64 > & |
digital | ) |
|
|
staticprivate |
Apply hole and spike filter to digital waveform.
Definition at line 342 of file BCM_DigitizationTool.cxx.
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;
◆ applyThreshold()
std::bitset< 64 > BCM_DigitizationTool::applyThreshold |
( |
int |
chan, |
|
|
const std::vector< float > & |
analog |
|
) |
| |
|
private |
Do ToT digitization.
Definition at line 329 of file BCM_DigitizationTool.cxx.
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);
◆ computeEnergy()
float BCM_DigitizationTool::computeEnergy |
( |
float |
simEner, |
|
|
const HepGeom::Point3D< double > & |
startPos, |
|
|
const HepGeom::Point3D< double > & |
endPos |
|
) |
| |
|
private |
Compute energy deposit depending on hit position.
Definition at line 270 of file BCM_DigitizationTool.cxx.
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;
◆ createAnalog()
std::vector< float > BCM_DigitizationTool::createAnalog |
( |
int |
mod, |
|
|
const std::vector< float > & |
enerVect, |
|
|
const std::vector< float > & |
timeVect |
|
) |
| |
|
private |
Fill in hit pulses on analog waveform.
Definition at line 294 of file BCM_DigitizationTool.cxx.
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;
◆ createOutputContainers()
StatusCode BCM_DigitizationTool::createOutputContainers |
( |
const EventContext & |
ctx | ) |
|
|
private |
Create the RDO and SDO containers.
Definition at line 71 of file BCM_DigitizationTool.cxx.
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;
◆ createRDOsAndSDOs()
void BCM_DigitizationTool::createRDOsAndSDOs |
( |
const EventContext & |
ctx | ) |
|
|
private |
Definition at line 132 of file BCM_DigitizationTool.cxx.
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);
◆ fillRDO()
void BCM_DigitizationTool::fillRDO |
( |
unsigned int |
chan, |
|
|
int |
p1x, |
|
|
int |
p1w, |
|
|
int |
p2x, |
|
|
int |
p2w |
|
) |
| |
|
private |
Create raw data object and put it in the container.
Definition at line 440 of file BCM_DigitizationTool.cxx.
444 bool collExists =
false;
447 for (; it_coll!=it_collE; ++it_coll) {
448 if ((*it_coll)->getChannel()==
chan) {
◆ filterPassed()
virtual bool PileUpToolBase::filterPassed |
( |
| ) |
const |
|
inlineoverridevirtualinherited |
◆ findPulses()
void BCM_DigitizationTool::findPulses |
( |
const std::bitset< 64 > & |
digital, |
|
|
int & |
p1x, |
|
|
int & |
p1w, |
|
|
int & |
p2x, |
|
|
int & |
p2w |
|
) |
| |
|
staticprivate |
Find first two pulses on digital waveform.
Definition at line 360 of file BCM_DigitizationTool.cxx.
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;
◆ initialize()
StatusCode BCM_DigitizationTool::initialize |
( |
| ) |
|
|
finaloverridevirtual |
◆ mergeEvent()
StatusCode BCM_DigitizationTool::mergeEvent |
( |
const EventContext & |
ctx | ) |
|
|
finaloverridevirtual |
◆ prepareEvent()
StatusCode BCM_DigitizationTool::prepareEvent |
( |
const EventContext & |
ctx, |
|
|
unsigned int |
nInputEvents |
|
) |
| |
|
finaloverridevirtual |
◆ processAllSubEvents() [1/2]
StatusCode BCM_DigitizationTool::processAllSubEvents |
( |
const EventContext & |
ctx | ) |
|
|
finaloverridevirtual |
alternative interface which uses the PileUpMergeSvc to obtain all the required SubEvents.
Reimplemented from PileUpToolBase.
Definition at line 168 of file BCM_DigitizationTool.cxx.
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();
208 ATH_MSG_DEBUG (
"SiHitCollection found with " << tmpColl->size() <<
" hits" );
210 for (
const auto& siHit : *tmpColl) {
218 return StatusCode::SUCCESS;
◆ processAllSubEvents() [2/2]
virtual StatusCode IPileUpTool::processAllSubEvents |
|
inherited |
dummy implementation to allow compilation while all Digitization packages are migrated to use this new interface.
◆ processBunchXing()
Reimplemented from PileUpToolBase.
Definition at line 224 of file BCM_DigitizationTool.cxx.
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;
◆ processSiHit()
void BCM_DigitizationTool::processSiHit |
( |
const SiHit & |
currentHit, |
|
|
double |
eventTime, |
|
|
unsigned int |
evtIndex, |
|
|
const EventContext & |
ctx |
|
) |
| |
|
private |
◆ resetFilter()
virtual void PileUpToolBase::resetFilter |
( |
| ) |
|
|
inlineoverridevirtualinherited |
◆ toProcess()
virtual bool PileUpToolBase::toProcess |
( |
int |
bunchXing | ) |
const |
|
inlineoverridevirtualinherited |
◆ m_depositVect
◆ m_effPrmDistance
Gaudi::Property<float> BCM_DigitizationTool::m_effPrmDistance {this, "EffDistanceParam", 0.0f, "Distance parameter for efficiency calculation"} |
|
private |
◆ m_effPrmSharpness
Gaudi::Property<float> BCM_DigitizationTool::m_effPrmSharpness {this, "EffSharpnessParam", 0.0f, "Sharpness parameter for efficiency calculation"} |
|
private |
◆ m_enerVect
std::vector<float> BCM_DigitizationTool::m_enerVect[8] |
|
private |
◆ m_filterPassed
bool PileUpToolBase::m_filterPassed {true} |
|
protectedinherited |
◆ 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.
◆ m_hitsContainerKey
◆ m_inputObjectName
std::string BCM_DigitizationTool::m_inputObjectName {""} |
|
private |
◆ 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.
◆ m_mergeSvc
◆ m_mipDeposit
Gaudi::Property<float> BCM_DigitizationTool::m_mipDeposit {this, "MIPDeposit", 0.0f, "Most probable MIP deposit in BCM pad"} |
|
private |
◆ m_modNoise
std::vector<float> BCM_DigitizationTool::m_modNoise |
|
private |
◆ m_modSignal
std::vector<float> BCM_DigitizationTool::m_modSignal |
|
private |
◆ m_ninoThr
std::vector<float> BCM_DigitizationTool::m_ninoThr |
|
private |
◆ m_onlyUseContainerName
BooleanProperty BCM_DigitizationTool::m_onlyUseContainerName {this, "OnlyUseContainerName", true, "Don't use the ReadHandleKey directly. Just extract the container name from it."} |
|
private |
◆ m_outputKey
◆ m_outputSDOKey
◆ m_rdoContainer
◆ m_rndmGenSvc
◆ m_simDataCollMap
◆ m_timeDelay
Gaudi::Property<float> BCM_DigitizationTool::m_timeDelay {this, "TimeDelay", 0.0f, "Pulse time delay"} |
|
private |
◆ m_timeVect
std::vector<float> BCM_DigitizationTool::m_timeVect[8] |
|
private |
◆ 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.
The documentation for this class was generated from the following files:
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
#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.
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.
double energyLoss() const
A wrapper class for event-slot-local random engines.
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.
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.