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  {
14  if (detid.subdetId()>=SiStripDetId::TIB) {
15  SiStripDetId siStripDetId = detid();
16  if (siStripDetId.subdetId()==SiStripDetId::TOB) return 1.f/0.047f;
17  if (siStripDetId.moduleGeometry()==SiStripDetId::W5 || siStripDetId.moduleGeometry()==SiStripDetId::W6 ||
18  siStripDetId.moduleGeometry()==SiStripDetId::W7)
19  return 1.f/0.047f;
20  return 1.f/0.029f; // so it is TEC ring 1-4 or TIB or TOB;
21  } else if (detid.subdetId()==1) return 1.f/0.0285f;
22  else return 1.f/0.027f;
23  }
24 
25 
26  template<typename Iter>
27  inline float chargePerCM(DetId detid, Iter a, Iter b) {
28  return float(std::accumulate(a,b,int(0)))*sensorThicknessInverse(detid);
29  }
30 
31  template<typename Clus>
32  inline float chargePerCM(DetId detid, Clus const & cl) {
33  return cl.charge()*sensorThicknessInverse(detid);
34  }
35 
36 
37  template<typename Clus>
38  inline float chargePerCM(DetId detid, Clus const & cl, LocalTrajectoryParameters const & tp) {
39  return chargePerCM(detid,cl)*tp.absdz();
40  }
41 
42  template<typename Clus>
43  inline float chargePerCM(Clus const & cl, LocalTrajectoryParameters const & tp, float invThick) {
44  return cl.charge()*invThick*tp.absdz();
45  }
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 
54 
55 }
56 
57 
58 #endif // DataFormatsSiStripClusterSiStripClusterTools_H
59 
float chargePerCM(DetId detid, Iter a, Iter b)
float sensorThicknessInverse(DetId detid)
T mag() const
Definition: PV3DBase.h:67
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:38
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
Definition: DetId.h:18
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
ModuleGeometry moduleGeometry() const
Definition: SiStripDetId.h:118