GEMC  2.3
Geant4 Monte-Carlo Framework
HitProcess.h
Go to the documentation of this file.
1 #ifndef HIT_PROCESS_H
20 #define HIT_PROCESS_H 1
21 
22 // gemc headers
23 #include "detector.h"
24 #include "Hit.h"
25 #include "outputFactory.h"
26 #include "options.h"
27 
28 
29 
33 class trueInfos
34 {
35  public:
36  trueInfos(MHit*);
38 
39  unsigned int nsteps;
40  double eTot;
41  double x, y, z;
42  double lx, ly, lz;
43  double time;
44 };
45 
46 
47 
65 {
66  public:
67  virtual ~HitProcess(){;}
68  void init(string name, goptions go,map<string, double> gp)
69  {
70  HCname = name;
71  gemcOpt = go;
72  gpars = gp;
73  verbosity = gemcOpt.optMap["HIT_VERBOSITY"].arg;
74  log_msg = " > " + HCname + " Hit Process ";
75  }
76 
77  // local initializations
78  // init_subclass is used at the END of the event level
79  // by the hit process routine
80  // NOTICE:
81  // Variables in the processID of the sensitive detector
82  // should be initialized in the CONSTRUCTOR of the class
83 
84  // notice, this is executed for each class instantiation (each event basically)
85  // we don't want to connect to DB here!
86  // use static members insted as in FTOF template
87 
88  virtual void initWithRunNumber(int runno) {;}
89 
90  // - integrateRaw: returns geant4 raw information integrated over the hit
91  // - add the info in the bank if INTEGRATEDRAW is TRUE
92  map<string, double> integrateRaw(MHit*, int, bool);
93 
94  // - allRaws: returns all geant4 raw information step by step\n\n
95  // this is not virtual, its declared in hitProcess.cc and common to all
96  map< string, vector <double> > allRaws(MHit*, int);
97 
98  // - integrateDgt: returns digitized information integrated over the hit
99  virtual map<string, double> integrateDgt(MHit*, int) = 0;
100 
101  // - signalVT: returns a V(t) function
102  virtual map< double, double > signalVT(MHit*) ;
103 
104  // - quantum signal: V(t) in ADC channel, reported every bunch time
105  virtual map< int, int > quantumS(map< double, double >, MHit*) ;
106 
107  // - multiDgt: returns multiple digitized information / hit
108  virtual map< string, vector <int> > multiDgt(MHit*, int) = 0;
109 
110  // The pure virtual method processID returns a (new) identifier
111  // containing hit sharing information
112  virtual vector<identifier> processID(vector<identifier>, G4Step*, detector) = 0;
113 
114  protected:
115 
116  // hit collection name
117  string HCname;
119  map<string, double> gpars;
120  double verbosity;
121  string log_msg;
122 
123  inline double DGauss(double x, double *par, double Edep, double stepTime)
124  {
125  double t0 = par[0] + stepTime; // delay + start time of signal so that peak is t0 + rise.
126  double rise = par[1]/3; // rise time, equal to sigma of first gaussian.
127  double fall = par[2]/3; // fall time, equal to sigma of second gaussian
128  double ampl = Edep*par[3]/2; // amplitude of the signal mV/MeV - divided by 2 cause it's 2 gaussians
129 
130  double peak = t0 + 3*rise;
131 
132 // cout << t0 << " " << rise << " " << fall << " " << ampl << " " << peds <<
133 // peds - ampl*exp(-0.5*pow((x-peak)/rise, 2)) - ampl*exp(-0.5*pow((x-peak)/fall, 2)) << endl;
134 
135  return - ampl*exp(-0.5*pow((x-peak)/rise, 2)) - ampl*exp(-0.5*pow((x-peak)/fall, 2));
136  }
137 };
138 
139 // Define HitProcess as a pointer to a function that returns a pointer
140 typedef HitProcess *(*HitProcess_Factory)();
141 
142 // Return HitProcess from the Hit Process Map
143 HitProcess *getHitProcess(map<string, HitProcess_Factory> *hitProcessMap, string);
144 
145 // returns the list of Hit Factories registered
146 set<string> getListOfHitProcessHit(map<string, HitProcess_Factory>);
147 
148 
149 
150 
151 
152 #endif
goptions gemcOpt
Definition: HitProcess.h:118
virtual void initWithRunNumber(int runno)
Definition: HitProcess.h:88
void init(string name, goptions go, map< string, double > gp)
Definition: HitProcess.h:68
set< string > getListOfHitProcessHit(map< string, HitProcess_Factory >)
Definition: HitProcess.cc:23
double verbosity
Definition: HitProcess.h:120
double ly
Definition: HitProcess.h:42
double lz
Definition: HitProcess.h:42
double verbosity
double time
Definition: HitProcess.h:43
double z
Definition: HitProcess.h:41
double lx
Definition: HitProcess.h:42
double eTot
Definition: HitProcess.h:40
double x
Definition: HitProcess.h:41
string log_msg
Definition: HitProcess.h:121
virtual ~HitProcess()
Definition: HitProcess.h:67
Definition: Hit.h:22
double DGauss(double x, double *par, double Edep, double stepTime)
Definition: HitProcess.h:123
double y
Definition: HitProcess.h:41
unsigned int nsteps
Definition: HitProcess.h:39
HitProcess * getHitProcess(map< string, HitProcess_Factory > *hitProcessMap, string)
Definition: HitProcess.cc:8
map< string, double > gpars
Definition: HitProcess.h:119
~trueInfos()
Definition: HitProcess.h:37
string HCname
Definition: HitProcess.h:117
trueInfos(MHit *)
Definition: HitProcess.cc:324