CMS 3D CMS Logo

StripCPE.cc
Go to the documentation of this file.
5 #include <algorithm>
6 #include <cmath>
7 #include <cassert>
8 
10  const MagneticField& mag,
11  const TrackerGeometry& geom,
13  const SiStripBackPlaneCorrection& BackPlaneCorrection,
14  const SiStripConfObject& confObj,
15  const SiStripLatency& latency)
16  : peakMode_(latency.singleReadOutMode() == 1),
17  geom_(geom),
18  magfield_(mag),
19  LorentzAngleMap_(LorentzAngle),
20  BackPlaneCorrectionMap_(BackPlaneCorrection) {
21  typedef std::map<std::string, SiStripModuleGeometry> map_t;
22  map_t modules;
37 
38  const unsigned size =
39  static_cast<unsigned int>(
40  max_element(modules.begin(), modules.end(), [&](auto& arg1, auto& arg2) { return arg1.second < arg2.second; })
41  ->second) +
42  1;
43  xtalk1.resize(size);
44  xtalk2.resize(size);
45 
46  for (map_t::const_iterator it = modules.begin(); it != modules.end(); it++) {
47  const std::string modeS(peakMode_ ? "Peak" : "Deco"), xtalk1S("xtalk1_" + it->first + modeS),
48  xtalk2S("xtalk2_" + it->first + modeS);
49 
50  if (!confObj.isParameter(xtalk1S))
51  throw cms::Exception("SiStripConfObject does not contain: ") << xtalk1S;
52  if (!confObj.isParameter(xtalk2S))
53  throw cms::Exception("SiStripConfObject does not contain: ") << xtalk2S;
54 
55  xtalk1[static_cast<int>(it->second)] = confObj.get<double>(xtalk1S);
56  xtalk2[static_cast<int>(it->second)] = confObj.get<double>(xtalk2S);
57  }
58 
59  fillParams();
60 }
61 
63  const GeomDetUnit& det) const {
64  StripCPE::Param const& p = param(det);
65  const float barycenter = cluster.barycenter();
66  const float fullProjection =
67  p.coveredStrips(p.drift + LocalVector(0, 0, -p.thickness), p.topology->localPosition(barycenter));
68  const float strip = barycenter - 0.5f * (1.f - p.backplanecorrection) * fullProjection;
69 
70  return std::make_pair(p.topology->localPosition(strip), p.topology->localError(strip, 1.f / 12.f));
71 }
72 
73 float StripCPE::Param::coveredStrips(const LocalVector& lvec, const LocalPoint& lpos) const {
74  return topology->coveredStrips(lpos + 0.5f * lvec, lpos - 0.5f * lvec);
75 }
76 
78  LocalVector lbfield = (det->surface()).toLocal(magfield_.inTesla(det->surface().position()));
79 
80  float tanLorentzAnglePerTesla = LorentzAngleMap_.getLorentzAngle(det->geographicalId().rawId());
81 
82  float dir_x = -tanLorentzAnglePerTesla * lbfield.y();
83  float dir_y = tanLorentzAnglePerTesla * lbfield.x();
84  float dir_z = 1.f; // E field always in z direction
85 
86  return LocalVector(dir_x, dir_y, dir_z);
87 }
88 
90  auto const& dus = geom_.detUnits();
91  m_off = dus.size();
92  for (unsigned int i = 1; i < 7; ++i) {
93  LogDebug("LookingForFirstStrip")
94  << "Subdetector " << i << " GeomDetEnumerator " << GeomDetEnumerators::tkDetEnum[i] << " offset "
95  << geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i]) << " is it strip? "
96  << (geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i]) != dus.size()
97  ? dus[geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i])]->type().isTrackerStrip()
98  : false);
99  if (geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i]) != dus.size() &&
100  dus[geom_.offsetDU(GeomDetEnumerators::tkDetEnum[i])]->type().isTrackerStrip()) {
103  }
104  }
105  LogDebug("LookingForFirstStrip") << " Chosen offset: " << m_off;
106  m_Params.resize(dus.size() - m_off);
107  for (auto i = m_off; i != dus.size(); ++i) {
108  auto& p = m_Params[i - m_off];
109  const StripGeomDetUnit* stripdet = (const StripGeomDetUnit*)(dus[i]);
110  assert(stripdet->index() == int(i));
111  // assert(stripdet->geographicalId().subdetId()>1); // not pixel..
112  assert(stripdet->type().isTrackerStrip()); // not pixel
113 
114  const Bounds& bounds = stripdet->specificSurface().bounds();
115  p.maxLength = std::sqrt(std::pow(bounds.length(), 2.f) + std::pow(bounds.width(), 2.f));
116  p.thickness = bounds.thickness();
117  p.invThickness = 1.f / p.thickness;
118  p.drift = driftDirection(stripdet) * p.thickness;
119  p.topology = (StripTopology*)(&stripdet->topology());
120  p.nstrips = p.topology->nstrips();
121  p.moduleGeom = SiStripDetId(stripdet->geographicalId()).moduleGeometry();
122  p.backplanecorrection = BackPlaneCorrectionMap_.getBackPlaneCorrection(stripdet->geographicalId().rawId());
123 
124  const TkRadialStripTopology* rtop =
125  dynamic_cast<const TkRadialStripTopology*>(&stripdet->specificType().specificTopology());
126  p.pitch_rel_err2 =
127  (rtop)
128  ? pow(0.5f * rtop->angularWidth() * rtop->stripLength() / rtop->localPitch(LocalPoint(0, 0, 0)), 2.f) / 12.f
129  : 0.f;
130  }
131 }
std::pair< LocalPoint, LocalError > LocalValues
size
Write out results.
const bool peakMode_
Definition: StripCPE.h:73
Local3DVector LocalVector
Definition: LocalVector.h:12
Params m_Params
Definition: StripCPE.h:86
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
StripCPE(edm::ParameterSet &conf, const MagneticField &, const TrackerGeometry &, const SiStripLorentzAngle &, const SiStripBackPlaneCorrection &, const SiStripConfObject &, const SiStripLatency &)
Definition: StripCPE.cc:9
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
int index() const
Definition: GeomDet.h:83
void fillParams()
Definition: StripCPE.cc:89
unsigned int offsetDU(SubDetector sid) const
StripTopology const * topology
Definition: StripCPE.h:35
Param const & param(const GeomDetUnit &det) const
Definition: StripCPE.h:81
constexpr int pow(int x)
Definition: conifer.h:24
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
assert(be >=bs)
const TrackerGeometry & geom_
Definition: StripCPE.h:74
unsigned int m_off
Definition: StripCPE.h:87
U second(std::pair< T, U > const &p)
const SiStripLorentzAngle & LorentzAngleMap_
Definition: StripCPE.h:76
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
bool isParameter(const std::string &name) const
std::vector< float > xtalk1
Definition: StripCPE.h:78
T sqrt(T t)
Definition: SSEVec.h:19
float getBackPlaneCorrection(const uint32_t &) const
const Topology & topology() const override
Returns a reference to the strip proxy topology.
float localPitch(const LocalPoint &) const override
double f[11][100]
virtual StripGeomDetType const & specificType() const
const MagneticField & magfield_
Definition: StripCPE.h:75
virtual const TopologyType & specificTopology() const
bool isTrackerStrip() const
Definition: GeomDetType.cc:13
virtual float coveredStrips(const LocalPoint &lp1, const LocalPoint &lp2) const
Definition: StripTopology.h:36
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
float stripLength() const override
float angularWidth() const override
StripClusterParameterEstimator::LocalValues localParameters(const SiStripCluster &cl, const GeomDetUnit &) const override
Definition: StripCPE.cc:62
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
const SiStripBackPlaneCorrection & BackPlaneCorrectionMap_
Definition: StripCPE.h:77
float getLorentzAngle(const uint32_t &) const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const PositionType & position() const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::vector< float > xtalk2
Definition: StripCPE.h:79
float barycenter() const
const GeomDetType & type() const override
Definition: Bounds.h:18
valueType get(const std::string &name) const
float coveredStrips(const LocalVector &, const LocalPoint &) const
Definition: StripCPE.cc:73
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40
LocalVector driftDirection(const StripGeomDetUnit *det) const override
Definition: StripCPE.cc:77
constexpr SubDetector tkDetEnum[8]
#define LogDebug(id)
const Bounds & bounds() const
Definition: Surface.h:87