CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
EvaluateMuonMVAID.cc
Go to the documentation of this file.
1 //
2 //
3 //
4 //
5 
8 
11 
14 #include <vector>
15 
16 class EvaluateMuonMVAID : public BaseMVAValueMapProducer<pat::Muon> {
17 public:
18  explicit EvaluateMuonMVAID(const edm::ParameterSet& iConfig, const BaseMVACache* cache)
19  : BaseMVAValueMapProducer<pat::Muon>(iConfig, cache) {}
20 
21  void fillAdditionalVariables(const pat::Muon& m) override {
22  float norm_chi2;
23  float n_Valid_hits;
24  if (m.globalTrack().isNonnull()) {
25  norm_chi2 = m.globalTrack()->normalizedChi2();
26  n_Valid_hits = m.globalTrack()->hitPattern().numberOfValidMuonHits();
27  } else if (m.innerTrack().isNonnull()) {
28  norm_chi2 = m.innerTrack()->normalizedChi2();
29  n_Valid_hits = m.innerTrack()->hitPattern().numberOfValidMuonHits();
30  } else {
31  norm_chi2 = -99;
32  n_Valid_hits = -99;
33  }
34 
35  this->setValue("Muon_norm_chi2_extended", norm_chi2);
36  this->setValue("Muon_n_Valid_hits_extended", n_Valid_hits);
37  }
38 
39  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
41  descriptions.add("EvaluateMuonMVAID", desc);
42  }
43 };
44 
45 //define this as a plug-in
static edm::ParameterSetDescription getDescription()
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void setValue(const std::string var, float val)
Definition: HeavyIon.h:7
Definition: Muon.py:1
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void fillAdditionalVariables(const pat::Muon &m) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
def cache(function)
Definition: utilities.py:3
Analysis-level muon class.
Definition: Muon.h:51
EvaluateMuonMVAID(const edm::ParameterSet &iConfig, const BaseMVACache *cache)