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 TrackerTopology &ttopo, 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
 
const TrackerTopologyttopo_
 
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 54 of file PixelCPEBase.h.

Member Typedef Documentation

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

Definition at line 280 of file PixelCPEBase.h.

typedef GloballyPositioned<double> PixelCPEBase::Frame
protected

Definition at line 216 of file PixelCPEBase.h.

Constructor & Destructor Documentation

PixelCPEBase::PixelCPEBase ( edm::ParameterSet const &  conf,
const MagneticField mag,
const TrackerGeometry geom,
const TrackerTopology ttopo,
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().

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

Member Function Documentation

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

Definition at line 345 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().

346 {
347 
348 
349  /*
350  // get cluster center of gravity (of charge)
351  float xcenter = cl.x();
352  float ycenter = cl.y();
353 
354  // get the cluster position in local coordinates (cm)
355 
356  // ggiurgiu@jhu.edu 12/09/2010 : This function is called without track info, therefore there are no track
357  // angles to provide here. Call the default localPosition (without track info)
358  LocalPoint lp = theTopol->localPosition( MeasurementPoint(xcenter, ycenter) );
359 
360 
361  // get the cluster position in global coordinates (cm)
362  GlobalPoint gp = theDet->surface().toGlobal( lp );
363  float gp_mod = sqrt( gp.x()*gp.x() + gp.y()*gp.y() + gp.z()*gp.z() );
364 
365  // normalize
366  float gpx = gp.x()/gp_mod;
367  float gpy = gp.y()/gp_mod;
368  float gpz = gp.z()/gp_mod;
369 
370  // make a global vector out of the global point; this vector will point from the
371  // origin of the detector to the cluster
372  GlobalVector gv(gpx, gpy, gpz);
373 
374  // make local unit vector along local X axis
375  const Local3DVector lvx(1.0, 0.0, 0.0);
376 
377  // get the unit X vector in global coordinates/
378  GlobalVector gvx = theDet->surface().toGlobal( lvx );
379 
380  // make local unit vector along local Y axis
381  const Local3DVector lvy(0.0, 1.0, 0.0);
382 
383  // get the unit Y vector in global coordinates
384  GlobalVector gvy = theDet->surface().toGlobal( lvy );
385 
386  // make local unit vector along local Z axis
387  const Local3DVector lvz(0.0, 0.0, 1.0);
388 
389  // get the unit Z vector in global coordinates
390  GlobalVector gvz = theDet->surface().toGlobal( lvz );
391 
392  // calculate the components of gv (the unit vector pointing to the cluster)
393  // in the local coordinate system given by the basis {gvx, gvy, gvz}
394  // note that both gv and the basis {gvx, gvy, gvz} are given in global coordinates
395  float gv_dot_gvx = gv.x()*gvx.x() + gv.y()*gvx.y() + gv.z()*gvx.z();
396  float gv_dot_gvy = gv.x()*gvy.x() + gv.y()*gvy.y() + gv.z()*gvy.z();
397  float gv_dot_gvz = gv.x()*gvz.x() + gv.y()*gvz.y() + gv.z()*gvz.z();
398  */
399 
400  // all the above is equivalent to
401  LocalPoint lp = theDetParam.theTopol->localPosition( MeasurementPoint(theClusterParam.theCluster->x(), theClusterParam.theCluster->y()) );
402  auto gvx = lp.x()-theDetParam.theOrigin.x();
403  auto gvy = lp.y()-theDetParam.theOrigin.y();
404  auto gvz = -1.f/theDetParam.theOrigin.z();
405  // normalization not required as only ratio used...
406 
407 
408  //theClusterParam.zneg = (gvz < 0); // Not used, AH
409 
410  // calculate angles
411  theClusterParam.cotalpha = gvx*gvz;
412  theClusterParam.cotbeta = gvy*gvz;
413 
414  theClusterParam.with_track_angle = false;
415 
416 
417  /*
418  // used only in dberror param...
419  auto alpha = HALF_PI - std::atan(cotalpha_);
420  auto beta = HALF_PI - std::atan(cotbeta_);
421  if (zneg) { beta -=PI; alpha -=PI;}
422 
423  auto alpha_ = atan2( gv_dot_gvz, gv_dot_gvx );
424  auto beta_ = atan2( gv_dot_gvz, gv_dot_gvy );
425 
426  assert(std::abs(std::round(alpha*10000.f)-std::round(alpha_*10000.f))<2);
427  assert(std::abs(std::round(beta*10000.f)-std::round(beta_*10000.f))<2);
428  */
429 
430 }
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 283 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().

285 {
286  //cout<<" in PixelCPEBase:computeAnglesFromTrajectory - "<<endl; //dk
287 
288  //theClusterParam.loc_traj_param = ltp;
289 
290  LocalVector localDir = ltp.momentum();
291 
292 
293  float locx = localDir.x();
294  float locy = localDir.y();
295  float locz = localDir.z();
296 
297  /*
298  // Danek's definition
299  alpha_ = acos(locx/sqrt(locx*locx+locz*locz));
300  if ( isFlipped() ) // &&& check for FPIX !!!
301  alpha_ = PI - alpha_ ;
302  beta_ = acos(locy/sqrt(locy*locy+locz*locz));
303  */
304 
305 
306  theClusterParam.cotalpha = locx/locz;
307  theClusterParam.cotbeta = locy/locz;
308  //theClusterParam.zneg = (locz < 0); // Not used, AH
309 
310 
311  LocalPoint trk_lp = ltp.position();
312  theClusterParam.trk_lp_x = trk_lp.x();
313  theClusterParam.trk_lp_y = trk_lp.y();
314 
315  theClusterParam.with_track_angle = true;
316 
317 
318  // ggiurgiu@jhu.edu 12/09/2010 : needed to correct for bows/kinks
319  AlgebraicVector5 vec_trk_parameters = ltp.mixedFormatVector();
320  theClusterParam.loc_trk_pred = Topology::LocalTrackPred( vec_trk_parameters );
321 
322 }
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 564 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().

564  {
565 
566  //cout<<" in PixelCPEBase:computeLorentzShifts - "<<driftDirection_<<endl; //dk
567 
568  // Max shift (at the other side of the sensor) in cm
569  theDetParam.lorentzShiftInCmX = theDetParam.driftDirection.x()/theDetParam.driftDirection.z() * theDetParam.theThickness; //
570  theDetParam.lorentzShiftInCmY = theDetParam.driftDirection.y()/theDetParam.driftDirection.z() * theDetParam.theThickness; //
571 
572  //cout<<" in PixelCPEBase:computeLorentzShifts - "
573  //<<lorentzShiftInCmX_<<" "
574  //<<lorentzShiftInCmY_<<" "
575  //<<endl; //dk
576 
577  LogDebug("PixelCPEBase") << " The drift direction in local coordinate is "
578  << theDetParam.driftDirection ;
579 }
#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 456 of file PixelCPEBase.cc.

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

Referenced by getParameters().

456  {
457  auto i = det.index();
458  //cout << "get parameters of detector " << i << endl;
459  assert(i<int(m_DetParams.size()));
460  //if (i>=int(m_DetParams.size())) m_DetParams.resize(i+1); // should never happen!
461  const DetParam & p = m_DetParams[i];
462  return p;
463 }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
DetParams m_DetParams
Definition: PixelCPEBase.h:282
int index() const
Definition: GeomDet.h:99
LocalVector PixelCPEBase::driftDirection ( DetParam theDetParam,
GlobalVector  bfield 
) const
private

Definition at line 473 of file PixelCPEBase.cc.

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

Referenced by fillDetParams().

473  {
474 
475  Frame detFrame(theDetParam.theDet->surface().position(), theDetParam.theDet->surface().rotation());
476  LocalVector Bfield = detFrame.toLocal(bfield);
477  return driftDirection(theDetParam,Bfield);
478 
479 }
LocalVector driftDirection(DetParam &theDetParam, GlobalVector bfield) const
GloballyPositioned< double > Frame
Definition: PixelCPEBase.h:216
LocalVector PixelCPEBase::driftDirection ( DetParam theDetParam,
LocalVector  bfield 
) const
private

Definition at line 482 of file PixelCPEBase.cc.

References funct::abs(), alpha2Order, gather_cfg::cout, createTree::dd, f, GeomDet::geographicalId(), SiPixelLorentzAngle::getLorentzAngle(), GeomDetEnumerators::isBarrel(), GeomDetEnumerators::isTrackerPixel(), lAOffset_, lAWidthBPix_, lAWidthFPix_, LogDebug, lorentzAngle_, lorentzAngleWidth_, NULL, 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().

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

Definition at line 140 of file PixelCPEBase.cc.

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

Referenced by PixelCPEBase().

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

Implements PixelClusterParameterEstimator.

Definition at line 139 of file PixelCPEBase.h.

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

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

141  {
142 #ifdef EDM_ML_DEBUG
143  nRecHitsTotal_++ ;
144  //std::cout<<" in PixelCPEBase:localParameters(all) - "<<nRecHitsTotal_<<std::endl; //dk
145 #endif
146 
147  DetParam const & theDetParam = detParam(det);
148  ClusterParam * theClusterParam = createClusterParam(cl);
149  setTheClu( theDetParam, *theClusterParam );
150  computeAnglesFromDetPosition(theDetParam, *theClusterParam);
151 
152  // localPosition( cl, det ) must be called before localError( cl, det ) !!!
153  LocalPoint lp = localPosition(theDetParam, *theClusterParam);
154  LocalError le = localError(theDetParam, *theClusterParam);
155  SiPixelRecHitQuality::QualWordType rqw = rawQualityWord(*theClusterParam);
156  auto tuple = std::make_tuple(lp, le , rqw);
157  delete theClusterParam;
158 
159  //std::cout<<" in PixelCPEBase:localParameters(all) - "<<lp.x()<<" "<<lp.y()<<std::endl; //dk
160  return tuple;
161  }
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 166 of file PixelCPEBase.h.

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

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

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

447 {
448  // Check the relative position of the local +/- z in global coordinates.
449  float tmp1 = theDetParam.theDet->surface().toGlobal(Local3DPoint(0.,0.,0.)).perp2();
450  float tmp2 = theDetParam.theDet->surface().toGlobal(Local3DPoint(0.,0.,1.)).perp2();
451  //cout << " 1: " << tmp1 << " 2: " << tmp2 << endl;
452  if ( tmp2<tmp1 ) return true;
453  else return false;
454 }
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 588 of file PixelCPEBase.cc.

References PixelCPEBase::ClusterParam::hasBadPixels_, PixelCPEBase::ClusterParam::hasFilledProb_, PixelCPEBase::ClusterParam::isOnEdge_, dqm-mbProfile::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().

589 {
591  float probabilityXY;
592  if ( theClusterParam.probabilityX_ !=0 && theClusterParam.probabilityY_ !=0 )
593  probabilityXY = theClusterParam.probabilityX_ * theClusterParam.probabilityY_ * (1.f - std::log(theClusterParam.probabilityX_ * theClusterParam.probabilityY_) ) ;
594  else
595  probabilityXY = 0;
597  qualWord );
598 
599  SiPixelRecHitQuality::thePacking.setProbabilityQ ( theClusterParam.probabilityQ_ ,
600  qualWord );
601 
602  SiPixelRecHitQuality::thePacking.setQBin ( (int)theClusterParam.qBin_,
603  qualWord );
604 
605  SiPixelRecHitQuality::thePacking.setIsOnEdge ( theClusterParam.isOnEdge_,
606  qualWord );
607 
608  SiPixelRecHitQuality::thePacking.setHasBadPixels ( theClusterParam.hasBadPixels_,
609  qualWord );
610 
611  SiPixelRecHitQuality::thePacking.setSpansTwoROCs ( theClusterParam.spansTwoROCs_,
612  qualWord );
613 
614  SiPixelRecHitQuality::thePacking.setHasFilledProb ( theClusterParam.hasFilledProb_,
615  qualWord );
616 
617  return qualWord;
618 }
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 252 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().

