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