CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
 InduceChargeFP420 (double w, double g)
 
virtual ~InduceChargeFP420 ()
 
- 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 ( double  w,
double  g 
)
inline

Definition at line 12 of file InduceChargeFP420.h.

References clusterWidth, g, geVperElectron, and w.

const double w
Definition: UKUtility.cc:23
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
virtual InduceChargeFP420::~InduceChargeFP420 ( )
inlinevirtual

Definition at line 13 of file InduceChargeFP420.h.

13 {}

Member Function Documentation

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

Implements IChargeFP420.

Definition at line 16 of file InduceChargeFP420.cc.

References funct::abs(), capacitive_coupling, ecal_dqm_sourceclient-live_cfg::cerr, gather_cfg::cout, FiducialXYZ, i, relval_steps::k, query::result, ntuplemaker::status, and x().

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

Member Data Documentation

double InduceChargeFP420::clusterWidth
private

Definition at line 23 of file InduceChargeFP420.h.

Referenced by InduceChargeFP420().

double InduceChargeFP420::geVperElectron
private

Definition at line 24 of file InduceChargeFP420.h.

Referenced by InduceChargeFP420().

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

Definition at line 21 of file InduceChargeFP420.h.