CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
METSignificanceProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: METProducers
4 // Class: METSignificanceProducer
5 //
6 //
7 
8 //____________________________________________________________________________||
10 
11 
12 //____________________________________________________________________________||
13 namespace cms
14 {
15 
16 //____________________________________________________________________________||
18  {
19 
20  std::vector<edm::InputTag> srcLeptonsTags = iConfig.getParameter< std::vector<edm::InputTag> >("srcLeptons");
21  for(std::vector<edm::InputTag>::const_iterator it=srcLeptonsTags.begin();it!=srcLeptonsTags.end();it++) {
22  lepTokens_.push_back( consumes<edm::View<reco::Candidate> >( *it ) );
23  }
24 
25  pfjetsToken_ = consumes<edm::View<reco::Jet> >(iConfig.getParameter<edm::InputTag>("srcPfJets"));
26 
27  metToken_ = consumes<edm::View<reco::MET> >(iConfig.getParameter<edm::InputTag>("srcMet"));
28  pfCandidatesToken_ = consumes<edm::View<reco::Candidate> >(iConfig.getParameter<edm::InputTag>("srcPFCandidates"));
29 
30  metSigAlgo_ = new metsig::METSignificance(iConfig);
31 
32  produces<double>("METSignificance");
33  produces<math::Error<2>::type>("METCovariance");
34 
35  }
36 
37 //____________________________________________________________________________||
39  {
40  //
41  // met
42  //
44  event.getByToken(metToken_, metHandle);
45  const reco::MET& met = (*metHandle)[0];
46 
47  //
48  // candidates
49  //
51  event.getByToken( pfCandidatesToken_, pfCandidates );
52 
53  //
54  // leptons
55  //
56  std::vector< edm::Handle<reco::CandidateView> > leptons;
57  for ( std::vector<edm::EDGetTokenT<edm::View<reco::Candidate> > >::const_iterator srcLeptons_i = lepTokens_.begin();
58  srcLeptons_i != lepTokens_.end(); ++srcLeptons_i ) {
59 
61  event.getByToken(*srcLeptons_i, leptons_i);
62  leptons.push_back( leptons_i );
63 
64  }
65 
66  //
67  // jets
68  //
70  event.getByToken( pfjetsToken_, jets );
71 
72  //
73  // compute the significance
74  //
75  const reco::METCovMatrix cov = metSigAlgo_->getCovariance( *jets, leptons, *pfCandidates);
76  double sig = metSigAlgo_->getSignificance(cov, met);
77 
78  std::auto_ptr<double> significance (new double);
79  (*significance) = sig;
80 
82  (*covPtr)(0,0) = cov(0,0);
83  (*covPtr)(1,0) = cov(1,0);
84  (*covPtr)(1,1) = cov(1,1);
85 
86  event.put( covPtr, "METCovariance" );
87  event.put( significance, "METSignificance" );
88 
89  }
90 
91 //____________________________________________________________________________||
93 }
94 
95 //____________________________________________________________________________||
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
virtual void produce(edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::EDGetTokenT< edm::View< reco::Candidate > > pfCandidatesToken_
ROOT::Math::SMatrix< double, 2 > METCovMatrix
Definition: MET.h:40
ErrorD< N >::type type
Definition: Error.h:39
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
tuple METSignificance
____________________________________________________________________________||
Definition: MET.h:42
vector< PseudoJet > jets
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
reco::METCovMatrix getCovariance(const edm::View< reco::Jet > &jets, const std::vector< edm::Handle< reco::CandidateView > > &leptons, const edm::View< reco::Candidate > &pfCandidates)
METSignificanceProducer(const edm::ParameterSet &)
metsig::METSignificance * metSigAlgo_
edm::EDGetTokenT< edm::View< reco::Jet > > pfjetsToken_
double getSignificance(const reco::METCovMatrix &cov, const reco::MET &met) const
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")