CMS 3D CMS Logo

StripCPEfromTrackAngle.cc
Go to the documentation of this file.
4 
5 #include "vdt/vdtMath.h"
6 
8  const MagneticField& mag,
9  const TrackerGeometry& geom,
10  const SiStripLorentzAngle& lorentz,
11  const SiStripBackPlaneCorrection& backPlaneCorrection,
12  const SiStripConfObject& confObj,
13  const SiStripLatency& latency)
14  : StripCPE(conf, mag, geom, lorentz, backPlaneCorrection, confObj, latency),
15  useLegacyError(conf.existsAs<bool>("useLegacyError") ? conf.getParameter<bool>("useLegacyError") : true),
16  maxChgOneMIP(conf.existsAs<float>("maxChgOneMIP") ? conf.getParameter<double>("maxChgOneMIP") : -6000.),
17  m_algo(useLegacyError ? Algo::legacy : (maxChgOneMIP < 0 ? Algo::mergeCK : Algo::chargeCK)) {
18  mLC_P[0] = conf.existsAs<double>("mLC_P0") ? conf.getParameter<double>("mLC_P0") : -.326;
19  mLC_P[1] = conf.existsAs<double>("mLC_P1") ? conf.getParameter<double>("mLC_P1") : .618;
20  mLC_P[2] = conf.existsAs<double>("mLC_P2") ? conf.getParameter<double>("mLC_P2") : .300;
21 
22  mHC_P[SiStripDetId::TIB - 3][0] = conf.existsAs<double>("mTIB_P0") ? conf.getParameter<double>("mTIB_P0") : -.742;
23  mHC_P[SiStripDetId::TIB - 3][1] = conf.existsAs<double>("mTIB_P1") ? conf.getParameter<double>("mTIB_P1") : .202;
24  mHC_P[SiStripDetId::TID - 3][0] = conf.existsAs<double>("mTID_P0") ? conf.getParameter<double>("mTID_P0") : -1.026;
25  mHC_P[SiStripDetId::TID - 3][1] = conf.existsAs<double>("mTID_P1") ? conf.getParameter<double>("mTID_P1") : .253;
26  mHC_P[SiStripDetId::TOB - 3][0] = conf.existsAs<double>("mTOB_P0") ? conf.getParameter<double>("mTOB_P0") : -1.427;
27  mHC_P[SiStripDetId::TOB - 3][1] = conf.existsAs<double>("mTOB_P1") ? conf.getParameter<double>("mTOB_P1") : .433;
28  mHC_P[SiStripDetId::TEC - 3][0] = conf.existsAs<double>("mTEC_P0") ? conf.getParameter<double>("mTEC_P0") : -1.885;
29  mHC_P[SiStripDetId::TEC - 3][1] = conf.existsAs<double>("mTEC_P1") ? conf.getParameter<double>("mTEC_P1") : .471;
30 }
31 
33  const float uProj,
34  const SiStripDetId::SubDetector loc) const {
35  auto fun = [&](float x) -> float { return mLC_P[0] * x * vdt::fast_expf(-x * mLC_P[1]) + mLC_P[2]; };
36  auto uerr = (N <= 4) ? fun(uProj) : mHC_P[loc - 3][0] + float(N) * mHC_P[loc - 3][1];
37  return uerr * uerr;
38 }
39 
40 float StripCPEfromTrackAngle::legacyStripErrorSquared(const unsigned N, const float uProj) const {
41  if
42  UNLIKELY((float(N) - uProj) > 3.5f)
43  return float(N * N) / 12.f;
44  else {
45  static constexpr float P1 = -0.339;
46  static constexpr float P2 = 0.90;
47  static constexpr float P3 = 0.279;
48  const float uerr = P1 * uProj * vdt::fast_expf(-uProj * P2) + P3;
49  return uerr * uerr;
50  }
51 }
52 
54  ALocalValues& retValues,
55  const GeomDetUnit& det,
56  const LocalTrajectoryParameters& ltp) const {
57  auto const& par = getAlgoParam(det, ltp);
58  auto const& p = par.p;
59  auto loc = par.loc;
60  auto corr = par.corr;
61  auto afp = par.afullProjection;
62 
63  auto fill = [&](unsigned int i, float uerr2) {
64  const float strip = clusters[i]->barycenter() + corr;
65  retValues[i].first = p.topology->localPosition(strip, ltp.vector());
66  retValues[i].second = p.topology->localError(strip, uerr2, ltp.vector());
67  };
68 
69  switch (m_algo) {
70  case Algo::chargeCK:
71  for (auto i = 0U; i < clusters.size(); ++i) {
72  auto dQdx = siStripClusterTools::chargePerCM(*clusters[i], ltp, p.invThickness);
73  auto N = clusters[i]->amplitudes().size();
74  auto uerr2 = dQdx > maxChgOneMIP ? legacyStripErrorSquared(N, afp) : stripErrorSquared(N, afp, loc);
75  fill(i, uerr2);
76  }
77  break;
78  case Algo::legacy:
79  for (auto i = 0U; i < clusters.size(); ++i) {
80  auto N = clusters[i]->amplitudes().size();
81  auto uerr2 = legacyStripErrorSquared(N, afp);
82  fill(i, uerr2);
83  }
84  break;
85  case Algo::mergeCK:
86  for (auto i = 0U; i < clusters.size(); ++i) {
87  auto N = clusters[i]->amplitudes().size();
88  auto uerr2 = clusters[i]->isMerged() ? legacyStripErrorSquared(N, afp) : stripErrorSquared(N, afp, loc);
89  fill(i, uerr2);
90  }
91  break;
92  }
93 }
94 
96  AlgoParam const& par) const {
97  auto const& p = par.p;
98  auto const& ltp = par.ltp;
99  auto loc = par.loc;
100  auto corr = par.corr;
101  auto afp = par.afullProjection;
102 
103  float uerr2 = 0;
104 
105  auto N = cluster.amplitudes().size();
106 
107  switch (m_algo) {
108  case Algo::chargeCK: {
109  auto dQdx = siStripClusterTools::chargePerCM(cluster, ltp, p.invThickness);
110  uerr2 = dQdx > maxChgOneMIP ? legacyStripErrorSquared(N, afp) : stripErrorSquared(N, afp, loc);
111  } break;
112  case Algo::legacy:
113  uerr2 = legacyStripErrorSquared(N, afp);
114  break;
115  case Algo::mergeCK:
116  uerr2 = cluster.isMerged() ? legacyStripErrorSquared(N, afp) : stripErrorSquared(N, afp, loc);
117  break;
118  }
119 
120  const float strip = cluster.barycenter() + corr;
121 
122  return std::make_pair(p.topology->localPosition(strip, ltp.vector()),
123  p.topology->localError(strip, uerr2, ltp.vector()));
124 }
125 
127  const SiStripCluster& cluster, const GeomDetUnit& det, const LocalTrajectoryParameters& ltp) const {
128  auto const& par = getAlgoParam(det, ltp);
129  return localParameters(cluster, par);
130 }
StripCPE::AlgoParam::corr
float corr
Definition: StripCPE.h:49
StripCPEfromTrackAngle::mLC_P
float mLC_P[3]
Definition: StripCPEfromTrackAngle.h:11
StripCPE
Definition: StripCPE.h:17
electrons_cff.bool
bool
Definition: electrons_cff.py:366
mps_fire.i
i
Definition: mps_fire.py:428
StripCPEfromTrackAngle::localParameters
void localParameters(AClusters const &clusters, ALocalValues &retValues, const GeomDetUnit &gd, const LocalTrajectoryParameters &ltp) const override
Definition: StripCPEfromTrackAngle.cc:53
SiStripCluster::barycenter
float barycenter() const
Definition: SiStripCluster.cc:25
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
GeomDet
Definition: GeomDet.h:27
config_102169_raw_cff.latency
latency
Definition: config_102169_raw_cff.py:29
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
siStripClusterTools::chargePerCM
float chargePerCM(DetId detid, Iter a, Iter b)
Definition: SiStripClusterTools.h:29
HLTSiStripMonitoring_cff.useLegacyError
useLegacyError
Definition: HLTSiStripMonitoring_cff.py:74
StripCPE::AlgoParam::afullProjection
float afullProjection
Definition: StripCPE.h:48
DDAxes::x
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
StripTopology.h
StripCPE::AlgoParam
Definition: StripCPE.h:44
LocalTrajectoryParameters
Definition: LocalTrajectoryParameters.h:25
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
SiStripLorentzAngle
Definition: SiStripLorentzAngle.h:26
myMath::fast_expf
float fast_expf(float x)
Definition: EcalUncalibRecHitRatioMethodAlgo.h:27
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
StripCPEfromTrackAngle::maxChgOneMIP
const float maxChgOneMIP
Definition: StripCPEfromTrackAngle.h:23
DynArray
Definition: DynArray.h:5
N
#define N
Definition: blowfish.cc:9
StripCPE::AlgoParam::p
Param const & p
Definition: StripCPE.h:45
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
LocalTrajectoryParameters::vector
AlgebraicVector5 vector() const
Definition: LocalTrajectoryParameters.h:120
SiStripDetId::TEC
static constexpr auto TEC
Definition: SiStripDetId.h:40
Algo
Definition: fakeMenu.h:6
SiStripClusterTools.h
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
StripCPE::getAlgoParam
AlgoParam getAlgoParam(const GeomDetUnit &det, const LocalTrajectoryParameters &ltp) const
Definition: StripCPE.h:57
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
funct::true
true
Definition: Factorize.h:173
ntuplemaker.fill
fill
Definition: ntuplemaker.py:304
StripCPEfromTrackAngle::Algo::mergeCK
edm::ParameterSet
Definition: ParameterSet.h:47
HLTSiStripMonitoring_cff.maxChgOneMIP
maxChgOneMIP
Definition: HLTSiStripMonitoring_cff.py:75
SiStripCluster::isMerged
bool isMerged() const
Definition: SiStripCluster.h:83
StripCPEfromTrackAngle::stripErrorSquared
float stripErrorSquared(const unsigned N, const float uProj, const SiStripDetId::SubDetector loc) const
Definition: StripCPEfromTrackAngle.cc:32
StripCPE::AlgoParam::loc
SiStripDetId::SubDetector loc
Definition: StripCPE.h:47
StripCPEfromTrackAngle::legacyStripErrorSquared
float legacyStripErrorSquared(const unsigned N, const float uProj) const
Definition: StripCPEfromTrackAngle.cc:40
StripCPEfromTrackAngle::m_algo
Algo m_algo
Definition: StripCPEfromTrackAngle.h:27
SiStripCluster::size
uint8_t size() const
Definition: SiStripCluster.h:63
SiStripDetId::TOB
static constexpr auto TOB
Definition: SiStripDetId.h:39
SiStripCluster::amplitudes
SiStripCluster const & amplitudes() const
Definition: SiStripCluster.h:68
SiStripDetId::TID
static constexpr auto TID
Definition: SiStripDetId.h:38
StripCPEfromTrackAngle.h
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
StripCPEfromTrackAngle::StripCPEfromTrackAngle
StripCPEfromTrackAngle(edm::ParameterSet &conf, const MagneticField &mag, const TrackerGeometry &geom, const SiStripLorentzAngle &lorentz, const SiStripBackPlaneCorrection &backPlaneCorrection, const SiStripConfObject &confObj, const SiStripLatency &latency)
Definition: StripCPEfromTrackAngle.cc:7
StripCPEfromTrackAngle::Algo::chargeCK
SiStripDetId::TIB
static constexpr auto TIB
Definition: SiStripDetId.h:37
StripCPEfromTrackAngle::Algo::legacy
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
StripClusterParameterEstimator::LocalValues
std::pair< LocalPoint, LocalError > LocalValues
Definition: StripClusterParameterEstimator.h:27
StripCPEfromTrackAngle::mHC_P
float mHC_P[4][2]
Definition: StripCPEfromTrackAngle.h:12
SiStripSubdetector::Subdetector
Subdetector
Definition: SiStripEnums.h:5
SiStripLatency
Definition: SiStripLatency.h:59
MagneticField
Definition: MagneticField.h:19
SiStripCluster
Definition: SiStripCluster.h:8
SiStripBackPlaneCorrection
Definition: SiStripBackPlaneCorrection.h:27
StripCPE::AlgoParam::ltp
const LocalTrajectoryParameters & ltp
Definition: StripCPE.h:46
TrackerGeometry
Definition: TrackerGeometry.h:14
SiStripConfObject
Definition: SiStripConfObject.h:31