CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PixelCPEFastParamsHost< TrackerTraits > Class Template Reference

#include <PixelCPEFastParamsHost.h>

Inheritance diagram for PixelCPEFastParamsHost< TrackerTraits >:
PixelCPEGenericBase PixelCPEBase PixelClusterParameterEstimator

Public Types

using Buffer = cms::alpakatools::host_buffer< pixelCPEforDevice::ParamsOnDeviceT< TrackerTraits > >
 
using ConstBuffer = cms::alpakatools::const_host_buffer< pixelCPEforDevice::ParamsOnDeviceT< TrackerTraits > >
 
- Public Types inherited from PixelClusterParameterEstimator
typedef std::pair< LocalPoint, LocalErrorLocalValues
 
using ReturnType = std::tuple< LocalPoint, LocalError, SiPixelRecHitQuality::QualWordType >
 
typedef std::vector< LocalValuesVLocalValues
 

Public Member Functions

Buffer buffer ()
 
ConstBuffer buffer () const
 
ConstBuffer const_buffer () const
 
pixelCPEforDevice::ParamsOnDeviceT< TrackerTraits > const * data () const
 
PixelCPEFastParamsHostoperator= (PixelCPEFastParamsHost const &)=delete
 
PixelCPEFastParamsHostoperator= (PixelCPEFastParamsHost &&)=default
 
 PixelCPEFastParamsHost (edm::ParameterSet const &conf, const MagneticField *mag, const TrackerGeometry &geom, const TrackerTopology &ttopo, const SiPixelLorentzAngle *lorentzAngle, const SiPixelGenErrorDBObject *genErrorDBObject, const SiPixelLorentzAngle *lorentzAngleWidth)
 The constructor. More...
 
 PixelCPEFastParamsHost (PixelCPEFastParamsHost const &)=delete
 
 PixelCPEFastParamsHost (PixelCPEFastParamsHost &&)=default
 
auto size () const
 
 ~PixelCPEFastParamsHost () override=default
 
- Public Member Functions inherited from PixelCPEGenericBase
 PixelCPEGenericBase (edm::ParameterSet const &conf, const MagneticField *mag, const TrackerGeometry &geom, const TrackerTopology &ttopo, const SiPixelLorentzAngle *lorentzAngle, const SiPixelGenErrorDBObject *genErrorDBObject, const SiPixelLorentzAngle *lorentzAngleWidth)
 
 ~PixelCPEGenericBase () override=default
 
- Public Member Functions inherited from PixelCPEBase
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)
 
