CMS 3D CMS Logo

Chi2ChargeMeasurementEstimatorESProducer.cc
Go to the documentation of this file.
1 
10 
12 
13 #include <limits>
14 
16 
18 
19 namespace {
20 
22  public:
28  template <typename... Args>
29  Chi2ChargeMeasurementEstimator(float minGoodPixelCharge,
30  float minGoodStripCharge,
32  Args&&... args)
34  minGoodPixelCharge_(minGoodPixelCharge),
35  minGoodStripCharge_(minGoodStripCharge),
36  pTChargeCutThreshold2_(pTChargeCutThreshold >= 0. ? pTChargeCutThreshold * pTChargeCutThreshold
37  : std::numeric_limits<float>::max()) {}
38 
39  bool preFilter(const TrajectoryStateOnSurface& ts, const MeasurementEstimator::OpaquePayload& opay) const override;
40 
41  Chi2ChargeMeasurementEstimator* clone() const override { return new Chi2ChargeMeasurementEstimator(*this); }
42 
43  private:
44  const float minGoodPixelCharge_;
45  const float minGoodStripCharge_;
46  const float pTChargeCutThreshold2_;
47 
48  bool checkClusterCharge(DetId id, SiStripCluster const& cluster, const TrajectoryStateOnSurface& ts) const {
49  return siStripClusterTools::chargePerCM(id, cluster, ts.localParameters()) > minGoodStripCharge_;
50  }
51  };
52 
54  const MeasurementEstimator::OpaquePayload& opay) const {
55  // what we got?
56  if (opay.tag != ClusterFilterPayload::myTag)
57  return true; // not mine...
58 
59  auto const& clf = reinterpret_cast<ClusterFilterPayload const&>(opay);
60 
61  if (ts.globalMomentum().perp2() > pTChargeCutThreshold2_)
62  return true;
63 
64  DetId detid = clf.detId;
65  uint32_t subdet = detid.subdetId();
66 
67  if (subdet > 2) {
68  return checkClusterCharge(detid, *clf.cluster[0], ts) &&
69  (nullptr == clf.cluster[1] || checkClusterCharge(detid, *clf.cluster[1], ts));
70  }
71 
72  /* pixel charge not implemented as not used...
73  auto const & thit = static_cast<const SiPixelRecHit &>(hit);
74  thit.cluster()->charge() ...
75 
76  */
77 
78  return true;
79  }
80 
81 } // namespace
82 
86 #include <memory>
87 
89 
90 namespace {
91 
92  class Chi2ChargeMeasurementEstimatorESProducer : public edm::ESProducer {
93  public:
94  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
95  Chi2ChargeMeasurementEstimatorESProducer(const edm::ParameterSet& p);
96  ~Chi2ChargeMeasurementEstimatorESProducer() override;
97  std::unique_ptr<Chi2MeasurementEstimatorBase> produce(const TrackingComponentsRecord&);
98 
99  private:
100  const double m_maxChi2;
101  const double m_nSigma;
102  const double m_maxDis;
103  const double m_maxSag;
104  const double m_minTol;
105  const double m_minpt;
106  const float m_minGoodStripCharge;
107  const double m_pTChargeCutThreshold;
108  };
109 
112  desc.add<std::string>("ComponentName", "Chi2Charge");
113  desc.add<double>("pTChargeCutThreshold", -1.);
115  desc.add<edm::ParameterSetDescription>("clusterChargeCut", descCCC);
116  descriptions.add("Chi2ChargeMeasurementEstimatorDefault", desc);
117  }
118 
119  Chi2ChargeMeasurementEstimatorESProducer::Chi2ChargeMeasurementEstimatorESProducer(const edm::ParameterSet& pset)
120  : m_maxChi2(pset.getParameter<double>("MaxChi2")),
121  m_nSigma(pset.getParameter<double>("nSigma")),
122  m_maxDis(pset.getParameter<double>("MaxDisplacement")),
123  m_maxSag(pset.getParameter<double>("MaxSagitta")),
124  m_minTol(pset.getParameter<double>("MinimalTolerance")),
125  m_minpt(pset.getParameter<double>("MinPtForHitRecoveryInGluedDet")),
126  m_minGoodStripCharge(clusterChargeCut(pset)),
127  m_pTChargeCutThreshold(pset.getParameter<double>("pTChargeCutThreshold")) {
128  std::string const& myname = pset.getParameter<std::string>("ComponentName");
129  setWhatProduced(this, myname);
130  }
131 
132  Chi2ChargeMeasurementEstimatorESProducer::~Chi2ChargeMeasurementEstimatorESProducer() {}
133 
134  std::unique_ptr<Chi2MeasurementEstimatorBase> Chi2ChargeMeasurementEstimatorESProducer::produce(
135  const TrackingComponentsRecord& iRecord) {
136  auto minGoodPixelCharge = 0;
137 
138  return std::make_unique<Chi2ChargeMeasurementEstimator>(minGoodPixelCharge,
139  m_minGoodStripCharge,
140  m_pTChargeCutThreshold,
141  m_maxChi2,
142  m_nSigma,
143  m_maxDis,
144  m_maxSag,
145  m_minTol,
146  m_minpt);
147  }
148 
149 } // namespace
150 
152 DEFINE_FWK_EVENTSETUP_MODULE(Chi2ChargeMeasurementEstimatorESProducer);
writedatasetfile.args
args
Definition: writedatasetfile.py:18
Chi2MeasurementEstimator.h
HLT_FULL_cff.pTChargeCutThreshold
pTChargeCutThreshold
Definition: HLT_FULL_cff.py:6906
TrajectoryStateOnSurface.h
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
Chi2MeasurementEstimator::clone
Chi2MeasurementEstimator * clone() const override
Definition: Chi2MeasurementEstimator.h:21
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
MeasurementEstimator::OpaquePayload::tag
int tag
Definition: MeasurementEstimator.h:23
Chi2MeasurementEstimator
Definition: Chi2MeasurementEstimator.h:15
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
siStripClusterTools::chargePerCM
float chargePerCM(DetId detid, Iter a, Iter b)
Definition: SiStripClusterTools.h:29
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
Chi2ChargeMeasurementEstimator_cfi.Chi2ChargeMeasurementEstimator
Chi2ChargeMeasurementEstimator
Definition: Chi2ChargeMeasurementEstimator_cfi.py:7
ESProducer.h
ClusterFilterPayload.h
Chi2MeasurementEstimatorParams.h
DetId
Definition: DetId.h:17
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
MeasurementEstimator::preFilter
virtual bool preFilter(const TrajectoryStateOnSurface &, OpaquePayload const &) const
Definition: MeasurementEstimator.h:50
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
chi2MeasurementEstimatorParams::getFilledConfigurationDescription
edm::ParameterSetDescription getFilledConfigurationDescription()
Definition: Chi2MeasurementEstimatorParams.h:6
HLT_FULL_cff.minGoodStripCharge
minGoodStripCharge
Definition: HLT_FULL_cff.py:106
SiStripClusterTools.h
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrajectoryStateOnSurface::localParameters
const LocalTrajectoryParameters & localParameters() const
Definition: TrajectoryStateOnSurface.h:73
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripCluster.h
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
MeasurementEstimator::OpaquePayload
Definition: MeasurementEstimator.h:21
getFilledConfigurationDescription4CCC
edm::ParameterSetDescription getFilledConfigurationDescription4CCC()
Definition: ClusterChargeCut.h:12
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
ModuleFactory.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
TrackingComponentsRecord.h
ClusterFilterPayload::myTag
static constexpr int myTag
Definition: ClusterFilterPayload.h:17
edm::ESProducer
Definition: ESProducer.h:104
ClusterChargeCut.h
ParameterSet.h
clusterChargeCut
float clusterChargeCut(const edm::ParameterSet &conf, const char *name="clusterChargeCut")
Definition: ClusterChargeCut.h:7
SiStripCluster
Definition: SiStripCluster.h:8
gather_cfg.preFilter
tuple preFilter
Definition: gather_cfg.py:51
PV3DBase::perp2
T perp2() const
Definition: PV3DBase.h:68
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
TrackingComponentsRecord
Definition: TrackingComponentsRecord.h:12