CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Protected Types | Protected Attributes | Private Types | Private Member Functions | Private Attributes
PixelCPEBase Class Referenceabstract

#include <PixelCPEBase.h>

Inheritance diagram for PixelCPEBase:
PixelClusterParameterEstimator PixelCPEGeneric PixelCPETemplateReco

Classes

struct  ClusterParam
 
struct  DetParam
 

Public Member Functions

ReturnType getParameters (const SiPixelCluster &cl, const GeomDetUnit &det) const
 
ReturnType getParameters (const SiPixelCluster &cl, const GeomDetUnit &det, const LocalTrajectoryParameters &ltp) const
 
 PixelCPEBase (edm::ParameterSet const &conf, const MagneticField *mag, const TrackerGeometry &geom, const SiPixelLorentzAngle *lorentzAngle, const SiPixelGenErrorDBObject *genErrorDBObject, const SiPixelTemplateDBObject *templateDBobject, const SiPixelLorentzAngle *lorentzAngleWidth, int flag=0)
 
- Public Member Functions inherited from PixelClusterParameterEstimator
unsigned int clusterProbComputationFlag () const
 
virtual ReturnType getParameters (const SiPixelCluster &cl, const GeomDetUnit &det, const TrajectoryStateOnSurface &tsos) const
 
virtual VLocalValues localParametersV (const SiPixelCluster &cluster, const GeomDetUnit &gd) const
 
virtual VLocalValues localParametersV (const SiPixelCluster &cluster, const GeomDetUnit &gd, TrajectoryStateOnSurface &tsos) const
 
 PixelClusterParameterEstimator ()
 
virtual ~PixelClusterParameterEstimator ()
 

Protected Types

typedef GloballyPositioned
< double > 
Frame
 

Protected Attributes

bool alpha2Order
 
bool DoLorentz_
 
const SiPixelGenErrorDBObjectgenErrorDBObject_
 
const TrackerGeometrygeom_
 
float lAOffset_
 
float lAWidthBPix_
 
float lAWidthFPix_
 
bool LoadTemplatesFromDB_
 
const SiPixelLorentzAnglelorentzAngle_
 
const SiPixelLorentzAnglelorentzAngleWidth_
 
const MagneticFieldmagfield_
 
const SiPixelTemplateDBObjecttemplateDBobject_
 
int theFlag_
 
int theVerboseLevel
 
bool useLAOffsetFromConfig_
 
bool useLAWidthFromConfig_
 
bool useLAWidthFromDB_
 
- Protected Attributes inherited from PixelClusterParameterEstimator
unsigned int clusterProbComputationFlag_
 

Private Types

using DetParams = std::vector< DetParam >
 

Private Member Functions

void computeAnglesFromDetPosition (DetParam const &theDetParam, ClusterParam &theClusterParam) const
 
void computeAnglesFromTrajectory (DetParam const &theDetParam, ClusterParam &theClusterParam, const LocalTrajectoryParameters &ltp) const
 
void computeLorentzShifts (DetParam &) const
 
virtual ClusterParamcreateClusterParam (const SiPixelCluster &cl) const =0
 
DetParam const & detParam (const GeomDetUnit &det) const
 
LocalVector driftDirection (DetParam &theDetParam, GlobalVector bfield) const
 
LocalVector driftDirection (DetParam &theDetParam, LocalVector bfield) const
 
void fillDetParams ()
 
bool isFlipped (DetParam const &theDetParam) const
 
virtual LocalError localError (DetParam const &theDetParam, ClusterParam &theClusterParam) const =0
 
virtual LocalPoint localPosition (DetParam const &theDetParam, ClusterParam &theClusterParam) const =0
 
SiPixelRecHitQuality::QualWordType rawQualityWord (ClusterParam &theClusterParam) const
 
void setTheClu (DetParam const &, ClusterParam &theClusterParam) const
 

Private Attributes

DetParams m_DetParams =DetParams(1440)
 

Additional Inherited Members

- Public Types inherited from PixelClusterParameterEstimator
typedef std::pair< LocalPoint,
LocalError
LocalValues
 
using ReturnType = std::tuple< LocalPoint, LocalError, SiPixelRecHitQuality::QualWordType >
 
typedef std::vector< LocalValuesVLocalValues
 

Detailed Description

Definition at line 53 of file PixelCPEBase.h.

Member Typedef Documentation

using PixelCPEBase::DetParams = std::vector<DetParam>
private

Definition at line 278 of file PixelCPEBase.h.

typedef GloballyPositioned<double> PixelCPEBase::Frame
protected

Definition at line 215 of file PixelCPEBase.h.

Constructor & Destructor Documentation

PixelCPEBase::PixelCPEBase ( edm::ParameterSet const &  conf,
const MagneticField mag,
const TrackerGeometry geom,
const SiPixelLorentzAngle lorentzAngle,
const SiPixelGenErrorDBObject genErrorDBObject,
const SiPixelTemplateDBObject templateDBobject,
const SiPixelLorentzAngle lorentzAngleWidth,
int  flag = 0 
)

Definition at line 41 of file PixelCPEBase.cc.

References alpha2Order, PixelClusterParameterEstimator::clusterProbComputationFlag_, DoLorentz_, edm::ParameterSet::existsAs(), fillDetParams(), genErrorDBObject_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), lAOffset_, lAWidthBPix_, lAWidthFPix_, LoadTemplatesFromDB_, LogDebug, lorentzAngle_, lorentzAngleWidth_, templateDBobject_, theFlag_, theVerboseLevel, useLAOffsetFromConfig_, useLAWidthFromConfig_, and useLAWidthFromDB_.

Referenced by PixelCPEGeneric::PixelCPEGeneric().