253 {
254 
255  //--- Geometric Quality Information
256  int minInX,minInY,maxInX,maxInY=0;
257  minInX = theClusterParam.theCluster->minPixelRow();
258  minInY = theClusterParam.theCluster->minPixelCol();
259  maxInX = theClusterParam.theCluster->maxPixelRow();
260  maxInY = theClusterParam.theCluster->maxPixelCol();
261 
262  theClusterParam.isOnEdge_ = theDetParam.theRecTopol->isItEdgePixelInX(minInX) | theDetParam.theRecTopol->isItEdgePixelInX(maxInX) |
263  theDetParam.theRecTopol->isItEdgePixelInY(minInY) | theDetParam.theRecTopol->isItEdgePixelInY(maxInY) ;
264 
265  // FOR NOW UNUSED. KEEP IT IN CASE WE WANT TO USE IT IN THE FUTURE
266  // Bad Pixels have their charge set to 0 in the clusterizer
267  //hasBadPixels_ = false;
268  //for(unsigned int i=0; i<theClusterParam.theCluster->pixelADC().size(); ++i) {
269  //if(theClusterParam.theCluster->pixelADC()[i] == 0) { hasBadPixels_ = true; break;}
270  //}
271 
272  theClusterParam.spansTwoROCs_ = theDetParam.theRecTopol->containsBigPixelInX(minInX,maxInX) |
273  theDetParam.theRecTopol->containsBigPixelInY(minInY,maxInY);
274 
275 }

