GEMC  2.2
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  init_subclass();
76  }
77 
78  // local initializations
79  // init_subclass is used at the END of the event level
80  // by the hit process routine
81  // NOTICE:
82  // Variables in the processID of the sensitive detector
83  // should be initialized in the CONSTRUCTOR of the class
84  virtual void init_subclass() {;}
85 
86  // - integrateRaw: returns geant4 raw information integrated over the hit
87  // - add the info in the bank if INTEGRATEDRAW is TRUE
88  map<string, double> integrateRaw(MHit*, int, bool);
89 
90  // - allRaws: returns all geant4 raw information step by step\n\n
91  // this is not virtual, its declared in hitProcess.cc and common to all
92  map< string, vector <double> > allRaws(MHit*, int);
93 
94  // - integrateDgt: returns digitized information integrated over the hit
95  virtual map<string, double> integrateDgt(MHit*, int) = 0;
96 
97  // - signalVT: returns a V(t) function
98  virtual map< double, double > signalVT(MHit*, int) ;
99 
100  // - multiDgt: returns multiple digitized information / hit
101  virtual map< string, vector <int> > multiDgt(MHit*, int) = 0;
102 
103  // The pure virtual method processID returns a (new) identifier
104  // containing hit sharing information
105  virtual vector<identifier> processID(vector<identifier>, G4Step*, detector) = 0;
106 
107  protected:
108 
109  // hit collection name
110  string HCname;
112  map<string, double> gpars;
113  double verbosity;
114  string log_msg;
115 
116  // signal parameters
117  double par[4];
118 
119  inline double DGauss(double x, double *par, double Edep, double stepTime)
120  {
121  double t0 = par[0] + stepTime; // delay + start time of signal so that peak is t0 + rise.
122  double rise = par[1]/3; // rise time, equal to sigma of first gaussian.
123  double fall = par[2]/3; // fall time, equal to sigma of second gaussian
124  double ampl = Edep*par[3]/2; // amplitude of the signal mV/MeV - divided by 2 cause it's 2 gaussians
125 
126  double peak = t0 + 3*rise;
127 
128 // cout << t0 << " " << rise << " " << fall << " " << ampl << " " << peds <<
129 // peds - ampl*exp(-0.5*pow((x-peak)/rise, 2)) - ampl*exp(-0.5*pow((x-peak)/fall, 2)) << endl;
130 
131  return - ampl*exp(-0.5*pow((x-peak)/rise, 2)) - ampl*exp(-0.5*pow((x-peak)/fall, 2));
132  }
133 };
134 
135 // Define HitProcess as a pointer to a function that returns a pointer
136 typedef HitProcess *(*HitProcess_Factory)();
137 
138 // Return HitProcess from the Hit Process Map
139 HitProcess *getHitProcess(map<string, HitProcess_Factory> *hitProcessMap, string);
140 
141 // returns the list of Hit Factories registered
142 set<string> getListOfHitProcessHit(map<string, HitProcess_Factory>);
143 
144 
145 
146 
147 
148 #endif
goptions gemcOpt
Definition: HitProcess.h:111
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:113
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:114
virtual ~HitProcess()
Definition: HitProcess.h:67
Definition: Hit.h:22
double DGauss(double x, double *par, double Edep, double stepTime)
Definition: HitProcess.h:119
double y
Definition: HitProcess.h:41
virtual void init_subclass()
Definition: HitProcess.h:84
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:112
~trueInfos()
Definition: HitProcess.h:37
string HCname
Definition: HitProcess.h:110
trueInfos(MHit *)
Definition: HitProcess.cc:242