50  : useLAOffsetFromConfig_(false),
52  magfield_(mag), geom_(geom)
53 {
54 
55 #ifdef EDM_ML_DEBUG
56  nRecHitsTotal_=0;
57  nRecHitsUsedEdge_=0,
58 #endif
59 
60  //--- Lorentz angle tangent per Tesla
61  lorentzAngle_ = lorentzAngle;
62  lorentzAngleWidth_ = lorentzAngleWidth;
63 
64  //-- GenError Calibration Object (different from SiPixelCPEGenericErrorParm) from DB
65  genErrorDBObject_ = genErrorDBObject;
66  //cout<<" new errors "<<genErrorDBObject<<" "<<genErrorDBObject_<<endl;
67 
68  //-- Template Calibration Object from DB
69 #ifdef NEW_CPEERROR
70  if(theFlag_!=0) templateDBobject_ = templateDBobject;
71 #else
72  templateDBobject_ = templateDBobject;
73 #endif
74 
75  // Configurables
76  // For both templates & generic
77 
78  // Read templates and/or generic errors from DB
79  LoadTemplatesFromDB_ = conf.getParameter<bool>("LoadTemplatesFromDB");
80 
81  //--- Algorithm's verbosity
83  conf.getUntrackedParameter<int>("VerboseLevel",0);
84 
85  //-- Switch on/off E.B
86  alpha2Order = conf.getParameter<bool>("Alpha2Order");
87 
88  //--- A flag that could be used to change the behavior of
89  //--- clusterProbability() in TSiPixelRecHit (the *transient* one).
90  //--- The problem is that the transient hits are made after the CPE runs
91  //--- and they don't get the access to the PSet, so we pass it via the
92  //--- CPE itself...
93  //
95  = (unsigned int) conf.getParameter<int>("ClusterProbComputationFlag");
96 
97  // This LA related parameters are only relevant for the Generic algo
98  // They still have to be used in Base since the LA computation is in Base
99 
100  // Use LA-width from DB.
101  // If both (this and from config) are false LA-width is calcuated from LA-offset
102  useLAWidthFromDB_ = conf.existsAs<bool>("useLAWidthFromDB")?
103  conf.getParameter<bool>("useLAWidthFromDB"):false;
104 
105  // Use Alignment LA-offset in generic
106  //useLAAlignmentOffsets_ = conf.existsAs<bool>("useLAAlignmentOffsets")?
107  //conf.getParameter<bool>("useLAAlignmentOffsets"):false;
108 
109 
110  // Used only for testing
111  lAOffset_ = conf.existsAs<double>("lAOffset")? // fixed LA value
112  conf.getParameter<double>("lAOffset"):0.0;
113  lAWidthBPix_ = conf.existsAs<double>("lAWidthBPix")? // fixed LA width
114  conf.getParameter<double>("lAWidthBPix"):0.0;
115  lAWidthFPix_ = conf.existsAs<double>("lAWidthFPix")? // fixed LA width
116  conf.getParameter<double>("lAWidthFPix"):0.0;
117 
118  // Use LA-offset from config, for testing only
119  if(lAOffset_>0.0) useLAOffsetFromConfig_ = true;
120  // Use LA-width from config, split into fpix & bpix, for testing only
121  if(lAWidthBPix_>0.0 || lAWidthFPix_>0.0) useLAWidthFromConfig_ = true;
122 
123 
124  // For Templates only
125  // Compute the Lorentz shifts for this detector element for templates (from Alignment)
126  DoLorentz_ = conf.existsAs<bool>("DoLorentz")?conf.getParameter<bool>("DoLorentz"):false;
127 
128  LogDebug("PixelCPEBase") <<" LA constants - "
129  <<lAOffset_<<" "<<lAWidthBPix_<<" "<<lAWidthFPix_<<endl; //dk
130 
131  fillDetParams();
132 
133 }
#define LogDebug(id)
const SiPixelLorentzAngle * lorentzAngleWidth_
Definition: PixelCPEBase.h:244
void fillDetParams()
bool useLAWidthFromDB_
Definition: PixelCPEBase.h:234
float lAWidthBPix_
Definition: PixelCPEBase.h:229
bool useLAWidthFromConfig_
Definition: PixelCPEBase.h:233
bool LoadTemplatesFromDB_
Definition: PixelCPEBase.h:253
const SiPixelTemplateDBObject * templateDBobject_
Definition: PixelCPEBase.h:249
const MagneticField * magfield_
Definition: PixelCPEBase.h:240
tuple conf
Definition: dbtoconf.py:185
const SiPixelLorentzAngle * lorentzAngle_
Definition: PixelCPEBase.h:243
const SiPixelGenErrorDBObject * genErrorDBObject_
Definition: PixelCPEBase.h:246
bool useLAOffsetFromConfig_
Definition: PixelCPEBase.h:232
const TrackerGeometry & geom_
Definition: PixelCPEBase.h:241
float lAWidthFPix_
Definition: PixelCPEBase.h:230

Member Function Documentation

void PixelCPEBase::computeAnglesFromDetPosition ( DetParam const &  theDetParam,
ClusterParam theClusterParam 
) const
private

Definition at line 328 of file PixelCPEBase.cc.

References PixelCPEBase::ClusterParam::cotalpha, PixelCPEBase::ClusterParam::cotbeta, Topology::localPosition(), PixelCPEBase::ClusterParam::theCluster, PixelCPEBase::DetParam::theOrigin, PixelCPEBase::DetParam::theTopol, PixelCPEBase::ClusterParam::with_track_angle, PV3DBase< T, PVType, FrameType >::x(), SiPixelCluster::x(), PV3DBase< T, PVType, FrameType >::y(), SiPixelCluster::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by getParameters().

