GEMC  1.8
Geant4 Monte-Carlo Framework
flux_hitprocess.cc
Go to the documentation of this file.
1 // %%%%%%%%%%
2 // G4 headers
3 // %%%%%%%%%%
4 #include "G4UnitsTable.hh"
5 
6 
7 // %%%%%%%%%%%%%
8 // gemc headers
9 // %%%%%%%%%%%%%
10 #include "flux_hitprocess.h"
11 
12 
14 {
15  string hd_msg = Opt.args["LOG_MSG"].args + " CND Hit Process " ;
16  double HIT_VERBOSITY = Opt.args["HIT_VERBOSITY"].arg;
17 
18  PH_output out;
19  out.identity = aHit->GetId();
20  HCname = "TOF Hit Process";
21 
22  // %%%%%%%%%%%%%%%%%%%
23  // Raw hit information
24  // %%%%%%%%%%%%%%%%%%%
25  int nsteps = aHit->GetPos().size();
26 
27  // Get Total Energy deposited
28  double Etot = 0;
29  vector<G4double> Edep = aHit->GetEdep();
30  for(int s=0; s<nsteps; s++) Etot = Etot + Edep[s];
31 
32  // average global, local positions of the hit
33  double x, y, z;
34  double lx, ly, lz;
35  x = y = z = lx = ly = lz = 0;
36  vector<G4ThreeVector> pos = aHit->GetPos();
37  vector<G4ThreeVector> Lpos = aHit->GetLPos();
38 
39  if(Etot>0)
40  for(int s=0; s<nsteps; s++)
41  {
42  x = x + pos[s].x()*Edep[s]/Etot;
43  y = y + pos[s].y()*Edep[s]/Etot;
44  z = z + pos[s].z()*Edep[s]/Etot;
45  lx = lx + Lpos[s].x()*Edep[s]/Etot;
46  ly = ly + Lpos[s].y()*Edep[s]/Etot;
47  lz = lz + Lpos[s].z()*Edep[s]/Etot;
48  }
49  else
50  {
51  x = pos[0].x();
52  y = pos[0].y();
53  z = pos[0].z();
54  lx = Lpos[0].x();
55  ly = Lpos[0].y();
56  lz = Lpos[0].z();
57  }
58 
59 
60  // average time
61  double time = 0;
62  vector<G4double> times = aHit->GetTime();
63  for(int s=0; s<nsteps; s++) time = time + times[s]/nsteps;
64 
65  // Energy of the track
66  double Ene = aHit->GetE();
67 
68  out.raws.push_back(Etot);
69  out.raws.push_back(x);
70  out.raws.push_back(y);
71  out.raws.push_back(z);
72  out.raws.push_back(lx);
73  out.raws.push_back(ly);
74  out.raws.push_back(lz);
75  out.raws.push_back(time);
76  out.raws.push_back((double) aHit->GetPID());
77  out.raws.push_back(aHit->GetMom().getX());
78  out.raws.push_back(aHit->GetMom().getY());
79  out.raws.push_back(aHit->GetMom().getZ());
80  out.raws.push_back(aHit->GetVert().getX());
81  out.raws.push_back(aHit->GetVert().getY());
82  out.raws.push_back(aHit->GetVert().getZ());
83  out.raws.push_back(Ene);
84  out.raws.push_back((double) aHit->GetmPID());
85  out.raws.push_back(aHit->GetmVert().getX());
86  out.raws.push_back(aHit->GetmVert().getY());
87  out.raws.push_back(aHit->GetmVert().getZ());
88 
89 
90  // %%%%%%%%%%%%
91  // Digitization
92  // %%%%%%%%%%%%
93  int id = out.identity[0].id;
94 
95  if(HIT_VERBOSITY>4)
96  cout << hd_msg << " flux detector id: " << id << endl;
97 
98  out.dgtz.push_back(id);
99 
100 
101  return out;
102 }
103 
104 vector<identifier> flux_HitProcess :: ProcessID(vector<identifier> id, G4Step* aStep, detector Detector, gemc_opts Opt)
105 {
106  id[id.size()-1].id_sharing = 1;
107  return id;
108 }
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
vector< identifier > ProcessID(vector< identifier >, G4Step *, detector, gemc_opts)
Method to calculate new identifier.
PH_output ProcessHit(MHit *, gemc_opts)
Method to process the hit.
G4ThreeVector GetVert()
Definition: MHit.h:72
vector< double > raws
Raw information.
Definition: MPHBaseClass.h:26
int GetPID()
Definition: MHit.h:107
int GetmPID()
Definition: MHit.h:122
vector< identifier > GetId()
Definition: MHit.h:96
string HCname
Hit Collection name.
Definition: MPHBaseClass.h:41
G4ThreeVector GetmVert()
Definition: MHit.h:127
vector< identifier > identity
Identifier.
Definition: MPHBaseClass.h:28
vector< G4ThreeVector > GetLPos()
Definition: MHit.h:69
double GetE()
Definition: MHit.h:89
vector< G4ThreeVector > GetPos()
Definition: MHit.h:65
G4ThreeVector GetMom()
Definition: MHit.h:85
Definition: MHit.h:29
vector< double > GetTime()
Definition: MHit.h:82
map< string, opts > args
Options map.
Definition: usage.h:68
vector< double > GetEdep()
Definition: MHit.h:76
vector< int > dgtz
Digitized information.
Definition: MPHBaseClass.h:27