CMS 3D CMS Logo

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

#include <PixelCPEBase.h>

Inheritance diagram for PixelCPEBase:
PixelClusterParameterEstimator PixelCPEClusterRepair PixelCPEGenericBase PixelCPETemplateReco PixelCPEFast< TrackerTraits > PixelCPEFastParamsHost< TrackerTraits > PixelCPEGeneric

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 ()
 

Static Public Member Functions

static void fillPSetDescription (edm::ParameterSetDescription &desc)
 

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 doLorentzFromAlignment_
 
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 useLAFromDB_
 
bool useLAOffsetFromConfig_
 
bool useLAWidthFromConfig_
 
bool useLAWidthFromDB_
 
- Protected Attributes inherited from PixelClusterParameterEstimator
unsigned int clusterProbComputationFlag_
 

Static Protected Attributes

static constexpr float bothEdgeXError_ = 31.0f
 
static constexpr float bothEdgeYError_ = 90.0f
 
static constexpr float clusterSplitMaxError_ = 7777.7f
 
static constexpr float xEdgeXError_ = 23.0f
 
static constexpr float xEdgeYError_ = 39.0f
 
static constexpr float yEdgeXError_ = 24.0f
 
static constexpr float yEdgeYError_ = 96.0f
 

Private Member Functions

virtual std::unique_ptr< 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 42 of file PixelCPEBase.h.

Member Typedef Documentation

◆ DetParams

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

Definition at line 278 of file PixelCPEBase.h.

◆ Frame

typedef GloballyPositioned<double> PixelCPEBase::Frame
protected

Definition at line 202 of file PixelCPEBase.h.

Constructor & Destructor Documentation

◆ PixelCPEBase()

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 27 of file PixelCPEBase.cc.

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

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

Member Function Documentation

◆ computeAnglesFromDetPosition()

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

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

280  {
281  LocalPoint lp = theDetParam.theTopol->localPosition(
282  MeasurementPoint(theClusterParam.theCluster->x(), theClusterParam.theCluster->y()));
283  auto gvx = lp.x() - theDetParam.theOrigin.x();
284  auto gvy = lp.y() - theDetParam.theOrigin.y();
285  auto gvz = -1.f / theDetParam.theOrigin.z();
286  //--- Note that the normalization is not required as only the ratio used
287 
288  //theClusterParam.zneg = (gvz < 0); // Not used, AH
289 
290  // calculate angles
291  theClusterParam.cotalpha = gvx * gvz;
292  theClusterParam.cotbeta = gvy * gvz;
293 
294  theClusterParam.with_track_angle = false;
295 
296  /*
297  // used only in dberror param...
298  auto alpha = HALF_PI - std::atan(cotalpha_);
299  auto beta = HALF_PI - std::atan(cotbeta_);
300  if (zneg) { beta -=PI; alpha -=PI;}
301 
302  auto alpha_ = atan2( gv_dot_gvz, gv_dot_gvx );
303  auto beta_ = atan2( gv_dot_gvz, gv_dot_gvy );
304 
305  assert(std::abs(std::round(alpha*10000.f)-std::round(alpha_*10000.f))<2);
306  assert(std::abs(std::round(beta*10000.f)-std::round(beta_*10000.f))<2);
307  */
308 }
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.

◆ computeAnglesFromTrajectory()

void PixelCPEBase::computeAnglesFromTrajectory ( DetParam const &  theDetParam,
ClusterParam theClusterParam,
const LocalTrajectoryParameters ltp 
) const
protected

Definition at line 246 of file PixelCPEBase.cc.

References 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().

248  {
249  theClusterParam.cotalpha = ltp.dxdz();
250  theClusterParam.cotbeta = ltp.dydz();
251 
252  LocalPoint trk_lp = ltp.position();
253  theClusterParam.trk_lp_x = trk_lp.x();
254  theClusterParam.trk_lp_y = trk_lp.y();
255 
256  theClusterParam.with_track_angle = true;
257 
258  // GG: needed to correct for bows/kinks
259  theClusterParam.loc_trk_pred = Topology::LocalTrackPred(
260  theClusterParam.trk_lp_x, theClusterParam.trk_lp_y, theClusterParam.cotalpha, theClusterParam.cotbeta);
261 }
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
LocalPoint position() const
Local x and y position coordinates.