329 {
330 
331 
332  /*
333  // get cluster center of gravity (of charge)
334  float xcenter = cl.x();
335  float ycenter = cl.y();
336 
337  // get the cluster position in local coordinates (cm)
338 
339  // ggiurgiu@jhu.edu 12/09/2010 : This function is called without track info, therefore there are no track
340  // angles to provide here. Call the default localPosition (without track info)
341  LocalPoint lp = theTopol->localPosition( MeasurementPoint(xcenter, ycenter) );
342 
343 
344  // get the cluster position in global coordinates (cm)
345  GlobalPoint gp = theDet->surface().toGlobal( lp );
346  float gp_mod = sqrt( gp.x()*gp.x() + gp.y()*gp.y() + gp.z()*gp.z() );
347 
348  // normalize
349  float gpx = gp.x()/gp_mod;
350  float gpy = gp.y()/gp_mod;
351  float gpz = gp.z()/gp_mod;
352 
353  // make a global vector out of the global point; this vector will point from the
354  // origin of the detector to the cluster
355  GlobalVector gv(gpx, gpy, gpz);
356 
357  // make local unit vector along local X axis
358  const Local3DVector lvx(1.0, 0.0, 0.0);
359 
360  // get the unit X vector in global coordinates/
361  GlobalVector gvx = theDet->surface().toGlobal( lvx );
362 
363  // make local unit vector along local Y axis
364  const Local3DVector lvy(0.0, 1.0, 0.0);
365 
366  // get the unit Y vector in global coordinates
367  GlobalVector gvy = theDet->surface().toGlobal( lvy );
368 
369  // make local unit vector along local Z axis
370  const Local3DVector lvz(0.0, 0.0, 1.0);
371 
372  // get the unit Z vector in global coordinates
373  GlobalVector gvz = theDet->surface().toGlobal( lvz );
374 
375  // calculate the components of gv (the unit vector pointing to the cluster)
376  // in the local coordinate system given by the basis {gvx, gvy, gvz}
377  // note that both gv and the basis {gvx, gvy, gvz} are given in global coordinates
378  float gv_dot_gvx = gv.x()*gvx.x() + gv.y()*gvx.y() + gv.z()*gvx.z();
379  float gv_dot_gvy = gv.x()*gvy.x() + gv.y()*gvy.y() + gv.z()*gvy.z();
380  float gv_dot_gvz = gv.x()*gvz.x() + gv.y()*gvz.y() + gv.z()*gvz.z();
381  */
382 
383  // all the above is equivalent to
384  LocalPoint lp = theDetParam.theTopol->localPosition( MeasurementPoint(theClusterParam.theCluster->x(), theClusterParam.theCluster->y()) );
385  auto gvx = lp.x()-theDetParam.theOrigin.x();
386  auto gvy = lp.y()-theDetParam.theOrigin.y();
387  auto gvz = -1.f/theDetParam.theOrigin.z();
388  // normalization not required as only ratio used...
389 
390 
391  //theClusterParam.zneg = (gvz < 0); // Not used, AH
392 
393  // calculate angles
394  theClusterParam.cotalpha = gvx*gvz;
395  theClusterParam.cotbeta = gvy*gvz;
396 
397  theClusterParam.with_track_angle = false;
398 
399 
400  /*
401  // used only in dberror param...
402  auto alpha = HALF_PI - std::atan(cotalpha_);
403  auto beta = HALF_PI - std::atan(cotbeta_);
404  if (zneg) { beta -=PI; alpha -=PI;}
405 
406  auto alpha_ = atan2( gv_dot_gvz, gv_dot_gvx );
407  auto beta_ = atan2( gv_dot_gvz, gv_dot_gvy );
408 
409  assert(std::abs(std::round(alpha*10000.f)-std::round(alpha_*10000.f))<2);
410  assert(std::abs(std::round(beta*10000.f)-std::round(beta_*10000.f))<2);
411  */
412 
413 }
T y() const
Definition: PV3DBase.h:63
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
T x() const
Definition: PV3DBase.h:62
void PixelCPEBase::computeAnglesFromTrajectory ( DetParam const &  theDetParam,
ClusterParam theClusterParam,
const LocalTrajectoryParameters ltp 
) const
private

Definition at line 266 of file PixelCPEBase.cc.

References PixelCPEBase::ClusterParam::cotalpha, PixelCPEBase::ClusterParam::cotbeta, PixelCPEBase::ClusterParam::loc_trk_pred, LocalTrajectoryParameters::mixedFormatVector(), LocalTrajectoryParameters::momentum(), LocalTrajectoryParameters::position(), PixelCPEBase::ClusterParam::trk_lp_x, PixelCPEBase::ClusterParam::trk_lp_y, PixelCPEBase::ClusterParam::with_track_angle, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by getParameters().

268 {
269  //cout<<" in PixelCPEBase:computeAnglesFromTrajectory - "<<endl; //dk
270 
271  //theClusterParam.loc_traj_param = ltp;
272 
273  LocalVector localDir = ltp.momentum();
274 
275 
276  float locx = localDir.x();
277  float locy = localDir.y();
278  float locz = localDir.z();
279 
280  /*
281  // Danek's definition
282  alpha_ = acos(locx/sqrt(locx*locx+locz*locz));
283  if ( isFlipped() ) // &&& check for FPIX !!!
284  alpha_ = PI - alpha_ ;
285  beta_ = acos(locy/sqrt(locy*locy+locz*locz));
286  */
287 
288 
289  theClusterParam.cotalpha = locx/locz;
290  theClusterParam.cotbeta = locy/locz;
291  //theClusterParam.zneg = (locz < 0); // Not used, AH
292 
293 
294  LocalPoint trk_lp = ltp.position();
295  theClusterParam.trk_lp_x = trk_lp.x();
296  theClusterParam.trk_lp_y = trk_lp.y();
297 
298  theClusterParam.with_track_angle = true;
299 
300 
301  // ggiurgiu@jhu.edu 12/09/2010 : needed to correct for bows/kinks
302  AlgebraicVector5 vec_trk_parameters = ltp.mixedFormatVector();
303  theClusterParam.loc_trk_pred = Topology::LocalTrackPred( vec_trk_parameters );
304 
305 }
LocalPoint position() const
Local x and y position coordinates.
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
LocalVector momentum() const
Momentum vector in the local frame.
ROOT::Math::SVector< double, 5 > AlgebraicVector5
AlgebraicVector5 mixedFormatVector() const
T x() const
Definition: PV3DBase.h:62
void PixelCPEBase::computeLorentzShifts ( DetParam theDetParam) const
private

