CMS 3D CMS Logo

SiStripClusterTools.h
Go to the documentation of this file.
1 #ifndef DataFormatsSiStripClusterSiStripClusterTools_H
2 #define DataFormatsSiStripClusterSiStripClusterTools_H
3 
6 
7 #include <numeric>
8 
9 namespace siStripClusterTools {
10 
11  // to be moved and optimized in TrackerCommon when TrackerTopology will support moduleGeometry
12  inline float sensorThicknessInverse(DetId detid) {
13  if (detid.subdetId() >= SiStripDetId::TIB) {
14  SiStripDetId siStripDetId = detid();
15  if (siStripDetId.subdetId() == SiStripDetId::TOB)
16  return 1.f / 0.047f;
17  if (siStripDetId.moduleGeometry() == SiStripModuleGeometry::W5 ||
18  siStripDetId.moduleGeometry() == SiStripModuleGeometry::W6 ||
19  siStripDetId.moduleGeometry() == SiStripModuleGeometry::W7)
20  return 1.f / 0.047f;
21  return 1.f / 0.029f; // so it is TEC ring 1-4 or TIB or TOB;
22  } else if (detid.subdetId() == 1)
23  return 1.f / 0.0285f;
24  else
25  return 1.f / 0.027f;
26  }
27 
28  template <typename Iter>
29  inline float chargePerCM(DetId detid, Iter a, Iter b) {
30  return float(std::accumulate(a, b, int(0))) * sensorThicknessInverse(detid);
31  }
32 
33  template <typename Clus>
34  inline float chargePerCM(DetId detid, Clus const& cl) {
35  return cl.charge() * sensorThicknessInverse(detid);
36  }
37 
38  template <typename Clus>
39  inline float chargePerCM(DetId detid, Clus const& cl, LocalTrajectoryParameters const& tp) {
40  return chargePerCM(detid, cl) * tp.absdz();
41  }
42 
43  template <typename Clus>
44  inline float chargePerCM(Clus const& cl, LocalTrajectoryParameters const& tp, float invThick) {
45  return cl.charge() * invThick * tp.absdz();
46  }
47 
48  template <typename Clus>
49  inline float chargePerCM(DetId detid, Clus const& cl, const LocalVector& ldir) {
50  return chargePerCM(detid, cl) * std::abs(ldir.z()) / ldir.mag();
51  }
52 
53 } // namespace siStripClusterTools
54 
55 #endif // DataFormatsSiStripClusterSiStripClusterTools_H
T z() const
Definition: PV3DBase.h:61
SiStripModuleGeometry moduleGeometry() const
Definition: SiStripDetId.h:109
float chargePerCM(DetId detid, Iter a, Iter b)
float sensorThicknessInverse(DetId detid)
T mag() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
Definition: SiStripDetId.h:39
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
Definition: DetId.h:17
double b
Definition: hdecay.h:118
static constexpr auto TIB
Definition: SiStripDetId.h:37
double a
Definition: hdecay.h:119