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  jetSFType_ = iConfig.getParameter<std::string>("srcJetSF");
32  jetResPtType_ = iConfig.getParameter<std::string>("srcJetResPt");
33  jetResPhiType_ = iConfig.getParameter<std::string>("srcJetResPhi");
34  rhoToken_ = consumes<double>(iConfig.getParameter<edm::InputTag>("srcRho"));
35  }
36 
37  std::string alias = iConfig.exists("alias") ? iConfig.getParameter<std::string>("alias") : "";
38 
39  produces<reco::PFMETCollection>().setBranchAlias(alias);
40  }
41 
42 //____________________________________________________________________________||
44  {
46  event.getByToken(inputToken_, input);
47 
48  METAlgo algo;
49  CommonMETData commonMETdata = algo.run(*input.product(), globalThreshold_);
50 
51  const math::XYZTLorentzVector p4(commonMETdata.mex, commonMETdata.mey, 0.0, commonMETdata.met);
52  const math::XYZPoint vtx(0.0, 0.0, 0.0);
53 
54  PFSpecificAlgo pf;
55  SpecificPFMETData specific = pf.run(*input.product());
56 
57  reco::PFMET pfmet(specific, commonMETdata.sumet, p4, vtx);
58 
60  {
61  reco::METCovMatrix sigcov = getMETCovMatrix(event, setup, *input);
62  pfmet.setSignificanceMatrix(sigcov);
63  }
64 
65  std::auto_ptr<reco::PFMETCollection> pfmetcoll;
66  pfmetcoll.reset(new reco::PFMETCollection);
67 
68  pfmetcoll->push_back(pfmet);
69  event.put(pfmetcoll);
70  }
71 
72 
73 
75 
76  // leptons
77  std::vector< edm::Handle<reco::CandidateView> > leptons;
78  for ( std::vector<edm::EDGetTokenT<edm::View<reco::Candidate> > >::const_iterator srcLeptons_i = lepTokens_.begin();
79  srcLeptons_i != lepTokens_.end(); ++srcLeptons_i ) {
81  event.getByToken(*srcLeptons_i, leptons_i);
82  leptons.push_back( leptons_i );
83  /*
84  for ( reco::CandidateView::const_iterator lepton = leptons_i->begin();
85  lepton != leptons_i->end(); ++lepton ) {
86  leptons.push_back(*lepton);
87  }
88  */
89  }
90 
91  // jets
93  event.getByToken( jetToken_, inputJets );
94 
98 
100  event.getByToken(rhoToken_, rho);
101 
102  //Compute the covariance matrix and fill it
103  reco::METCovMatrix cov = metSigAlgo_->getCovariance( *inputJets, leptons, candInput, *rho, resPtObj, resPhiObj, resSFObj, event.isRealData() );
104 
105  return cov;
106  }
107 
108 
109 
110 
111 
112 //____________________________________________________________________________||
114 }
115 
116 //____________________________________________________________________________||
T getParameter(std::string const &) const
dictionary specific
static const JetResolution get(const edm::EventSetup &, const std::string &)
#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
std::string jetResPtType_
Definition: PFMETProducer.h:84
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
Definition: PFMETProducer.h:81
bool isRealData() const
Definition: EventBase.h:63
reco::METCovMatrix getMETCovMatrix(const edm::Event &event, const edm::EventSetup &, const edm::View< reco::Candidate > &input) const
static std::string const input
Definition: EdmProvDump.cc:44
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:76
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
std::string jetSFType_
Definition: PFMETProducer.h:83
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > lepTokens_
Definition: PFMETProducer.h:82
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)
std::string jetResPhiType_
Definition: PFMETProducer.h:85
T const * product() const
Definition: Handle.h:81
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
static const JetResolutionScaleFactor get(const edm::EventSetup &, const std::string &)
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
edm::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
Definition: PFMETProducer.h:73
edm::EDGetTokenT< double > rhoToken_
Definition: PFMETProducer.h:86
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
reco::METCovMatrix getCovariance(const edm::View< reco::Jet > &jets, const std::vector< edm::Handle< reco::CandidateView > > &leptons, const edm::View< reco::Candidate > &pfCandidates, double rho, JME::JetResolution &resPtObj, JME::JetResolution &resPhiObj, JME::JetResolutionScaleFactor &resSFObj, bool isRealData)