Definition at line 547 of file PixelCPEBase.cc.

References PixelCPEBase::DetParam::driftDirection, LogDebug, PixelCPEBase::DetParam::lorentzShiftInCmX, PixelCPEBase::DetParam::lorentzShiftInCmY, PixelCPEBase::DetParam::theThickness, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by fillDetParams().

547  {
548 
549  //cout<<" in PixelCPEBase:computeLorentzShifts - "<<driftDirection_<<endl; //dk
550 
551  // Max shift (at the other side of the sensor) in cm
552  theDetParam.lorentzShiftInCmX = theDetParam.driftDirection.x()/theDetParam.driftDirection.z() * theDetParam.theThickness; //
553  theDetParam.lorentzShiftInCmY = theDetParam.driftDirection.y()/theDetParam.driftDirection.z() * theDetParam.theThickness; //
554 
555  //cout<<" in PixelCPEBase:computeLorentzShifts - "
556  //<<lorentzShiftInCmX_<<" "
557  //<<lorentzShiftInCmY_<<" "
558  //<<endl; //dk
559 
560  LogDebug("PixelCPEBase") << " The drift direction in local coordinate is "
561  << theDetParam.driftDirection ;
562 }
#define LogDebug(id)
virtual ClusterParam* PixelCPEBase::createClusterParam ( const SiPixelCluster cl) const
privatepure virtual

Implemented in PixelCPEGeneric, and PixelCPETemplateReco.

Referenced by getParameters().

PixelCPEBase::DetParam const & PixelCPEBase::detParam ( const GeomDetUnit det) const
private

Definition at line 439 of file PixelCPEBase.cc.

References i, GeomDet::index(), m_DetParams, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by getParameters().

439  {
440  auto i = det.index();
441  //cout << "get parameters of detector " << i << endl;
442  assert(i<int(m_DetParams.size()));
443  //if (i>=int(m_DetParams.size())) m_DetParams.resize(i+1); // should never happen!
444  const DetParam & p = m_DetParams[i];
445  return p;
446 }
int i
Definition: DBlmapReader.cc:9
DetParams m_DetParams
Definition: PixelCPEBase.h:280
int index() const
Definition: GeomDet.h:97
LocalVector PixelCPEBase::driftDirection ( DetParam theDetParam,
GlobalVector  bfield 
) const
private

Definition at line 456 of file PixelCPEBase.cc.

References GloballyPositioned< T >::position(), GloballyPositioned< T >::rotation(), GeomDet::surface(), and PixelCPEBase::DetParam::theDet.

Referenced by fillDetParams().

456  {
457 
458  Frame detFrame(theDetParam.theDet->surface().position(), theDetParam.theDet->surface().rotation());
459  LocalVector Bfield = detFrame.toLocal(bfield);
460  return driftDirection(theDetParam,Bfield);
461 
462 }
LocalVector driftDirection(DetParam &theDetParam, GlobalVector bfield) const
GloballyPositioned< double > Frame
Definition: PixelCPEBase.h:215
LocalVector PixelCPEBase::driftDirection ( DetParam theDetParam,
LocalVector  bfield 
) const
private

Definition at line 465 of file PixelCPEBase.cc.

References funct::abs(), alpha2Order, gather_cfg::cout, createTree::dd, f, GeomDet::geographicalId(), SiPixelLorentzAngle::getLorentzAngle(), lAOffset_, lAWidthBPix_, lAWidthFPix_, LogDebug, lorentzAngle_, lorentzAngleWidth_, NULL, GeomDetEnumerators::PixelBarrel, DetId::rawId(), pileupReCalc_HLTpaths::scale, PixelCPEBase::DetParam::theDet, theFlag_, PixelCPEBase::DetParam::thePart, useLAOffsetFromConfig_, useLAWidthFromConfig_, useLAWidthFromDB_, PixelCPEBase::DetParam::widthLAFractionX, PixelCPEBase::DetParam::widthLAFractionY, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

