CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions
PixelCPEBase Class Referenceabstract

#include <PixelCPEBase.h>

Inheritance diagram for PixelCPEBase:
PixelClusterParameterEstimator PixelCPEClusterRepair PixelCPEGeneric PixelCPETemplateReco

Classes

struct  ClusterParam
 
struct  DetParam
 

Public Member Functions

ReturnType getParameters (const SiPixelCluster &cl, const GeomDetUnit &det) const override
 
ReturnType getParameters (const SiPixelCluster &cl, const GeomDetUnit &det, const LocalTrajectoryParameters &ltp) const override
 
 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

using DetParams = std::vector< DetParam >
 
typedef GloballyPositioned< double > Frame
 

Protected 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
 
DetParam const & detParam (const GeomDetUnit &det) const
 
LocalVector driftDirection (DetParam &theDetParam, GlobalVector bfield) const
 
LocalVector driftDirection (DetParam &theDetParam, LocalVector bfield) const
 
void setTheClu (DetParam const &, ClusterParam &theClusterParam) const
 

Protected Attributes

bool alpha2Order
 
bool DoLorentz_
 
const SiPixelGenErrorDBObjectgenErrorDBObject_
 
const TrackerGeometrygeom_
 
float lAOffset_
 
float lAWidthBPix_
 
float lAWidthFPix_
 
bool LoadTemplatesFromDB_
 
const SiPixelLorentzAnglelorentzAngle_
 
const SiPixelLorentzAnglelorentzAngleWidth_
 
DetParams m_DetParams =DetParams(1440)
 
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 Member Functions

virtual ClusterParamcreateClusterParam (const SiPixelCluster &cl) const =0
 
void fillDetParams ()
 
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
 

Additional Inherited Members

- Public Types inherited from PixelClusterParameterEstimator
typedef std::pair< LocalPoint, LocalErrorLocalValues
 
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>
protected

Definition at line 282 of file PixelCPEBase.h.

typedef GloballyPositioned<double> PixelCPEBase::Frame
protected

Definition at line 219 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 32 of file PixelCPEBase.cc.

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

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

Member Function Documentation

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

Definition at line 314 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 computeAnglesFromTrajectory(), and getParameters().

315 {
316 
317  LocalPoint lp = theDetParam.theTopol->localPosition( MeasurementPoint(theClusterParam.theCluster->x(), theClusterParam.theCluster->y()) );
318  auto gvx = lp.x()-theDetParam.theOrigin.x();
319  auto gvy = lp.y()-theDetParam.theOrigin.y();
320  auto gvz = -1.f/theDetParam.theOrigin.z();
321  //--- Note that the normalization is not required as only the ratio used
322 
323  //theClusterParam.zneg = (gvz < 0); // Not used, AH
324 
325  // calculate angles
326  theClusterParam.cotalpha = gvx*gvz;
327  theClusterParam.cotbeta = gvy*gvz;
328 
329  theClusterParam.with_track_angle = false;
330 
331 
332  /*
333  // used only in dberror param...
334  auto alpha = HALF_PI - std::atan(cotalpha_);
335  auto beta = HALF_PI - std::atan(cotbeta_);
336  if (zneg) { beta -=PI; alpha -=PI;}
337 
338  auto alpha_ = atan2( gv_dot_gvz, gv_dot_gvx );
339  auto beta_ = atan2( gv_dot_gvz, gv_dot_gvy );
340 
341  assert(std::abs(std::round(alpha*10000.f)-std::round(alpha_*10000.f))<2);
342  assert(std::abs(std::round(beta*10000.f)-std::round(beta_*10000.f))<2);
343  */
344 
345 }
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
protected

Definition at line 272 of file PixelCPEBase.cc.

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

Referenced by getParameters(), and setTheClu().

