CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
InduceChargeFP420 Class Reference

#include <InduceChargeFP420.h>

Inheritance diagram for InduceChargeFP420:
IChargeFP420

Public Member Functions

IChargeFP420::hit_map_type induce (const CDrifterFP420::collection_type &, int numStrips, double localPitch, int numStripsW, double localPitchW, int xytype, int verbosity) override
 
 InduceChargeFP420 (double w, double g)
 
 ~InduceChargeFP420 () override
 
- Public Member Functions inherited from IChargeFP420
virtual ~IChargeFP420 ()
 

Private Attributes

double clusterWidth
 
double geVperElectron
 
std::vector< float > signalCoupling
 

Additional Inherited Members

- Public Types inherited from IChargeFP420
typedef std::map< int, float, std::less< int > > hit_map_type
 

Detailed Description

Definition at line 7 of file InduceChargeFP420.h.

Constructor & Destructor Documentation

◆ InduceChargeFP420()

InduceChargeFP420::InduceChargeFP420 ( double  w,
double  g 
)
inline

Definition at line 11 of file InduceChargeFP420.h.

References clusterWidth, g, geVperElectron, and w().

11  {
12  clusterWidth = w;
13  geVperElectron = g;
14  }
T w() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4

◆ ~InduceChargeFP420()

InduceChargeFP420::~InduceChargeFP420 ( )
inlineoverride

Definition at line 15 of file InduceChargeFP420.h.

15 {}

Member Function Documentation

◆ induce()

IChargeFP420::hit_map_type InduceChargeFP420::induce ( const CDrifterFP420::collection_type _collection_points,
int  numStrips,
double  localPitch,
int  numStripsW,
double  localPitchW,
int  xytype,
int  verbosity 
)
overridevirtual

X

XW=Y

Implements IChargeFP420.

Definition at line 16 of file InduceChargeFP420.cc.

References funct::abs(), capacitive_coupling, EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, officialStyle::chan, gather_cfg::cout, FiducialXYZ, mps_fire::i, createfilelist::int, dqmdumpme::k, mps_fire::result, mps_update::status, ctppsCommonDQMSource_cfi::verbosity, and x.