465  {
466  const bool LocalPrint = false;
467 
468  // Use LA from DB or from config
469  float langle = 0.;
470  if( !useLAOffsetFromConfig_ ) { // get it from DB
471  if(lorentzAngle_ != NULL) { // a real LA object
472  langle = lorentzAngle_->getLorentzAngle(theDetParam.theDet->geographicalId().rawId());
473  //cout<<" la "<<langle<<" "<< theDetParam.theDet->geographicalId().rawId() <<endl;
474  } else { // no LA, unused
475  //cout<<" LA object is NULL, assume LA = 0"<<endl; //dk
476  langle = 0; // set to a fake value
477  }
478  if(LocalPrint) cout<<" Will use LA Offset from DB "<<langle<<endl;
479  } else { // from config file
480  langle = lAOffset_;
481  if(LocalPrint) cout<<" Will use LA Offset from config "<<langle<<endl;
482  }
483 
484  // Now do the LA width stuff
485  theDetParam.widthLAFractionX = 1.; // predefine to 1 (default) if things fail
486  theDetParam.widthLAFractionY = 1.;
487 
488  // Compute the charge width, generic only
489  if(theFlag_==0) {
490 
492  // take it from a seperate, special LA DB object (forWidth)
493 
494  auto langleWidth = lorentzAngleWidth_->getLorentzAngle(theDetParam.theDet->geographicalId().rawId());
495  if(langleWidth!=0.0) theDetParam.widthLAFractionX = std::abs(langleWidth/langle);
496  // leave the widthLAFractionY=1.
497  //cout<<" LAWidth lorentz width "<<theDetParam.widthLAFractionX<<" "<<theDetParam.widthLAFractionY<<endl;
498 
499  } else if(useLAWidthFromConfig_) { // get from config
500 
501  double lAWidth=0;
502  if( theDetParam.thePart == GeomDetEnumerators::PixelBarrel) lAWidth = lAWidthBPix_; // barrel
503  else lAWidth = lAWidthFPix_;
504 
505  if(langle!=0.0) theDetParam.widthLAFractionX = std::abs(lAWidth/langle);
506  // fix the FractionY at 1
507 
508  //cout<<" Lorentz width from config "<<theDetParam.widthLAFractionX<<" "<<theDetParam.widthLAFractionY<<endl;
509 
510  } else { // get if from the offset LA (old method used until 2013)
511  // do nothing
512  //cout<<" Old default LA width method "<<theDetParam.widthLAFractionX<<" "<<theDetParam.widthLAFractionY<<endl;
513 
514  }
515 
516  //cout<<" Final LA fraction "<<theDetParam.widthLAFractionX<<" "<<theDetParam.widthLAFractionY<<endl;
517 
518  } // if flag
519 
520 
521  if(LocalPrint) cout<<" in PixelCPEBase:driftDirection - "<<langle<<" "<<Bfield<<endl; //dk
522 
523  float alpha2 = alpha2Order ? langle*langle : 0; //
524 
525  // **********************************************************************
526  // Our convention is the following:
527  // +x is defined by the direction of the Lorentz drift!
528  // +z is defined by the direction of E field (so electrons always go into -z!)
529  // +y is defined by +x and +z, and it turns out to be always opposite to the +B field.
530  // **********************************************************************
531 
532  float dir_x = -( langle * Bfield.y() + alpha2* Bfield.z()* Bfield.x() );
533  float dir_y = ( langle * Bfield.x() - alpha2* Bfield.z()* Bfield.y() );
534  float dir_z = -( 1.f + alpha2* Bfield.z()*Bfield.z() );
535  auto scale = 1.f/std::abs( dir_z ); // same as 1 + alpha2*Bfield.z()*Bfield.z()
536  LocalVector dd(dir_x*scale, dir_y*scale, -1.f ); // last is -1 !
537 
538  LogDebug("PixelCPEBase") << " The drift direction in local coordinate is " << dd ;
539 
540  return dd;
541 }
#define LogDebug(id)
const SiPixelLorentzAngle * lorentzAngleWidth_
Definition: PixelCPEBase.h:244
#define NULL
Definition: scimark2.h:8
bool useLAWidthFromDB_
Definition: PixelCPEBase.h:234
float lAWidthBPix_
Definition: PixelCPEBase.h:229
bool useLAWidthFromConfig_
Definition: PixelCPEBase.h:233
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
const SiPixelLorentzAngle * lorentzAngle_
Definition: PixelCPEBase.h:243
bool useLAOffsetFromConfig_
Definition: PixelCPEBase.h:232
float getLorentzAngle(const uint32_t &) const
tuple cout
Definition: gather_cfg.py:121
float lAWidthFPix_
Definition: PixelCPEBase.h:230
void PixelCPEBase::fillDetParams ( )
private

Definition at line 138 of file PixelCPEBase.cc.

References computeLorentzShifts(), TrackerGeometry::detUnits(), DoLorentz_, driftDirection(), genErrorDBObject_, geom_, SiPixelGenErrorDBObject::getGenErrorID(), SiPixelTemplateDBObject::getTemplateID(), i, MagneticField::inTesla(), LogDebug, m_DetParams, magfield_, TrackerGeometry::offsetDU(), AlCaHLTBitMon_ParallelJobs::p, templateDBobject_, theFlag_, GeomDetEnumerators::TIB, and PV3DBase< T, PVType, FrameType >::z().

Referenced by PixelCPEBase().

