CMS 3D CMS Logo

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