Member Data Documentation

bool PixelCPEBase::alpha2Order
protected

Definition at line 252 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

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

Definition at line 248 of file PixelCPEBase.h.

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

const TrackerGeometry& PixelCPEBase::geom_
protected

Definition at line 242 of file PixelCPEBase.h.

Referenced by fillDetParams().

float PixelCPEBase::lAOffset_
protected

Definition at line 229 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

float PixelCPEBase::lAWidthBPix_
protected

Definition at line 230 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

float PixelCPEBase::lAWidthFPix_
protected

Definition at line 231 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

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

Definition at line 245 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

const SiPixelLorentzAngle* PixelCPEBase::lorentzAngleWidth_
protected

Definition at line 246 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

DetParams PixelCPEBase::m_DetParams =DetParams(1440)
private

Definition at line 282 of file PixelCPEBase.h.

Referenced by detParam(), and fillDetParams().

const MagneticField* PixelCPEBase::magfield_
protected

Definition at line 241 of file PixelCPEBase.h.

Referenced by fillDetParams().

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

Definition at line 239 of file PixelCPEBase.h.

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

int PixelCPEBase::theVerboseLevel
protected
const TrackerTopology& PixelCPEBase::ttopo_
protected

Definition at line 243 of file PixelCPEBase.h.

Referenced by PixelCPEGeneric::localError().

bool PixelCPEBase::useLAOffsetFromConfig_
protected

Definition at line 233 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

bool PixelCPEBase::useLAWidthFromConfig_
protected

Definition at line 234 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

bool PixelCPEBase::useLAWidthFromDB_
protected

Definition at line 235 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().