139 {
140  //cout<<" in fillDetParams "<<theFlag_<<endl;
141 
142  const unsigned m_detectors = geom_.offsetDU(GeomDetEnumerators::TIB); //first non-pixel detector unit
143  auto const & dus = geom_.detUnits();
144  m_DetParams.resize(m_detectors);
145  //cout<<"caching "<<m_detectors<<" pixel detectors"<<endl;
146  for (unsigned i=0; i!=m_detectors;++i) {
147  auto & p=m_DetParams[i];
148  p.theDet = dynamic_cast<const PixelGeomDetUnit*>(dus[i]);
149  assert(p.theDet);
150  assert(p.theDet->index()==int(i));
151 
152  p.theOrigin = p.theDet->surface().toLocal(GlobalPoint(0,0,0));
153 
154  //--- p.theDet->type() returns a GeomDetType, which implements subDetector()
155  p.thePart = p.theDet->type().subDetector();
156 
157  //cout<<" in PixelCPEBase - in det "<<thePart<<endl; //dk
158 
159  //--- The location in of this DetUnit in a cyllindrical coord system (R,Z)
160  //--- The call goes via BoundSurface, returned by p.theDet->surface(), but
161  //--- position() is implemented in GloballyPositioned<> template
162  //--- ( BoundSurface : Surface : GloballyPositioned<float> )
163  //p.theDetR = p.theDet->surface().position().perp(); //Not used, AH
164  //p.theDetZ = p.theDet->surface().position().z(); //Not used, AH
165  //--- Define parameters for chargewidth calculation
166 
167  //--- bounds() is implemented in BoundSurface itself.
168  p.theThickness = p.theDet->surface().bounds().thickness();
169 
170  // Cache the det id for templates and generic erros
171 
172  if(theFlag_==0) { // for generic
173 #ifdef NEW_CPEERROR
174  p.detTemplateId = genErrorDBObject_->getGenErrorID(p.theDet->geographicalId().rawId());
175 #else
176  if(useNewSimplerErrors)
177  p.detTemplateId = genErrorDBObject_->getGenErrorID(p.theDet->geographicalId().rawId());
178  else
179  p.detTemplateId = templateDBobject_->getTemplateID(p.theDet->geographicalId().rawId());
180 #endif
181  } else { // for templates
182  p.detTemplateId = templateDBobject_->getTemplateID(p.theDet->geographicalId());
183  }
184 
185  // just for testing
186  //int i1 = 0;
187  //if(theFlag_==0) i1 = genErrorDBObject_->getGenErrorID(p.theDet->geographicalId().rawId());
188  //int i2= templateDBobject_->getTemplateID(p.theDet->geographicalId().rawId());
189  //int i3= templateDBobject_->getTemplateID(p.theDet->geographicalId());
190  //if(i2!=i3) cout<<i2<<" != "<<i3<<endl;
191  //cout<<i<<" "<<p.detTemplateId<<" "<<i1<<" "<<i2<<" "<<i3<<endl;
192 
193  auto topol = &(p.theDet->specificTopology());
194  p.theTopol=topol;
195  auto const proxyT = dynamic_cast<const ProxyPixelTopology*>(p.theTopol);
196  if (proxyT) p.theRecTopol = dynamic_cast<const RectangularPixelTopology*>(&(proxyT->specificTopology()));
197  else p.theRecTopol = dynamic_cast<const RectangularPixelTopology*>(p.theTopol);
198  assert(p.theRecTopol);
199 
200  //---- The geometrical description of one module/plaquette
201  //p.theNumOfRow = p.theRecTopol->nrows(); // rows in x //Not used, AH
202  //p.theNumOfCol = p.theRecTopol->ncolumns(); // cols in y //Not used, AH
203  std::pair<float,float> pitchxy = p.theRecTopol->pitch();
204  p.thePitchX = pitchxy.first; // pitch along x
205  p.thePitchY = pitchxy.second; // pitch along y
206 
207  //p.theSign = isFlipped(&p) ? -1 : 1; //Not used, AH
208 
209  LocalVector Bfield = p.theDet->surface().toLocal(magfield_->inTesla(p.theDet->surface().position()));
210  p.bz = Bfield.z();
211 
212 
213  // Compute the Lorentz shifts for this detector element
214  if ( (theFlag_==0) || DoLorentz_ ) { // do always for generic and if(DOLorentz) for templates
215  p.driftDirection = driftDirection(p, Bfield );
217  }
218 
219 
220  LogDebug("PixelCPEBase") << "***** PIXEL LAYOUT *****"
221  << " thePart = " << p.thePart
222  << " theThickness = " << p.theThickness
223  << " thePitchX = " << p.thePitchX
224  << " thePitchY = " << p.thePitchY;
225  // << " theLShiftX = " << p.theLShiftX;
226 
227 
228  }
229 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
LocalVector driftDirection(DetParam &theDetParam, GlobalVector bfield) const
short getTemplateID(const uint32_t &detid) const
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
DetParams m_DetParams
Definition: PixelCPEBase.h:280
short getGenErrorID(const uint32_t &detid) const
virtual const DetUnitContainer & detUnits() const
Returm a vector of all GeomDetUnit.
unsigned int offsetDU(SubDetector sid) const
T z() const
Definition: PV3DBase.h:64
void computeLorentzShifts(DetParam &) const
const SiPixelTemplateDBObject * templateDBobject_
Definition: PixelCPEBase.h:249
const MagneticField * magfield_
Definition: PixelCPEBase.h:240
const SiPixelGenErrorDBObject * genErrorDBObject_
Definition: PixelCPEBase.h:246
const TrackerGeometry & geom_
Definition: PixelCPEBase.h:241
ReturnType PixelCPEBase::getParameters ( const SiPixelCluster cl,
const GeomDetUnit det 
) const
inlinevirtual

Implements PixelClusterParameterEstimator.

Definition at line 138 of file PixelCPEBase.h.

References computeAnglesFromDetPosition(), createClusterParam(), detParam(), asciidump::le, localError(), localPosition(), rawQualityWord(), and setTheClu().

Referenced by cms::SiPixelRecHitConverter::run().

140  {
141 #ifdef EDM_ML_DEBUG
142  nRecHitsTotal_++ ;
143  //std::cout<<" in PixelCPEBase:localParameters(all) - "<<nRecHitsTotal_<<std::endl; //dk
144 #endif
145 
146  DetParam const & theDetParam = detParam(det);
147  ClusterParam * theClusterParam = createClusterParam(cl);
148  setTheClu( theDetParam, *theClusterParam );
149  computeAnglesFromDetPosition(theDetParam, *theClusterParam);
150 
151  // localPosition( cl, det ) must be called before localError( cl, det ) !!!
152  LocalPoint lp = localPosition(theDetParam, *theClusterParam);
153  LocalError le = localError(theDetParam, *theClusterParam);
154  SiPixelRecHitQuality::QualWordType rqw = rawQualityWord(*theClusterParam);
155  auto tuple = std::make_tuple(lp, le , rqw);
156  delete theClusterParam;
157 
158  //std::cout<<" in PixelCPEBase:localParameters(all) - "<<lp.x()<<" "<<lp.y()<<std::endl; //dk
159  return tuple;
160  }
virtual ClusterParam * createClusterParam(const SiPixelCluster &cl) const =0
virtual LocalPoint localPosition(DetParam const &theDetParam, ClusterParam &theClusterParam) const =0
void computeAnglesFromDetPosition(DetParam const &theDetParam, ClusterParam &theClusterParam) const
SiPixelRecHitQuality::QualWordType rawQualityWord(ClusterParam &theClusterParam) const
void setTheClu(DetParam const &, ClusterParam &theClusterParam) const
virtual LocalError localError(DetParam const &theDetParam, ClusterParam &theClusterParam) const =0
DetParam const & detParam(const GeomDetUnit &det) const
ReturnType PixelCPEBase::getParameters ( const SiPixelCluster cl,
const GeomDetUnit det,
const LocalTrajectoryParameters ltp 
) const
inlinevirtual

Implements PixelClusterParameterEstimator.

Definition at line 165 of file PixelCPEBase.h.

References computeAnglesFromTrajectory(), createClusterParam(), detParam(), asciidump::le, localError(), localPosition(), rawQualityWord(), and setTheClu().

168  {
169 #ifdef EDM_ML_DEBUG
170  nRecHitsTotal_++ ;
171  //std::cout<<" in PixelCPEBase:localParameters(on track) - "<<nRecHitsTotal_<<std::endl; //dk
172 #endif
173 
174  DetParam const & theDetParam = detParam(det);
175  ClusterParam * theClusterParam = createClusterParam(cl);
176  setTheClu( theDetParam, *theClusterParam );
177  computeAnglesFromTrajectory(theDetParam, *theClusterParam, ltp);
178 
179  // localPosition( cl, det ) must be called before localError( cl, det ) !!!
180  LocalPoint lp = localPosition(theDetParam, *theClusterParam);
181  LocalError le = localError(theDetParam, *theClusterParam);
182  SiPixelRecHitQuality::QualWordType rqw = rawQualityWord(*theClusterParam);
183  auto tuple = std::make_tuple(lp, le , rqw);
184  delete theClusterParam;
185 
186  //std::cout<<" in PixelCPEBase:localParameters(on track) - "<<lp.x()<<" "<<lp.y()<<std::endl; //dk
187  return tuple;
188  }
virtual ClusterParam * createClusterParam(const SiPixelCluster &cl) const =0
void computeAnglesFromTrajectory(DetParam const &theDetParam, ClusterParam &theClusterParam, const LocalTrajectoryParameters &ltp) const
virtual LocalPoint localPosition(DetParam const &theDetParam, ClusterParam &theClusterParam) const =0
SiPixelRecHitQuality::QualWordType rawQualityWord(ClusterParam &theClusterParam) const
void setTheClu(DetParam const &, ClusterParam &theClusterParam) const
virtual LocalError localError(DetParam const &theDetParam, ClusterParam &theClusterParam) const =0
DetParam const & detParam(const GeomDetUnit &det) const
bool PixelCPEBase::isFlipped ( DetParam const &  theDetParam) const
private

Definition at line 429 of file PixelCPEBase.cc.

References PV3DBase< T, PVType, FrameType >::perp2(), GeomDet::surface(), PixelCPEBase::DetParam::theDet, and Surface::toGlobal().

430 {
431  // Check the relative position of the local +/- z in global coordinates.
432  float tmp1 = theDetParam.theDet->surface().toGlobal(Local3DPoint(0.,0.,0.)).perp2();
433  float tmp2 = theDetParam.theDet->surface().toGlobal(Local3DPoint(0.,0.,1.)).perp2();
434  //cout << " 1: " << tmp1 << " 2: " << tmp2 << endl;
435  if ( tmp2<tmp1 ) return true;
436  else return false;
437 }
Point3DBase< float, LocalTag > Local3DPoint
Definition: LocalPoint.h:9
virtual LocalError PixelCPEBase::localError ( DetParam const &  theDetParam,
ClusterParam theClusterParam 
) const
privatepure virtual

Implemented in PixelCPEGeneric, and PixelCPETemplateReco.

Referenced by getParameters().

virtual LocalPoint PixelCPEBase::localPosition ( DetParam const &  theDetParam,
ClusterParam theClusterParam 
) const
privatepure virtual

Implemented in PixelCPEGeneric, and PixelCPETemplateReco.

Referenced by getParameters().

SiPixelRecHitQuality::QualWordType PixelCPEBase::rawQualityWord ( ClusterParam theClusterParam) const
private

A convenience method to fill a whole SiPixelRecHitQuality word in one shot. This way, we can keep the details of what is filled within the pixel code and not expose the Transient SiPixelRecHit to it as well. The name of this function is chosen to match the one in SiPixelRecHit.

Definition at line 571 of file PixelCPEBase.cc.

References PixelCPEBase::ClusterParam::hasBadPixels_, PixelCPEBase::ClusterParam::hasFilledProb_, PixelCPEBase::ClusterParam::isOnEdge_, create_public_lumi_plots::log, PixelCPEBase::ClusterParam::probabilityQ_, PixelCPEBase::ClusterParam::probabilityX_, PixelCPEBase::ClusterParam::probabilityY_, PixelCPEBase::ClusterParam::qBin_, SiPixelRecHitQuality::Packing::setHasBadPixels(), SiPixelRecHitQuality::Packing::setHasFilledProb(), SiPixelRecHitQuality::Packing::setIsOnEdge(), SiPixelRecHitQuality::Packing::setProbabilityQ(), SiPixelRecHitQuality::Packing::setProbabilityXY(), SiPixelRecHitQuality::Packing::setQBin(), SiPixelRecHitQuality::Packing::setSpansTwoROCs(), PixelCPEBase::ClusterParam::spansTwoROCs_, and SiPixelRecHitQuality::thePacking.

Referenced by getParameters().

572 {
574  float probabilityXY;
575  if ( theClusterParam.probabilityX_ !=0 && theClusterParam.probabilityY_ !=0 )
576  probabilityXY = theClusterParam.probabilityX_ * theClusterParam.probabilityY_ * (1.f - std::log(theClusterParam.probabilityX_ * theClusterParam.probabilityY_) ) ;
577  else
578  probabilityXY = 0;
580  qualWord );
581 
582  SiPixelRecHitQuality::thePacking.setProbabilityQ ( theClusterParam.probabilityQ_ ,
583  qualWord );
584 
585  SiPixelRecHitQuality::thePacking.setQBin ( (int)theClusterParam.qBin_,
586  qualWord );
587 
588  SiPixelRecHitQuality::thePacking.setIsOnEdge ( theClusterParam.isOnEdge_,
589  qualWord );
590 
591  SiPixelRecHitQuality::thePacking.setHasBadPixels ( theClusterParam.hasBadPixels_,
592  qualWord );
593 
594  SiPixelRecHitQuality::thePacking.setSpansTwoROCs ( theClusterParam.spansTwoROCs_,
595  qualWord );
596 
597  SiPixelRecHitQuality::thePacking.setHasFilledProb ( theClusterParam.hasFilledProb_,
598  qualWord );
599 
600  return qualWord;
601 }
void setProbabilityXY(float prob, QualWordType &qualWord) const
static const Packing thePacking
void setHasBadPixels(bool flag, QualWordType &qualWord) const
void setProbabilityQ(float prob, QualWordType &qualWord) const
void setSpansTwoROCs(bool flag, QualWordType &qualWord) const
void setIsOnEdge(bool flag, QualWordType &qualWord) const
void setHasFilledProb(bool flag, QualWordType &qualWord) const
void setQBin(int qbin, QualWordType &qualWord) const
void PixelCPEBase::setTheClu ( DetParam const &  theDetParam,
ClusterParam theClusterParam 
) const
private