◆ computeLorentzShifts()

void PixelCPEBase::computeLorentzShifts ( DetParam theDetParam) const
protected

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

412  {
413  // Max shift (at the other side of the sensor) in cm
414  theDetParam.lorentzShiftInCmX =
415  theDetParam.driftDirection.x() / theDetParam.driftDirection.z() * theDetParam.theThickness; //
416  theDetParam.lorentzShiftInCmY =
417  theDetParam.driftDirection.y() / theDetParam.driftDirection.z() * theDetParam.theThickness; //
418 
419  LogDebug("PixelCPEBase::computeLorentzShifts()")
420  << " lorentzShiftsInCmX,Y = " << theDetParam.lorentzShiftInCmX << " " << theDetParam.lorentzShiftInCmY << " "
421  << theDetParam.driftDirection;
422 }
#define LogDebug(id)

◆ createClusterParam()

virtual std::unique_ptr<ClusterParam> PixelCPEBase::createClusterParam ( const SiPixelCluster cl) const
privatepure virtual

◆ detParam()

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

Definition at line 311 of file PixelCPEBase.cc.

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

Referenced by getParameters().

311  {
312  auto i = det.index();
313  //cout << "get parameters of detector " << i << endl;
314  assert(i < int(m_DetParams.size()));
315  //if (i>=int(m_DetParams.size())) m_DetParams.resize(i+1); // should never happen!
316  const DetParam& p = m_DetParams[i];
317  return p;
318 }
int index() const
Definition: GeomDet.h:83
DetParams m_DetParams
Definition: PixelCPEBase.h:280
assert(be >=bs)

◆ driftDirection() [1/2]

LocalVector PixelCPEBase::driftDirection ( DetParam theDetParam,
GlobalVector  bfield 
) const
protected

Definition at line 327 of file PixelCPEBase.cc.

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

Referenced by fillDetParams().

327  {
328  Frame detFrame(theDetParam.theDet->surface().position(), theDetParam.theDet->surface().rotation());
329  LocalVector Bfield = detFrame.toLocal(bfield);
330  return driftDirection(theDetParam, Bfield);
331 }
constexpr float Bfield
Definition: Config.h:55
LocalVector driftDirection(DetParam &theDetParam, GlobalVector bfield) const
GloballyPositioned< double > Frame
Definition: PixelCPEBase.h:202

◆ driftDirection() [2/2]

LocalVector PixelCPEBase::driftDirection ( DetParam theDetParam,
LocalVector  bfield 
) const
protected

Definition at line 333 of file PixelCPEBase.cc.

References funct::abs(), alpha2Order, mkfit::Config::Bfield, createTree::dd, f, GeomDet::geographicalId(), SiPixelLorentzAngle::getLorentzAngle(), GeomDetEnumerators::isBarrel(), GeomDetEnumerators::isTrackerPixel(), lAOffset_, lAWidthBPix_, lAWidthFPix_, LogDebug, lorentzAngle_, lorentzAngleWidth_, DetId::rawId(), l1tEGammaCrystalsEmulatorProducer_cfi::scale, PixelCPEBase::DetParam::theDet, theFlag_, PixelCPEBase::DetParam::thePart, useLAOffsetFromConfig_, useLAWidthFromConfig_, useLAWidthFromDB_, PixelCPEBase::DetParam::widthLAFractionX, and PixelCPEBase::DetParam::widthLAFractionY.

