GEMC  2.3
Geant4 Monte-Carlo Framework
ftm_hitprocess.cc
Go to the documentation of this file.
1 // gemc headers
2 #include "ftm_hitprocess.h"
3 #include "ftm_strip.h"
4 
5 // CLHEP units
6 #include "CLHEP/Units/PhysicalConstants.h"
7 using namespace CLHEP;
8 
9 map<string, double> FTM_HitProcess :: integrateDgt(MHit* aHit, int hitn)
10 {
11  map<string, double> dgtz;
12  vector<identifier> identity = aHit->GetId();
13 
14  // FTM ID:
15  // layer, type, sector, strip
16 
17  int layer = 2*identity[0].id + identity[1].id - 2 ;
18  int sector = identity[2].id;
19  int strip = identity[3].id;
20 
21  if(verbosity>4)
22  {
23  trueInfos tInfos(aHit);
24  cout << log_msg << " layer: " << layer << " sector: " << sector << " Strip: " << strip
25  << " x=" << tInfos.x << " y=" << tInfos.y << " z=" << tInfos.z << endl;
26  }
27  dgtz["hitn"] = hitn;
28  dgtz["layer"] = layer;
29  dgtz["sector"] = sector;
30  dgtz["strip"] = strip;
31 
32  return dgtz;
33 }
34 
35 
36 
37 vector<identifier> FTM_HitProcess :: processID(vector<identifier> id, G4Step* aStep, detector Detector)
38 {
39  double x, y, z;
40  G4ThreeVector xyz = aStep->GetPostStepPoint()->GetPosition();
41  x = xyz.x()/mm;
42  y = xyz.y()/mm;
43  z = xyz.z()/mm;
44 
45  vector<identifier> yid = id;
46  class ftm_strip ftms;
47  ftms.fill_infos();
48 
49  int layer = 2*yid[0].id + yid[1].id - 2 ;
50 
51  //yid[3].id = ftms.FindStrip(layer-1, x, y, z);
52  double depe = aStep->GetTotalEnergyDeposit();
53  //cout << "resolMM " << layer << " " << x << " " << y << " " << z << " " << depe << " " << aStep->GetTrack()->GetTrackID() << endl;
54  vector<double> multi_hit = ftms.FindStrip(layer-1, x, y, z, depe);
55 
56  int n_multi_hits = multi_hit.size()/2;
57 
58  // closest strip
59  //yid[4].id = (int) multi_hit[0];
60  yid[3].id = (int) multi_hit[0];
61 
62  yid[0].id_sharing = multi_hit[1];
63  yid[1].id_sharing = multi_hit[1];
64  yid[2].id_sharing = multi_hit[1];
65  yid[3].id_sharing = multi_hit[1];
66  // yid[4].id_sharing = multi_hit[1];
67 
68  // additional strip
69  for(int h=1; h<n_multi_hits; h++)
70  {
71  for(int j=0; j<3; j++)
72  {
73  identifier this_id;
74  this_id.name = yid[j].name;
75  this_id.rule = yid[j].rule;
76  this_id.id = yid[j].id;
77  this_id.time = yid[j].time;
78  this_id.TimeWindow = yid[j].TimeWindow;
79  this_id.TrackId = yid[j].TrackId;
80  this_id.id_sharing = multi_hit[3];
81  yid.push_back(this_id);
82  }
83  // last id is strip
84  identifier this_id;
85  this_id.name = yid[3].name;
86  this_id.rule = yid[3].rule;
87  this_id.id = (int) multi_hit[2];
88  this_id.time = yid[3].time;
89  this_id.TimeWindow = yid[3].TimeWindow;
90  this_id.TrackId = yid[3].TrackId;
91  this_id.id_sharing = multi_hit[3];
92  yid.push_back(this_id);
93  }
94 
95  return yid;
96 }
97 
98 
99 map< string, vector <int> > FTM_HitProcess :: multiDgt(MHit* aHit, int hitn)
100 {
101  map< string, vector <int> > MH;
102 
103  return MH;
104 }
105 
106 
107 
108 
void fill_infos()
Definition: ftm_strip.cc:7
map< string, double > integrateDgt(MHit *, int)
double verbosity
vector< identifier > GetId()
Definition: Hit.h:103
int id
manually assing ID. 0 if "ncopy" (will be set at hit processing time)
Definition: identifier.h:39
string name
Name of the detector.
Definition: identifier.h:37
double z
Definition: HitProcess.h:41
vector< double > FindStrip(int layer, double x, double y, double z, double Edep)
Definition: ftm_strip.cc:35
double x
Definition: HitProcess.h:41
double TimeWindow
Time Window. If abs(steptime - time) is smaller than TimeWindow, it&#39;s the same hit.
Definition: identifier.h:41
int TrackId
If Time Window is 0, it&#39;s a "flux" detector: if it&#39;s the same track, it&#39;s the same hit...
Definition: identifier.h:42
vector< identifier > processID(vector< identifier >, G4Step *, detector)
Definition: Hit.h:22
double y
Definition: HitProcess.h:41
double id_sharing
A single step can generate multiple identifiers. This variable represent the percentage sharing of th...
Definition: identifier.h:43
double time
Time of the first step.
Definition: identifier.h:40
string rule
"manual" or "ncopy"
Definition: identifier.h:38
map< string, vector< int > > multiDgt(MHit *, int)