Definition at line 235 of file PixelCPEBase.cc.

References RectangularPixelTopology::containsBigPixelInX(), RectangularPixelTopology::containsBigPixelInY(), RectangularPixelTopology::isItEdgePixelInX(), RectangularPixelTopology::isItEdgePixelInY(), PixelCPEBase::ClusterParam::isOnEdge_, SiPixelCluster::maxPixelCol(), SiPixelCluster::maxPixelRow(), SiPixelCluster::minPixelCol(), SiPixelCluster::minPixelRow(), PixelCPEBase::ClusterParam::spansTwoROCs_, PixelCPEBase::ClusterParam::theCluster, and PixelCPEBase::DetParam::theRecTopol.

Referenced by getParameters().

236 {
237 
238  //--- Geometric Quality Information
239  int minInX,minInY,maxInX,maxInY=0;
240  minInX = theClusterParam.theCluster->minPixelRow();
241  minInY = theClusterParam.theCluster->minPixelCol();
242  maxInX = theClusterParam.theCluster->maxPixelRow();
243  maxInY = theClusterParam.theCluster->maxPixelCol();
244 
245  theClusterParam.isOnEdge_ = theDetParam.theRecTopol->isItEdgePixelInX(minInX) | theDetParam.theRecTopol->isItEdgePixelInX(maxInX) |
246  theDetParam.theRecTopol->isItEdgePixelInY(minInY) | theDetParam.theRecTopol->isItEdgePixelInY(maxInY) ;
247 
248  // FOR NOW UNUSED. KEEP IT IN CASE WE WANT TO USE IT IN THE FUTURE
249  // Bad Pixels have their charge set to 0 in the clusterizer
250  //hasBadPixels_ = false;
251  //for(unsigned int i=0; i<theClusterParam.theCluster->pixelADC().size(); ++i) {
252  //if(theClusterParam.theCluster->pixelADC()[i] == 0) { hasBadPixels_ = true; break;}
253  //}
254 
255  theClusterParam.spansTwoROCs_ = theDetParam.theRecTopol->containsBigPixelInX(minInX,maxInX) |
256  theDetParam.theRecTopol->containsBigPixelInY(minInY,maxInY);
257 
258 }

