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 }
Vector3DBase< float, LocalTag >
SiStripModuleGeometry::W4
StripCPE::xtalk2
std::vector< float > xtalk2
Definition: StripCPE.h:79
MagneticField::inTesla
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
mps_fire.i
i
Definition: mps_fire.py:428
SiStripModuleGeometry::W7
LogMessageMonitor_cff.modules
modules
Definition: LogMessageMonitor_cff.py:7
SiStripCluster::barycenter
float barycenter() const
Definition: SiStripCluster.cc:25
StripCPE::driftDirection
LocalVector driftDirection(const StripGeomDetUnit *det) const override
Definition: StripCPE.cc:77
StripGeomDetUnit::topology
const Topology & topology() const override
Returns a reference to the strip proxy topology.
Definition: StripGeomDetUnit.cc:15
TkRadialStripTopology::localPitch
float localPitch(const LocalPoint &) const override
Definition: TkRadialStripTopology.cc:214
GeomDet
Definition: GeomDet.h:27
SiStripSimParameters_cfi.LorentzAngle
LorentzAngle
Definition: SiStripSimParameters_cfi.py:93
StripGeomDetType.h
StripCPE::m_Params
Params m_Params
Definition: StripCPE.h:86
config_102169_raw_cff.latency
latency
Definition: config_102169_raw_cff.py:29
StripCPE::peakMode_
const bool peakMode_
Definition: StripCPE.h:73
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
StripGeomDetUnit::type
const GeomDetType & type() const override
Definition: StripGeomDetUnit.cc:11
modules
Definition: MuonCleanerBySegments.cc:35
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
TkRadialStripTopology
Definition: TkRadialStripTopology.h:28
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
Bounds
Definition: Bounds.h:18
SiStripModuleGeometry::W3B
cms::cuda::assert
assert(be >=bs)
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
SiStripModuleGeometry::IB1
GeomDet::index
int index() const
Definition: GeomDet.h:83
SiStripConfObject::isParameter
bool isParameter(const std::string &name) const
Definition: SiStripConfObject.h:76
StripCPE::param
Param const & param(const GeomDetUnit &det) const
Definition: StripCPE.h:81
StripCPE::StripCPE
StripCPE(edm::ParameterSet &conf, const MagneticField &, const TrackerGeometry &, const SiStripLorentzAngle &, const SiStripBackPlaneCorrection &, const SiStripConfObject &, const SiStripLatency &)
Definition: StripCPE.cc:9
StripCPE::Param::topology
StripTopology const * topology
Definition: StripCPE.h:35
StripTopology.h
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
SiStripBackPlaneCorrection::getBackPlaneCorrection
float getBackPlaneCorrection(const uint32_t &) const
Definition: SiStripBackPlaneCorrection.cc:15
SiStripModuleGeometry::W3A
StripCPE::fillParams
void fillParams()
Definition: StripCPE.cc:89
SiStripModuleGeometry::W6
SiStripModuleGeometry::OB1
StripCPE::xtalk1
std::vector< float > xtalk1
Definition: StripCPE.h:78
StripCPE::geom_
const TrackerGeometry & geom_
Definition: StripCPE.h:74
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
SiStripLorentzAngle
Definition: SiStripLorentzAngle.h:26
SiStripModuleGeometry::W5
TrackerGeometry::detUnits
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: TrackerGeometry.h:61
GeomDetEnumerators::tkDetEnum
constexpr SubDetector tkDetEnum[8]
Definition: GeomDetEnumerators.h:37
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
StripCPE::BackPlaneCorrectionMap_
const SiStripBackPlaneCorrection & BackPlaneCorrectionMap_
Definition: StripCPE.h:77
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
StripTopology::coveredStrips
virtual float coveredStrips(const LocalPoint &lp1, const LocalPoint &lp2) const
Definition: StripTopology.h:36
Point3DBase< float, LocalTag >
SiStripModuleGeometry::W1B
StripCPE::LorentzAngleMap_
const SiStripLorentzAngle & LorentzAngleMap_
Definition: StripCPE.h:76
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripModuleGeometry::IB2
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
SiStripModuleGeometry::W1A
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
StripCPE::m_off
unsigned int m_off
Definition: StripCPE.h:87
StripCPE::Param::coveredStrips
float coveredStrips(const LocalVector &, const LocalPoint &) const
Definition: StripCPE.cc:73
TkRadialStripTopology.h
SiStripModuleGeometry::W2A
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
LocalVector
Local3DVector LocalVector
Definition: LocalVector.h:12
createfilelist.int
int
Definition: createfilelist.py:10
StripCPE::Param
Definition: StripCPE.h:33
SiStripModuleGeometry::W2B
toLocal
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
Definition: ConversionProducer.cc:202
StripCPE::magfield_
const MagneticField & magfield_
Definition: StripCPE.h:75
GeomDet::specificSurface
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40
StripCPE::localParameters
StripClusterParameterEstimator::LocalValues localParameters(const SiStripCluster &cl, const GeomDetUnit &) const override
Definition: StripCPE.cc:62
GeomDetType::isTrackerStrip
bool isTrackerStrip() const
Definition: GeomDetType.cc:13
SiStripLorentzAngle::getLorentzAngle
float getLorentzAngle(const uint32_t &) const
Definition: SiStripLorentzAngle.cc:15
SiStripConfObject::get
valueType get(const std::string &name) const
Definition: SiStripConfObject.h:63
GloballyPositioned::position
const PositionType & position() const
Definition: GloballyPositioned.h:36
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
StripGeomDetUnit::specificType
virtual StripGeomDetType const & specificType() const
Definition: StripGeomDetUnit.cc:13
StripGeomDetType::specificTopology
virtual const TopologyType & specificTopology() const
Definition: StripGeomDetType.h:23
SiStripModuleGeometry::OB2
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
cms::Exception
Definition: Exception.h:70
StripClusterParameterEstimator::LocalValues
std::pair< LocalPoint, LocalError > LocalValues
Definition: StripClusterParameterEstimator.h:27
SiStripDetId
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
TkRadialStripTopology::stripLength
float stripLength() const override
Definition: TkRadialStripTopology.h:132
TkRadialStripTopology::angularWidth
float angularWidth() const override
Definition: TkRadialStripTopology.h:164
StripCPE.h
SiStripLatency
Definition: SiStripLatency.h:59
MagneticField
Definition: MagneticField.h:19
SiStripCluster
Definition: SiStripCluster.h:8
TrackerGeometry::offsetDU
unsigned int offsetDU(SubDetector sid) const
Definition: TrackerGeometry.h:72
SiStripBackPlaneCorrection
Definition: SiStripBackPlaneCorrection.h:27
StripTopology
Definition: StripTopology.h:11
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
StripGeomDetUnit
Definition: StripGeomDetUnit.h:15
TrackerGeometry
Definition: TrackerGeometry.h:14
SiStripConfObject
Definition: SiStripConfObject.h:31