274 {
275 
276  theClusterParam.cotalpha = ltp.dxdz();
277  theClusterParam.cotbeta = ltp.dydz();
278 
279 
280  LocalPoint trk_lp = ltp.position();
281  theClusterParam.trk_lp_x = trk_lp.x();
282  theClusterParam.trk_lp_y = trk_lp.y();
283 
284  theClusterParam.with_track_angle = true;
285 
286  // GG: needed to correct for bows/kinks
287  theClusterParam.loc_trk_pred =
288  Topology::LocalTrackPred(theClusterParam.trk_lp_x, theClusterParam.trk_lp_y,
289  theClusterParam.cotalpha,theClusterParam.cotbeta);
290 
291 }
LocalPoint position() const
Local x and y position coordinates.
T y() const
Definition: PV3DBase.h:63
T x() const
Definition: PV3DBase.h:62
void PixelCPEBase::computeLorentzShifts ( DetParam theDetParam) const
protected

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

458 {
459  // Max shift (at the other side of the sensor) in cm
460  theDetParam.lorentzShiftInCmX = theDetParam.driftDirection.x()/theDetParam.driftDirection.z() * theDetParam.theThickness; //
461  theDetParam.lorentzShiftInCmY = theDetParam.driftDirection.y()/theDetParam.driftDirection.z() * theDetParam.theThickness; //
462 
463  LogDebug("PixelCPEBase::computeLorentzShifts()") << " lorentzShiftsInCmX,Y = "
464  << theDetParam.lorentzShiftInCmX <<" "
465  << theDetParam.lorentzShiftInCmY <<" "
466  << theDetParam.driftDirection;
467 }
#define LogDebug(id)
virtual ClusterParam* PixelCPEBase::createClusterParam ( const SiPixelCluster cl) const
privatepure virtual
PixelCPEBase::DetParam const & PixelCPEBase::detParam ( const GeomDetUnit det) const
protected

Definition at line 350 of file PixelCPEBase.cc.

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

Referenced by getParameters().

351 {
352  auto i = det.index();
353  //cout << "get parameters of detector " << i << endl;
354  assert(i<int(m_DetParams.size()));
355  //if (i>=int(m_DetParams.size())) m_DetParams.resize(i+1); // should never happen!
356  const DetParam & p = m_DetParams[i];
357  return p;
358 }
DetParams m_DetParams
Definition: PixelCPEBase.h:284
int index() const
Definition: GeomDet.h:99
LocalVector PixelCPEBase::driftDirection ( DetParam theDetParam,
GlobalVector  bfield 
) const
protected

Definition at line 368 of file PixelCPEBase.cc.

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

Referenced by fillDetParams().

369 {
370  Frame detFrame(theDetParam.theDet->surface().position(), theDetParam.theDet->surface().rotation());
371  LocalVector Bfield = detFrame.toLocal(bfield);
372  return driftDirection(theDetParam,Bfield);
373 }
LocalVector driftDirection(DetParam &theDetParam, GlobalVector bfield) const
GloballyPositioned< double > Frame
Definition: PixelCPEBase.h:219
LocalVector PixelCPEBase::driftDirection ( DetParam theDetParam,
LocalVector  bfield 
) const
protected

Definition at line 377 of file PixelCPEBase.cc.

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