- Static Public Member Functions inherited from PixelCPEGenericBase
static void fillPSetDescription (edm::ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from PixelCPEBase
static void fillPSetDescription (edm::ParameterSetDescription &desc)
 

Private Member Functions

void errorFromTemplates (DetParam const &theDetParam, ClusterParamGeneric &theClusterParam, float qclus) const
 
template<>
void errorFromTemplates (DetParam const &theDetParam, ClusterParamGeneric &theClusterParam, float qclus) const
 
void fillParamsForDevice ()
 
LocalError localError (DetParam const &theDetParam, ClusterParam &theClusterParam) const override
 
LocalPoint localPosition (DetParam const &theDetParam, ClusterParam &theClusterParam) const override
 

Private Attributes

Buffer buffer_
 
std::vector< SiPixelGenErrorStorethePixelGenError_
 

Additional Inherited Members

- Protected Types inherited from PixelCPEBase
using DetParams = std::vector< DetParam >
 
typedef GloballyPositioned< double > Frame
 
- Protected Member Functions inherited from PixelCPEGenericBase
std::unique_ptr< ClusterParamcreateClusterParam (const SiPixelCluster &cl) const override
 
void initializeLocalErrorVariables (float &xerr, float &yerr, bool &edgex, bool &edgey, bool &bigInX, bool &bigInY, int &maxPixelCol, int &maxPixelRow, int &minPixelCol, int &minPixelRow, uint &sizex, uint &sizey, DetParam const &theDetParam, ClusterParamGeneric const &theClusterParam) const
 
void setXYErrors (float &xerr, float &yerr, const bool edgex, const bool edgey, const unsigned int sizex, const unsigned int sizey, const bool bigInX, const bool bigInY, const bool useTemplateErrors, DetParam const &theDetParam, ClusterParamGeneric const &theClusterParam) const
 
- Protected Member Functions inherited from PixelCPEBase
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
 
- Static Protected Member Functions inherited from PixelCPEGenericBase
static void collect_edge_charges (ClusterParam &theClusterParam, int &q_f_X, int &q_l_X, int &q_f_Y, int &q_l_Y, bool truncate)
 
- Protected Attributes inherited from PixelCPEGenericBase
const float edgeClusterErrorX_
 
const float edgeClusterErrorY_
 
const bool truncatePixelCharge_
 
bool useErrorsFromTemplates_
 
const std::vector< float > xerr_barrel_l1_
 
const float xerr_barrel_l1_def_
 
const std::vector< float > xerr_barrel_ln_
 
const float xerr_barrel_ln_def_
 
const std::vector< float > xerr_endcap_
 
const float xerr_endcap_def_
 
const std::vector< float > yerr_barrel_l1_
 
const float yerr_barrel_l1_def_
 
const std::vector< float > yerr_barrel_ln_
 
const float yerr_barrel_ln_def_
 
const std::vector< float > yerr_endcap_
 
const float yerr_endcap_def_
 
- Protected Attributes inherited from PixelCPEBase
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 inherited from PixelCPEBase
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
 

Detailed Description

template<typename TrackerTraits>
class PixelCPEFastParamsHost< TrackerTraits >

Definition at line 18 of file PixelCPEFastParamsHost.h.

Member Typedef Documentation

◆ Buffer

template<typename TrackerTraits>
using PixelCPEFastParamsHost< TrackerTraits >::Buffer = cms::alpakatools::host_buffer<pixelCPEforDevice::ParamsOnDeviceT<TrackerTraits> >

Definition at line 20 of file PixelCPEFastParamsHost.h.

◆ ConstBuffer

template<typename TrackerTraits>
using PixelCPEFastParamsHost< TrackerTraits >::ConstBuffer = cms::alpakatools::const_host_buffer<pixelCPEforDevice::ParamsOnDeviceT<TrackerTraits> >

Definition at line 21 of file PixelCPEFastParamsHost.h.

Constructor & Destructor Documentation

◆ PixelCPEFastParamsHost() [1/3]

template<typename TrackerTraits >
PixelCPEFastParamsHost< TrackerTraits >::PixelCPEFastParamsHost ( edm::ParameterSet const &  conf,
const MagneticField mag,
const TrackerGeometry geom,
const TrackerTopology ttopo,
const SiPixelLorentzAngle lorentzAngle,
const SiPixelGenErrorDBObject genErrorDBObject,
const SiPixelLorentzAngle lorentzAngleWidth 
)

The constructor.

Definition at line 17 of file PixelCPEFastParamsHost.cc.

References Exception, PixelCPEFastParamsHost< TrackerTraits >::fillParamsForDevice(), PixelCPEBase::genErrorDBObject_, SiPixelGenError::pushfile(), PixelCPEFastParamsHost< TrackerTraits >::thePixelGenError_, and PixelCPEGenericBase::useErrorsFromTemplates_.

24  : PixelCPEGenericBase(conf, mag, geom, ttopo, lorentzAngle, genErrorDBObject, lorentzAngleWidth),
26  // Use errors from templates or from GenError
29  throw cms::Exception("InvalidCalibrationLoaded")
30  << "ERROR: GenErrors not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version "
31  << (*genErrorDBObject_).version();
32  }
33 
35 }
static bool pushfile(int filenum, std::vector< SiPixelGenErrorStore > &pixelTemp, std::string dir="")
std::vector< SiPixelGenErrorStore > thePixelGenError_
std::enable_if_t< not std::is_array_v< T >, host_buffer< T > > make_host_buffer()
Definition: memory.h:65
PixelCPEGenericBase(edm::ParameterSet const &conf, const MagneticField *mag, const TrackerGeometry &geom, const TrackerTopology &ttopo, const SiPixelLorentzAngle *lorentzAngle, const SiPixelGenErrorDBObject *genErrorDBObject, const SiPixelLorentzAngle *lorentzAngleWidth)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const SiPixelGenErrorDBObject * genErrorDBObject_
Definition: PixelCPEBase.h:236

◆ PixelCPEFastParamsHost() [2/3]

template<typename TrackerTraits>
PixelCPEFastParamsHost< TrackerTraits >::PixelCPEFastParamsHost ( PixelCPEFastParamsHost< TrackerTraits > const &  )
delete

◆ PixelCPEFastParamsHost() [3/3]

template<typename TrackerTraits>
PixelCPEFastParamsHost< TrackerTraits >::PixelCPEFastParamsHost ( PixelCPEFastParamsHost< TrackerTraits > &&  )
default

◆ ~PixelCPEFastParamsHost()

template<typename TrackerTraits>
PixelCPEFastParamsHost< TrackerTraits >::~PixelCPEFastParamsHost ( )
overridedefault

Member Function Documentation

◆ buffer() [1/2]

template<typename TrackerTraits>
Buffer PixelCPEFastParamsHost< TrackerTraits >::buffer ( )
inline

◆ buffer() [2/2]

template<typename TrackerTraits>
ConstBuffer PixelCPEFastParamsHost< TrackerTraits >::buffer ( ) const
inline

◆ const_buffer()

template<typename TrackerTraits>
ConstBuffer PixelCPEFastParamsHost< TrackerTraits >::const_buffer ( ) const
inline

◆ data()

template<typename TrackerTraits>
pixelCPEforDevice::ParamsOnDeviceT<TrackerTraits> const* PixelCPEFastParamsHost< TrackerTraits >::data ( ) const
inline

Definition at line 49 of file PixelCPEFastParamsHost.h.

References PixelCPEFastParamsHost< TrackerTraits >::buffer_.

49 { return buffer_.data(); }