Member Data Documentation

bool PixelCPEBase::alpha2Order
protected

Definition at line 250 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

bool PixelCPEBase::DoLorentz_
protected
const SiPixelGenErrorDBObject* PixelCPEBase::genErrorDBObject_
protected

Definition at line 246 of file PixelCPEBase.h.

Referenced by fillDetParams(), PixelCPEBase(), and PixelCPEGeneric::PixelCPEGeneric().

const TrackerGeometry& PixelCPEBase::geom_
protected

Definition at line 241 of file PixelCPEBase.h.

Referenced by fillDetParams().

float PixelCPEBase::lAOffset_
protected

Definition at line 228 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

float PixelCPEBase::lAWidthBPix_
protected

Definition at line 229 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

float PixelCPEBase::lAWidthFPix_
protected

Definition at line 230 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

bool PixelCPEBase::LoadTemplatesFromDB_
protected
const SiPixelLorentzAngle* PixelCPEBase::lorentzAngle_
protected

Definition at line 243 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

const SiPixelLorentzAngle* PixelCPEBase::lorentzAngleWidth_
protected

Definition at line 244 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

DetParams PixelCPEBase::m_DetParams =DetParams(1440)
private

Definition at line 280 of file PixelCPEBase.h.

Referenced by detParam(), and fillDetParams().

const MagneticField* PixelCPEBase::magfield_
protected

Definition at line 240 of file PixelCPEBase.h.

Referenced by fillDetParams().

const SiPixelTemplateDBObject* PixelCPEBase::templateDBobject_
protected
int PixelCPEBase::theFlag_
protected

Definition at line 238 of file PixelCPEBase.h.

Referenced by driftDirection(), fillDetParams(), and PixelCPEBase().

int PixelCPEBase::theVerboseLevel
protected
bool PixelCPEBase::useLAOffsetFromConfig_
protected

Definition at line 232 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

bool PixelCPEBase::useLAWidthFromConfig_
protected

Definition at line 233 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

bool PixelCPEBase::useLAWidthFromDB_
protected

Definition at line 234 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().