GEMC  1.8
Geant4 Monte-Carlo Framework
fmt_strip.cc
Go to the documentation of this file.
1 // %%%%%%%%%%%%%
2 // gemc headers
3 // %%%%%%%%%%%%%
4 #include "fmt_strip.h"
5 #include "Randomize.hh"
6 #include <iostream>
7 #include <cmath>
8 
10 {
11  // all dimensions are in mm
12 
13  Pi = 3.14159265358;
14  interlayer = (0.5+0.1+0.015+0.128+0.030+2.500)*2.; // distance between 2 layers of a superlayer
15  intersuperlayer = 20.0; // distance between 2 superlayers
16  pitch = 0.500; // pitch of the strips
17  hDrift = 5.0;
18  hStrip2Det = hDrift/2.;
19  sigma_td_max = 0.01; // very small transverse diffusion because of B field
20  w_i = 25.0;
21 
22  R_min = 12.900;
23  R_max = 215.0; // outer radius of strip part
24  Z_1stlayer = 295.-0.5-0.1-0.015-0.128-0.030-2.500; // z position of the 1st layer (middle of the drift gap)
25 
26  // z of the upstream part of the layer
27  Z0.push_back(Z_1stlayer);
28  Z0.push_back(Z0[0]+interlayer);
29  Z0.push_back(Z_1stlayer+intersuperlayer);
30  Z0.push_back(Z0[2]+interlayer);
31  Z0.push_back(Z_1stlayer+2.*intersuperlayer);
32  Z0.push_back(Z0[4]+interlayer);
33 
34  // angles of each layer
35  alpha.push_back(0);
36  alpha.push_back(Pi/2.);
37  alpha.push_back(Pi/3.);
38  alpha.push_back(Pi/2+Pi/3.);
39  alpha.push_back(2.*Pi/3.);
40  alpha.push_back(2.*Pi/3+Pi/2.);
41 
42  // Number of strips and pixels
43  N_str = (int) floor(2.*R_max/pitch);
44 }
45 
46 vector<double> fmt_strip::FindStrip(int layer, int sector, double x, double y, double z, double Edep)
47 {
48  // the return vector is always in pairs.
49  // The first number is the ID,
50  // the second number is the sharing percentage
51  vector<double> strip_id;
52  // number of electrons (Nt)
53  Nel = (int) (1e6*Edep/w_i);
54  if(z-Z0[layer]>0.5001*hDrift || z-Z0[layer]<-0.5001*hDrift) cout << "Warning! z position of the FMT hit is not in the sensitive volume: " << z-Z0[layer]<< endl;
55  sigma_td = sigma_td_max* sqrt((z-Z0[layer])/hDrift); // expression without Lorentz angle
56 
57  int ClosestStrip=0;
58  if(Nel>0)
59  {
60  for(int iel=0;iel<Nel;iel++)
61  { // loop over (total) electrons
62  u_real = (double) (G4RandGauss::shoot(y*cos(alpha[layer])-x*sin(alpha[layer]),sigma_td));
63  ClosestStrip = (int) (floor((u_real+R_max)/pitch));
64 
65  if(sqrt(x*x+y*y)<R_max && sqrt(x*x+y*y)>R_min && ClosestStrip>=0 && ClosestStrip<=N_str)
66  { // strip is in the acceptance (~)
67  for(int istrip=0;istrip< (int) (strip_id.size()/2);istrip++)
68  {
69  if(strip_id[2*istrip]==ClosestStrip)
70  {// already hit strip - add Edep
71  strip_id[2*istrip+1]=strip_id[2*istrip+1]+1./((double) Nel); // no gain fluctuation yet
72  ClosestStrip=-1; // not to use it anymore
73  }
74  }
75  if(ClosestStrip>-1)
76  { // this is a new strip
77  strip_id.push_back(ClosestStrip);
78  strip_id.push_back(1./((double) Nel)); // no gain fluctuation yet
79  }
80  }
81  else
82  {// not in the acceptance
83  strip_id.push_back(-1);
84  strip_id.push_back(1);
85  }
86  }
87  }
88  else
89  { // Nel=0, consider the Edep is 0
90  strip_id.push_back(-1);
91  strip_id.push_back(1);
92  }
93  return strip_id;
94 }
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
double Pi
Definition: fmt_strip.h:8
void fill_infos()
Definition: fmt_strip.cc:9
int N_str
Definition: fmt_strip.h:19
double R_max
Definition: fmt_strip.h:12
double sigma_td_max
Definition: fmt_strip.h:22
int Nel
Definition: fmt_strip.h:25
double Z_1stlayer
Definition: fmt_strip.h:15
double sigma_td
Definition: fmt_strip.h:23
double w_i
Definition: fmt_strip.h:24
double R_min
Definition: fmt_strip.h:13
vector< double > alpha
Definition: fmt_strip.h:18
double pitch
Definition: fmt_strip.h:7
vector< double > FindStrip(int layer, int sector, double x, double y, double z, double Edep)
Definition: fmt_strip.cc:46
vector< double > Z0
Definition: fmt_strip.h:17
double u_real
Definition: fmt_strip.h:26
double hDrift
Definition: fmt_strip.h:20
double hStrip2Det
Definition: fmt_strip.h:21
double intersuperlayer
Definition: fmt_strip.h:11
double interlayer
Definition: fmt_strip.h:10