◆ errorFromTemplates() [1/2]

template<typename TrackerTraits >
void PixelCPEFastParamsHost< TrackerTraits >::errorFromTemplates ( DetParam const &  theDetParam,
ClusterParamGeneric theClusterParam,
float  qclus 
) const
private

Definition at line 340 of file PixelCPEFastParamsHost.cc.

References PixelCPEBase::DetParam::bx, PixelCPEBase::DetParam::bz, PixelCPEBase::ClusterParam::cotalpha, PixelCPEBase::ClusterParam::cotbeta, PixelCPEBase::DetParam::detTemplateId, LogDebug, SiStripPI::max, pixelCPEforDevice::micronsToCm, PixelCPEGenericBase::ClusterParamGeneric::pixmx, SiPixelGenError::qbin(), PixelCPEBase::ClusterParam::qBin_, PixelCPEGenericBase::ClusterParamGeneric::sigmax, PixelCPEGenericBase::ClusterParamGeneric::sigmay, PixelCPEGenericBase::ClusterParamGeneric::sx1, PixelCPEGenericBase::ClusterParamGeneric::sx2, PixelCPEGenericBase::ClusterParamGeneric::sy1, and PixelCPEGenericBase::ClusterParamGeneric::sy2.

342  {
343  float locBz = theDetParam.bz;
344  float locBx = theDetParam.bx;
345  LogDebug("PixelCPEFastParamsHost") << "PixelCPEFastParamsHost::localPosition(...) : locBz = " << locBz;
346 
347  theClusterParam.pixmx = std::numeric_limits<int>::max(); // max pixel charge for truncation of 2-D cluster
348 
349  theClusterParam.sigmay = -999.9; // CPE Generic y-error for multi-pixel cluster
350  theClusterParam.sigmax = -999.9; // CPE Generic x-error for multi-pixel cluster
351  theClusterParam.sy1 = -999.9; // CPE Generic y-error for single single-pixel
352  theClusterParam.sy2 = -999.9; // CPE Generic y-error for single double-pixel cluster
353  theClusterParam.sx1 = -999.9; // CPE Generic x-error for single single-pixel cluster
354  theClusterParam.sx2 = -999.9; // CPE Generic x-error for single double-pixel cluster
355 
356  float dummy;
357 
358  SiPixelGenError gtempl(this->thePixelGenError_);
359  int gtemplID = theDetParam.detTemplateId;
360 
361  theClusterParam.qBin_ = gtempl.qbin(gtemplID,
362  theClusterParam.cotalpha,
363  theClusterParam.cotbeta,
364  locBz,
365  locBx,
366  qclus,
367  false,
368  theClusterParam.pixmx,
369  theClusterParam.sigmay,
370  dummy,
371  theClusterParam.sigmax,
372  dummy,
373  theClusterParam.sy1,
374  dummy,
375  theClusterParam.sy2,
376  dummy,
377  theClusterParam.sx1,
378  dummy,
379  theClusterParam.sx2,
380  dummy);
381 
382  theClusterParam.sigmax = theClusterParam.sigmax * pixelCPEforDevice::micronsToCm;
383  theClusterParam.sx1 = theClusterParam.sx1 * pixelCPEforDevice::micronsToCm;
384  theClusterParam.sx2 = theClusterParam.sx2 * pixelCPEforDevice::micronsToCm;
385 
386  theClusterParam.sigmay = theClusterParam.sigmay * pixelCPEforDevice::micronsToCm;
387  theClusterParam.sy1 = theClusterParam.sy1 * pixelCPEforDevice::micronsToCm;
388  theClusterParam.sy2 = theClusterParam.sy2 * pixelCPEforDevice::micronsToCm;
389 }
std::vector< SiPixelGenErrorStore > thePixelGenError_
constexpr float micronsToCm
#define LogDebug(id)

◆ errorFromTemplates() [2/2]

template<>
void PixelCPEFastParamsHost< pixelTopology::Phase2 >::errorFromTemplates ( DetParam const &  theDetParam,
ClusterParamGeneric theClusterParam,
float  qclus 
) const
private

Definition at line 392 of file PixelCPEFastParamsHost.cc.

References PixelCPEBase::ClusterParam::qBin_.

394  {
395  theClusterParam.qBin_ = 0.0f;
396 }

◆ fillParamsForDevice()

template<typename TrackerTraits >
void PixelCPEFastParamsHost< TrackerTraits >::fillParamsForDevice ( )
private

Definition at line 38 of file PixelCPEFastParamsHost.cc.

References funct::abs(), cms::cuda::assert(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), CommonMethods::cp(), f, nano_mu_digi_cff::float, g, mps_fire::i, createfilelist::int, GeomDetEnumerators::isBarrel(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), dqmdumpme::k, pixelCPEforDevice::kGenErrorQBins, GetRecoTauVFromDQM_MC_cff::kk, pixelCPEforDevice::kNumErrorBins, PVValHelper::ladder, phase1PixelTopology::layerStart, LogDebug, visualization-live-secondInstance_cfg::m, SiStripPI::max, SiStripPI::min, phase1PixelTopology::numberOfModules, AlCaHLTBitMon_ParallelJobs::p, findQualityFiles::rr, mathSSE::sqrt(), Calorimetry_cff::thickness, mitigatedMETSequence_cff::U, x, detailsBasic3DVector::y, detailsBasic3DVector::z, and SOAFrame< T >::z().

