ATLAS Offline Software
Loading...
Searching...
No Matches
MM_StripsResponseSimulation.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 MM_DIGITIZATION_STRIPRESPONSESIMULATION_H
6#define MM_DIGITIZATION_STRIPRESPONSESIMULATION_H
22
23Comments to be added here...
24
25*/
26
28#include <TFile.h>
29#include <TH1F.h>
30#include <TH2F.h>
31
34#include "GaudiKernel/IToolSvc.h"
35#include "GaudiKernel/Service.h"
36#include "GaudiKernel/StatusCode.h"
42#include <sys/stat.h>
43
44#include <algorithm>
45#include <cmath>
46#include <iomanip>
47#include <iostream>
48#include <sstream>
49#include <string>
50#include <utility>
51
54
55namespace CLHEP {
56 class HepRandomEngine;
57 class HepRandom;
58 class RandGeneral;
59} // namespace CLHEP
60
62public:
63
65 ConfigModule() = default;
67 float qThreshold{0.};
68
70 float crossTalk1{0.}; // 0.10; //
72 float crossTalk2{0.}; // 0.03;
73
74 float driftGapWidth{0.};
75
76 // Avalanche gain
77 float avalancheGain{0.};
79
80 bool writeOutputFile{false};
81 bool writeEventDisplays{false};
82
83 };
84 MM_StripsResponseSimulation(ConfigModule&& cfg);
85
87 MM_StripToolOutput GetResponseFrom(const MM_DigitToolInput& digiInput, double gainFraction, double stripPitch,
88 CLHEP::HepRandomEngine* rndmEngine) const;
89
90
91 float getQThreshold() const { return m_cfg.qThreshold; };
92 float getDriftGapWidth() const { return m_cfg.driftGapWidth; };
93 double getDriftVelocity() const { return m_cfg.driftVelocity; };
94 float getInteractionDensityMean() const { return m_cfg.interactionDensityMean; }
95 float getInteractionDensitySigma() const { return m_cfg.interactionDensitySigma; }
96 float getLongitudinalDiffusionSigma() const { return m_cfg.longitudinalDiffusionSigma; }
97 float getTransversDiffusionSigma() const { return m_cfg.transverseDiffusionSigma; }
98
99private:
100 void initHistos();
101 void writeHistos();
103
104 struct DataCache {
105 std::vector<std::unique_ptr<MM_IonizationCluster>> IonizationClusters{};
106 std::vector<int> finalNumberofStrip{};
107 std::vector<std::vector<float>> finalqStrip{};
108 std::vector<std::vector<float>> finaltStrip{};
109 std::vector<float> tStripElectronicsAbThr{};
110 std::vector<float> qStripElectronics{};
111 };
112
113 void whichStrips(DataCache& cache,
114 const MM_DigitToolInput& digiInput,
115 double gainFraction,
116 double stripPitch, CLHEP::HepRandomEngine* rndmEngine) const;
117
118
119 std::map<std::string, std::unique_ptr<TH1F>> m_mapOfHistograms{};
120 std::map<std::string, std::unique_ptr<TH2F>> m_mapOf2DHistograms{};
121
122 std::unique_ptr<CLHEP::RandGeneral> m_randNelectrons{};
123
124 static constexpr unsigned int s_NelectronPropBins{300};
125
126
127 std::unique_ptr<TFile> m_outputFile{nullptr};
128
129protected:
130 // seperate random number generation for performance monitoring
131 float generateTransverseDiffusion(float posY, CLHEP::HepRandomEngine* rndmEngine) const;
132 float getTransverseDiffusion(float posY, CLHEP::HepRandomEngine* rndmEngine) const;
133 float getLongitudinalDiffusion(float posY, CLHEP::HepRandomEngine* rndmEngine) const;
134 float getEffectiveCharge(CLHEP::HepRandomEngine* rndmEngine) const;
135 float getPathLengthTraveled(CLHEP::HepRandomEngine* rndmEngine) const;
136};
137#endif
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
void whichStrips(DataCache &cache, const MM_DigitToolInput &digiInput, double gainFraction, double stripPitch, CLHEP::HepRandomEngine *rndmEngine) const
float getTransverseDiffusion(float posY, CLHEP::HepRandomEngine *rndmEngine) const
MM_StripToolOutput GetResponseFrom(const MM_DigitToolInput &digiInput, double gainFraction, double stripPitch, CLHEP::HepRandomEngine *rndmEngine) const
std::map< std::string, std::unique_ptr< TH2F > > m_mapOf2DHistograms
std::map< std::string, std::unique_ptr< TH1F > > m_mapOfHistograms
float getLongitudinalDiffusion(float posY, CLHEP::HepRandomEngine *rndmEngine) const
float getEffectiveCharge(CLHEP::HepRandomEngine *rndmEngine) const
float getPathLengthTraveled(CLHEP::HepRandomEngine *rndmEngine) const
float generateTransverseDiffusion(float posY, CLHEP::HepRandomEngine *rndmEngine) const
std::unique_ptr< CLHEP::RandGeneral > m_randNelectrons
static constexpr unsigned int s_NelectronPropBins
float crossTalk2
// crosstalk of second neighbor strips, it's 6%
float qThreshold
qThreshold=2e, we accept a good strip if the charge is >=2e
float crossTalk1
crosstalk of neighbor strips, it's 15%
std::vector< std::vector< float > > finalqStrip
std::vector< std::vector< float > > finaltStrip
std::vector< std::unique_ptr< MM_IonizationCluster > > IonizationClusters