CMS 3D CMS Logo

ChargeDrifterFP420.cc
Go to the documentation of this file.
1 // File: ChargeDrifterFP420
3 // Date: 08.2008
4 // Description: ChargeDrifterFP420 for FP420
5 // Modifications:
8 using namespace std;
9 
11  double mt, double tn, double dc, double tm, double cdr, double dv, double av, double ptx, double pty, int verbosity) {
12  //
13  //
14  verbo = verbosity;
15  modulePath = mt;
16  constTe = tn;
17  constDe = dc;
18  temperature = tm; // keep just in case
19  startT0 = cdr;
20  depV = dv;
21  appV = av;
22 
23  ldriftcurrX = ptx;
24  ldriftcurrY = pty;
25  //
26  //
27 
28  // edm::LogInfo("ChargeDrifterFP420") << "call constructor";
29  if (verbo > 0) {
30  std::cout << "ChargeDrifterFP420: call constructor" << std::endl;
31  std::cout << "ldriftcurrX= " << ldriftcurrX << "ldriftcurrY= " << ldriftcurrY << std::endl;
32  std::cout << "modulePath= " << modulePath << "constTe= " << constTe << std::endl;
33  std::cout << "ChargeDrifterFP420:----------------------" << std::endl;
34  }
35 }
36 
38  const G4ThreeVector &driftDir,
39  const int &xytype) {
40  //
41  //
42  if (verbo > 0) {
43  std::cout << "ChargeDrifterFP420: collection_type call drift" << std::endl;
44  }
45  //
46  //
47  collection_type _temp;
48  _temp.resize(ion.size());
49 
50  for (unsigned int i = 0; i < ion.size(); i++) {
51  _temp[i] = drift(ion[i], driftDir, xytype);
52  }
53  return _temp;
54 }
55 
57  const G4ThreeVector &drift,
58  const int &xytype) {
59  //
60  //
61  // sliX sliY sliZ are LOCALl(!) coordinates coming from
62  // ...hit.getEntryLocalP()...
63  //
64  //
65  // Exchange xytype 1 <-> 2
66  double sliX = (edu).x();
67  double sliY = (edu).y();
68  double sliZ = (edu).z();
69 
70  double currX = sliX;
71  double currY = sliY;
72  double currZ = sliZ;
73 
74  double pathFraction = 0., pathValue = 0.;
75  double tanShiftAngleX = 0., tanShiftAngleY = 0., tanShiftAngleZ = 0.;
76  double xDriftDueToField = 0., yDriftDueToField = 0., zDriftDueToField = 0.;
77  if (verbo > 0) {
78  std::cout << "============================================================="
79  "====== "
80  << std::endl;
81  std::cout << "ChargeDrifterFP420: xytype= " << xytype << std::endl;
82  std::cout << "constTe= " << constTe << "ldriftcurrX= " << ldriftcurrX << "ldriftcurrY= " << ldriftcurrY
83  << std::endl;
84  std::cout << "1currX = " << currX << " 1currY = " << currY << " 1currZ = " << currZ << std::endl;
85  std::cout << "drift.x() = " << drift.x() << " drift.y() = " << drift.y() << " drift.z() = " << drift.z()
86  << std::endl;
87  }
88 
89  // Yglobal Xlocal:
90  //
91  //
92  // will define drift time of electrons along Xlocal or Ygobal with ldriftcurrY
93  // from Yglobal change of ldriftcurrX to ldriftcurrY is done in intialization
94  // of ChargeDrifterFP420, so use old names for ldriftcurres
95  if (xytype == 2) {
96  tanShiftAngleY = drift.y() / drift.x();
97  tanShiftAngleZ = drift.z() / drift.x();
98 
99  // pathValue = fabs(sliX-ldriftcurrX*int(sliX/ldriftcurrX));
100  pathValue = fabs(sliX) - int(fabs(sliX / (2 * ldriftcurrX)) + 0.5) * (2 * ldriftcurrX);
101  pathValue = fabs(pathValue);
102  pathFraction = pathValue / ldriftcurrX;
103  if (verbo > 0) {
104  std::cout << "==================================" << std::endl;
105  std::cout << "fabs(sliX)= " << fabs(sliX) << "ldriftcurrX= " << ldriftcurrX << std::endl;
106  std::cout << "fabs(sliX/(2*ldriftcurrX))+0.5= " << fabs(sliX / (2 * ldriftcurrX)) + 0.5 << std::endl;
107  std::cout << "int(fabs(sliX/(2*ldriftcurrX))+0.5)*(2*ldriftcurrX)= "
108  << int(fabs(sliX / (2 * ldriftcurrX)) + 0.5) * (2 * ldriftcurrX) << std::endl;
109  std::cout << "pathValue= " << pathValue << std::endl;
110  std::cout << "pathFraction= " << pathFraction << std::endl;
111  std::cout << "==================================" << std::endl;
112  }
113 
114  pathFraction = pathFraction > 0. ? pathFraction : 0.;
115  pathFraction = pathFraction < 1. ? pathFraction : 1.;
116 
117  yDriftDueToField // Drift along Y due to BField
118  = pathValue * tanShiftAngleY;
119  zDriftDueToField // Drift along Z due to BField
120  = pathValue * tanShiftAngleZ;
121  // will define Y and Z ccordinates (E along X)
122  currY = sliY + yDriftDueToField;
123  currZ = sliZ + zDriftDueToField;
124  }
125 
126  // Xglobal Ylocal:
127  // will define drift time of electrons along Ylocal
128  else if (xytype == 1) {
129  tanShiftAngleX = drift.x() / drift.y();
130  tanShiftAngleZ = drift.z() / drift.y();
131 
132  // pathValue = fabs(sliY-ldriftcurrY*int(sliY/ldriftcurrY));
133  pathValue = fabs(sliY) - int(fabs(sliY / (2 * ldriftcurrY)) + 0.5) * (2 * ldriftcurrY);
134  pathValue = fabs(pathValue);
135  pathFraction = pathValue / ldriftcurrY;
136  //
137  //
138 
139  if (verbo > 0) {
140  std::cout << "==================================" << std::endl;
141  std::cout << "fabs(sliY)= " << fabs(sliY) << "ldriftcurrY= " << ldriftcurrY << std::endl;
142  std::cout << "fabs(sliY/(2*ldriftcurrY))+0.5= " << fabs(sliY / (2 * ldriftcurrY)) + 0.5 << std::endl;
143  std::cout << "int(fabs(sliY/(2*ldriftcurrY))+0.5)*(2*ldriftcurrY)= "
144  << int(fabs(sliY / (2 * ldriftcurrY)) + 0.5) * (2 * ldriftcurrY) << std::endl;
145  std::cout << "pathValue= " << pathValue << std::endl;
146  std::cout << "pathFraction= " << pathFraction << std::endl;
147  std::cout << "==================================" << std::endl;
148  }
149 
150  if (pathFraction < 0. || pathFraction > 1.)
151  std::cout << "ChargeDrifterFP420: ERROR:pathFraction=" << pathFraction << std::endl;
152  pathFraction = pathFraction > 0. ? pathFraction : 0.;
153  pathFraction = pathFraction < 1. ? pathFraction : 1.;
154  xDriftDueToField // Drift along X due to BField
155  = pathValue * tanShiftAngleX;
156  // = (ldriftcurrY-sliY)*tanShiftAngleX;
157  zDriftDueToField // Drift along Z due to BField
158  = pathValue * tanShiftAngleZ;
159  // will define X and Z ccordinates (E along Y)
160  currX = sliX + xDriftDueToField;
161  currZ = sliZ + zDriftDueToField;
162  }
163  // double tanShiftAngleX = drift.x()/drift.z();
164  // double tanShiftAngleY = drift.y()/drift.z();
165  // double pathFraction = (modulePath/2.-sliZ)/modulePath ;
166  // pathFraction = pathFraction>0. ? pathFraction : 0. ;
167  // pathFraction = pathFraction<1. ? pathFraction : 1. ;
168 
169  // uble xDriftDueToField // Drift along X due to BField
170  //= (modulePath/2. - sliZ)*tanShiftAngleX;
171  // uble yDriftDueToField // Drift along Y due to BField
172  //= (modulePath/2. - sliZ)*tanShiftAngleY;
173  // uble currX = sliX + xDriftDueToField;
174  // uble currY = sliY + yDriftDueToField;
175  //
176  //
177  // log is a ln
178  // std::cout << "ChargeDrifterFP420: depV=" <<depV << " appV=" << appV << "
179  // startT0 =" <<startT0 << " 1.-2*depV*pathFraction/(depV+appV) ="
180  // <<1.-2*depV*pathFraction/(depV+appV) << "
181  // log(1.-2*depV*pathFraction/(depV+appV)) ="
182  // <<log(1.-2*depV*pathFraction/(depV+appV)) << std::endl;
183  double bbb = 1. - 2 * depV * pathFraction / (depV + appV);
184  if (bbb < 0.)
185  std::cout << "ChargeDrifterFP420:ERROR: check your Voltage for log(bbb) bbb=" << bbb << std::endl;
186  double driftTime = -constTe * log(bbb) + startT0;
187  // log(1.-2*depV*pathFraction/(depV+appV)) + startT0;
188  // since no magnetic field the Sigma_x, Sigma_y are the same = sigma
189  // !!!!!!!!!!!!!!!!!
190  double sigma = sqrt(2. * constDe * driftTime * 100.); // * 100. - since constDe is [cm2/sec], but i want [mm2/sec]
191 
192  // std::cout << "ChargeDrifterFP420: driftTime= " << driftTime << "
193  // pathFraction= " << pathFraction << " constTe= " << constTe << " sigma=
194  // " << sigma << std::endl;
195  if (verbo > 0) {
196  std::cout << "ChargeDrifterFP420: drift: xytype=" << xytype << "pathFraction=" << pathFraction << std::endl;
197  std::cout << " constTe= " << constTe << " driftTime = " << driftTime << " startT0 = " << startT0 << std::endl;
198  std::cout << " log = " << log(1. - 2 * depV * pathFraction / (depV + appV)) << std::endl;
199  std::cout << " negativ inside log = " << -2 * depV * pathFraction / (depV + appV) << std::endl;
200  std::cout << " constDe = " << constDe << " sigma = " << sigma << std::endl;
201 
202  std::cout << "ChargeDrifterFP420: drift: xytype=" << xytype << "pathValue=" << pathValue << std::endl;
203  std::cout << " tanShiftAngleX = " << tanShiftAngleX << " tanShiftAngleY = " << tanShiftAngleY
204  << " tanShiftAngleZ = " << tanShiftAngleZ << std::endl;
205  std::cout << "sliX = " << sliX << " sliY = " << sliY << " sliZ = " << sliZ << std::endl;
206  std::cout << "pathFraction = " << pathFraction << " driftTime = " << driftTime << std::endl;
207  std::cout << "sigma = " << sigma << std::endl;
208  std::cout << "xDriftDueToField = " << xDriftDueToField << " yDriftDueToField = " << yDriftDueToField
209  << " zDriftDueToField = " << zDriftDueToField << std::endl;
210  std::cout << "2currX = " << currX << " 2currY = " << currY << " 2currZ = " << currZ << std::endl;
211  std::cout << "ChargeDrifterFP420: drift; finally, rETURN AmplitudeSlimentFP420" << std::endl;
212  std::cout << "===================================================================" << std::endl;
213  std::cout << " (edu).energy()= " << (edu).energy() << std::endl;
214  std::cout << "==" << std::endl;
215  }
216  // std::cout << "ChargeDrifterFP420: (edu).energy()= " << (edu).energy() <<
217  // std::endl;
218  return AmplitudeSegmentFP420(currX, currY, currZ, sigma, (edu).energy());
219 }
T z() const
Definition: PV3DBase.h:61
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:36
ChargeDrifterFP420(double, double, double, double, double, double, double, double, double, int)
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
T sqrt(T t)
Definition: SSEVec.h:19
std::vector< AmplitudeSegmentFP420 > collection_type
Definition: CDrifterFP420.h:13
std::vector< EnergySegmentFP420 > ionization_type
Definition: CDrifterFP420.h:14
CDrifterFP420::collection_type drift(const CDrifterFP420::ionization_type &, const G4ThreeVector &, const int &) override
float x