Referenced by PixelCPEFastParamsHost< TrackerTraits >::PixelCPEFastParamsHost().

38  {
39  // this code executes only once per job, computation inefficiency is not an issue
40  // many code blocks are repeated: better keep the computation local and self consistent as blocks may in future move around, be deleted ...
41  // It is valid only for Phase1 and the version of GenError in DB used in late 2018 and in 2021
42 
43  buffer_->commonParams().theThicknessB = m_DetParams.front().theThickness;
44  buffer_->commonParams().theThicknessE = m_DetParams.back().theThickness;
45  buffer_->commonParams().thePitchX = m_DetParams[0].thePitchX;
46  buffer_->commonParams().thePitchY = m_DetParams[0].thePitchY;
47 
48  buffer_->commonParams().numberOfLaddersInBarrel = TrackerTraits::numberOfLaddersInBarrel;
49 
50  LogDebug("PixelCPEFastParamsHost") << "pitch & thickness " << buffer_->commonParams().thePitchX << ' '
51  << buffer_->commonParams().thePitchY << " "
52  << buffer_->commonParams().theThicknessB << ' '
53  << buffer_->commonParams().theThicknessE;
54 
55  // zero average geometry
56  memset(&buffer_->averageGeometry(), 0, sizeof(pixelTopology::AverageGeometryT<TrackerTraits>));
57 
58  uint32_t oldLayer = 0;
59  uint32_t oldLadder = 0;
60  float rl = 0;
61  float zl = 0;
62  float miz = 500, mxz = 0;
63  float pl = 0;
64  int nl = 0;
65 
67  for (auto i = 0U; i < m_DetParams.size(); ++i) {
68  auto& p = m_DetParams[i];
69  auto& g = buffer_->detParams(i);
70 
71  g.nRowsRoc = p.theDet->specificTopology().rowsperroc();
72  g.nColsRoc = p.theDet->specificTopology().colsperroc();
73  g.nRows = p.theDet->specificTopology().rocsX() * g.nRowsRoc;
74  g.nCols = p.theDet->specificTopology().rocsY() * g.nColsRoc;
75 
76  g.numPixsInModule = g.nRows * g.nCols;
77 
78  assert(p.theDet->index() == int(i));
79  assert(buffer_->commonParams().thePitchY == p.thePitchY);
80  assert(buffer_->commonParams().thePitchX == p.thePitchX);
81 
82  g.isBarrel = GeomDetEnumerators::isBarrel(p.thePart);
83  g.isPosZ = p.theDet->surface().position().z() > 0;
84  g.layer = ttopo_.layer(p.theDet->geographicalId());
85  g.index = i; // better be!
86  g.rawId = p.theDet->geographicalId();
87  auto thickness = g.isBarrel ? buffer_->commonParams().theThicknessB : buffer_->commonParams().theThicknessE;
88  assert(thickness == p.theThickness);
89 
90  auto ladder = ttopo_.pxbLadder(p.theDet->geographicalId());
91  if (oldLayer != g.layer) {
92  oldLayer = g.layer;
93  LogDebug("PixelCPEFastParamsHost") << "new layer at " << i << (g.isBarrel ? " B " : (g.isPosZ ? " E+ " : " E- "))
94  << g.layer << " starting at " << g.rawId << '\n'
95  << "old layer had " << nl << " ladders";
96  nl = 0;
97  }
98  if (oldLadder != ladder) {
99  oldLadder = ladder;
100  LogDebug("PixelCPEFastParamsHost") << "new ladder at " << i
101  << (g.isBarrel ? " B " : (g.isPosZ ? " E+ " : " E- ")) << ladder
102  << " starting at " << g.rawId << '\n'
103  << "old ladder ave z,r,p mz " << zl / 8.f << " " << rl / 8.f << " " << pl / 8.f
104  << ' ' << miz << ' ' << mxz;
105  rl = 0;
106  zl = 0;
107  pl = 0;
108  miz = 500;
109  mxz = 0;
110  nl++;
111  }
112 
113  g.shiftX = 0.5f * p.lorentzShiftInCmX;
114  g.shiftY = 0.5f * p.lorentzShiftInCmY;
115  g.chargeWidthX = p.lorentzShiftInCmX * p.widthLAFractionX;
116  g.chargeWidthY = p.lorentzShiftInCmY * p.widthLAFractionY;
117 
118  g.x0 = p.theOrigin.x();
119  g.y0 = p.theOrigin.y();
120  g.z0 = p.theOrigin.z();
121 
122  auto vv = p.theDet->surface().position();
123  auto rr = pixelCPEforDevice::Rotation(p.theDet->surface().rotation());
124  g.frame = pixelCPEforDevice::Frame(vv.x(), vv.y(), vv.z(), rr);
125 
126  zl += vv.z();
127  miz = std::min(miz, std::abs(vv.z()));
128  mxz = std::max(mxz, std::abs(vv.z()));
129  rl += vv.perp();
130  pl += vv.phi(); // (not obvious)
131 
132  // errors .....
133  ClusterParamGeneric cp;
134 
135  cp.with_track_angle = false;
136 
137  auto lape = p.theDet->localAlignmentError();
138  if (lape.invalid())
139  lape = LocalError(); // zero....
140 
141  g.apeXX = lape.xx();
142  g.apeYY = lape.yy();
143 
144  auto toMicron = [&](float x) { return std::min(511, int(x * 1.e4f + 0.5f)); };
145 
146  // average angle
147  auto gvx = p.theOrigin.x() + 40.f * buffer_->commonParams().thePitchX;
148  auto gvy = p.theOrigin.y();
149  auto gvz = 1.f / p.theOrigin.z();
150  //--- Note that the normalization is not required as only the ratio used
151 
152  {
153  // calculate angles (fed into errorFromTemplates)
154  cp.cotalpha = gvx * gvz;
155  cp.cotbeta = gvy * gvz;
156 
157  errorFromTemplates(p, cp, 20000.);
158  }
159 
160 #ifdef EDM_ML_DEBUG
161  auto m = 10000.f;
162  for (float qclus = 15000; qclus < 35000; qclus += 15000) {
163  errorFromTemplates(p, cp, qclus);
164  LogDebug("PixelCPEFastParamsHost") << i << ' ' << qclus << ' ' << cp.pixmx << ' ' << m * cp.sigmax << ' '
165  << m * cp.sx1 << ' ' << m * cp.sx2 << ' ' << m * cp.sigmay << ' ' << m * cp.sy1
166  << ' ' << m * cp.sy2;
167  }
168  LogDebug("PixelCPEFastParamsHost") << i << ' ' << m * std::sqrt(lape.xx()) << ' ' << m * std::sqrt(lape.yy());
169 #endif // EDM_ML_DEBUG
170 
171  g.pixmx = std::max(0, cp.pixmx);
172  g.sx2 = toMicron(cp.sx2);
173  g.sy1 = std::max(21, toMicron(cp.sy1)); // for some angles sy1 is very small
174  g.sy2 = std::max(55, toMicron(cp.sy2)); // sometimes sy2 is smaller than others (due to angle?)
175 
176  //sample xerr as function of position
177  // moduleOffsetX is the definition of TrackerTraits::xOffset,
178  // needs to be calculated because for Phase2 the modules are not uniform
179  float moduleOffsetX = -(0.5f * float(g.nRows) + TrackerTraits::bigPixXCorrection);
180  auto const xoff = moduleOffsetX * buffer_->commonParams().thePitchX;
181 
182  for (int ix = 0; ix < pixelCPEforDevice::kNumErrorBins; ++ix) {
183  auto x = xoff * (1.f - (0.5f + float(ix)) / 8.f);
184  auto gvx = p.theOrigin.x() - x;
185  auto gvy = p.theOrigin.y();
186  auto gvz = 1.f / p.theOrigin.z();
187  cp.cotbeta = gvy * gvz;
188  cp.cotalpha = gvx * gvz;
189  errorFromTemplates(p, cp, 20000.f);
190  g.sigmax[ix] = toMicron(cp.sigmax);
191  g.sigmax1[ix] = toMicron(cp.sx1);
192  LogDebug("PixelCPEFastParamsHost") << "sigmax vs x " << i << ' ' << x << ' ' << cp.cotalpha << ' '
193  << int(g.sigmax[ix]) << ' ' << int(g.sigmax1[ix]) << ' ' << 10000.f * cp.sigmay
194  << std::endl;
195  }
196 #ifdef EDM_ML_DEBUG
197  // sample yerr as function of position
198  // moduleOffsetY is the definition of TrackerTraits::yOffset (removed)
199  float moduleOffsetY = 0.5f * float(g.nCols) + TrackerTraits::bigPixYCorrection;
200  auto const yoff = -moduleOffsetY * buffer_->commonParams().thePitchY;
201 
202  for (int ix = 0; ix < pixelCPEforDevice::kNumErrorBins; ++ix) {
203  auto y = yoff * (1.f - (0.5f + float(ix)) / 8.f);
204  auto gvx = p.theOrigin.x() + 40.f * buffer_->commonParams().thePitchY;
205  auto gvy = p.theOrigin.y() - y;
206  auto gvz = 1.f / p.theOrigin.z();
207  cp.cotbeta = gvy * gvz;
208  cp.cotalpha = gvx * gvz;
209  errorFromTemplates(p, cp, 20000.f);
210  LogDebug("PixelCPEFastParamsHost") << "sigmay vs y " << i << ' ' << y << ' ' << cp.cotbeta << ' '
211  << 10000.f * cp.sigmay << std::endl;
212  }
213 #endif // EDM_ML_DEBUG
214 
215  // calculate angles (repeated)
216  cp.cotalpha = gvx * gvz;
217  cp.cotbeta = gvy * gvz;
218  auto aveCB = cp.cotbeta;
219 
220  // sample x by charge
221  int qbin = pixelCPEforDevice::kGenErrorQBins; // low charge
222  int k = 0;
223  for (int qclus = 1000; qclus < 200000; qclus += 1000) {
224  errorFromTemplates(p, cp, qclus);
225  if (cp.qBin_ == qbin)
226  continue;
227  qbin = cp.qBin_;
228  g.xfact[k] = cp.sigmax;
229  g.yfact[k] = cp.sigmay;
230  g.minCh[k++] = qclus;
231 #ifdef EDM_ML_DEBUG
232  LogDebug("PixelCPEFastParamsHost") << i << ' ' << g.rawId << ' ' << cp.cotalpha << ' ' << qclus << ' ' << cp.qBin_
233  << ' ' << cp.pixmx << ' ' << m * cp.sigmax << ' ' << m * cp.sx1 << ' '
234  << m * cp.sx2 << ' ' << m * cp.sigmay << ' ' << m * cp.sy1 << ' ' << m * cp.sy2
235  << std::endl;
236 #endif // EDM_ML_DEBUG
237  }
238 
240 
241  // fill the rest (sometimes bin 4 is missing)
242  for (int kk = k; kk < pixelCPEforDevice::kGenErrorQBins; ++kk) {
243  g.xfact[kk] = g.xfact[k - 1];
244  g.yfact[kk] = g.yfact[k - 1];
245  g.minCh[kk] = g.minCh[k - 1];
246  }
247  auto detx = 1.f / g.xfact[0];
248  auto dety = 1.f / g.yfact[0];
249  for (int kk = 0; kk < pixelCPEforDevice::kGenErrorQBins; ++kk) {
250  g.xfact[kk] *= detx;
251  g.yfact[kk] *= dety;
252  }
253  // sample y in "angle" (estimated from cluster size)
254  float ys = 8.f - 4.f; // apperent bias of half pixel (see plot)
255  // plot: https://indico.cern.ch/event/934821/contributions/3974619/attachments/2091853/3515041/DigilessReco.pdf page 25
256  // sample yerr as function of "size"
257  for (int iy = 0; iy < pixelCPEforDevice::kNumErrorBins; ++iy) {
258  ys += 1.f; // first bin 0 is for size 9 (and size is in fixed point 2^3)
260  ys += 8.f; // last bin for "overflow"
261  // cp.cotalpha = ys*(buffer_->commonParams().thePitchX/(8.f*thickness)); // use this to print sampling in "x" (and comment the line below)
262  cp.cotbeta = std::copysign(ys * (buffer_->commonParams().thePitchY / (8.f * thickness)), aveCB);
263  errorFromTemplates(p, cp, 20000.f);
264  g.sigmay[iy] = toMicron(cp.sigmay);
265  LogDebug("PixelCPEFastParamsHost") << "sigmax/sigmay " << i << ' ' << (ys + 4.f) / 8.f << ' ' << cp.cotalpha
266  << '/' << cp.cotbeta << ' ' << 10000.f * cp.sigmax << '/' << int(g.sigmay[iy])
267  << std::endl;
268  }
269  } // loop over det
270 
271  constexpr int numberOfModulesInLadder = TrackerTraits::numberOfModulesInLadder;
272  constexpr int numberOfLaddersInBarrel = TrackerTraits::numberOfLaddersInBarrel;
273  constexpr int numberOfModulesInBarrel = TrackerTraits::numberOfModulesInBarrel;
274 
275  constexpr float ladderFactor = 1.f / float(numberOfModulesInLadder);
276 
277  constexpr int firstEndcapPos = TrackerTraits::firstEndcapPos;
278  constexpr int firstEndcapNeg = TrackerTraits::firstEndcapNeg;
279 
280  // compute ladder baricenter (only in global z) for the barrel
281  //
282  auto& aveGeom = buffer_->averageGeometry();
283  int il = 0;
284  for (int im = 0, nm = numberOfModulesInBarrel; im < nm; ++im) {
285  auto const& g = buffer_->detParams(im);
286  il = im / numberOfModulesInLadder;
287  assert(il < int(numberOfLaddersInBarrel));
288  auto z = g.frame.z();
289  aveGeom.ladderZ[il] += ladderFactor * z;
290  aveGeom.ladderMinZ[il] = std::min(aveGeom.ladderMinZ[il], z);
291  aveGeom.ladderMaxZ[il] = std::max(aveGeom.ladderMaxZ[il], z);
292  aveGeom.ladderX[il] += ladderFactor * g.frame.x();
293  aveGeom.ladderY[il] += ladderFactor * g.frame.y();
294  aveGeom.ladderR[il] += ladderFactor * sqrt(g.frame.x() * g.frame.x() + g.frame.y() * g.frame.y());
295  }
296  assert(il + 1 == int(numberOfLaddersInBarrel));
297  // add half_module and tollerance
298  constexpr float moduleLength = TrackerTraits::moduleLength;
299  constexpr float module_tolerance = 0.2f;
300  for (int il = 0, nl = numberOfLaddersInBarrel; il < nl; ++il) {
301  aveGeom.ladderMinZ[il] -= (0.5f * moduleLength - module_tolerance);
302  aveGeom.ladderMaxZ[il] += (0.5f * moduleLength - module_tolerance);
303  }
304 
305  // compute "max z" for first layer in endcap (should we restrict to the outermost ring?)
306  for (auto im = TrackerTraits::layerStart[firstEndcapPos]; im < TrackerTraits::layerStart[firstEndcapPos + 1]; ++im) {
307  auto const& g = buffer_->detParams(im);
308  aveGeom.endCapZ[0] = std::max(aveGeom.endCapZ[0], g.frame.z());
309  }
310  for (auto im = TrackerTraits::layerStart[firstEndcapNeg]; im < TrackerTraits::layerStart[firstEndcapNeg + 1]; ++im) {
311  auto const& g = buffer_->detParams(im);
312  aveGeom.endCapZ[1] = std::min(aveGeom.endCapZ[1], g.frame.z());
313  }
314  // correct for outer ring being closer
315  aveGeom.endCapZ[0] -= TrackerTraits::endcapCorrection;
316  aveGeom.endCapZ[1] += TrackerTraits::endcapCorrection;
317 #ifdef EDM_ML_DEBUG
318  for (int jl = 0, nl = numberOfLaddersInBarrel; jl < nl; ++jl) {
319  LogDebug("PixelCPEFastParamsHost") << jl << ':' << aveGeom.ladderR[jl] << '/'
320  << std::sqrt(aveGeom.ladderX[jl] * aveGeom.ladderX[jl] +
321  aveGeom.ladderY[jl] * aveGeom.ladderY[jl])
322  << ',' << aveGeom.ladderZ[jl] << ',' << aveGeom.ladderMinZ[jl] << ','
323  << aveGeom.ladderMaxZ[jl] << '\n';
324  }
325  LogDebug("PixelCPEFastParamsHost") << aveGeom.endCapZ[0] << ' ' << aveGeom.endCapZ[1];
326 #endif // EDM_ML_DEBUG
327 
328  // fill Layer and ladders geometry
329  memset(&buffer_->layerGeometry(), 0, sizeof(pixelCPEforDevice::LayerGeometryT<TrackerTraits>));
330  memcpy(buffer_->layerGeometry().layerStart,
333  memcpy(buffer_->layerGeometry().layer,
334  pixelTopology::layer<TrackerTraits>.data(),
335  pixelTopology::layer<TrackerTraits>.size());
336  buffer_->layerGeometry().maxModuleStride = pixelTopology::maxModuleStride<TrackerTraits>;
337 }
bool isBarrel(GeomDetEnumerators::SubDetector m)
DetParams m_DetParams
Definition: PixelCPEBase.h:282
unsigned int pxbLadder(const DetId &id) const
assert(be >=bs)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
constexpr uint16_t numberOfModules
unsigned int layer(const DetId &id) const
constexpr int kNumErrorBins
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr T z() const
Definition: SOARotation.h:133
double f[11][100]
void errorFromTemplates(DetParam const &theDetParam, ClusterParamGeneric &theClusterParam, float qclus) const
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
constexpr int kGenErrorQBins
const TrackerTopology & ttopo_
Definition: PixelCPEBase.h:231
SOAFrame< float > Frame
static constexpr uint32_t layerStart[numberOfLayers+1]
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)
SOARotation< float > Rotation
#define LogDebug(id)