378 {
379  // Use LA from DB or from config
380  float langle = 0.;
381  if( !useLAOffsetFromConfig_ ) { // get it from DB
382  if(lorentzAngle_ != nullptr) { // a real LA object
383  langle = lorentzAngle_->getLorentzAngle(theDetParam.theDet->geographicalId().rawId());
384  LogDebug("PixelCPEBase::driftDirection()")
385  <<" la "<<langle<<" "<< theDetParam.theDet->geographicalId().rawId() <<endl;
386  } else { // no LA, unused
387  langle = 0; // set to a fake value
388  LogDebug("PixelCPEBase::driftDirection()") <<" LA object is NULL, assume LA = 0"<<endl; //dk
389  }
390  LogDebug("PixelCPEBase::driftDirection()") << " Will use LA Offset from DB "<<langle<<endl;
391  } else { // from config file
392  langle = lAOffset_;
393  LogDebug("PixelCPEBase::driftDirection()") << " Will use LA Offset from config "<<langle<<endl;
394  }
395 
396  // Now do the LA width stuff
397  theDetParam.widthLAFractionX = 1.; // predefine to 1 (default) if things fail
398  theDetParam.widthLAFractionY = 1.;
399 
400  // Compute the charge width, generic only
401  if(theFlag_==0) {
402 
403  if(useLAWidthFromDB_ && (lorentzAngleWidth_ != nullptr) ) {
404  // take it from a separate, special LA DB object (forWidth)
405 
406  auto langleWidth = lorentzAngleWidth_->getLorentzAngle(theDetParam.theDet->geographicalId().rawId());
407  if(langleWidth!=0.0) theDetParam.widthLAFractionX = std::abs(langleWidth/langle);
408  // leave the widthLAFractionY=1.
409  //cout<<" LAWidth lorentz width "<<theDetParam.widthLAFractionX<<" "<<theDetParam.widthLAFractionY<<endl;
410 
411  } else if(useLAWidthFromConfig_) { // get from config
412 
413  double lAWidth=0;
414  if( GeomDetEnumerators::isTrackerPixel(theDetParam.thePart) && GeomDetEnumerators::isBarrel(theDetParam.thePart) ) lAWidth = lAWidthBPix_; // barrel
415  else lAWidth = lAWidthFPix_;
416 
417  if(langle!=0.0) theDetParam.widthLAFractionX = std::abs(lAWidth/langle);
418  // fix the FractionY at 1
419 
420  //cout<<" Lorentz width from config "<<theDetParam.widthLAFractionX<<" "<<theDetParam.widthLAFractionY<<endl;
421 
422  } else { // get if from the offset LA (old method used until 2013)
423  // do nothing
424  //cout<<" Old default LA width method "<<theDetParam.widthLAFractionX<<" "<<theDetParam.widthLAFractionY<<endl;
425 
426  }
427 
428  //cout<<" Final LA fraction "<<theDetParam.widthLAFractionX<<" "<<theDetParam.widthLAFractionY<<endl;
429 
430  } // if flag
431 
432 
433  float alpha2 = alpha2Order ? langle*langle : 0; //
434 
435  // **********************************************************************
436  // Our convention is the following:
437  // +x is defined by the direction of the Lorentz drift!
438  // +z is defined by the direction of E field (so electrons always go into -z!)
439  // +y is defined by +x and +z, and it turns out to be always opposite to the +B field.
440  // **********************************************************************
441 
442  float dir_x = -( langle * Bfield.y() + alpha2* Bfield.z()* Bfield.x() );
443  float dir_y = ( langle * Bfield.x() - alpha2* Bfield.z()* Bfield.y() );
444  float dir_z = -( 1.f + alpha2* Bfield.z()*Bfield.z() );
445  auto scale = 1.f/std::abs( dir_z ); // same as 1 + alpha2*Bfield.z()*Bfield.z()
446  LocalVector dd(dir_x*scale, dir_y*scale, -1.f ); // last is -1 !
447 
448  LogDebug("PixelCPEBase") << " The drift direction in local coordinate is " << dd ;
449 
450  return dd;
451 }
#define LogDebug(id)
const SiPixelLorentzAngle * lorentzAngleWidth_
Definition: PixelCPEBase.h:249
bool isBarrel(GeomDetEnumerators::SubDetector m)
bool useLAWidthFromDB_
Definition: PixelCPEBase.h:238
float lAWidthBPix_
Definition: PixelCPEBase.h:233
bool useLAWidthFromConfig_
Definition: PixelCPEBase.h:237
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
const SiPixelLorentzAngle * lorentzAngle_
Definition: PixelCPEBase.h:248
bool useLAOffsetFromConfig_
Definition: PixelCPEBase.h:236
float getLorentzAngle(const uint32_t &) const
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
float lAWidthFPix_
Definition: PixelCPEBase.h:234
void PixelCPEBase::fillDetParams ( )
private

