GEMC  1.8
Geant4 Monte-Carlo Framework
ftm_strip.cc
Go to the documentation of this file.
1 // %%%%%%%%%%%%%
2 // gemc headers
3 // %%%%%%%%%%%%%
4 #include "ftm_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.3/2.+0.1+0.015)*2.; // distance between 2 layers of a superlayer
15  intersuperlayer = 20.0; // distance between 2 superlayers
16 
17  pitch = 0.500; // pitch of the strips
18  hDrift = 5.35;
19  hStrip2Det = hDrift/2.;
20  sigma_td_max = 0.0; // very small transverse diffusion (temporary)
21  w_i = 25.0;
22 
23  Rmin = 65.0; // inner radius of disks
24  Rmax = 142.0; // outer radius of disks
25  Z_1stlayer = 1763.-0.3/2.-0.1-0.015; // z position of the 1st layer : epoxy center - half epoxy Dz - PCB Dz - strips Dz
26 
27  // z of the upstream part of the layer
28  Z0.push_back(Z_1stlayer);
29  Z0.push_back(Z0[0]+interlayer);
30  Z0.push_back(Z_1stlayer+intersuperlayer);
31  Z0.push_back(Z0[2]+interlayer);
32 
33  // Number of strips
34  Nstrips = (int) floor(2.*(Rmax+Rmin)/pitch);
35 }
36 
37 vector<double> ftm_strip::FindStrip(int layer, double x, double y, double z, double Edep)
38 {
39  // the return vector is always in pairs.
40  // The first number is the ID,
41  // the second number is the sharing percentage
42  vector<double> strip_id;
43  // number of electrons (Nt)
44  Nel = (int) (1e6*Edep/w_i);
45  if(fabs(z-Z0[layer])>(hDrift+0.2)) cout << "Warning! z position of the FTM hit is not in the sensitive volume: " << z-Z0[layer]<< endl;
46  sigma_td = sigma_td_max* sqrt(fabs(z-Z0[layer])/hDrift); // expression without Lorentz angle
47 
48  int ClosestStrip=0;
49  if(Nel>0)
50  {
51  for(int iel=0;iel<Nel;iel++)
52  { // loop over (total) electrons
53  if(layer%2==0)
54  {
55  x_real = (double) (G4RandGauss::shoot(x,sigma_td));
56  y_real = y;
57  if(-Rmin<x_real && x_real<Rmin && y_real<0) ClosestStrip = (int) (floor(2.0*Rmax/pitch+(x_real+Rmin)/pitch+0.5));
58  else ClosestStrip = (int) (floor((x_real+Rmax)/pitch+0.5));
59  }
60  if(layer%2==1)
61  {
62  x_real = x;
63  y_real = (double) (G4RandGauss::shoot(y,sigma_td));
64  if(-Rmin<y_real && y_real<Rmin && x_real<0) ClosestStrip = (int) (floor(2.0*Rmax/pitch+(y_real+Rmin)/pitch+0.5));
65  else ClosestStrip = (int) (floor((y_real+Rmax)/pitch+0.5));
66  }
67 
68  if(sqrt(x_real*x_real+y_real*y_real)<Rmax && sqrt(x_real*x_real+y_real*y_real)>Rmin && ClosestStrip>=0 && ClosestStrip<=Nstrips)
69  { // strip is in the acceptance
70  for(int istrip=0;istrip< (int) (strip_id.size()/2);istrip++)
71  {
72  if(strip_id[2*istrip]==ClosestStrip)
73  {// already hit strip - add Edep
74  strip_id[2*istrip+1]=strip_id[2*istrip+1]+1./((double) Nel); // no gain fluctuation yet
75  ClosestStrip=-1; // not to use it anymore
76  }
77  }
78  if(ClosestStrip>-1)
79  { // this is a new strip
80  strip_id.push_back(ClosestStrip);
81  strip_id.push_back(1./((double) Nel)); // no gain fluctuation yet
82  }
83  }
84  else
85  {// not in the acceptance
86  strip_id.push_back(-1);
87  strip_id.push_back(1);
88  }
89  }
90  }
91  else
92  { // Nel=0, consider the Edep is 0
93  strip_id.push_back(-1);
94  strip_id.push_back(1);
95  }
96  return strip_id;
97 }
98 
double Rmax
Definition: ftm_strip.h:13
double interlayer
Definition: ftm_strip.h:10
double hDrift
Definition: ftm_strip.h:20
void fill_infos()
Definition: ftm_strip.cc:9
double y_real
Definition: ftm_strip.h:26
double intersuperlayer
Definition: ftm_strip.h:11
double Z_1stlayer
Definition: ftm_strip.h:14
double x_real
Definition: ftm_strip.h:26
double Pi
Definition: ftm_strip.h:8
double Rmin
Definition: ftm_strip.h:12
vector< double > Z0
Definition: ftm_strip.h:16
vector< double > FindStrip(int layer, double x, double y, double z, double Edep)
Definition: ftm_strip.cc:37
int Nstrips
Definition: ftm_strip.h:19
int Nel
Definition: ftm_strip.h:25
double w_i
Definition: ftm_strip.h:24
double sigma_td
Definition: ftm_strip.h:23
double sigma_td_max
Definition: ftm_strip.h:22
double hStrip2Det
Definition: ftm_strip.h:21
double pitch
Definition: ftm_strip.h:7