◆ fillPSetDescription()

template<typename TrackerTraits >
void PixelCPEFastParamsHost< TrackerTraits >::fillPSetDescription ( edm::ParameterSetDescription desc)
static

Definition at line 475 of file PixelCPEFastParamsHost.cc.

References submitPVResolutionJobs::desc, and PixelCPEGenericBase::fillPSetDescription().

Referenced by ALPAKA_ACCELERATOR_NAMESPACE::PixelCPEFastParamsESProducerAlpaka< TrackerTraits >::fillDescriptions().

475  {
476  // call PixelCPEGenericBase fillPSetDescription to add common rechit errors
478 }
static void fillPSetDescription(edm::ParameterSetDescription &desc)

◆ localError()

template<typename TrackerTraits >
LocalError PixelCPEFastParamsHost< TrackerTraits >::localError ( DetParam const &  theDetParam,
ClusterParam theClusterParam 
) const
overrideprivatevirtual

Implements PixelCPEBase.

Definition at line 459 of file PixelCPEFastParamsHost.cc.

References LogDebug, PixelCPEGenericBase::ClusterParamGeneric::sigmax, and PixelCPEGenericBase::ClusterParamGeneric::sigmay.

460  {
461  ClusterParamGeneric& theClusterParam = static_cast<ClusterParamGeneric&>(theClusterParamBase);
462 
463  auto xerr = theClusterParam.sigmax;
464  auto yerr = theClusterParam.sigmay;
465 
466  LogDebug("PixelCPEFastParamsHost") << " errors " << xerr << " " << yerr;
467 
468  auto xerr_sq = xerr * xerr;
469  auto yerr_sq = yerr * yerr;
470 
471  return LocalError(xerr_sq, 0, yerr_sq);
472 }
#define LogDebug(id)