333  {
334  // Use LA from DB or from config
335  float langle = 0.;
336  if (!useLAOffsetFromConfig_) { // get it from DB
337  if (lorentzAngle_ != nullptr) { // a real LA object
338  langle = lorentzAngle_->getLorentzAngle(theDetParam.theDet->geographicalId().rawId());
339  LogDebug("PixelCPEBase::driftDirection()")
340  << " la " << langle << " " << theDetParam.theDet->geographicalId().rawId() << endl;
341  } else { // no LA, unused
342  langle = 0; // set to a fake value
343  LogDebug("PixelCPEBase::driftDirection()") << " LA object is NULL, assume LA = 0" << endl; //dk
344  }
345  LogDebug("PixelCPEBase::driftDirection()") << " Will use LA Offset from DB " << langle << endl;
346  } else { // from config file
347  langle = lAOffset_;
348  LogDebug("PixelCPEBase::driftDirection()") << " Will use LA Offset from config " << langle << endl;
349  }
350 
351  // Now do the LA width stuff
352  theDetParam.widthLAFractionX = 1.; // predefine to 1 (default) if things fail
353  theDetParam.widthLAFractionY = 1.;
354 
355  // Compute the charge width, generic only
356  if (theFlag_ == 0) {
357  if (useLAWidthFromDB_ && (lorentzAngleWidth_ != nullptr)) {
358  // take it from a separate, special LA DB object (forWidth)
359 
360  auto langleWidth = lorentzAngleWidth_->getLorentzAngle(theDetParam.theDet->geographicalId().rawId());
361  if (langleWidth != 0.0)
362  theDetParam.widthLAFractionX = std::abs(langleWidth / langle);
363  // leave the widthLAFractionY=1.
364  //cout<<" LAWidth lorentz width "<<theDetParam.widthLAFractionX<<" "<<theDetParam.widthLAFractionY<<endl;
365 
366  } else if (useLAWidthFromConfig_) { // get from config
367 
368  double lAWidth = 0;
369  if (GeomDetEnumerators::isTrackerPixel(theDetParam.thePart) && GeomDetEnumerators::isBarrel(theDetParam.thePart))
370  lAWidth = lAWidthBPix_; // barrel
371  else
372  lAWidth = lAWidthFPix_;
373 
374  if (langle != 0.0)
375  theDetParam.widthLAFractionX = std::abs(lAWidth / langle);
376  // fix the FractionY at 1
377 
378  //cout<<" Lorentz width from config "<<theDetParam.widthLAFractionX<<" "<<theDetParam.widthLAFractionY<<endl;
379 
380  } else { // get if from the offset LA (old method used until 2013)
381  // do nothing
382  //cout<<" Old default LA width method "<<theDetParam.widthLAFractionX<<" "<<theDetParam.widthLAFractionY<<endl;
383  }
384 
385  //cout<<" Final LA fraction "<<theDetParam.widthLAFractionX<<" "<<theDetParam.widthLAFractionY<<endl;
386 
387  } // if flag
388 
389  float alpha2 = alpha2Order ? langle * langle : 0; //
390 
391  // **********************************************************************
392  // Our convention is the following:
393  // +x is defined by the direction of the Lorentz drift!
394  // +z is defined by the direction of E field (so electrons always go into -z!)
395  // +y is defined by +x and +z, and it turns out to be always opposite to the +B field.
396  // **********************************************************************
397 
398  float dir_x = -(langle * Bfield.y() + alpha2 * Bfield.z() * Bfield.x());
399  float dir_y = (langle * Bfield.x() - alpha2 * Bfield.z() * Bfield.y());
400  float dir_z = -(1.f + alpha2 * Bfield.z() * Bfield.z());
401  auto scale = 1.f / std::abs(dir_z); // same as 1 + alpha2*Bfield.z()*Bfield.z()
402  LocalVector dd(dir_x * scale, dir_y * scale, -1.f); // last is -1 !
403 
404  LogDebug("PixelCPEBase") << " The drift direction in local coordinate is " << dd;
405 
406  return dd;
407 }
const SiPixelLorentzAngle * lorentzAngleWidth_
Definition: PixelCPEBase.h:232
bool isBarrel(GeomDetEnumerators::SubDetector m)
string dd
Definition: createTree.py:154
bool useLAWidthFromDB_
Definition: PixelCPEBase.h:221
float lAWidthBPix_
Definition: PixelCPEBase.h:216
bool useLAWidthFromConfig_
Definition: PixelCPEBase.h:220
constexpr float Bfield
Definition: Config.h:55
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
const SiPixelLorentzAngle * lorentzAngle_
Definition: PixelCPEBase.h:231
bool useLAOffsetFromConfig_
Definition: PixelCPEBase.h:219
float getLorentzAngle(const uint32_t &) const
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
float lAWidthFPix_
Definition: PixelCPEBase.h:217
#define LogDebug(id)

