CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PixelCPEBase.cc
Go to the documentation of this file.
1 // Move geomCorrection to the concrete class. d.k. 06/06.
2 // Change drift direction. d.k. 06/06
3 
4 // G. Giurgiu (ggiurgiu@pha.jhu.edu), 12/01/06, implemented the function:
5 // computeAnglesFromDetPosition(const SiPixelCluster & cl,
6 // const GeomDetUnit & det ) const
7 // 09/09/07, replaced assert statements with throw cms::Exception
8 // and fix an invalid pointer check in setTheDet function
9 // 09/21/07, implement caching of Lorentz drift direction
10 // 01/24/09, use atan2 to get the alpha and beta angles
11 // change to use Lorentz angle from DB Lotte Wilke, Jan. 31st, 2008
12 // Change to use Generic error & Template calibration from DB - D.Fehling 11/08
13 
14 
17 
19 
20 //#define TPDEBUG
21 #define CORRECT_FOR_BIG_PIXELS
22 
23 // MessageLogger
25 
26 // Magnetic field
28 
32 
33 #include <iostream>
34 
35 using namespace std;
36 
37 const float PI = 3.141593;
38 const float degsPerRad = 57.29578;
39 
40 //-----------------------------------------------------------------------------
41 // A fairly boring constructor. All quantities are DetUnit-dependent, and
42 // will be initialized in setTheDet().
43 //-----------------------------------------------------------------------------
45  const SiPixelCPEGenericErrorParm * genErrorParm, const SiPixelTemplateDBObject * templateDBobject)
46  : theDet(0), nRecHitsTotal_(0), nRecHitsUsedEdge_(0),
47  probabilityX_(0.0), probabilityY_(0.0),
48  probabilityQ_(0.0), qBin_(0),
49  isOnEdge_(0), hasBadPixels_(0),
50  spansTwoROCs_(0),
51  hasFilledProb_(0), clusterProbComputationFlag_(0),
52  loc_trk_pred_(0.0, 0.0, 0.0, 0.0)
53 {
54  //--- Lorentz angle tangent per Tesla
55  // theTanLorentzAnglePerTesla =
56 
57  // conf.getParameter<double>("TanLorentzAnglePerTesla");
58  lorentzAngle_ = lorentzAngle;
59  /* if(!lorentzAngle_)
60  theTanLorentzAnglePerTesla =
61  conf.getParameter<double>("TanLorentzAnglePerTesla");
62  */
63 
64  //--- Algorithm's verbosity
66  conf.getUntrackedParameter<int>("VerboseLevel",0);
67 
68  //-- Magnetic Field
69  magfield_ = mag;
70 
71  //-- Error Parametriaztion from DB for CPE Generic
72  genErrorParm_ = genErrorParm;
73 
74  //-- Template Calibration Object from DB
75  templateDBobject_ = templateDBobject;
76 
77  //-- Switch on/off E.B
78  alpha2Order = conf.getParameter<bool>("Alpha2Order");
79 
80  //--- A flag that could be used to change the behavior of
81  //--- clusterProbability() in TSiPixelRecHit (the *transient* one).
82  //--- The problem is that the transient hits are made after the CPE runs
83  //--- and they don't get the access to the PSet, so we pass it via the
84  //--- CPE itself...
85  //
87  = (unsigned int) conf.getParameter<int>("ClusterProbComputationFlag");
88 
89 }
90 
91 //-----------------------------------------------------------------------------
92 // One function to cache the variables common for one DetUnit.
93 //-----------------------------------------------------------------------------
94 void
95 PixelCPEBase::setTheDet( const GeomDetUnit & det, const SiPixelCluster & cluster ) const
96 {
97  if ( theDet == &det )
98  return; // we have already seen this det unit
99 
100  //--- This is a new det unit, so cache it
101  theDet = dynamic_cast<const PixelGeomDetUnit*>( &det );
102 
103  if ( !theDet )
104  {
105  throw cms::Exception(" PixelCPEBase::setTheDet : ")
106  << " Wrong pointer to PixelGeomDetUnit object !!!";
107  }
108 
109  //--- theDet->type() returns a GeomDetType, which implements subDetector()
111  switch ( thePart )
112  {
114  // A barrel! A barrel!
115  break;
117  // A forward! A forward!
118  break;
119  default:
120  throw cms::Exception("PixelCPEBase::setTheDet :")
121  << "PixelCPEBase: A non-pixel detector type in here?" ;
122  }
123 
124  //--- The location in of this DetUnit in a cyllindrical coord system (R,Z)
125  //--- The call goes via BoundSurface, returned by theDet->surface(), but
126  //--- position() is implemented in GloballyPositioned<> template
127  //--- ( BoundSurface : Surface : GloballyPositioned<float> )
129  theDetZ = theDet->surface().position().z();
130  //--- Define parameters for chargewidth calculation
131 
132  //--- bounds() is implemented in BoundSurface itself.
134 
135  //--- Cache the topology.
136  // ggiurgiu@jhu.edu 12/09/2010 : no longer need to dynamyc cast to RectangularPixelTopology
137  //theTopol
138  //= dynamic_cast<const RectangularPixelTopology*>( & (theDet->specificTopology()) );
139 
141 
142  //---- The geometrical description of one module/plaquette
143  theNumOfRow = theTopol->nrows(); // rows in x
144  theNumOfCol = theTopol->ncolumns(); // cols in y
145  std::pair<float,float> pitchxy = theTopol->pitch();
146  thePitchX = pitchxy.first; // pitch along x
147  thePitchY = pitchxy.second; // pitch along y
148 
149  //--- Find the offset
150  // ggiurgiu@jhu.edu 12/09/2010 : this piece is deprecated
151  //MeasurementPoint offset =
152  //theTopol->measurementPosition( LocalPoint(0.0, 0.0),
153  // Topology::LocalTrackAngles( LocalTrajectoryParameters::dxdz(),
154  // LocalTrajectoryParameters::dydz() ) );
155  //
156  //theOffsetX = offset.x();
157  //theOffsetY = offset.y();
158 
159  //--- Find if the E field is flipped: i.e. whether it points
160  //--- from the beam, or towards the beam. (The voltages are
161  //--- applied backwards on every other module in barrel and
162  //--- blade in forward.)
163  theSign = isFlipped() ? -1 : 1;
164 
165  //--- The Lorentz shift.
167 
169 
170  // testing
172  //cout<<" lorentz shift "<<theLShiftX<<" "<<theLShiftY<<endl;
173  theLShiftY=0.;
174  }
175 
176  //--- Geometric Quality Information
177  int minInX,minInY,maxInX,maxInY=0;
178  minInX = cluster.minPixelRow();
179  minInY = cluster.minPixelCol();
180  maxInX = cluster.maxPixelRow();
181  maxInY = cluster.maxPixelCol();
182 
183  if(theTopol->isItEdgePixelInX(minInX) || theTopol->isItEdgePixelInX(maxInX) ||
184  theTopol->isItEdgePixelInY(minInY) || theTopol->isItEdgePixelInY(maxInY) ) {
185  isOnEdge_ = true;
186  }
187  else isOnEdge_ = false;
188 
189  // Bad Pixels have their charge set to 0 in the clusterizer
190  hasBadPixels_ = false;
191  for(unsigned int i=0; i<cluster.pixelADC().size(); ++i) {
192  if(cluster.pixelADC()[i] == 0) hasBadPixels_ = true;
193  }
194 
195  if(theTopol->containsBigPixelInX(minInX,maxInX) ||
196  theTopol->containsBigPixelInY(minInY,maxInY) ) {
197  spansTwoROCs_ = true;
198  }
199  else spansTwoROCs_ = false;
200 
201 
202  if (theVerboseLevel > 1)
203  {
204  LogDebug("PixelCPEBase") << "***** PIXEL LAYOUT *****"
205  << " thePart = " << thePart
206  << " theThickness = " << theThickness
207  << " thePitchX = " << thePitchX
208  << " thePitchY = " << thePitchY
209  // << " theOffsetX = " << theOffsetX
210  // << " theOffsetY = " << theOffsetY
211  << " theLShiftX = " << theLShiftX;
212  }
213 
214 }
215 
216 //-----------------------------------------------------------------------------
217 // Compute alpha_ and beta_ from the position of this DetUnit.
218 // &&& DOES NOT WORK FOR NOW. d.k. 6/06
219 // The angles from dets are calculated internaly in the PixelCPEInitial class
220 //-----------------------------------------------------------------------------
221 // G. Giurgiu, 12/01/06 : implement the function
222 void PixelCPEBase::
224  const GeomDetUnit & det ) const
225 {
226  //--- This is a new det unit, so cache it
227  theDet = dynamic_cast<const PixelGeomDetUnit*>( &det );
228  if ( ! theDet )
229  {
230  throw cms::Exception("PixelCPEBase::computeAngleFromDetPosition")
231  << " Wrong pointer to pixel detector !!!" << endl;
232 
233  }
234 
235  // get cluster center of gravity (of charge)
236  float xcenter = cl.x();
237  float ycenter = cl.y();
238 
239  // get the cluster position in local coordinates (cm)
240 
241  // ggiurgiu@jhu.edu 12/09/2010 : This function is called without track info, therefore there are no track
242  // angles to provide here. Call the default localPosition (without track info)
243  LocalPoint lp = theTopol->localPosition( MeasurementPoint(xcenter, ycenter) );
244 
245  // get the cluster position in global coordinates (cm)
246  GlobalPoint gp = theDet->surface().toGlobal( lp );
247  float gp_mod = sqrt( gp.x()*gp.x() + gp.y()*gp.y() + gp.z()*gp.z() );
248 
249  // normalize
250  float gpx = gp.x()/gp_mod;
251  float gpy = gp.y()/gp_mod;
252  float gpz = gp.z()/gp_mod;
253 
254  // make a global vector out of the global point; this vector will point from the
255  // origin of the detector to the cluster
256  GlobalVector gv(gpx, gpy, gpz);
257 
258  // make local unit vector along local X axis
259  const Local3DVector lvx(1.0, 0.0, 0.0);
260 
261  // get the unit X vector in global coordinates/
262  GlobalVector gvx = theDet->surface().toGlobal( lvx );
263 
264  // make local unit vector along local Y axis
265  const Local3DVector lvy(0.0, 1.0, 0.0);
266 
267  // get the unit Y vector in global coordinates
268  GlobalVector gvy = theDet->surface().toGlobal( lvy );
269 
270  // make local unit vector along local Z axis
271  const Local3DVector lvz(0.0, 0.0, 1.0);
272 
273  // get the unit Z vector in global coordinates
274  GlobalVector gvz = theDet->surface().toGlobal( lvz );
275 
276  // calculate the components of gv (the unit vector pointing to the cluster)
277  // in the local coordinate system given by the basis {gvx, gvy, gvz}
278  // note that both gv and the basis {gvx, gvy, gvz} are given in global coordinates
279  float gv_dot_gvx = gv.x()*gvx.x() + gv.y()*gvx.y() + gv.z()*gvx.z();
280  float gv_dot_gvy = gv.x()*gvy.x() + gv.y()*gvy.y() + gv.z()*gvy.z();
281  float gv_dot_gvz = gv.x()*gvz.x() + gv.y()*gvz.y() + gv.z()*gvz.z();
282 
283  // calculate angles
284  alpha_ = atan2( gv_dot_gvz, gv_dot_gvx );
285  beta_ = atan2( gv_dot_gvz, gv_dot_gvy );
286 
287  cotalpha_ = gv_dot_gvx / gv_dot_gvz;
288  cotbeta_ = gv_dot_gvy / gv_dot_gvz;
289 
290  with_track_angle = false;
291 }
292 
293 //-----------------------------------------------------------------------------
294 // Compute alpha_ and beta_ from the LocalTrajectoryParameters.
295 // Note: should become const after both localParameters() become const.
296 //-----------------------------------------------------------------------------
297 void PixelCPEBase::
299  const GeomDetUnit & det,
300  const LocalTrajectoryParameters & ltp) const
301 {
302  loc_traj_param_ = ltp;
303 
304  LocalVector localDir = ltp.momentum()/ltp.momentum().mag();
305 
306  // &&& Or, maybe we need to move to the local frame ???
307  // LocalVector localDir( theDet->toLocal(theState.globalDirection()));
308  //thePart = theDet->type().part();
309 
310  float locx = localDir.x();
311  float locy = localDir.y();
312  float locz = localDir.z();
313 
314  /*
315  // Danek's definition
316  alpha_ = acos(locx/sqrt(locx*locx+locz*locz));
317  if ( isFlipped() ) // &&& check for FPIX !!!
318  alpha_ = PI - alpha_ ;
319  beta_ = acos(locy/sqrt(locy*locy+locz*locz));
320  */
321 
322  // &&& In the above, why not use atan2() ?
323  // ggiurgiu@fnal.gov, 01/24/09 : Use it now.
324  alpha_ = atan2( locz, locx );
325  beta_ = atan2( locz, locy );
326 
327  cotalpha_ = locx/locz;
328  cotbeta_ = locy/locz;
329 
330  LocalPoint trk_lp = ltp.position();
331  trk_lp_x = trk_lp.x();
332  trk_lp_y = trk_lp.y();
333 
334  with_track_angle = true;
335 
336 
337  // ggiurgiu@jhu.edu 12/09/2010 : needed to correct for bows/kinks
338  AlgebraicVector5 vec_trk_parameters = ltp.mixedFormatVector();
339  //loc_trk_pred = &Topology::LocalTrackPred( vec_trk_parameters );
340  loc_trk_pred_ = Topology::LocalTrackPred( vec_trk_parameters );
341 
342 }
343 
344 //-----------------------------------------------------------------------------
345 // Estimate theAlpha for barrel, based on the det position.
346 // &&& Needs to be consolidated from the above.
347 //-----------------------------------------------------------------------------
348 //float
349 //PixelCPEBase::estimatedAlphaForBarrel(float centerx) const
350 //{
351 // float tanalpha = theSign * (centerx-theOffsetX) * thePitchX / theDetR;
352 // return PI/2.0 - atan(tanalpha);
353 //}
354 
355 //-----------------------------------------------------------------------------
356 // The local position.
357 // Should do correctly the big pixels.
358 //-----------------------------------------------------------------------------
361  const GeomDetUnit & det) const {
362  setTheDet( det, cluster );
363 
364  float lpx = xpos(cluster);
365  float lpy = ypos(cluster);
366  float lxshift = theLShiftX * thePitchX; // shift in cm
367  float lyshift = theLShiftY * thePitchY;
368  LocalPoint cdfsfs(lpx-lxshift, lpy-lyshift);
369  return cdfsfs;
370 }
371 
372 //-----------------------------------------------------------------------------
373 // Seems never used?
374 //-----------------------------------------------------------------------------
377  const GeomDetUnit & det) const {
378 
379  LocalPoint lp = localPosition(cluster,det);
380 
381  // ggiurgiu@jhu.edu 12/09/2010 : trk angles needed for bow/kink correction
382 
383  if ( with_track_angle )
385  else
386  return theTopol->measurementPosition( lp );
387 
388 }
389 
390 
391 //-----------------------------------------------------------------------------
392 // Once we have the position, feed it to the topology to give us
393 // the error.
394 // &&& APPARENTLY THIS METHOD IS NOT BEING USED ??? (Delete it?)
395 //-----------------------------------------------------------------------------
397 PixelCPEBase::measurementError( const SiPixelCluster& cluster, const GeomDetUnit & det) const
398 {
399  LocalPoint lp( localPosition(cluster, det) );
400  LocalError le( localError( cluster, det) );
401 
402  // ggiurgiu@jhu.edu 12/09/2010 : trk angles needed for bow/kink correction
403  if ( with_track_angle )
405  else
406  return theTopol->measurementError( lp, le );
407 }
408 
409 //-----------------------------------------------------------------------------
410 // The isFlipped() is a silly way to determine which detectors are inverted.
411 // In the barrel for every 2nd ladder the E field direction is in the
412 // global r direction (points outside from the z axis), every other
413 // ladder has the E field inside. Something similar is in the
414 // forward disks (2 sides of the blade). This has to be recognised
415 // because the charge sharing effect is different.
416 //
417 // The isFliped does it by looking and the relation of the local (z always
418 // in the E direction) to global coordinates. There is probably a much
419 // better way.
420 //-----------------------------------------------------------------------------
422 {
423  // Check the relative position of the local +/- z in global coordinates.
424  float tmp1 = theDet->surface().toGlobal(Local3DPoint(0.,0.,0.)).perp();
425  float tmp2 = theDet->surface().toGlobal(Local3DPoint(0.,0.,1.)).perp();
426  //cout << " 1: " << tmp1 << " 2: " << tmp2 << endl;
427  if ( tmp2<tmp1 ) return true;
428  else return false;
429 }
430 
431 //-----------------------------------------------------------------------------
432 // HALF OF the Lorentz shift (so for the full shift multiply by 2), and
433 // in the units of pitch. (So note these are neither local nor measurement
434 // units!)
435 //-----------------------------------------------------------------------------
437 {
439  Param & p = const_cast<PixelCPEBase*>(this)->m_Params[ theDet->geographicalId().rawId() ];
440  if ( p.topology )
441  {
442  //cout << "--------------- old ----------------------" << endl;
443  //cout << "p.topology = " << p.topology << endl;
444  dir = p.drift;
445  //cout << "same direction: dir = " << dir << endl;
446  }
447  else
448  {
449  //cout << "--------------- new ----------------------" << endl;
450  //cout << "p.topology = " << p.topology << endl;
451 
452  // ggiurgiu@jhu.edu 12/09/2010 : no longer need to cast
453  //p.topology = (RectangularPixelTopology*)( & ( theDet->specificTopology() ) );
454  p.topology = &( theDet->specificTopology() );
455 
457  dir = p.drift;
458  //cout << "p.topology = " << p.topology << endl;
459  //cout << "new direction: dir = " << dir << endl;
460 
461  }
462  //LocalVector dir = driftDirection(magfield_->inTesla(theDet->surface().position()) );
463 
464  // max shift in cm
465  float xdrift = dir.x()/dir.z() * theThickness;
466  // express the shift in units of pitch,
467  // divide by 2 to get the average correction
468  float lshift = xdrift / thePitchX / 2.;
469 
470  //cout << "Lorentz Drift = " << lshift << endl;
471  //cout << "X Drift = " << dir.x() << endl;
472  //cout << "Z Drift = " << dir.z() << endl;
473 
474  return lshift;
475 
476 
477 }
478 
480 {
481 
483 
484  Param & p = const_cast<PixelCPEBase*>(this)->m_Params[ theDet->geographicalId().rawId() ];
485  if ( p.topology )
486  {
487  //cout << "--------------- old y ----------------------" << endl;
488  //cout << "p.topology y = " << p.topology << endl;
489  dir = p.drift;
490  //cout << "same direction y: dir = " << dir << endl;
491  }
492  else
493  {
494  //cout << "--------------- new y ----------------------" << endl;
495  //cout << "p.topology y = " << p.topology << endl;
496 
497  //p.topology = (RectangularPixelTopology*)( & ( theDet->specificTopology() ) );
498  p.topology = &( theDet->specificTopology() );
499 
501  dir = p.drift;
502  //cout << "p.topology y = " << p.topology << endl;
503  //cout << "new direction y: dir = " << dir << endl;
504 
505  }
506 
507  //LocalVector dir = driftDirection(magfield_->inTesla(theDet->surface().position()) );
508 
509  float ydrift = dir.y()/dir.z() * theThickness;
510  float lshift = ydrift / thePitchY / 2.;
511  return lshift;
512 
513 
514 }
515 
516 //-----------------------------------------------------------------------------
517 // Sum the pixels in the first and the last row, and the total. Returns
518 // a vector of three elements with q_first, q_last and q_total.
519 // &&& Really need a simpler & cleaner way, this is very confusing...
520 //-----------------------------------------------------------------------------
521 void PixelCPEBase::xCharge(const vector<SiPixelCluster::Pixel>& pixelsVec,
522  const int& imin, const int& imax,
523  float& q1, float& q2) const {
524  //calculate charge in the first and last pixel in y
525  // and the total cluster charge
526  q1 = 0.0;
527  q2 = 0.0;
528  float qm = 0.0;
529  int isize = pixelsVec.size();
530  for (int i=0; i<isize; ++i) {
531  if ( (pixelsVec[i].x) == imin )
532  q1 += pixelsVec[i].adc;
533  else if ( (pixelsVec[i].x) == imax)
534  q2 += float(pixelsVec[i].adc);
535  else
536  qm += float(pixelsVec[i].adc);
537  }
538  return;
539 }
540 //-----------------------------------------------------------------------------
541 // Sum the pixels in the first and the last column, and the total. Returns
542 // a vector of three elements with q_first, q_last and q_total.
543 // &&& Really need a simpler & cleaner way, this is very confusing...
544 //-----------------------------------------------------------------------------
545 void PixelCPEBase::yCharge(const vector<SiPixelCluster::Pixel>& pixelsVec,
546  const int& imin, const int& imax,
547  float& q1, float& q2) const {
548 
549  //calculate charge in the first and last pixel in y
550  // and the inner cluster charge
551  q1 = 0;
552  q2 = 0;
553  float qm=0;
554  int isize = pixelsVec.size();
555  for (int i=0; i<isize; ++i) {
556  if ( (pixelsVec[i].y) == imin)
557  q1 += pixelsVec[i].adc;
558  else if ( (pixelsVec[i].y) == imax)
559  q2 += pixelsVec[i].adc;
560  //else if (pixelsVec[i].y < ymax && pixelsVec[i].y > ymin )
561  else
562  qm += float(pixelsVec[i].adc);
563  }
564  return;
565 }
566 //-----------------------------------------------------------------------------
567 // Drift direction.
568 // Works OK for barrel and forward.
569 // The formulas used for dir_x,y,z have to be exactly the same as the ones
570 // used in the digitizer (SiPixelDigitizerAlgorithm.cc).
571 // Assumption: setTheDet() has been called already.
572 //
573 // Petar (2/23/07): uhm, actually, there is a bug in the sign for both X and Y!
574 // (The signs have been fixed in SiPixelDigitizer, but not in here.)
575 //-----------------------------------------------------------------------------
578 
579  Frame detFrame(theDet->surface().position(), theDet->surface().rotation());
580  LocalVector Bfield = detFrame.toLocal(bfield);
581 
582  if(lorentzAngle_ == 0){
583  throw cms::Exception("invalidPointer") << "[PixelCPEBase::driftDirection] zero pointer to lorentz angle record ";
584  }
586  float alpha2;
587  if (alpha2Order) {
588  alpha2 = langle*langle;
589  } else {
590  alpha2 = 0.0;
591  }
592  // &&& dir_x should have a "-" and dir_y a "+"
593  float dir_x = ( langle * Bfield.y() + alpha2* Bfield.z()* Bfield.x() );
594  float dir_y = -( langle * Bfield.x() - alpha2* Bfield.z()* Bfield.y() );
595  float dir_z = -( 1 + alpha2* Bfield.z()*Bfield.z() );
596  float scale = (1 + alpha2* Bfield.z()*Bfield.z() );
597  LocalVector theDriftDirection = LocalVector(dir_x/scale, dir_y/scale, dir_z/scale );
598  if ( theVerboseLevel > 9 )
599  LogDebug("PixelCPEBase") << " The drift direction in local coordinate is "
600  << theDriftDirection ;
601 
602  return theDriftDirection;
603 }
604 
605 //-----------------------------------------------------------------------------
606 // One-shot computation of the driftDirection and both lorentz shifts
607 //-----------------------------------------------------------------------------
608 void
610 {
611  Frame detFrame(theDet->surface().position(), theDet->surface().rotation());
612  GlobalVector global_Bfield = magfield_->inTesla( theDet->surface().position() );
613  LocalVector Bfield = detFrame.toLocal(global_Bfield);
614  if(lorentzAngle_ == 0){
615  throw cms::Exception("invalidPointer") << "[PixelCPEBase::computeLorentzShifts] zero pointer to lorentz angle record ";
616  }
618  double alpha2;
619  if ( alpha2Order) {
620  alpha2 = langle * langle;
621  }
622  else {
623  alpha2 = 0.0;
624  }
625 
626  // **********************************************************************
627  // Our convention is the following:
628  // +x is defined by the direction of the Lorentz drift!
629  // +z is defined by the direction of E field (so electrons always go into -z!)
630  // +y is defined by +x and +z, and it turns out to be always opposite to the +B field.
631  // **********************************************************************
632 
633  // Note correct signs for dir_x and dir_y!
634  double dir_x = -( langle * Bfield.y() + alpha2* Bfield.z()* Bfield.x() );
635  double dir_y = ( langle * Bfield.x() - alpha2* Bfield.z()* Bfield.y() );
636  double dir_z = -( 1 + alpha2* Bfield.z()* Bfield.z() );
637 
638  // &&& Why do we need to scale???
639  //double scale = (1 + alpha2* Bfield.z()*Bfield.z() );
640  double scale = fabs( dir_z ); // same as 1 + alpha2*Bfield.z()*Bfield.z()
641  driftDirection_ = LocalVector(dir_x/scale, dir_y/scale, dir_z/scale ); // last is -1 !
642 
643  // Max shift (at the other side of the sensor) in cm
645  // Express the shift in units of pitch,
647 
648  // Max shift (at the other side of the sensor) in cm
650  // Express the shift in units of pitch,
652 
653 
654  if ( theVerboseLevel > 9 ) {
655  LogDebug("PixelCPEBase") << " The drift direction in local coordinate is "
656  << driftDirection_ ;
657 
658 // cout << "Lorentz Drift (in cm) along X = " << lorentzShiftInCmX_ << endl;
659 // cout << "Lorentz Drift (in cm) along Y = " << lorentzShiftInCmY_ << endl;
660  }
661 }
662 
663 //-----------------------------------------------------------------------------
668 //-----------------------------------------------------------------------------
671 {
673 
675  qualWord );
676 
678  qualWord );
679 
681  qualWord );
682 
684  qualWord );
685 
687  qualWord );
688 
690  qualWord );
691 
693  qualWord );
694 
695  return qualWord;
696 }
int adc(sample_type sample)
get the ADC sample (12 bits)
#define LogDebug(id)
double lorentzShiftX_
Definition: PixelCPEBase.h:247
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
Topology::LocalTrackPred loc_trk_pred_
Definition: PixelCPEBase.h:270
PixelCPEBase(edm::ParameterSet const &conf, const MagneticField *mag=0, const SiPixelLorentzAngle *lorentzAngle=0, const SiPixelCPEGenericErrorParm *genErrorParm=0, const SiPixelTemplateDBObject *templateDBobject=0)
Definition: PixelCPEBase.cc:44
int minPixelCol() const
Local3DVector LocalVector
Definition: LocalVector.h:12
float theNumOfRow
Definition: PixelCPEBase.h:195
bool with_track_angle
Definition: PixelCPEBase.h:220
virtual bool containsBigPixelInX(const int &ixmin, const int &ixmax) const =0
T perp() const
Definition: PV3DBase.h:66
void setIsOnEdge(bool flag, QualWordType &qualWord)
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
#define PI
void setProbabilityXY(float prob, QualWordType &qualWord)
virtual int ncolumns() const =0
void setSpansTwoROCs(bool flag, QualWordType &qualWord)
LocalPoint position() const
Local x and y position coordinates.
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
void setHasBadPixels(bool flag, QualWordType &qualWord)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
void computeAnglesFromDetPosition(const SiPixelCluster &cl, const GeomDetUnit &det) const
void xCharge(const std::vector< SiPixelCluster::Pixel > &, const int &, const int &, float &q1, float &q2) const
float theLShiftY
Definition: PixelCPEBase.h:200
float theThickness
Definition: PixelCPEBase.h:190
unsigned int clusterProbComputationFlag_
Definition: PixelCPEBase.h:238
T y() const
Definition: PV3DBase.h:57
virtual int nrows() const =0
SiPixelRecHitQuality::QualWordType rawQualityWord() const
void yCharge(const std::vector< SiPixelCluster::Pixel > &, const int &, const int &, float &q1, float &q2) const
MeasurementError measurementError(const SiPixelCluster &, const GeomDetUnit &det) const
float probabilityQ_
Definition: PixelCPEBase.h:225
bool spansTwoROCs_
Definition: PixelCPEBase.h:229
GeomDetType::SubDetector thePart
Definition: PixelCPEBase.h:188
double q2[4]
Definition: TauolaWrapper.h:88
virtual float ypos(const SiPixelCluster &) const =0
float theNumOfCol
Definition: PixelCPEBase.h:196
double lorentzShiftInCmY_
Definition: PixelCPEBase.h:250
int maxPixelRow() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
virtual float thickness() const =0
void setProbabilityQ(float prob, QualWordType &qualWord)
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
virtual bool isItEdgePixelInX(int ixbin) const =0
T mag() const
Definition: PV3DBase.h:61
int minPixelRow() const
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
bool hasBadPixels_
Definition: PixelCPEBase.h:228
LocalVector driftDirection_
Definition: PixelCPEBase.h:246
void computeLorentzShifts() const
bool isFlipped() const
void computeAnglesFromTrajectory(const SiPixelCluster &cl, const GeomDetUnit &det, const LocalTrajectoryParameters &ltp) const
T sqrt(T t)
Definition: SSEVec.h:28
bool hasFilledProb_
Definition: PixelCPEBase.h:230
T z() const
Definition: PV3DBase.h:58
LocalVector driftDirection(GlobalVector bfield) const
double lorentzShiftInCmX_
Definition: PixelCPEBase.h:249
const SiPixelTemplateDBObject * templateDBobject_
Definition: PixelCPEBase.h:263
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:74
const MagneticField * magfield_
Definition: PixelCPEBase.h:257
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
LocalVector momentum() const
Momentum vector in the local frame.
virtual bool containsBigPixelInY(const int &iymin, const int &iymax) const =0
const std::vector< uint16_t > & pixelADC() const
tuple conf
Definition: dbtoconf.py:185
virtual LocalError localError(const SiPixelCluster &cl, const GeomDetUnit &det) const =0
virtual std::pair< float, float > pitch() const =0
Point3DBase< float, LocalTag > Local3DPoint
Definition: LocalPoint.h:9
const Bounds & bounds() const
Definition: BoundSurface.h:89
void setHasFilledProb(bool flag, QualWordType &qualWord)
ROOT::Math::SVector< double, 5 > AlgebraicVector5
LocalTrajectoryParameters loc_traj_param_
Definition: PixelCPEBase.h:272
double q1[4]
Definition: TauolaWrapper.h:87
const SiPixelLorentzAngle * lorentzAngle_
Definition: PixelCPEBase.h:259
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
const PixelTopology * theTopol
Definition: PixelCPEBase.h:185
MeasurementPoint measurementPosition(const SiPixelCluster &, const GeomDetUnit &det) const
int maxPixelCol() const
AlgebraicVector5 mixedFormatVector() const
void setTheDet(const GeomDetUnit &det, const SiPixelCluster &cluster) const
Definition: PixelCPEBase.cc:95
virtual float lorentzShiftX() const
Pixel cluster – collection of neighboring pixels above threshold.
virtual bool isItEdgePixelInY(int iybin) const =0
float probabilityXY() const
Definition: PixelCPEBase.h:137
float getLorentzAngle(const uint32_t &) const
float y() const
const RotationType & rotation() const
Params m_Params
Definition: PixelCPEBase.h:355
virtual const GeomDetType & type() const
void setQBin(int qbin, QualWordType &qualWord)
dbl *** dir
Definition: mlp_gen.cc:35
const PixelGeomDetUnit * theDet
Definition: PixelCPEBase.h:181
Definition: DDAxes.h:10
float theLShiftX
Definition: PixelCPEBase.h:199
PixelTopology const * topology
Definition: PixelCPEBase.h:347
double lorentzShiftY_
Definition: PixelCPEBase.h:248
virtual float lorentzShiftY() const
T x() const
Definition: PV3DBase.h:56
const float degsPerRad
Definition: PixelCPEBase.cc:38
const PositionType & position() const
virtual LocalPoint localPosition(const SiPixelCluster &cl, const GeomDetUnit &det) const
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
float x() const
SubDetector subDetector() const
Definition: GeomDetType.h:22
const SiPixelCPEGenericErrorParm * genErrorParm_
Definition: PixelCPEBase.h:261
virtual float xpos(const SiPixelCluster &) const =0