ATLAS Offline Software
BCM_DigitizationTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef BCM_DIGITIZATION_BCM_DIGITIZATIONTOOL_H
6 #define BCM_DIGITIZATION_BCM_DIGITIZATIONTOOL_H
7 
10 
11 #include "GaudiKernel/ServiceHandle.h"
12 
14 
18 #include "InDetSimEvent/SiHit.h"
19 
22 
23 #include "CLHEP/Geometry/Point3D.h"
24 
25 #include <bitset>
26 
27 namespace CLHEP
28 {
29  class HepRandomEngine;
30 }
31 
32 
35 
36  public:
37 
39  BCM_DigitizationTool(const std::string& type, const std::string& name,const IInterface* parent);
40 
41  virtual StatusCode initialize() override final;
44  virtual StatusCode processAllSubEvents(const EventContext& ctx) override final;
46  virtual StatusCode prepareEvent(const EventContext& ctx, unsigned int) override final;
47  virtual StatusCode processBunchXing(int bunchXing,
48  SubEventIterator bSubEvents,
49  SubEventIterator eSubEvents) override final;
50  virtual StatusCode mergeEvent(const EventContext& ctx) override final;
51 
52  private:
54  StatusCode createOutputContainers(const EventContext& ctx);
55  void processSiHit(const SiHit &currentHit, double eventTime, unsigned int evtIndex, const EventContext& ctx);
56  void createRDOsAndSDOs(const EventContext& ctx);
57 
59  float computeEnergy(float simEner, const HepGeom::Point3D<double>& startPos, const HepGeom::Point3D<double>& endPos);
60 
62  std::vector<float> createAnalog(int mod, const std::vector<float>& enerVect, const std::vector<float>& timeVect);
63 
65  void addNoise(int mod, std::vector<float> &analog, CLHEP::HepRandomEngine *randomEngine);
66 
68  std::bitset<64> applyThreshold(int chan, const std::vector<float>& analog);
69 
71  static void applyFilter(std::bitset<64> &digital);
72 
74  static void findPulses(const std::bitset<64>& digital, int &p1x, int &p1w, int &p2x, int &p2w);
75 
77  void fillRDO(unsigned int chan, int p1x, int p1w, int p2x, int p2w);
78 
79  // Digitization parameters
80  std::vector<float> m_modNoise;
81  std::vector<float> m_modSignal;
82  std::vector<float> m_ninoThr;
83  Gaudi::Property<float> m_mipDeposit{this, "MIPDeposit", 0.0f, "Most probable MIP deposit in BCM pad"};
84  Gaudi::Property<float> m_effPrmDistance{this, "EffDistanceParam", 0.0f, "Distance parameter for efficiency calculation"};
85  Gaudi::Property<float> m_effPrmSharpness{this, "EffSharpnessParam", 0.0f, "Sharpness parameter for efficiency calculation"};
86  Gaudi::Property<float> m_timeDelay{this, "TimeDelay", 0.0f, "Pulse time delay"};
87 
88  BooleanProperty m_onlyUseContainerName{this, "OnlyUseContainerName", true, "Don't use the ReadHandleKey directly. Just extract the container name from it."};
89  SG::ReadHandleKey<SiHitCollection> m_hitsContainerKey{this, "HitCollName", "BCMHits", "Input simulation hits collection name"};
90  std::string m_inputObjectName{""};
91 
92  // Write handle keys
93  SG::WriteHandleKey<BCM_RDO_Container> m_outputKey{this, "OutputRDOKey", "BCM_RDOs", ""};
94  SG::WriteHandleKey<InDetSimDataCollection> m_outputSDOKey{this, "OutputSDOKey", "BCM_SDO_Map", ""};
95 
96  // Output objects
99 
100  ServiceHandle <PileUpMergeSvc> m_mergeSvc{this, "MergeSvc", "PileUpMergeSvc", "Merge service used in digitization"};
101  ServiceHandle<IAthRNGSvc> m_rndmGenSvc{this, "RndmSvc", "AthRNGSvc", ""};
102 
103  // Vectors to store G4 hit information
104  std::vector<float> m_enerVect[8];
105  std::vector<float> m_timeVect[8];
106  std::vector<InDetSimData::Deposit> m_depositVect[8];
107 };
108 
109 #endif // BCM_DIGITIZATION_BCM_DIGITIZATIONTOOL_H
BCM_DigitizationTool::processSiHit
void processSiHit(const SiHit &currentHit, double eventTime, unsigned int evtIndex, const EventContext &ctx)
Definition: BCM_DigitizationTool.cxx:109
BCM_DigitizationTool::m_modSignal
std::vector< float > m_modSignal
Most probable MIP signal.
Definition: BCM_DigitizationTool.h:81
BCM_DigitizationTool::prepareEvent
virtual StatusCode prepareEvent(const EventContext &ctx, unsigned int) override final
PileUpToolBase methods.
Definition: BCM_DigitizationTool.cxx:156
BCM_DigitizationTool::findPulses
static void findPulses(const std::bitset< 64 > &digital, int &p1x, int &p1w, int &p2x, int &p2w)
Find first two pulses on digital waveform.
Definition: BCM_DigitizationTool.cxx:360
BCM_DigitizationTool
Pileup tool for BCM digitization.
Definition: BCM_DigitizationTool.h:34
SiHit.h
BCM_DigitizationTool::fillRDO
void fillRDO(unsigned int chan, int p1x, int p1w, int p2x, int p2w)
Create raw data object and put it in the container.
Definition: BCM_DigitizationTool.cxx:440
BCM_DigitizationTool::m_timeDelay
Gaudi::Property< float > m_timeDelay
Definition: BCM_DigitizationTool.h:86
InDetSimDataCollection
Definition: InDetSimDataCollection.h:25
BCM_DigitizationTool::m_timeVect
std::vector< float > m_timeVect[8]
G4 hit times.
Definition: BCM_DigitizationTool.h:105
BCM_DigitizationTool::m_simDataCollMap
InDetSimDataCollection * m_simDataCollMap
Output SDO map.
Definition: BCM_DigitizationTool.h:98
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
BCM_DigitizationTool::m_ninoThr
std::vector< float > m_ninoThr
NINO threshold.
Definition: BCM_DigitizationTool.h:82
BCM_DigitizationTool::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Definition: BCM_DigitizationTool.h:100
BCM_DigitizationTool::initialize
virtual StatusCode initialize() override final
Definition: BCM_DigitizationTool.cxx:37
BCM_DigitizationTool::processAllSubEvents
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
alternative interface which uses the PileUpMergeSvc to obtain all the required SubEvents.
Definition: BCM_DigitizationTool.cxx:168
SiHit
Definition: SiHit.h:19
BCM_DigitizationTool::applyThreshold
std::bitset< 64 > applyThreshold(int chan, const std::vector< float > &analog)
Do ToT digitization.
Definition: BCM_DigitizationTool.cxx:329
SG::WriteHandleKey< BCM_RDO_Container >
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
BCM_DigitizationTool::createOutputContainers
StatusCode createOutputContainers(const EventContext &ctx)
Create the RDO and SDO containers.
Definition: BCM_DigitizationTool.cxx:71
BCM_RDO_Container
Definition: BCM_RDO_Container.h:27
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
BCM_DigitizationTool::createAnalog
std::vector< float > createAnalog(int mod, const std::vector< float > &enerVect, const std::vector< float > &timeVect)
Fill in hit pulses on analog waveform.
Definition: BCM_DigitizationTool.cxx:294
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
BCM_DigitizationTool::m_rdoContainer
BCM_RDO_Container * m_rdoContainer
Output RDO container.
Definition: BCM_DigitizationTool.h:97
BCM_DigitizationTool::m_onlyUseContainerName
BooleanProperty m_onlyUseContainerName
Definition: BCM_DigitizationTool.h:88
CLHEP
STD'S.
Definition: IAtRndmGenSvc.h:19
BCM_DigitizationTool::processBunchXing
virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
Definition: BCM_DigitizationTool.cxx:224
InDetSimData.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
BCM_DigitizationTool::m_modNoise
std::vector< float > m_modNoise
RMS Gaussian noise.
Definition: BCM_DigitizationTool.h:80
BCM_DigitizationTool::createRDOsAndSDOs
void createRDOsAndSDOs(const EventContext &ctx)
Definition: BCM_DigitizationTool.cxx:132
InDetBCM_RawDataCLASS_DEF.h
PileUpToolBase
Definition: PileUpToolBase.h:18
BCM_DigitizationTool::m_enerVect
std::vector< float > m_enerVect[8]
G4 hit energies, weighted.
Definition: BCM_DigitizationTool.h:104
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
BCM_DigitizationTool::BCM_DigitizationTool
BCM_DigitizationTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters.
Definition: BCM_DigitizationTool.cxx:26
BCM_DigitizationTool::m_effPrmDistance
Gaudi::Property< float > m_effPrmDistance
Definition: BCM_DigitizationTool.h:84
BCM_DigitizationTool::m_hitsContainerKey
SG::ReadHandleKey< SiHitCollection > m_hitsContainerKey
Definition: BCM_DigitizationTool.h:89
BCM_RDO_Container.h
BCM_DigitizationTool::m_rndmGenSvc
ServiceHandle< IAthRNGSvc > m_rndmGenSvc
Random number service.
Definition: BCM_DigitizationTool.h:101
BCM_DigitizationTool::addNoise
void addNoise(int mod, std::vector< float > &analog, CLHEP::HepRandomEngine *randomEngine)
Add noise to analog waveform.
Definition: BCM_DigitizationTool.cxx:321
BCM_DigitizationTool::m_inputObjectName
std::string m_inputObjectName
Definition: BCM_DigitizationTool.h:90
PileUpMergeSvc.h
the preferred mechanism to access information from the different event stores in a pileup job.
InDetSimDataCollection.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
BCM_DigitizationTool::computeEnergy
float computeEnergy(float simEner, const HepGeom::Point3D< double > &startPos, const HepGeom::Point3D< double > &endPos)
Compute energy deposit depending on hit position.
Definition: BCM_DigitizationTool.cxx:270
BCM_DigitizationTool::m_effPrmSharpness
Gaudi::Property< float > m_effPrmSharpness
Definition: BCM_DigitizationTool.h:85
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
BCM_DigitizationTool::applyFilter
static void applyFilter(std::bitset< 64 > &digital)
Apply hole and spike filter to digital waveform.
Definition: BCM_DigitizationTool.cxx:342
BCM_DigitizationTool::m_outputKey
SG::WriteHandleKey< BCM_RDO_Container > m_outputKey
Definition: BCM_DigitizationTool.h:93
BCM_DigitizationTool::mergeEvent
virtual StatusCode mergeEvent(const EventContext &ctx) override final
Definition: BCM_DigitizationTool.cxx:258
PileUpToolBase.h
helper base class IPileUpTool::toProcess().
BCM_DigitizationTool::m_depositVect
std::vector< InDetSimData::Deposit > m_depositVect[8]
Deposit vectors for SDO map.
Definition: BCM_DigitizationTool.h:106
BCM_DigitizationTool::m_mipDeposit
Gaudi::Property< float > m_mipDeposit
Definition: BCM_DigitizationTool.h:83
BCM_DigitizationTool::m_outputSDOKey
SG::WriteHandleKey< InDetSimDataCollection > m_outputSDOKey
Definition: BCM_DigitizationTool.h:94
IAthRNGSvc.h
ServiceHandle< PileUpMergeSvc >
SiHitCollection.h