◆ fillDetParams()

void PixelCPEBase::fillDetParams ( )
private

Definition at line 118 of file PixelCPEBase.cc.

References cms::cuda::assert(), mkfit::Config::Bfield, computeLorentzShifts(), TrackerGeometry::detUnits(), doLorentzFromAlignment_, 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, and useLAFromDB_.

Referenced by PixelCPEBase().

118  {
119  // MM: this code finds the last Pixel (Inner Tracker) DetUnit to loop upon when filling the det params, by looking the first detId which is from
120  // the Outer Tracker (Strips in case of the Phase-0/1 detector).
121 
122  auto const& dus = geom_.detUnits();
123  unsigned m_detectors = dus.size();
124  for (unsigned int i = 1; i < 7; ++i) {
125  LogDebug("PixelCPEBase:: LookingForFirstStrip")
126  << "Subdetector " << i << " GeomDetEnumerator " << GeomDetEnumerators::tkDetEnum[i] << " offset "
127  << geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i]) << " is it strip? "
128  << (geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i]) != dus.size()
129  ? dus[geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i])]->type().isOuterTracker()
130  : false);
131 
132  if (geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i]) != dus.size() &&
133  dus[geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i])]->type().isOuterTracker()) {
134  if (geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i]) < m_detectors) {
136  }
137  }
138  }
139  LogDebug("LookingForFirstStrip") << " Chosen offset: " << m_detectors;
140 
141  m_DetParams.resize(m_detectors);
142  LogDebug("PixelCPEBase::fillDetParams():") << "caching " << m_detectors << " pixel detectors" << endl;
143  for (unsigned i = 0; i != m_detectors; ++i) {
144  auto& p = m_DetParams[i];
145  p.theDet = dynamic_cast<const PixelGeomDetUnit*>(dus[i]);
146  assert(p.theDet);
147  assert(p.theDet->index() == int(i));
148 
149  p.theOrigin = p.theDet->surface().toLocal(GlobalPoint(0, 0, 0));
150 
151  //--- p.theDet->type() returns a GeomDetType, which implements subDetector()
152  p.thePart = p.theDet->type().subDetector();
153 
154  //--- The location in of this DetUnit in a cyllindrical coord system (R,Z)
155  //--- The call goes via BoundSurface, returned by p.theDet->surface(), but
156  //--- position() is implemented in GloballyPositioned<> template
157  //--- ( BoundSurface : Surface : GloballyPositioned<float> )
158  //p.theDetR = p.theDet->surface().position().perp(); //Not used, AH
159  //p.theDetZ = p.theDet->surface().position().z(); //Not used, AH
160  //--- Define parameters for chargewidth calculation
161 
162  //--- bounds() is implemented in BoundSurface itself.
163  p.theThickness = p.theDet->surface().bounds().thickness();
164 
165  // Cache the det id for templates and generic erros
166 
167  if (theFlag_ == 0) { // for generic
168  if (LoadTemplatesFromDB_) // do only if genError requested
169  p.detTemplateId = genErrorDBObject_->getGenErrorID(p.theDet->geographicalId().rawId());
170  } else { // for templates
171  p.detTemplateId = templateDBobject_->getTemplateID(p.theDet->geographicalId());
172  }
173 
174  auto topol = &(p.theDet->specificTopology());
175  p.theTopol = topol;
176 
177  //--- The geometrical description of one module/plaquette
178  std::pair<float, float> pitchxy = p.theTopol->pitch();
179  p.thePitchX = pitchxy.first; // pitch along x
180  p.thePitchY = pitchxy.second; // pitch along y
181 
182  LocalVector Bfield = p.theDet->surface().toLocal(magfield_->inTesla(p.theDet->surface().position()));
183  p.bz = Bfield.z();
184  p.bx = Bfield.x();
185 
186  //--- Compute the Lorentz shifts for this detector element
187  if ((theFlag_ == 0) || useLAFromDB_ ||
188  doLorentzFromAlignment_) { // do always for generic and if using LA from DB or alignment for templates
189  p.driftDirection = driftDirection(p, Bfield);
191  }
192 
193  LogDebug("PixelCPEBase::fillDetParams()") << "***** PIXEL LAYOUT *****"
194  << " thePart = " << p.thePart << " theThickness = " << p.theThickness
195  << " thePitchX = " << p.thePitchX << " thePitchY = " << p.thePitchY;
196  // << " theLShiftX = " << p.theLShiftX;
197  }
198 }
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
unsigned int offsetDU(SubDetector sid) const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
DetParams m_DetParams
Definition: PixelCPEBase.h:280
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
bool doLorentzFromAlignment_
Definition: PixelCPEBase.h:240
assert(be >=bs)
void computeLorentzShifts(DetParam &) const
bool LoadTemplatesFromDB_
Definition: PixelCPEBase.h:241
short getGenErrorID(const uint32_t &detid) const
constexpr float Bfield
Definition: Config.h:55
const SiPixelTemplateDBObject * templateDBobject_
Definition: PixelCPEBase.h:235
const MagneticField * magfield_
Definition: PixelCPEBase.h:227
const SiPixelGenErrorDBObject * genErrorDBObject_
Definition: PixelCPEBase.h:234
short getTemplateID(const uint32_t &detid) const
LocalVector driftDirection(DetParam &theDetParam, GlobalVector bfield) const
const TrackerGeometry & geom_
Definition: PixelCPEBase.h:228
constexpr SubDetector tkDetEnum[8]
#define LogDebug(id)

