ATLAS Offline Software
Loading...
Searching...
No Matches
CSC_Digitizer.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MUONDIGITIZATION_CSC_DIGITIZER_H
6#define MUONDIGITIZATION_CSC_DIGITIZER_H
7
8#include <TString.h> // for Form
9
10#include <algorithm>
11#include <cassert>
12#include <map>
13#include <vector>
14
15#include "CLHEP/Random/RandomEngine.h"
17#include "GaudiKernel/ServiceHandle.h"
18#include "GaudiKernel/StatusCode.h"
24
25// Author: Ketevi A. Assamagan
26// BNL, October 17 2003
27
28// Digitization class for CSC hits
29
30class DigitData {
31public:
32 double driftTime0;
33 double driftTime;
35};
36
38public:
39 // full constructor
40 CSC_Digitizer(const CscHitIdHelper* cscHitHelper, const MuonGM::MuonDetectorManager* muonMgr, ICscCalibTool* pcalib);
41
42 // Destructor
43 ~CSC_Digitizer() = default;
44 // Public methods
45
46 // initialize random number generators
47 StatusCode initialize();
48
49 // set the digitization time window
50 void setWindow(const double t1, const double t2);
51
52 void set(const double bunchTime);
53
54 void setAmplification(const double amplification) { m_amplification = amplification; }
55
56 void setDebug(int debug) { m_debug = debug; }
57
58 void setDriftVelocity(double v0) { m_driftVelocity = v0; }
59 void setElectronEnergy(double e) { m_electronEnergy = e; } // eV
61
62 // digitize a single hit
63 StatusCode digitize_hit(const CSCSimHit* cscHit, std::vector<IdentifierHash>& hashVec,
64 std::map<IdentifierHash, std::pair<double, double> >& data_map, CLHEP::HepRandomEngine* rndmEngine);
65 StatusCode digitize_hit(const CSCSimHit* cscHit, std::vector<IdentifierHash>& hashVec,
66 std::map<IdentifierHash, std::vector<float> >& data_SampleMap,
67 std::map<IdentifierHash, std::vector<float> >& data_SampleMapOddPhase, CLHEP::HepRandomEngine* rndmEngine);
68 StatusCode digitize_hit(const CSCSimHit* cscHit, std::vector<IdentifierHash>& hashVec,
69 std::map<IdentifierHash, std::vector<float> >& data_SampleMap, CLHEP::HepRandomEngine* rndmEngine);
70
71 // input parameters should be as form of cscHelper returned value...
72 IdentifierHash getHashId(const Identifier& input_id, const int stripId, const int measuresPhi) const;
73
74private:
75 // private methods need to compute the induce charge on the strip
76 double qWire(const int& nElectrons, const double& gammaDist) const;
77 static double qStripR(const double x) ;
78 double qStripR(const double x, const Identifier& id) const;
79 double qStripPhi(const double x, const Identifier& id) const;
80 static double fparamPhi(const double x, const std::array<double, 9>& p) ;
81 double getDriftTime(const MuonGM::CscReadoutElement* descriptor, const Amg::Vector3D& pos) const;
82
83 bool outsideWindow(double time) const; // default +-50...
84 void fillMaps(const IdentifierHash hash, const double driftTime, const double stripCharge, std::vector<IdentifierHash>& hashVec,
85 std::map<IdentifierHash, std::pair<double, double> >& data_map);
86 void fillSampleMaps(const IdentifierHash hash, const double driftTime, const double stripCharge, std::vector<IdentifierHash>& hashVec,
87 std::map<IdentifierHash, std::vector<float> >& data_map,
88 bool phase = 0); // new interface trying to provide 4 samples instead of q,t
89
90 Identifier to_identifier(const CSCSimHit* cscHit) const;
91
92 // private data members
94 const MuonGM::MuonDetectorManager* m_muonMgr{nullptr}; // cannot use ReadCondHandleKey since no athena component
95 const CscIdHelper* m_cscIdHelper{nullptr};
97
98 static constexpr int s_maxElectron{21}; // max electron per interaction :not configurable
100 double m_electronEnergy{66.}; // unit is eV
101
102 double m_Polia{0.};
103 std::array<double, s_maxElectron> m_sprob{0.};
106 double m_bunchTime{0.};
107 double m_amplification{0.};
108 double m_driftVelocity{60.}; // (1e-6 * 1e9); // 6 cm/microsecond -> mm/ns // 0.06
109 int m_debug{0};
111 std::map<char, int> m_stationDict{};
112};
113
114#endif
const bool debug
#define x
const CscHitIdHelper * m_cscHitHelper
static double fparamPhi(const double x, const std::array< double, 9 > &p)
void fillMaps(const IdentifierHash hash, const double driftTime, const double stripCharge, std::vector< IdentifierHash > &hashVec, std::map< IdentifierHash, std::pair< double, double > > &data_map)
StatusCode initialize()
double m_amplification
static constexpr int s_maxElectron
double qStripPhi(const double x, const Identifier &id) const
std::map< char, int > m_stationDict
Cache the csc id dictionary.
double m_electronEnergy
~CSC_Digitizer()=default
double getDriftTime(const MuonGM::CscReadoutElement *descriptor, const Amg::Vector3D &pos) const
void setElectronEnergy(double e)
void fillSampleMaps(const IdentifierHash hash, const double driftTime, const double stripCharge, std::vector< IdentifierHash > &hashVec, std::map< IdentifierHash, std::vector< float > > &data_map, bool phase=0)
void setAmplification(const double amplification)
void setDriftVelocity(double v0)
static double qStripR(const double x)
double m_driftVelocity
void setWindow(const double t1, const double t2)
const CscIdHelper * m_cscIdHelper
const MuonGM::MuonDetectorManager * m_muonMgr
void setNInterFixed()
std::array< double, s_maxElectron > m_sprob
IdentifierHash getHashId(const Identifier &input_id, const int stripId, const int measuresPhi) const
ICscCalibTool * m_pcalib
void setDebug(int debug)
double qWire(const int &nElectrons, const double &gammaDist) const
bool m_NInterFromEnergyLoss
StatusCode digitize_hit(const CSCSimHit *cscHit, std::vector< IdentifierHash > &hashVec, std::map< IdentifierHash, std::pair< double, double > > &data_map, CLHEP::HepRandomEngine *rndmEngine)
Old way before 10/2010.
CSC_Digitizer(const CscHitIdHelper *cscHitHelper, const MuonGM::MuonDetectorManager *muonMgr, ICscCalibTool *pcalib)
double m_timeWindowUpperOffset
double m_timeWindowLowerOffset
bool outsideWindow(double time) const
void set(const double bunchTime)
Identifier to_identifier(const CSCSimHit *cscHit) const
double driftTime0
double driftTime
double stripCharge
This is a "hash" representation of an Identifier.
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Eigen::Matrix< double, 3, 1 > Vector3D