Definition at line 127 of file PixelCPEBase.cc.

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

Referenced by getParameters(), and PixelCPEBase().

128 {
129  // &&& PM: I have no idea what this code is doing, and what it is doing here!???
130  //
131  auto const & dus = geom_.detUnits();
132  unsigned m_detectors = dus.size();
133  for(unsigned int i=1;i<7;++i) {
134  LogDebug("PixelCPEBase:: LookingForFirstStrip") << "Subdetector " << i
135  << " GeomDetEnumerator " << GeomDetEnumerators::tkDetEnum[i]
136  << " offset " << geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i])
137  << " is it strip? " << (geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i]) != dus.size() ?
138  dus[geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i])]->type().isTrackerStrip() : false);
139  if(geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i]) != dus.size() &&
140  dus[geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i])]->type().isTrackerStrip()) {
142  }
143  }
144  LogDebug("LookingForFirstStrip") << " Chosen offset: " << m_detectors;
145 
146 
147  m_DetParams.resize(m_detectors);
148  LogDebug("PixelCPEBase::fillDetParams():") <<"caching "<<m_detectors<<" pixel detectors"<<endl;
149  for (unsigned i=0; i!=m_detectors;++i) {
150  auto & p=m_DetParams[i];
151  p.theDet = dynamic_cast<const PixelGeomDetUnit*>(dus[i]);
152  assert(p.theDet);
153  assert(p.theDet->index()==int(i));
154 
155  p.theOrigin = p.theDet->surface().toLocal(GlobalPoint(0,0,0));
156 
157  //--- p.theDet->type() returns a GeomDetType, which implements subDetector()
158  p.thePart = p.theDet->type().subDetector();
159 
160 
161  //--- The location in of this DetUnit in a cyllindrical coord system (R,Z)
162  //--- The call goes via BoundSurface, returned by p.theDet->surface(), but
163  //--- position() is implemented in GloballyPositioned<> template
164  //--- ( BoundSurface : Surface : GloballyPositioned<float> )
165  //p.theDetR = p.theDet->surface().position().perp(); //Not used, AH
166  //p.theDetZ = p.theDet->surface().position().z(); //Not used, AH
167  //--- Define parameters for chargewidth calculation
168 
169  //--- bounds() is implemented in BoundSurface itself.
170  p.theThickness = p.theDet->surface().bounds().thickness();
171 
172  // Cache the det id for templates and generic erros
173 
174  if(theFlag_==0) { // for generic
175  if(LoadTemplatesFromDB_ ) // do only if genError requested
176  p.detTemplateId = genErrorDBObject_->getGenErrorID(p.theDet->geographicalId().rawId());
177  } else { // for templates
178  p.detTemplateId = templateDBobject_->getTemplateID(p.theDet->geographicalId());
179  }
180 
181 
182  auto topol = &(p.theDet->specificTopology());
183  p.theTopol=topol;
184  auto const proxyT = dynamic_cast<const ProxyPixelTopology*>(p.theTopol);
185  if (proxyT) p.theRecTopol = dynamic_cast<const RectangularPixelTopology*>(&(proxyT->specificTopology()));
186  else p.theRecTopol = dynamic_cast<const RectangularPixelTopology*>(p.theTopol);
187  assert(p.theRecTopol);
188 
189  //--- The geometrical description of one module/plaquette
190  //p.theNumOfRow = p.theRecTopol->nrows(); // rows in x //Not used, AH. PM: leave commented out.
191  //p.theNumOfCol = p.theRecTopol->ncolumns(); // cols in y //Not used, AH. PM: leave commented out.
192  std::pair<float,float> pitchxy = p.theRecTopol->pitch();
193  p.thePitchX = pitchxy.first; // pitch along x
194  p.thePitchY = pitchxy.second; // pitch along y
195 
196 
197  LocalVector Bfield = p.theDet->surface().toLocal(magfield_->inTesla(p.theDet->surface().position()));
198  p.bz = Bfield.z();
199  p.bx = Bfield.x();
200 
201 
202  //--- Compute the Lorentz shifts for this detector element
203  if ( (theFlag_==0) || DoLorentz_ ) { // do always for generic and if(DOLorentz) for templates
204  p.driftDirection = driftDirection(p, Bfield );
206  }
207 
208 
209  LogDebug("PixelCPEBase::fillDetParams()") << "***** PIXEL LAYOUT *****"
210  << " thePart = " << p.thePart
211  << " theThickness = " << p.theThickness
212  << " thePitchX = " << p.thePitchX
213  << " thePitchY = " << p.thePitchY;
214  // << " theLShiftX = " << p.theLShiftX;
215 
216 
217  }
218 }
#define LogDebug(id)
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
LocalVector driftDirection(DetParam &theDetParam, GlobalVector bfield) const
short getTemplateID(const uint32_t &detid) const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
DetParams m_DetParams
Definition: PixelCPEBase.h:284
short getGenErrorID(const uint32_t &detid) const
bool LoadTemplatesFromDB_
Definition: PixelCPEBase.h:258
unsigned int offsetDU(SubDetector sid) const
T z() const
Definition: PV3DBase.h:64
void computeLorentzShifts(DetParam &) const
const SiPixelTemplateDBObject * templateDBobject_
Definition: PixelCPEBase.h:254
const MagneticField * magfield_
Definition: PixelCPEBase.h:244
SubDetector tkDetEnum[8]
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
const SiPixelGenErrorDBObject * genErrorDBObject_
Definition: PixelCPEBase.h:251
const TrackerGeometry & geom_
Definition: PixelCPEBase.h:245
T x() const
Definition: PV3DBase.h:62
ReturnType PixelCPEBase::getParameters ( const SiPixelCluster cl,
const GeomDetUnit det 
) const
inlineoverridevirtual

