test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFMETProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: METProducers
4 // Class: PFMETProducer
5 //
6 //
7 
8 //____________________________________________________________________________||
10 
11 //____________________________________________________________________________||
12 namespace cms
13 {
14 
15 //____________________________________________________________________________||
17  : inputToken_(consumes<edm::View<reco::Candidate> >(iConfig.getParameter<edm::InputTag>("src")))
18  , calculateSignificance_(iConfig.getParameter<bool>("calculateSignificance"))
19  , globalThreshold_(iConfig.getParameter<double>("globalThreshold"))
20  {
22  {
23  metSigAlgo_ = new metsig::METSignificance(iConfig);
24 
25  jetToken_ = mayConsume<edm::View<reco::Jet> >(iConfig.getParameter<edm::InputTag>("srcJets"));
26  std::vector<edm::InputTag> srcLeptonsTags = iConfig.getParameter< std::vector<edm::InputTag> >("srcLeptons");
27  for(std::vector<edm::InputTag>::const_iterator it=srcLeptonsTags.begin();it!=srcLeptonsTags.end();it++) {
28  lepTokens_.push_back( mayConsume<edm::View<reco::Candidate> >( *it ) );
29  }
30 
31  }
32 
33  std::string alias = iConfig.exists("alias") ? iConfig.getParameter<std::string>("alias") : "";
34 
35  produces<reco::PFMETCollection>().setBranchAlias(alias);
36  }
37 
38 //____________________________________________________________________________||
40  {
42  event.getByToken(inputToken_, input);
43 
44  METAlgo algo;
45  CommonMETData commonMETdata = algo.run(*input.product(), globalThreshold_);
46 
47  const math::XYZTLorentzVector p4(commonMETdata.mex, commonMETdata.mey, 0.0, commonMETdata.met);
48  const math::XYZPoint vtx(0.0, 0.0, 0.0);
49 
50  PFSpecificAlgo pf;
51  SpecificPFMETData specific = pf.run(*input.product());
52 
53  reco::PFMET pfmet(specific, commonMETdata.sumet, p4, vtx);
54 
56  {
57  reco::METCovMatrix sigcov = getMETCovMatrix(event, *input);
58  pfmet.setSignificanceMatrix(sigcov);
59  }
60 
61  std::auto_ptr<reco::PFMETCollection> pfmetcoll;
62  pfmetcoll.reset(new reco::PFMETCollection);
63 
64  pfmetcoll->push_back(pfmet);
65  event.put(pfmetcoll);
66  }
67 
68 
69 
71 
72  // leptons
73  std::vector< edm::Handle<reco::CandidateView> > leptons;
74  for ( std::vector<edm::EDGetTokenT<edm::View<reco::Candidate> > >::const_iterator srcLeptons_i = lepTokens_.begin();
75  srcLeptons_i != lepTokens_.end(); ++srcLeptons_i ) {
77  event.getByToken(*srcLeptons_i, leptons_i);
78  leptons.push_back( leptons_i );
79  /*
80  for ( reco::CandidateView::const_iterator lepton = leptons_i->begin();
81  lepton != leptons_i->end(); ++lepton ) {
82  leptons.push_back(*lepton);
83  }
84  */
85  }
86 
87  // jets
89  event.getByToken( jetToken_, inputJets );
90 
91  //Compute the covariance matrix and fill it
92  reco::METCovMatrix cov = metSigAlgo_->getCovariance( *inputJets, leptons, candInput);
93 
94  return cov;
95  }
96 
97 
98 
99 
100 
101 //____________________________________________________________________________||
103 }
104 
105 //____________________________________________________________________________||
T getParameter(std::string const &) const
dictionary specific
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void setSignificanceMatrix(const reco::METCovMatrix &matrix)
Definition: MET.cc:157
bool exists(std::string const &parameterName) const
checks if a parameter exists
PFMETProducer(const edm::ParameterSet &)
ROOT::Math::SMatrix< double, 2 > METCovMatrix
Definition: MET.h:40
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
Definition: PFMETProducer.h:79
static std::string const input
Definition: EdmProvDump.cc:43
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
tuple METSignificance
____________________________________________________________________________||
CommonMETData run(const edm::View< reco::Candidate > &candidates, double globalThreshold=0.0)
Definition: METAlgo.cc:16
double p4[4]
Definition: TauolaWrapper.h:92
virtual void produce(edm::Event &, const edm::EventSetup &) override
metsig::METSignificance * metSigAlgo_
Definition: PFMETProducer.h:74
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
Definition: PFMETProducer.h:80
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
MET made from Particle Flow Candidates.
SpecificPFMETData run(const edm::View< reco::Candidate > &pfCands)
reco::METCovMatrix getCovariance(const edm::View< reco::Jet > &jets, const std::vector< edm::Handle< reco::CandidateView > > &leptons, const edm::View< reco::Candidate > &pfCandidates)
T const * product() const
Definition: Handle.h:81
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
edm::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
Definition: PFMETProducer.h:71
reco::METCovMatrix getMETCovMatrix(const edm::Event &event, const edm::View< reco::Candidate > &input) const
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")