CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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,
14  const SiStripLorentzAngle& LorentzAngle,
15  const SiStripConfObject& confObj,
16  const SiStripLatency& latency)
17  : peakMode_(latency.singleReadOutMode() == 1),
18  geom_(geom),
19  magfield_(mag),
20  LorentzAngleMap_(LorentzAngle)
21 {
22  typedef std::map<std::string,SiStripDetId::ModuleGeometry> map_t;
23  map_t modules;
24  modules["IB1"]=SiStripDetId::IB1;
25  modules["IB2"]=SiStripDetId::IB2;
26  modules["OB1"]=SiStripDetId::OB1;
27  modules["OB2"]=SiStripDetId::OB2;
28  modules["W1A"]=SiStripDetId::W1A;
29  modules["W2A"]=SiStripDetId::W2A;
30  modules["W3A"]=SiStripDetId::W3A;
31  modules["W1B"]=SiStripDetId::W1B;
32  modules["W2B"]=SiStripDetId::W2B;
33  modules["W3B"]=SiStripDetId::W3B;
34  modules["W4"] =SiStripDetId::W4;
35  modules["W5"] =SiStripDetId::W5;
36  modules["W6"] =SiStripDetId::W6;
37  modules["W7"] =SiStripDetId::W7;
38 
39  const unsigned size = max_element( modules.begin(),modules.end(),
40  boost::bind(&map_t::value_type::second,boost::lambda::_1) <
41  boost::bind(&map_t::value_type::second,boost::lambda::_2) )->second + 1;
42  shift.resize(size);
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
48  modeS(peakMode_?"Peak":"Deco"),
49  shiftS( "shift_" + it->first + modeS ),
50  xtalk1S("xtalk1_" + it->first + modeS ),
51  xtalk2S("xtalk2_" + it->first + modeS );
52 
53  if(!confObj.isParameter(shiftS)) throw cms::Exception("SiStripConfObject does not contain: ") << shiftS;
54  if(!confObj.isParameter(xtalk1S)) throw cms::Exception("SiStripConfObject does not contain: ") << xtalk1S;
55  if(!confObj.isParameter(xtalk2S)) throw cms::Exception("SiStripConfObject does not contain: ") << xtalk2S;
56 
57  shift[it->second] = confObj.get<double>(shiftS);
58  xtalk1[it->second] = confObj.get<double>(xtalk1S);
59  xtalk2[it->second] = confObj.get<double>(xtalk2S);
60  }
61 
62  fillParams();
63 
64 }
65 
67 localParameters( const SiStripCluster& cluster, const GeomDetUnit& det) const {
68  StripCPE::Param const & p = param(det);
69  const float barycenter = cluster.barycenter();
70  const float fullProjection = p.coveredStrips( p.drift + LocalVector(0,0,-p.thickness), LocalPoint(barycenter,0,0));
71  const float strip = barycenter - 0.5f * (1-shift[p.moduleGeom]) * fullProjection;
72 
73  return std::make_pair( p.topology->localPosition(strip),
74  p.topology->localError(strip, 1.f/12.f) );
75 }
76 
78 coveredStrips(const LocalVector& lvec, const LocalPoint& lpos) const {
79  return
80  ( topology->measurementPosition(lpos + 0.5f*lvec)
81  - topology->measurementPosition(lpos - 0.5f*lvec)).x();
82 }
83 
85 driftDirection(const StripGeomDetUnit* det) const {
86  LocalVector lbfield = (det->surface()).toLocal(magfield_.inTesla(det->surface().position()));
87 
88  float tanLorentzAnglePerTesla = LorentzAngleMap_.getLorentzAngle(det->geographicalId().rawId());
89 
90  float dir_x = -tanLorentzAnglePerTesla * lbfield.y();
91  float dir_y = tanLorentzAnglePerTesla * lbfield.x();
92  float dir_z = 1.f; // E field always in z direction
93 
94  return LocalVector(dir_x,dir_y,dir_z);
95 }
96 
97 
98 void
100  m_off = geom_.offsetDU(GeomDetEnumerators::TIB); // yes we know this
101  auto const & dus = geom_.detUnits();
102  m_Params.resize(dus.size()-m_off);
103  for (auto i=m_off; i!=dus.size();++i) {
104  auto & p= m_Params[i-m_off];
105  const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)(dus[i]);
106  assert(stripdet->index()==int(i));
107  assert(stripdet->geographicalId().subdetId()>1); // not pixel..
108 
109  const Bounds& bounds = stripdet->specificSurface().bounds();
110  p.maxLength = std::sqrt( std::pow(bounds.length(),2.f)+std::pow(bounds.width(),2.f) );
111  p.thickness = bounds.thickness();
112  p.drift = driftDirection(stripdet) * p.thickness;
113  p.topology=(StripTopology*)(&stripdet->topology());
114  p.nstrips = p.topology->nstrips();
115  p.moduleGeom = SiStripDetId(stripdet->geographicalId()).moduleGeometry();
116 
117  const RadialStripTopology* rtop = dynamic_cast<const RadialStripTopology*>(&stripdet->specificType().specificTopology());
118  p.pitch_rel_err2 = (rtop)
119  ? pow( 0.5f * rtop->angularWidth() * rtop->stripLength()/rtop->localPitch(LocalPoint(0,0,0)), 2.f) / 12.f
120  : 0.f;
121  }
122 }
StripCPE(edm::ParameterSet &conf, const MagneticField &, const TrackerGeometry &, const SiStripLorentzAngle &, const SiStripConfObject &, const SiStripLatency &)
Definition: StripCPE.cc:11
const bool peakMode_
Definition: StripCPE.h:31
int i
Definition: DBlmapReader.cc:9
Local3DVector LocalVector
Definition: LocalVector.h:12
Params m_Params
Definition: StripCPE.h:56
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
std::vector< double > xtalk2
Definition: StripCPE.h:37
const float & getLorentzAngle(const uint32_t &) const
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:43
void fillParams()
Definition: StripCPE.cc:99
StripTopology const * topology
Definition: StripCPE.h:41
T y() const
Definition: PV3DBase.h:62
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
std::pair< LocalPoint, LocalError > LocalValues
const TrackerGeometry & geom_
Definition: StripCPE.h:32
const BoundPlane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:38
unsigned int m_off
Definition: StripCPE.h:57
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
U second(std::pair< T, U > const &p)
const SiStripLorentzAngle & LorentzAngleMap_
Definition: StripCPE.h:34
virtual const DetUnitContainer & detUnits() const
Returm a vector of all GeomDetUnit.
std::vector< double > xtalk1
Definition: StripCPE.h:36
SiStripDetId::ModuleGeometry moduleGeom
Definition: StripCPE.h:45
T sqrt(T t)
Definition: SSEVec.h:46
unsigned int offsetDU(SubDetector sid) const
virtual const TopologyType & specificTopology() const
StripClusterParameterEstimator::LocalValues localParameters(const SiStripCluster &cl, const GeomDetUnit &) const
Definition: StripCPE.cc:67
virtual const Topology & topology() const
Returns a reference to the strip proxy topology.
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:72
double f[11][100]
float barycenter() const
const MagneticField & magfield_
Definition: StripCPE.h:33
std::vector< double > shift
Definition: StripCPE.h:35
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
int index() const
Definition: GeomDet.h:92
float coveredStrips(const LocalVector &, const LocalPoint &) const
Definition: StripCPE.cc:78
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
virtual StripGeomDetType & specificType() const
tuple conf
Definition: dbtoconf.py:185
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
const Bounds & bounds() const
Definition: BoundSurface.h:89
virtual float localPitch(const LocalPoint &) const
LocalVector driftDirection(const StripGeomDetUnit *det) const
Definition: StripCPE.cc:85
valueType get(const std::string &name) const
virtual float stripLength() const
virtual LocalError localError(float strip, float stripErr2) const =0
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
Param const & param(const GeomDetUnit &det) const
Definition: StripCPE.h:48
LocalVector drift
Definition: StripCPE.h:42
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
virtual LocalPoint localPosition(float strip) const =0
float angularWidth() const
Definition: Bounds.h:18
bool isParameter(const std::string &name) const
x
Definition: VDTMath.h:216
T x() const
Definition: PV3DBase.h:61
const PositionType & position() const
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40