Implements PixelClusterParameterEstimator.

Definition at line 142 of file PixelCPEBase.h.

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

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

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

Implements PixelClusterParameterEstimator.

Definition at line 169 of file PixelCPEBase.h.

References haddnano::cl, computeAnglesFromTrajectory(), createClusterParam(), detParam(), fillDetParams(), localError(), localPosition(), rawQualityWord(), and setTheClu().

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

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

477 {
479  if (theClusterParam.hasFilledProb_) {
480  float probabilityXY=0;
481  if(theClusterParam.filled_from_2d) probabilityXY = theClusterParam.probabilityX_;
482  else if ( theClusterParam.probabilityX_ !=0 && theClusterParam.probabilityY_ !=0 )
483  probabilityXY = theClusterParam.probabilityX_ * theClusterParam.probabilityY_ * (1.f - std::log(theClusterParam.probabilityX_ * theClusterParam.probabilityY_) ) ;
485  qualWord );
486 
487  SiPixelRecHitQuality::thePacking.setProbabilityQ ( theClusterParam.probabilityQ_ ,
488  qualWord );
489  }
490  SiPixelRecHitQuality::thePacking.setQBin ( theClusterParam.qBin_,
491  qualWord );
492 
493  SiPixelRecHitQuality::thePacking.setIsOnEdge ( theClusterParam.isOnEdge_,
494  qualWord );
495 
496  SiPixelRecHitQuality::thePacking.setHasBadPixels ( theClusterParam.hasBadPixels_,
497  qualWord );
498 
499  SiPixelRecHitQuality::thePacking.setSpansTwoROCs ( theClusterParam.spansTwoROCs_,
500  qualWord );
501 
502  SiPixelRecHitQuality::thePacking.setHasFilledProb ( theClusterParam.hasFilledProb_,
503  qualWord );
504 
505  return qualWord;
506 }
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
protected

Definition at line 224 of file PixelCPEBase.cc.

