CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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,
12  const SiStripLorentzAngle& LorentzAngle,
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;
23  modules["IB1"] = SiStripModuleGeometry::IB1;
24  modules["IB2"] = SiStripModuleGeometry::IB2;
25  modules["OB1"] = SiStripModuleGeometry::OB1;
26  modules["OB2"] = SiStripModuleGeometry::OB2;
27  modules["W1A"] = SiStripModuleGeometry::W1A;
28  modules["W2A"] = SiStripModuleGeometry::W2A;
29  modules["W3A"] = SiStripModuleGeometry::W3A;
30  modules["W1B"] = SiStripModuleGeometry::W1B;
31  modules["W2B"] = SiStripModuleGeometry::W2B;
32  modules["W3B"] = SiStripModuleGeometry::W3B;
33  modules["W4"] = SiStripModuleGeometry::W4;
34  modules["W5"] = SiStripModuleGeometry::W5;
35  modules["W6"] = SiStripModuleGeometry::W6;
36  modules["W7"] = SiStripModuleGeometry::W7;
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
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 float coveredStrips(const LocalPoint &lp1, const LocalPoint &lp2) const
Definition: StripTopology.h:36
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
float thickness
Definition: StripCPE.h:37
void fillParams()
Definition: StripCPE.cc:89
StripTopology const * topology
Definition: StripCPE.h:35
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
T y() const
Definition: PV3DBase.h:60
const Bounds & bounds() const
Definition: Surface.h:87
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
assert(be >=bs)
const TrackerGeometry & geom_
Definition: StripCPE.h:74
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
float backplanecorrection
Definition: StripCPE.h:39
unsigned int m_off
Definition: StripCPE.h:87
bool isTrackerStrip() const
Definition: GeomDetType.cc:13
U second(std::pair< T, U > const &p)
const SiStripLorentzAngle & LorentzAngleMap_
Definition: StripCPE.h:76
std::vector< float > xtalk1
Definition: StripCPE.h:78
float getLorentzAngle(const uint32_t &) const
virtual StripGeomDetType const & specificType() const
T sqrt(T t)
Definition: SSEVec.h:19
unsigned int offsetDU(SubDetector sid) const
virtual const TopologyType & specificTopology() const
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
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
float barycenter() const
const MagneticField & magfield_
Definition: StripCPE.h:75
int index() const
Definition: GeomDet.h:83
float coveredStrips(const LocalVector &, const LocalPoint &) const
Definition: StripCPE.cc:73
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
valueType get(const std::string &name) const
virtual LocalError localError(float strip, float stripErr2) const =0
std::vector< float > xtalk2
Definition: StripCPE.h:79
Param const & param(const GeomDetUnit &det) const
Definition: StripCPE.h:81
LocalVector drift
Definition: StripCPE.h:36
virtual LocalPoint localPosition(float strip) const =0
const GeomDetType & type() const override
Definition: Bounds.h:18
bool isParameter(const std::string &name) const
T x() const
Definition: PV3DBase.h:59
const PositionType & position() const
tuple size
Write out results.
LocalVector driftDirection(const StripGeomDetUnit *det) const override
Definition: StripCPE.cc:77
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
constexpr SubDetector tkDetEnum[8]
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40
#define LogDebug(id)