CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
METProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: METProducers
4 // Class: METProducer
5 //
6 // Original Author: Rick Cavanaugh
7 // Created: April 4, 2006
8 //
9 //
10 
11 //____________________________________________________________________________||
12 // Modification by R. Remington on 10/21/08
13 // Added globalThreshold input Parameter to impose on each tower in tower collection
14 // that is looped over by the CaloSpecificAlgo. This is in order to fulfill Scheme B threhsolds...
15 // Modified: 12.13.2008 by R.Cavanaugh, UIC/Fermilab
16 // Description: include Particle Flow MET
17 // Modified: 12.12.2008 by R. Remington, UFL
18 // Description: include TCMET , move alg_.run() inside of relevant if-statements, and add METSignficance algorithm to METtype="CaloMET" cases
19 
20 //____________________________________________________________________________||
22 
27 
39 
49 
50 #include <memory>
51 
52 //____________________________________________________________________________||
53 namespace cms
54 {
56  : inputLabel(iConfig.getParameter<edm::InputTag>("src"))
57  , inputType(iConfig.getParameter<std::string>("InputType"))
58  , METtype(iConfig.getParameter<std::string>("METType"))
59  , alias(iConfig.getParameter<std::string>("alias"))
60  , inputToken_(consumes<edm::View<reco::Candidate> >(inputLabel))
61  , calculateSignificance_(false)
62  , resolutions_(0)
63  , globalThreshold(iConfig.getParameter<double>("globalThreshold"))
64  {
65 
66 
67  if( METtype == "CaloMET" )
68  {
69  noHF = iConfig.getParameter<bool>("noHF");
70  produces<reco::CaloMETCollection>().setBranchAlias(alias.c_str());
71  calculateSignificance_ = iConfig.getParameter<bool>("calculateSignificance");
72  }
73  else if( METtype == "GenMET" )
74  {
75  onlyFiducial = iConfig.getParameter<bool>("onlyFiducialParticles");
76  usePt = iConfig.getParameter<bool>("usePt");
77  applyFiducialThresholdForFractions = iConfig.getParameter<bool>("applyFiducialThresholdForFractions");
78  produces<reco::GenMETCollection>().setBranchAlias(alias.c_str());
79  }
80  else if( METtype == "PFMET" )
81  {
82  produces<reco::PFMETCollection>().setBranchAlias(alias.c_str());
83 
84  calculateSignificance_ = iConfig.getParameter<bool>("calculateSignificance");
85 
86  if(calculateSignificance_)
87  {
88  jetsLabel_ = iConfig.getParameter<edm::InputTag>("jets");
89  jetToken_ = consumes<edm::View<reco::PFJet> >(iConfig.getParameter<edm::InputTag>("jets"));
90  }
91 
92  }
93  else if( METtype == "PFClusterMET" )
94  {
95  produces<reco::PFClusterMETCollection>().setBranchAlias(alias.c_str());
96  }
97  else if (METtype == "TCMET" )
98  {
99  produces<reco::METCollection>().setBranchAlias(alias.c_str());
101  }
102  else
103  produces<reco::METCollection>().setBranchAlias(alias.c_str());
104 
105  if (calculateSignificance_ && ( METtype == "CaloMET" || METtype == "PFMET"))
106  {
108  }
109  }
110 
111 
113  {
114  if( METtype == "CaloMET" )
115  {
116  produce_CaloMET(event);
117  return;
118  }
119 
120  if( METtype == "TCMET" )
121  {
122  produce_TCMET(event, setup);
123  return;
124  }
125 
126  if( METtype == "PFMET" )
127  {
128  produce_PFMET(event);
129  return;
130  }
131 
132  if( METtype == "PFClusterMET" )
133  {
134  produce_PFClusterMET(event);
135  return;
136  }
137 
138  if( METtype == "GenMET" )
139  {
140  produce_GenMET(event);
141  return;
142  }
143 
144  produce_else(event);
145  }
146 
148  {
150  event.getByToken(inputToken_, input);
151 
152  METAlgo algo;
153  CommonMETData commonMETdata = algo.run(*input.product(), globalThreshold);
154 
155  CaloSpecificAlgo calospecalgo;
156  reco::CaloMET calomet = calospecalgo.addInfo(input, commonMETdata, noHF, globalThreshold);
157 
159  {
160  SignCaloSpecificAlgo signcalospecalgo;
161  signcalospecalgo.calculateBaseCaloMET(input, commonMETdata, *resolutions_, noHF, globalThreshold);
162  calomet.SetMetSignificance(signcalospecalgo.getSignificance() );
163  calomet.setSignificanceMatrix(signcalospecalgo.getSignificanceMatrix());
164  }
165 
166  std::auto_ptr<reco::CaloMETCollection> calometcoll;
167  calometcoll.reset(new reco::CaloMETCollection);
168  calometcoll->push_back( calomet ) ;
169  event.put( calometcoll );
170  }
171 
173  {
174  std::auto_ptr<reco::METCollection> tcmetcoll;
175  tcmetcoll.reset(new reco::METCollection);
176  tcmetcoll->push_back( tcMetAlgo_.CalculateTCMET(event, setup ) ) ;
177  event.put( tcmetcoll );
178  }
179 
181  {
183  event.getByToken(inputToken_, input);
184 
185  METAlgo algo;
186  CommonMETData commonMETdata = algo.run(*input.product(), globalThreshold);
187 
188  const math::XYZTLorentzVector p4(commonMETdata.mex, commonMETdata.mey, 0.0, commonMETdata.met);
189  const math::XYZPoint vtx(0.0, 0.0, 0.0);
190 
191  PFSpecificAlgo pf;
192  SpecificPFMETData specific = pf.run(*input.product());
193 
194  reco::PFMET pfmet(specific, commonMETdata.sumet, p4, vtx);
195 
197  {
198  metsig::SignPFSpecificAlgo pfsignalgo;
199  pfsignalgo.setResolutions(resolutions_);
200 
202  event.getByToken(jetToken_, jets);
203  pfsignalgo.addPFJets(jets.product());
204  pfmet.setSignificanceMatrix(pfsignalgo.mkSignifMatrix(input));
205  }
206 
207  std::auto_ptr<reco::PFMETCollection> pfmetcoll;
208  pfmetcoll.reset(new reco::PFMETCollection);
209 
210  pfmetcoll->push_back(pfmet);
211  event.put(pfmetcoll);
212  }
213 
215  {
217  event.getByToken(inputToken_, input);
218 
219  METAlgo algo;
220  CommonMETData commonMETdata = algo.run(*input.product(), globalThreshold);
221 
222  PFClusterSpecificAlgo pfcluster;
223  std::auto_ptr<reco::PFClusterMETCollection> pfclustermetcoll;
224  pfclustermetcoll.reset (new reco::PFClusterMETCollection);
225 
226  pfclustermetcoll->push_back( pfcluster.addInfo(input, commonMETdata) );
227  event.put( pfclustermetcoll );
228  }
229 
231  {
233  event.getByToken(inputToken_, input);
234 
235  CommonMETData commonMETdata;
236 
238  std::auto_ptr<reco::GenMETCollection> genmetcoll;
239  genmetcoll.reset (new reco::GenMETCollection);
240  genmetcoll->push_back( gen.addInfo(input, &commonMETdata, globalThreshold, onlyFiducial,applyFiducialThresholdForFractions, usePt) );
241  event.put( genmetcoll );
242  }
243 
245  {
247  event.getByToken(inputToken_, input);
248 
249  METAlgo algo;
250  CommonMETData commonMETdata = algo.run(*input.product(), globalThreshold);
251 
252  math::XYZTLorentzVector p4( commonMETdata.mex, commonMETdata.mey, 0.0, commonMETdata.met);
253  math::XYZPoint vtx(0,0,0);
254  reco::MET met( commonMETdata.sumet, p4, vtx );
255  std::auto_ptr<reco::METCollection> metcoll;
256  metcoll.reset(new reco::METCollection);
257  metcoll->push_back( met );
258  event.put( metcoll );
259  }
260 
261 }
T getParameter(std::string const &) const
dictionary specific
void produce_CaloMET(edm::Event &event)
Definition: METProducer.cc:147
reco::MET CalculateTCMET(edm::Event &event, const edm::EventSetup &setup)
Definition: TCMETAlgo.cc:172
reco::GenMET addInfo(edm::Handle< edm::View< reco::Candidate > > particles, CommonMETData *met, double globalThreshold=0, bool onlyFiducial=false, bool applyFiducialThresholdForFractions=false, bool usePt=false)
tuple met
____________________________________________________________________________||
Definition: CaloMET_cfi.py:7
edm::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
Definition: METProducer.h:68
bool calculateSignificance_
Definition: METProducer.h:71
std::vector< reco::GenMET > GenMETCollection
collection of GenMET objects
std::string alias
Definition: METProducer.h:66
void produce_else(edm::Event &event)
Definition: METProducer.cc:244
void produce_TCMET(edm::Event &event, const edm::EventSetup &setup)
Definition: METProducer.cc:172
edm::EDGetTokenT< edm::View< reco::PFJet > > jetToken_
Definition: METProducer.h:91
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:23
reco::PFClusterMET addInfo(edm::Handle< edm::View< reco::Candidate > > PFClusterCandidates, const CommonMETData &met)
static std::string const input
Definition: EdmProvDump.cc:44
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
std::vector< reco::PFClusterMET > PFClusterMETCollection
collection of PFClusterMET objects
CommonMETData run(const edm::View< reco::Candidate > &candidates, double globalThreshold=0.0)
Definition: METAlgo.cc:16
Definition: MET.h:32
bool applyFiducialThresholdForFractions
Definition: METProducer.h:85
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void addPFJets(const edm::View< reco::PFJet > *PFJets)
void setResolutions(metsig::SignAlgoResolutions *resolutions)
double p4[4]
Definition: TauolaWrapper.h:92
vector< PseudoJet > jets
void produce_GenMET(edm::Event &event)
Definition: METProducer.cc:230
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
void setSignificanceMatrix(const TMatrixD &matrix)
Definition: MET.cc:185
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.
TCMETAlgo tcMetAlgo_
Definition: METProducer.h:94
SpecificPFMETData run(const edm::View< reco::Candidate > &pfCands)
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
TMatrixD getSignificanceMatrix() const
double globalThreshold
Definition: METProducer.h:79
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
reco::CaloMET addInfo(edm::Handle< edm::View< reco::Candidate > > towers, const CommonMETData &met, bool noHF, double globalThreshold)
void calculateBaseCaloMET(edm::Handle< edm::View< reco::Candidate > > towers, const CommonMETData &met, const metsig::SignAlgoResolutions &resolutions, bool noHF, double globalthreshold)
T const * product() const
Definition: Handle.h:81
edm::InputTag jetsLabel_
Definition: METProducer.h:73
void produce_PFClusterMET(edm::Event &event)
Definition: METProducer.cc:214
metsig::SignAlgoResolutions * resolutions_
Definition: METProducer.h:72
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
void produce_PFMET(edm::Event &event)
Definition: METProducer.cc:180
void configure(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iConsumesCollector)
Definition: TCMETAlgo.cc:65
volatile std::atomic< bool > shutdown_flag false
METProducer(const edm::ParameterSet &)
Definition: METProducer.cc:55
std::string METtype
Definition: METProducer.h:65
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void SetMetSignificance(double metsig)
Definition: CaloMET.h:76
virtual void produce(edm::Event &, const edm::EventSetup &) override
Definition: METProducer.cc:112
TMatrixD mkSignifMatrix(edm::Handle< edm::View< reco::Candidate > > &PFCandidates)