◆ fillPSetDescription()

void PixelCPEBase::fillPSetDescription ( edm::ParameterSetDescription desc)
static

Definition at line 456 of file PixelCPEBase.cc.

References submitPVResolutionJobs::desc.

Referenced by PixelCPETemplateRecoESProducer::fillDescriptions(), PixelCPEFastESProducerT< TrackerTraits >::fillDescriptions(), PixelCPEClusterRepairESProducer::fillDescriptions(), PixelCPEGenericESProducer::fillDescriptions(), and ALPAKA_ACCELERATOR_NAMESPACE::PixelCPEFastParamsESProducerAlpaka< TrackerTraits >::fillDescriptions().

456  {
457  desc.add<bool>("LoadTemplatesFromDB", true);
458  desc.add<bool>("Alpha2Order", true);
459  desc.add<int>("ClusterProbComputationFlag", 0);
460  desc.add<bool>("useLAWidthFromDB", true);
461  desc.add<double>("lAOffset", 0.0);
462  desc.add<double>("lAWidthBPix", 0.0);
463  desc.add<double>("lAWidthFPix", 0.0);
464  desc.add<bool>("doLorentzFromAlignment", false);
465  desc.add<bool>("useLAFromDB", true);
466 }

◆ getParameters() [1/2]

ReturnType PixelCPEBase::getParameters ( const SiPixelCluster cl,
const GeomDetUnit det 
) const
inlineoverridevirtual

Implements PixelClusterParameterEstimator.

Definition at line 132 of file PixelCPEBase.h.

References haddnano::cl, computeAnglesFromDetPosition(), createClusterParam(), detParam(), localError(), localPosition(), LogDebug, rawQualityWord(), setTheClu(), mkLumiAveragedPlots::tuple, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

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