◆ localPosition()

template<typename TrackerTraits >
LocalPoint PixelCPEFastParamsHost< TrackerTraits >::localPosition ( DetParam const &  theDetParam,
ClusterParam theClusterParamBase 
) const
overrideprivatevirtual

Hit position in the local frame (in cm). Unlike other CPE's, this one converts everything from the measurement frame (in channel numbers) into the local frame (in centimeters).

< Q of the first pixel in X

< Q of the last pixel in X

< Q of the first pixel in Y

< Q of the last pixel in Y

Implements PixelCPEBase.

Definition at line 404 of file PixelCPEFastParamsHost.cc.

References SiPixelCluster::charge(), CommonMethods::cp(), GeomDet::index(), LogDebug, SiPixelCluster::maxPixelCol(), SiPixelCluster::maxPixelRow(), SiPixelCluster::minPixelCol(), SiPixelCluster::minPixelRow(), PixelCPEBase::ClusterParam::qBin_, PixelCPEGenericBase::ClusterParamGeneric::sigmax, PixelCPEGenericBase::ClusterParamGeneric::sigmay, PixelCPEBase::ClusterParam::theCluster, and PixelCPEBase::DetParam::theDet.

405  {
406  ClusterParamGeneric& theClusterParam = static_cast<ClusterParamGeneric&>(theClusterParamBase);
407 
409  errorFromTemplates(theDetParam, theClusterParam, theClusterParam.theCluster->charge());
410  } else {
411  theClusterParam.qBin_ = 0;
412  }
413 
414  int q_f_X;
415  int q_l_X;
416  int q_f_Y;
417  int q_l_Y;
418  collect_edge_charges(theClusterParam, q_f_X, q_l_X, q_f_Y, q_l_Y, useErrorsFromTemplates_ && truncatePixelCharge_);
419 
420  // do GPU like ...
422 
423  cp.minRow[0] = theClusterParam.theCluster->minPixelRow();
424  cp.maxRow[0] = theClusterParam.theCluster->maxPixelRow();
425  cp.minCol[0] = theClusterParam.theCluster->minPixelCol();
426  cp.maxCol[0] = theClusterParam.theCluster->maxPixelCol();
427 
428  cp.q_f_X[0] = q_f_X;
429  cp.q_l_X[0] = q_l_X;
430  cp.q_f_Y[0] = q_f_Y;
431  cp.q_l_Y[0] = q_l_Y;
432 
433  cp.charge[0] = theClusterParam.theCluster->charge();
434 
435  auto ind = theDetParam.theDet->index();
436  pixelCPEforDevice::position<TrackerTraits>(buffer_->commonParams(), buffer_->detParams(ind), cp, 0);
437  auto xPos = cp.xpos[0];
438  auto yPos = cp.ypos[0];
439 
440  // set the error (mind ape....)
441  pixelCPEforDevice::errorFromDB<TrackerTraits>(buffer_->commonParams(), buffer_->detParams(ind), cp, 0);
442  theClusterParam.sigmax = cp.xerr[0];
443  theClusterParam.sigmay = cp.yerr[0];
444 
445  LogDebug("PixelCPEFastParamsHost") << " in PixelCPEFastParamsHost:localPosition - pos = " << xPos << " " << yPos
446  << " size " << cp.maxRow[0] - cp.minRow[0] << ' ' << cp.maxCol[0] - cp.minCol[0];
447 
448  //--- Now put the two together
449  LocalPoint pos_in_local(xPos, yPos);
450  return pos_in_local;
451 }
static void collect_edge_charges(ClusterParam &theClusterParam, int &q_f_X, int &q_l_X, int &q_f_Y, int &q_l_Y, bool truncate)
void errorFromTemplates(DetParam const &theDetParam, ClusterParamGeneric &theClusterParam, float qclus) const
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)
#define LogDebug(id)

◆ operator=() [1/2]

template<typename TrackerTraits>
PixelCPEFastParamsHost& PixelCPEFastParamsHost< TrackerTraits >::operator= ( PixelCPEFastParamsHost< TrackerTraits > const &  )
delete

◆ operator=() [2/2]

template<typename TrackerTraits>
PixelCPEFastParamsHost& PixelCPEFastParamsHost< TrackerTraits >::operator= ( PixelCPEFastParamsHost< TrackerTraits > &&  )
default

◆ size()

template<typename TrackerTraits>
auto PixelCPEFastParamsHost< TrackerTraits >::size ( void  ) const
inline

Member Data Documentation

◆ buffer_

template<typename TrackerTraits>
Buffer PixelCPEFastParamsHost< TrackerTraits >::buffer_
private

◆ thePixelGenError_

template<typename TrackerTraits>
std::vector<SiPixelGenErrorStore> PixelCPEFastParamsHost< TrackerTraits >::thePixelGenError_
private