1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#ifndef DataFormatsSiStripClusterSiStripClusterTools_H
#define DataFormatsSiStripClusterSiStripClusterTools_H
#include "DataFormats/TrajectoryState/interface/LocalTrajectoryParameters.h"
#include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
#include <numeric>
namespace siStripClusterTools {
// to be moved and optimized in TrackerCommon when TrackerTopology will support moduleGeometry
inline float sensorThicknessInverse(DetId detid) {
if (detid.subdetId() >= SiStripDetId::TIB) {
SiStripDetId siStripDetId = detid();
if (siStripDetId.subdetId() == SiStripDetId::TOB)
return 1.f / 0.047f;
if (siStripDetId.moduleGeometry() == SiStripModuleGeometry::W5 ||
siStripDetId.moduleGeometry() == SiStripModuleGeometry::W6 ||
siStripDetId.moduleGeometry() == SiStripModuleGeometry::W7)
return 1.f / 0.047f;
return 1.f / 0.029f; // so it is TEC ring 1-4 or TIB or TOB;
} else if (detid.subdetId() == 1)
return 1.f / 0.0285f;
else
return 1.f / 0.027f;
}
template <typename Iter>
inline float chargePerCM(DetId detid, Iter a, Iter b) {
return float(std::accumulate(a, b, int(0))) * sensorThicknessInverse(detid);
}
template <typename Clus>
inline float chargePerCM(DetId detid, Clus const& cl) {
return cl.charge() * sensorThicknessInverse(detid);
}
template <typename Clus>
inline float chargePerCM(DetId detid, Clus const& cl, LocalTrajectoryParameters const& tp) {
return chargePerCM(detid, cl) * tp.absdz();
}
template <typename Clus>
inline float chargePerCM(Clus const& cl, LocalTrajectoryParameters const& tp, float invThick) {
return cl.charge() * invThick * tp.absdz();
}
template <typename Clus>
inline float chargePerCM(DetId detid, Clus const& cl, const LocalVector& ldir) {
return chargePerCM(detid, cl) * std::abs(ldir.z()) / ldir.mag();
}
} // namespace siStripClusterTools
#endif // DataFormatsSiStripClusterSiStripClusterTools_H
|