22  {
23  signalCoupling.clear();
24  signalCoupling.push_back(capacitive_coupling[0]);
25  signalCoupling.push_back(capacitive_coupling[1]);
26 
27  // in mm local coordinates (temporarily)
28  // float FiducialX = 5., FiducialY = 10., FiducialZ = 0.250;
29  int stripLeft, stripRight, stripLeftW, stripRightW;
30  double upperBound, lowerBound, upperBoundW, lowerBoundW;
31 
32  hit_map_type hit_signal;
33 
34  // map to store pixel integrals in the x and in the y directions
35  std::map<int, float, less<int>> x, y;
36 
37  for (CDrifterFP420::collection_type::const_iterator sp = _collection_points.begin(); sp != _collection_points.end();
38  sp++) {
39  float chargePositionW = -1.; // charge in strip coord in Wide pixel
40  float chargePosition = -1.; // charge in strip coord
41 
42  // define chargePosition
43  G4ThreeVector Position3D = (*sp).position(); // charge in strip coord
44 
45  if (verbosity > 0) {
46  std::cout << " =============================*InduceChargeFP420:induce:"
47  "Position3D= "
48  << Position3D << std::endl;
49  std::cout << " localPitch= " << localPitch << std::endl;
50  std::cout << " xytype= " << xytype << " numStrips= " << numStrips << std::endl;
51  }
52 
53  // is slice still inside fiducial volume of the plate? if not -> put slice
54  // energy to zero.
55  if (abs(Position3D.x()) < FiducialXYZ[0] && abs(Position3D.y()) < FiducialXYZ[1]) {
56  if (abs(Position3D.z()) < FiducialXYZ[2]) {
57  } else {
58  // (*sp).amplitude() == 0.;
59  std::cout << " *InduceChargeFP420:Z slice outside the plate: Position3D= " << Position3D << std::endl;
60  }
61  } else {
62  // (*sp).amplitude() == 0.;
63  std::cout << " *InduceChargeFP420:XY slice outside the plate: Position3D= " << Position3D << std::endl;
64  }
65 
66  // chargePosition - still local coordinates, so exchange x and y due to 90
67  // degree rotation Yglobal::
68  if (xytype == 1) {
69  // =
70  chargePosition = 0.5 * numStrips + Position3D.x() / localPitch; // charge in strip coord. in l.r.f
71  // starting at edge of plate
72  chargePositionW = 0.5 * numStripsW + Position3D.y() / localPitchW; // charge in strip coord. in l.r.f
73  // starting at edge of plate
74  }
75  // X:
76  else if (xytype == 2) {
77  // =
78  chargePosition = 0.5 * numStrips + Position3D.y() / localPitch; // charge in strip coord. in l.r.f
79  // starting at edge of plate
80  chargePositionW = 0.5 * numStripsW + Position3D.x() / localPitchW; // charge in strip coord. in l.r.f
81  // starting at edge of plate
82  } else {
83  std::cout << "**** InduceChargeFP420: !!! ERROR: you have not to be "
84  "here !!! xytype="
85  << xytype << std::endl;
86  // break;
87  }
88 
89  if (verbosity > 0) {
90  if (xytype == 2) {
91  std::cout << "===================================**** "
92  "InduceChargeFP420: xytype= "
93  << xytype << std::endl;
94  std::cout << " chargePositionW= " << chargePositionW << " chargePosition= " << chargePosition << std::endl;
95  std::cout << "Position3D= " << Position3D << std::endl;
96  }
97  }
98 
99  float chargeSpread = (*sp).sigma() / localPitch; // sigma in strip pitches
100  float chargeSpreadW = (*sp).sigma() / localPitchW; // sigma in strip pitches
101 
102  // Define strips intervals along x: check edge condition
103 
104  stripLeft = int(chargePosition - clusterWidth * chargeSpread);
105  stripRight = int(chargePosition + clusterWidth * chargeSpread);
106  stripLeft = (0 < stripLeft ? stripLeft : 0);
107  stripRight = (numStrips > stripRight ? stripRight : numStrips - 1);
108 
109  stripLeftW = int(chargePositionW - clusterWidth * chargeSpreadW);
110  stripRightW = int(chargePositionW + clusterWidth * chargeSpreadW);
111  stripLeftW = (0 < stripLeftW ? stripLeftW : 0);
112  stripRightW = (numStripsW > stripRightW ? stripRightW : numStripsW - 1);
113 
114  if (verbosity > 1) {
115  std::cout << " Position3D = " << Position3D << "amplitude=" << (*sp).amplitude() << std::endl;
116  std::cout << " MaxChargeSpread= " << clusterWidth * chargeSpread << " sigma= " << (*sp).sigma() << std::endl;
117  std::cout << "*** numStrips= " << numStrips << " localPitch= " << localPitch << "xytype=" << xytype << std::endl;
118  std::cout << " chargePosition= " << chargePosition << " chargeSpread= " << chargeSpread << std::endl;
119  std::cout << " stripLeft= " << stripLeft << " stripRight= " << stripRight << std::endl;
120  std::cout << " chargePositionW= " << chargePositionW << " chargeSpreadW= " << chargeSpreadW << std::endl;
121  std::cout << " stripLeftW= " << stripLeftW << " stripRightW= " << stripRightW << std::endl;
122  }
125  for (int i = stripLeft; i <= stripRight; i++) {
126  /* Definition of the integration borns */
127  // go to "left"
128  if (i == 0)
129  lowerBound = 0.;
130  else {
131  gsl_sf_result result;
132  int status = gsl_sf_erf_Q_e((i - chargePosition) / chargeSpread, &result);
133  if (status != 0)
134  std::cerr << "InduceChargeFP420::could not compute gaussian tail "
135  "probability for the threshold chosen"
136  << std::endl;
137  lowerBound = 1. - result.val;
138  if (verbosity > 0) {
139  std::cout << "go to left: i= " << i << "lowerBound=" << lowerBound << std::endl;
140  }
141  }
142 
143  // go to "right"
144  if (i == numStrips - 1)
145  upperBound = 1.;
146  else {
147  gsl_sf_result result;
148  int status = gsl_sf_erf_Q_e((i - chargePosition + 1) / chargeSpread, &result);
149  if (status != 0)
150  std::cerr << "InduceChargeFP420::could not compute gaussian tail "
151  "probability for the threshold chosen"
152  << std::endl;
153  upperBound = 1. - result.val;
154 
155  if (verbosity > 0) {
156  std::cout << "go to right: i= " << i << "upperBound=" << upperBound << std::endl;
157  }
158  }
159 
160  double totalIntegrationRange = upperBound - lowerBound;
161  x[i] = totalIntegrationRange; // save strip integral
162 
163  if (totalIntegrationRange <= 0.)
164  std::cout << " upperBound= " << upperBound << " lowerBound= " << lowerBound << std::endl;
165  if (verbosity == -30) {
166  std::cout << " *InduceChargeFP420:====================================X i = " << i << std::endl;
167  std::cout << " upperBound= " << upperBound << " lowerBound= " << lowerBound << std::endl;
168  std::cout << " totalIntegrationRange= " << totalIntegrationRange << std::endl;
169  std::cout << " *InduceChargeFP420:==================================== " << std::endl;
170  }
171 
172  } // for
175  for (int i = stripLeftW; i <= stripRightW; i++) {
176  /* Definition of the integration borns */
177  // go to "left"
178  if (i == 0)
179  lowerBoundW = 0.;
180  else {
181  gsl_sf_result result;
182  int status = gsl_sf_erf_Q_e((i - chargePositionW) / chargeSpreadW, &result);
183  if (status != 0)
184  std::cerr << "InduceChargeFP420::W could not compute gaussian tail "
185  "probability for the threshold chosen"
186  << std::endl;
187  lowerBoundW = 1. - result.val;
188 
189  if (verbosity > 0) {
190  std::cout << "go to left: i= " << i << "lowerBoundW=" << lowerBoundW << std::endl;
191  }
192  }
193 
194  // go to "right"
195  if (i == numStripsW - 1)
196  upperBoundW = 1.;
197  else {
198  gsl_sf_result result;
199  int status = gsl_sf_erf_Q_e((i - chargePositionW + 1) / chargeSpreadW, &result);
200  if (status != 0)
201  std::cerr << "InduceChargeFP420::W could not compute gaussian tail "
202  "probability for the threshold chosen"
203  << std::endl;
204  upperBoundW = 1. - result.val;
205 
206  if (verbosity > 0) {
207  std::cout << "go to right: i= " << i << "upperBoundW=" << upperBoundW << std::endl;
208  }
209  }
210 
211  double totalIntegrationRange = upperBoundW - lowerBoundW;
212  y[i] = totalIntegrationRange; // save W strip integral
213 
214  if (totalIntegrationRange <= 0.)
215  std::cout << " upperBoundW= " << upperBoundW << " lowerBoundW= " << lowerBoundW << std::endl;
216 
217  if (verbosity == -30) {
218  std::cout << " *InduceChargeFP420:====================================XW i= " << i << std::endl;
219  std::cout << " upperBoundW= " << upperBoundW << " lowerBoundW= " << lowerBoundW << std::endl;
220  std::cout << " totalIntegrationRange= " << totalIntegrationRange << std::endl;
221  std::cout << " *InduceChargeFP420:==================================== " << std::endl;
222  }
223  }
225  // calculate signal on x strips with including capacitive coupling
226  int nSignalCoupling = signalCoupling.size();
227 
229  /*
230  int lll,copyinlll;
231  lll = unpackLayerIndex(rn0,zside);
232  if(lll==1) {copyinlll= lll/2;}
233  else if(lll==2) {copyinlll= (lll-1)/2;}
234  else{std::cout << " InduceChargeFP420:WARNING plane number in superlayer= "
235  << lll << std::endl;}
236 */
238  if (verbosity > 1) {
239  std::cout << "InduceChargeFP420: "
240  "*************************************************************** "
241  << std::endl;
242  std::cout << " numStripsW= " << numStripsW << " numStrips= " << numStrips << std::endl;
243  std::cout << " nSignalCoupling= " << nSignalCoupling << " xytype= " << xytype << std::endl;
244  std::cout << " stripLeftW= " << stripLeftW << " stripRightW= " << stripRightW << std::endl;
245  std::cout << " stripLeft= " << stripLeft << " stripRight= " << stripRight << std::endl;
246  }
247  // Get the 2D charge integrals by folding x and y strips
248  for (int iy = stripLeftW; iy <= stripRightW; iy++) { // loop over Wide y index
249  for (int ix = stripLeft; ix <= stripRight; ix++) { // loop over x index
250  for (int k = -nSignalCoupling + 1; k <= nSignalCoupling - 1; k++) {
251  if (ix + k >= 0 && ix + k < numStrips) {
252  float ChargeFraction = signalCoupling[abs(k)] * (x[ix] * y[iy] / geVperElectron) * (*sp).amplitude();
253  if (ChargeFraction > 0.) {
254  // int chan = PixelDigi::pixelToChannel( ix, iy); // Get index
255  int chan = iy * numStrips + (ix + k); // Get index
256 
257  // if(k==0 ){
258  // std::cout << "InduceChargeFP420: chan= " << chan <<
259  // std::endl; std::cout << "ix= " << ix << "iy= " << iy <<
260  // std::endl;
261  // }
262  if (verbosity > 0) {
263  if (k == 0 && xytype == 2) {
264  std::cout << "InduceChargeFP420: "
265  " chan= "
266  << chan << std::endl;
267  std::cout << "ix= " << ix << "iy= " << iy << "k= " << k << "ChargeFraction= " << ChargeFraction
268  << std::endl;
269  std::cout << "hit_signal[chan]= " << hit_signal[chan] << "geVperElectron= " << geVperElectron
270  << std::endl;
271  std::cout << "signalCoupling[abs(k)]= " << signalCoupling[abs(k)] << "x[ix]= " << x[ix]
272  << "y[iy]= " << y[iy] << "(*sp).amplitude()= " << (*sp).amplitude() << std::endl;
273  }
274  }
275  // Load the amplitude:
276  hit_signal[chan] += ChargeFraction;
277  } // endif ChargeFraction
278  } // endif ix+k
279  else {
280  // std::cout << "WARNING: ix+k =" << ix+k <<
281  // std::endl;
282  } // endif ix+k
283  } // endfor k
284  } // endfor ix
285  } // endfor iy
286 
287  if (verbosity > 0) {
288  std::cout << "==========================================================="
289  "====================== "
290  << std::endl;
291  }
292 
293  } // for loop on ions (*sp)
294 
295  if (verbosity > 0) {
296  std::cout << "end of InduceChargeFP420============================= " << std::endl;
297  }
298 
299  return hit_signal;
300 }
std::vector< float > signalCoupling
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const float FiducialXYZ[3]
std::map< int, float, std::less< int > > hit_map_type
Definition: IChargeFP420.h:11
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
static const float capacitive_coupling[2]

Member Data Documentation

◆ clusterWidth

double InduceChargeFP420::clusterWidth
private

Definition at line 30 of file InduceChargeFP420.h.

Referenced by InduceChargeFP420().

◆ geVperElectron

double InduceChargeFP420::geVperElectron
private

Definition at line 31 of file InduceChargeFP420.h.

Referenced by InduceChargeFP420().

◆ signalCoupling

std::vector<float> InduceChargeFP420::signalCoupling
private

Definition at line 28 of file InduceChargeFP420.h.