CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Chi2ChargeMeasurementEstimator.cc
Go to the documentation of this file.
4 
11 
12 bool Chi2ChargeMeasurementEstimator::checkClusterCharge(const OmniClusterRef::ClusterStripRef cluster, float chargeCut) const
13 {
14  int clusCharge=accumulate( cluster->amplitudes().begin(), cluster->amplitudes().end(), uint16_t(0));
15  return (clusCharge>chargeCut);
16 }
17 
18 bool Chi2ChargeMeasurementEstimator::checkCharge(const TrackingRecHit& aRecHit,
19  int subdet, float chargeCut) const
20 {
21  auto const & hit = aRecHit.hit(); // this works for both TRH and TTRH!
22 
23  if (aRecHit.getRTTI() == 4) {
24  const SiStripMatchedRecHit2D *matchHit = static_cast<const SiStripMatchedRecHit2D *>(hit);
25  if likely(matchHit!=0) return (checkClusterCharge(matchHit->monoClusterRef().cluster_strip(), chargeCut)
26  &&checkClusterCharge(matchHit->stereoClusterRef().cluster_strip(), chargeCut));
27  else{
28  const std::type_info &type = typeid(aRecHit);
29  throw cms::Exception("Unknown RecHit Type") << "checkCharge/SiStripMatchedRecHit2D: Wrong recHit type: " << type.name();
30  }
31  } else {
32  auto const & thit = static_cast<const BaseTrackerRecHit *>(hit);
33  auto const & clus = thit->firstClusterRef();
34  if (!clus.isPixel()) return checkClusterCharge(clus.cluster_strip(), chargeCut);
35  else return (clus.cluster_pixel()->charge()>chargeCut);
36  }
37 }
38 
39 
40 
41 float Chi2ChargeMeasurementEstimator::sensorThickness (const DetId& detid) const
42 {
43  if (detid.subdetId()>=SiStripDetId::TIB) {
44  SiStripDetId siStripDetId = detid();
45  if (siStripDetId.subdetId()==SiStripDetId::TOB) return 0.047;
46  if (siStripDetId.moduleGeometry()==SiStripDetId::W5 || siStripDetId.moduleGeometry()==SiStripDetId::W6 ||
47  siStripDetId.moduleGeometry()==SiStripDetId::W7)
48  return 0.047;
49  return 0.029; // so it is TEC ring 1-4 or TIB or TOB;
50  } else if (detid.subdetId()==1) return 0.0285;
51  else return 0.027;
52 }
53 
54 
55 std::pair<bool,double>
56 Chi2ChargeMeasurementEstimator::estimate(const TrajectoryStateOnSurface& tsos,
57  const TrackingRecHit& aRecHit) const {
58 
59 
60 
61  std::pair<bool,double> estimateResult = Chi2MeasurementEstimator::estimate(tsos, aRecHit);
62  if ( !estimateResult.first || (!(cutOnStripCharge_||cutOnPixelCharge_)) ||
63  (tsos.globalMomentum ().perp()>pTChargeCutThreshold_)) return estimateResult;
64 
65  SiStripDetId detid = aRecHit.geographicalId();
66  uint32_t subdet = detid.subdetId();
67  if((detid.det()==1) && (((subdet>2)&&cutOnStripCharge_) || ((subdet<3)&&cutOnPixelCharge_))) {
68 
69  float theDxdz = tsos.localParameters().dxdz();
70  float theDydz = tsos.localParameters().dydz();
71  float chargeCut = (float) minGoodCharge(subdet) * sensorThickness(detid)*(sqrt(1. + theDxdz*theDxdz + theDydz*theDydz));
72 
73  if (!checkCharge(aRecHit, subdet, chargeCut)) return HitReturnType(false,0.);
74  else return estimateResult;
75  }
76 
77  return estimateResult;
78 }
79 
type
Definition: HCALResponse.h:21
T perp() const
Definition: PV3DBase.h:72
const LocalTrajectoryParameters & localParameters() const
T sqrt(T t)
Definition: SSEVec.h:48
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
unsigned int getRTTI() const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
Definition: DetId.h:18
virtual TrackingRecHit const * hit() const
virtual OmniClusterRef const & firstClusterRef() const =0
return(e1-e2)*(e1-e2)+dp *dp
#define likely(x)
Definition: Likely.h:20
GlobalVector globalMomentum() const
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
DetId geographicalId() const
ModuleGeometry moduleGeometry() const
Definition: SiStripDetId.h:132
Detector det() const
get the detector field from this detid
Definition: DetId.h:35