132  {
133 #ifdef EDM_ML_DEBUG
134  nRecHitsTotal_++;
135  LogDebug("PixelCPEBase") << " in PixelCPEBase:localParameters(all) - " << nRecHitsTotal_;
136 #endif
137 
138  DetParam const& theDetParam = detParam(det);
139  std::unique_ptr<ClusterParam> theClusterParam = createClusterParam(cl);
140  setTheClu(theDetParam, *theClusterParam);
141  computeAnglesFromDetPosition(theDetParam, *theClusterParam);
142 
143  // localPosition( cl, det ) must be called before localError( cl, det ) !!!
144  LocalPoint lp = localPosition(theDetParam, *theClusterParam);
145  LocalError le = localError(theDetParam, *theClusterParam);
146  SiPixelRecHitQuality::QualWordType rqw = rawQualityWord(*theClusterParam);
147  auto tuple = std::make_tuple(lp, le, rqw);
148 
149  LogDebug("PixelCPEBase") << " in PixelCPEBase:localParameters(all) - " << lp.x() << " " << lp.y();
150  return tuple;
151  }
void computeAnglesFromDetPosition(DetParam const &theDetParam, ClusterParam &theClusterParam) const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
SiPixelRecHitQuality::QualWordType rawQualityWord(ClusterParam &theClusterParam) const
virtual LocalPoint localPosition(DetParam const &theDetParam, ClusterParam &theClusterParam) const =0
virtual std::unique_ptr< ClusterParam > createClusterParam(const SiPixelCluster &cl) const =0
DetParam const & detParam(const GeomDetUnit &det) const
virtual LocalError localError(DetParam const &theDetParam, ClusterParam &theClusterParam) const =0
void setTheClu(DetParam const &, ClusterParam &theClusterParam) const
#define LogDebug(id)

◆ getParameters() [2/2]

ReturnType PixelCPEBase::getParameters ( const SiPixelCluster cl,
const GeomDetUnit det,
const LocalTrajectoryParameters ltp 
) const
inlineoverridevirtual

Implements PixelClusterParameterEstimator.

Definition at line 156 of file PixelCPEBase.h.

References haddnano::cl, computeAnglesFromTrajectory(), createClusterParam(), detParam(), localError(), localPosition(), LogDebug, rawQualityWord(), setTheClu(), mkLumiAveragedPlots::tuple, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

158  {
159 #ifdef EDM_ML_DEBUG
160  nRecHitsTotal_++;
161  LogDebug("PixelCPEBase") << " in PixelCPEBase:localParameters(on track) - " << nRecHitsTotal_;
162 #endif
163 
164  DetParam const& theDetParam = detParam(det);
165  std::unique_ptr<ClusterParam> theClusterParam = createClusterParam(cl);
166  setTheClu(theDetParam, *theClusterParam);
167  computeAnglesFromTrajectory(theDetParam, *theClusterParam, ltp);
168 
169  // localPosition( cl, det ) must be called before localError( cl, det ) !!!
170  LocalPoint lp = localPosition(theDetParam, *theClusterParam);
171  LocalError le = localError(theDetParam, *theClusterParam);
172  SiPixelRecHitQuality::QualWordType rqw = rawQualityWord(*theClusterParam);
173  auto tuple = std::make_tuple(lp, le, rqw);
174 
175  LogDebug("PixelCPEBase") << " in PixelCPEBase:localParameters(on track) - " << lp.x() << " " << lp.y();
176  return tuple;
177  }
void computeAnglesFromTrajectory(DetParam const &theDetParam, ClusterParam &theClusterParam, const LocalTrajectoryParameters &ltp) const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
SiPixelRecHitQuality::QualWordType rawQualityWord(ClusterParam &theClusterParam) const
virtual LocalPoint localPosition(DetParam const &theDetParam, ClusterParam &theClusterParam) const =0
virtual std::unique_ptr< ClusterParam > createClusterParam(const SiPixelCluster &cl) const =0
DetParam const & detParam(const GeomDetUnit &det) const
virtual LocalError localError(DetParam const &theDetParam, ClusterParam &theClusterParam) const =0
void setTheClu(DetParam const &, ClusterParam &theClusterParam) const
#define LogDebug(id)