References computeAnglesFromTrajectory(), RectangularPixelTopology::containsBigPixelInX(), RectangularPixelTopology::containsBigPixelInY(), PixelCPEBase::ClusterParam::edgeTypeX_, PixelCPEBase::ClusterParam::edgeTypeY_, PixelCPEBase::ClusterParam::isOnEdge_, SiPixelCluster::maxPixelCol(), SiPixelCluster::maxPixelRow(), SiPixelCluster::minPixelCol(), SiPixelCluster::minPixelRow(), RectangularPixelTopology::ncolumns(), RectangularPixelTopology::nrows(), PixelCPEBase::ClusterParam::spansTwoROCs_, PixelCPEBase::ClusterParam::theCluster, and PixelCPEBase::DetParam::theRecTopol.

Referenced by getParameters().

225 {
226 
227  //--- Geometric Quality Information
228  int minInX,minInY,maxInX,maxInY=0;
229  minInX = theClusterParam.theCluster->minPixelRow();
230  minInY = theClusterParam.theCluster->minPixelCol();
231  maxInX = theClusterParam.theCluster->maxPixelRow();
232  maxInY = theClusterParam.theCluster->maxPixelCol();
233 
234  int min_row(0), min_col(0);
235  int max_row = theDetParam.theRecTopol->nrows() - 1;
236  int max_col = theDetParam.theRecTopol->ncolumns() - 1;
237 
238  if (minInX == min_row)
239  theClusterParam.edgeTypeX_ = 1;
240  else if (maxInX == max_row)
241  theClusterParam.edgeTypeX_ = 2;
242  else
243  theClusterParam.edgeTypeX_ = 0;
244 
245  if(minInY == min_col)
246  theClusterParam.edgeTypeY_ = 1;
247  else if (maxInY == max_col)
248  theClusterParam.edgeTypeY_ = 2;
249  else
250  theClusterParam.edgeTypeY_ = 0;
251 
252  theClusterParam.isOnEdge_ = ( theClusterParam.edgeTypeX_ || theClusterParam.edgeTypeY_ );
253 
254  // &&& FOR NOW UNUSED. KEEP IT IN CASE WE WANT TO USE IT IN THE FUTURE
255  // Bad Pixels have their charge set to 0 in the clusterizer
256  //hasBadPixels_ = false;
257  //for(unsigned int i=0; i<theClusterParam.theCluster->pixelADC().size(); ++i) {
258  //if(theClusterParam.theCluster->pixelADC()[i] == 0) { hasBadPixels_ = true; break;}
259  //}
260 
261  theClusterParam.spansTwoROCs_ = theDetParam.theRecTopol->containsBigPixelInX(minInX,maxInX) |
262  theDetParam.theRecTopol->containsBigPixelInY(minInY,maxInY);
263 
264 }

Member Data Documentation

bool PixelCPEBase::alpha2Order
protected

Definition at line 255 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

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

Definition at line 251 of file PixelCPEBase.h.

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

const TrackerGeometry& PixelCPEBase::geom_
protected

Definition at line 245 of file PixelCPEBase.h.

Referenced by PixelCPEClusterRepair::fill2DTemplIDs(), and fillDetParams().

float PixelCPEBase::lAOffset_
protected

Definition at line 232 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

float PixelCPEBase::lAWidthBPix_
protected

Definition at line 233 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

float PixelCPEBase::lAWidthFPix_
protected

Definition at line 234 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

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

Definition at line 248 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

const SiPixelLorentzAngle* PixelCPEBase::lorentzAngleWidth_
protected

Definition at line 249 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

DetParams PixelCPEBase::m_DetParams =DetParams(1440)
protected

Definition at line 284 of file PixelCPEBase.h.

Referenced by detParam(), PixelCPEClusterRepair::fill2DTemplIDs(), and fillDetParams().

const MagneticField* PixelCPEBase::magfield_
protected

Definition at line 244 of file PixelCPEBase.h.

Referenced by fillDetParams().

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

Definition at line 242 of file PixelCPEBase.h.

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

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

Definition at line 236 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

bool PixelCPEBase::useLAWidthFromConfig_
protected

Definition at line 237 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

bool PixelCPEBase::useLAWidthFromDB_
protected

Definition at line 238 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().