Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:41

0001 #ifndef DataFormatsSiStripClusterSiStripClusterTools_H
0002 #define DataFormatsSiStripClusterSiStripClusterTools_H
0003 
0004 #include "DataFormats/TrajectoryState/interface/LocalTrajectoryParameters.h"
0005 #include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
0006 
0007 #include <numeric>
0008 
0009 namespace siStripClusterTools {
0010 
0011   // to be moved and optimized in TrackerCommon when TrackerTopology will support moduleGeometry
0012   inline float sensorThicknessInverse(DetId detid) {
0013     if (detid.subdetId() >= SiStripDetId::TIB) {
0014       SiStripDetId siStripDetId = detid();
0015       if (siStripDetId.subdetId() == SiStripDetId::TOB)
0016         return 1.f / 0.047f;
0017       if (siStripDetId.moduleGeometry() == SiStripModuleGeometry::W5 ||
0018           siStripDetId.moduleGeometry() == SiStripModuleGeometry::W6 ||
0019           siStripDetId.moduleGeometry() == SiStripModuleGeometry::W7)
0020         return 1.f / 0.047f;
0021       return 1.f / 0.029f;  // so it is TEC ring 1-4 or TIB or TOB;
0022     } else if (detid.subdetId() == 1)
0023       return 1.f / 0.0285f;
0024     else
0025       return 1.f / 0.027f;
0026   }
0027 
0028   template <typename Iter>
0029   inline float chargePerCM(DetId detid, Iter a, Iter b) {
0030     return float(std::accumulate(a, b, int(0))) * sensorThicknessInverse(detid);
0031   }
0032 
0033   template <typename Clus>
0034   inline float chargePerCM(DetId detid, Clus const& cl) {
0035     return cl.charge() * sensorThicknessInverse(detid);
0036   }
0037 
0038   template <typename Clus>
0039   inline float chargePerCM(DetId detid, Clus const& cl, LocalTrajectoryParameters const& tp) {
0040     return chargePerCM(detid, cl) * tp.absdz();
0041   }
0042 
0043   template <typename Clus>
0044   inline float chargePerCM(Clus const& cl, LocalTrajectoryParameters const& tp, float invThick) {
0045     return cl.charge() * invThick * tp.absdz();
0046   }
0047 
0048   template <typename Clus>
0049   inline float chargePerCM(DetId detid, Clus const& cl, const LocalVector& ldir) {
0050     return chargePerCM(detid, cl) * std::abs(ldir.z()) / ldir.mag();
0051   }
0052 
0053 }  // namespace siStripClusterTools
0054 
0055 #endif  // DataFormatsSiStripClusterSiStripClusterTools_H