ATLAS Offline Software
Loading...
Searching...
No Matches
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
27namespace 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
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition IPileUpTool.h:22
the preferred mechanism to access information from the different event stores in a pileup job.
helper base class IPileUpTool::toProcess().
std::vector< InDetSimData::Deposit > m_depositVect[8]
Deposit vectors for SDO map.
float computeEnergy(float simEner, const HepGeom::Point3D< double > &startPos, const HepGeom::Point3D< double > &endPos)
Compute energy deposit depending on hit position.
std::vector< float > m_enerVect[8]
G4 hit energies, weighted.
std::vector< float > m_modNoise
RMS Gaussian noise.
Gaudi::Property< float > m_effPrmSharpness
std::vector< float > createAnalog(int mod, const std::vector< float > &enerVect, const std::vector< float > &timeVect)
Fill in hit pulses on analog waveform.
SG::ReadHandleKey< SiHitCollection > m_hitsContainerKey
std::bitset< 64 > applyThreshold(int chan, const std::vector< float > &analog)
Do ToT digitization.
Gaudi::Property< float > m_effPrmDistance
BCM_DigitizationTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters.
void addNoise(int mod, std::vector< float > &analog, CLHEP::HepRandomEngine *randomEngine)
Add noise to analog waveform.
StatusCode createOutputContainers(const EventContext &ctx)
Create the RDO and SDO containers.
SG::WriteHandleKey< BCM_RDO_Container > m_outputKey
virtual StatusCode mergeEvent(const EventContext &ctx) override final
InDetSimDataCollection * m_simDataCollMap
Output SDO map.
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
alternative interface which uses the PileUpMergeSvc to obtain all the required SubEvents.
std::vector< float > m_modSignal
Most probable MIP signal.
BooleanProperty m_onlyUseContainerName
SG::WriteHandleKey< InDetSimDataCollection > m_outputSDOKey
void fillRDO(unsigned int chan, int p1x, int p1w, int p2x, int p2w)
Create raw data object and put it in the container.
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Gaudi::Property< float > m_mipDeposit
static void applyFilter(std::bitset< 64 > &digital)
Apply hole and spike filter to digital waveform.
virtual StatusCode prepareEvent(const EventContext &ctx, unsigned int) override final
PileUpToolBase methods.
virtual StatusCode initialize() override final
Gaudi::Property< float > m_timeDelay
void processSiHit(const SiHit &currentHit, double eventTime, unsigned int evtIndex, const EventContext &ctx)
void createRDOsAndSDOs(const EventContext &ctx)
BCM_RDO_Container * m_rdoContainer
Output RDO container.
static void findPulses(const std::bitset< 64 > &digital, int &p1x, int &p1w, int &p2x, int &p2w)
Find first two pulses on digital waveform.
std::vector< float > m_ninoThr
NINO threshold.
ServiceHandle< IAthRNGSvc > m_rndmGenSvc
Random number service.
virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
std::vector< float > m_timeVect[8]
G4 hit times.
PileUpToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition SiHit.h:19