◆ localError()

virtual LocalError PixelCPEBase::localError ( DetParam const &  theDetParam,
ClusterParam theClusterParam 
) const
privatepure virtual

◆ localPosition()

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

◆ rawQualityWord()

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 430 of file PixelCPEBase.cc.

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

430  {
432  if (theClusterParam.hasFilledProb_) {
433  float probabilityXY = 0;
434  if (theClusterParam.filled_from_2d)
435  probabilityXY = theClusterParam.probabilityX_;
436  else if (theClusterParam.probabilityX_ != 0 && theClusterParam.probabilityY_ != 0)
437  probabilityXY = theClusterParam.probabilityX_ * theClusterParam.probabilityY_ *
438  (1.f - std::log(theClusterParam.probabilityX_ * theClusterParam.probabilityY_));
439  SiPixelRecHitQuality::thePacking.setProbabilityXY(probabilityXY, qualWord);
440 
441  SiPixelRecHitQuality::thePacking.setProbabilityQ(theClusterParam.probabilityQ_, qualWord);
442  }
443  SiPixelRecHitQuality::thePacking.setQBin(theClusterParam.qBin_, qualWord);
444 
445  SiPixelRecHitQuality::thePacking.setIsOnEdge(theClusterParam.isOnEdge_, qualWord);
446 
447  SiPixelRecHitQuality::thePacking.setHasBadPixels(theClusterParam.hasBadPixels_, qualWord);
448 
449  SiPixelRecHitQuality::thePacking.setSpansTwoROCs(theClusterParam.spansTwoROCs_, qualWord);
450 
451  SiPixelRecHitQuality::thePacking.setHasFilledProb(theClusterParam.hasFilledProb_, qualWord);
452 
453  return qualWord;
454 }
static const Packing thePacking
void setHasBadPixels(bool flag, 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 setProbabilityQ(float prob, QualWordType &qualWord) const
void setProbabilityXY(float prob, QualWordType &qualWord) const

◆ setTheClu()

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

Definition at line 203 of file PixelCPEBase.cc.

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

Referenced by getParameters().

203  {
204  //--- Geometric Quality Information
205  int minInX, minInY, maxInX, maxInY = 0;
206  minInX = theClusterParam.theCluster->minPixelRow();
207  minInY = theClusterParam.theCluster->minPixelCol();
208  maxInX = theClusterParam.theCluster->maxPixelRow();
209  maxInY = theClusterParam.theCluster->maxPixelCol();
210 
211  int min_row(0), min_col(0);
212  int max_row = theDetParam.theTopol->nrows() - 1;
213  int max_col = theDetParam.theTopol->ncolumns() - 1;
214 
215  if (minInX == min_row)
216  theClusterParam.edgeTypeX_ = 1;
217  else if (maxInX == max_row)
218  theClusterParam.edgeTypeX_ = 2;
219  else
220  theClusterParam.edgeTypeX_ = 0;
221 
222  if (minInY == min_col)
223  theClusterParam.edgeTypeY_ = 1;
224  else if (maxInY == max_col)
225  theClusterParam.edgeTypeY_ = 2;
226  else
227  theClusterParam.edgeTypeY_ = 0;
228 
229  theClusterParam.isOnEdge_ = (theClusterParam.edgeTypeX_ || theClusterParam.edgeTypeY_);
230 
231  // &&& FOR NOW UNUSED. KEEP IT IN CASE WE WANT TO USE IT IN THE FUTURE
232  // Bad Pixels have their charge set to 0 in the clusterizer
233  //hasBadPixels_ = false;
234  //for(unsigned int i=0; i<theClusterParam.theCluster->pixelADC().size(); ++i) {
235  //if(theClusterParam.theCluster->pixelADC()[i] == 0) { hasBadPixels_ = true; break;}
236  //}
237 
238  theClusterParam.spansTwoROCs_ = theDetParam.theTopol->containsBigPixelInX(minInX, maxInX) ||
239  theDetParam.theTopol->containsBigPixelInY(minInY, maxInY);
240 }

Member Data Documentation

◆ alpha2Order

bool PixelCPEBase::alpha2Order
protected

Definition at line 236 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

◆ bothEdgeXError_

constexpr float PixelCPEBase::bothEdgeXError_ = 31.0f
staticprotected

◆ bothEdgeYError_

constexpr float PixelCPEBase::bothEdgeYError_ = 90.0f
staticprotected

◆ clusterSplitMaxError_

constexpr float PixelCPEBase::clusterSplitMaxError_ = 7777.7f
staticprotected

◆ doLorentzFromAlignment_

bool PixelCPEBase::doLorentzFromAlignment_
protected

◆ genErrorDBObject_

const SiPixelGenErrorDBObject* PixelCPEBase::genErrorDBObject_
protected

◆ geom_

const TrackerGeometry& PixelCPEBase::geom_
protected

Definition at line 228 of file PixelCPEBase.h.

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

◆ lAOffset_

float PixelCPEBase::lAOffset_
protected

Definition at line 215 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

◆ lAWidthBPix_

float PixelCPEBase::lAWidthBPix_
protected

Definition at line 216 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

◆ lAWidthFPix_

float PixelCPEBase::lAWidthFPix_
protected

Definition at line 217 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

◆ LoadTemplatesFromDB_

bool PixelCPEBase::LoadTemplatesFromDB_
protected

◆ lorentzAngle_

const SiPixelLorentzAngle* PixelCPEBase::lorentzAngle_
protected

Definition at line 231 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

◆ lorentzAngleWidth_

const SiPixelLorentzAngle* PixelCPEBase::lorentzAngleWidth_
protected

Definition at line 232 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

◆ m_DetParams

DetParams PixelCPEBase::m_DetParams = DetParams(1440)
protected

Definition at line 280 of file PixelCPEBase.h.

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

◆ magfield_

const MagneticField* PixelCPEBase::magfield_
protected

Definition at line 227 of file PixelCPEBase.h.

Referenced by fillDetParams().

◆ templateDBobject_

const SiPixelTemplateDBObject* PixelCPEBase::templateDBobject_
protected

◆ theFlag_

int PixelCPEBase::theFlag_
protected

Definition at line 225 of file PixelCPEBase.h.

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

◆ theVerboseLevel

int PixelCPEBase::theVerboseLevel
protected

◆ ttopo_

const TrackerTopology& PixelCPEBase::ttopo_
protected

◆ useLAFromDB_

bool PixelCPEBase::useLAFromDB_
protected

Definition at line 238 of file PixelCPEBase.h.

Referenced by fillDetParams(), and PixelCPEBase().

◆ useLAOffsetFromConfig_

bool PixelCPEBase::useLAOffsetFromConfig_
protected

Definition at line 219 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

◆ useLAWidthFromConfig_

bool PixelCPEBase::useLAWidthFromConfig_
protected

Definition at line 220 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

◆ useLAWidthFromDB_

bool PixelCPEBase::useLAWidthFromDB_
protected

Definition at line 221 of file PixelCPEBase.h.

Referenced by driftDirection(), and PixelCPEBase().

◆ xEdgeXError_

constexpr float PixelCPEBase::xEdgeXError_ = 23.0f
staticprotected

◆ xEdgeYError_

constexpr float PixelCPEBase::xEdgeYError_ = 39.0f
staticprotected

◆ yEdgeXError_

constexpr float PixelCPEBase::yEdgeXError_ = 24.0f
staticprotected

◆ yEdgeYError_

constexpr float PixelCPEBase::yEdgeYError_ = 96.0f
staticprotected