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 // $Id: METProducer.cc,v 1.53 2013/05/07 13:16:16 salee Exp $
9 //
10 //
11 
12 //____________________________________________________________________________||
13 // Modification by R. Remington on 10/21/08
14 // Added globalThreshold input Parameter to impose on each tower in tower collection
15 // that is looped over by the CaloSpecificAlgo. This is in order to fulfill Scheme B threhsolds...
16 // Modified: 12.13.2008 by R.Cavanaugh, UIC/Fermilab
17 // Description: include Particle Flow MET
18 // Modified: 12.12.2008 by R. Remington, UFL
19 // Description: include TCMET , move alg_.run() inside of relevant if-statements, and add METSignficance algorithm to METtype="CaloMET" cases
20 
21 //____________________________________________________________________________||
23 
27 
40 
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  , calculateSignificance_(false)
61  , resolutions_(0)
62  , globalThreshold(iConfig.getParameter<double>("globalThreshold"))
63  {
64  if( METtype == "CaloMET" )
65  {
66  noHF = iConfig.getParameter<bool>("noHF");
67  produces<reco::CaloMETCollection>().setBranchAlias(alias.c_str());
68  calculateSignificance_ = iConfig.getParameter<bool>("calculateSignificance");
69  }
70  else if( METtype == "GenMET" )
71  {
72  onlyFiducial = iConfig.getParameter<bool>("onlyFiducialParticles");
73  usePt = iConfig.getParameter<bool>("usePt");
74  applyFiducialThresholdForFractions = iConfig.getParameter<bool>("applyFiducialThresholdForFractions");
75  produces<reco::GenMETCollection>().setBranchAlias(alias.c_str());
76  }
77  else if( METtype == "PFMET" )
78  {
79  produces<reco::PFMETCollection>().setBranchAlias(alias.c_str());
80 
81  calculateSignificance_ = iConfig.getParameter<bool>("calculateSignificance");
82 
83  if(calculateSignificance_)
84  {
85  jetsLabel_ = iConfig.getParameter<edm::InputTag>("jets");
86  }
87 
88  }
89  else if( METtype == "PFClusterMET" )
90  {
91  produces<reco::PFClusterMETCollection>().setBranchAlias(alias.c_str());
92  }
93  else if (METtype == "TCMET" )
94  {
95  produces<reco::METCollection>().setBranchAlias(alias.c_str());
96 
97  int rfType_ = iConfig.getParameter<int>("rf_type");
98  bool correctShowerTracks_ = iConfig.getParameter<bool>("correctShowerTracks");
99 
100  int responseFunctionType = 0;
101  if(! correctShowerTracks_)
102  {
103  if( rfType_ == 1 ) responseFunctionType = 1; // 'fit'
104  else if( rfType_ == 2 ) responseFunctionType = 2; // 'mode'
105  else { /* probably error */ }
106  }
107  tcMetAlgo_.configure(iConfig, responseFunctionType );
108  }
109  else
110  produces<reco::METCollection>().setBranchAlias(alias.c_str());
111 
112  if (calculateSignificance_ && ( METtype == "CaloMET" || METtype == "PFMET")){
114 
115  }
116  }
117 
118 
120  {
121  if( METtype == "CaloMET" )
122  {
123  produce_CaloMET(event);
124  return;
125  }
126 
127  if( METtype == "TCMET" )
128  {
129  produce_TCMET(event, setup);
130  return;
131  }
132 
133  if( METtype == "PFMET" )
134  {
135  produce_PFMET(event);
136  return;
137  }
138 
139  if( METtype == "PFClusterMET" )
140  {
141  produce_PFClusterMET(event);
142  return;
143  }
144 
145  if( METtype == "GenMET" )
146  {
147  produce_GenMET(event);
148  return;
149  }
150 
151  produce_else(event);
152  }
153 
155  {
157  event.getByLabel(inputLabel, input);
158 
159  METAlgo algo;
160  CommonMETData commonMETdata = algo.run(input, globalThreshold);
161 
162  CaloSpecificAlgo calospecalgo;
163  reco::CaloMET calomet = calospecalgo.addInfo(input, commonMETdata, noHF, globalThreshold);
164 
166  {
167  SignCaloSpecificAlgo signcalospecalgo;
168  signcalospecalgo.calculateBaseCaloMET(input, commonMETdata, *resolutions_, noHF, globalThreshold);
169  calomet.SetMetSignificance(signcalospecalgo.getSignificance() );
170  calomet.setSignificanceMatrix(signcalospecalgo.getSignificanceMatrix());
171  }
172 
173  std::auto_ptr<reco::CaloMETCollection> calometcoll;
174  calometcoll.reset(new reco::CaloMETCollection);
175  calometcoll->push_back( calomet ) ;
176  event.put( calometcoll );
177  }
178 
180  {
181  std::auto_ptr<reco::METCollection> tcmetcoll;
182  tcmetcoll.reset(new reco::METCollection);
183  tcmetcoll->push_back( tcMetAlgo_.CalculateTCMET(event, setup ) ) ;
184  event.put( tcmetcoll );
185  }
186 
188  {
190  event.getByLabel(inputLabel, input);
191 
192  METAlgo algo;
193  CommonMETData commonMETdata = algo.run(input, globalThreshold);
194 
195  PFSpecificAlgo pf;
196 
198  {
200  event.getByLabel(jetsLabel_, jets);
201  pf.runSignificance(*resolutions_, jets);
202  }
203 
204  std::auto_ptr<reco::PFMETCollection> pfmetcoll;
205  pfmetcoll.reset(new reco::PFMETCollection);
206  pfmetcoll->push_back( pf.addInfo(input, commonMETdata) );
207  event.put( pfmetcoll );
208  }
209 
211  {
213  event.getByLabel(inputLabel, input);
214 
215  METAlgo algo;
216  CommonMETData commonMETdata = algo.run(input, globalThreshold);
217 
218  PFClusterSpecificAlgo pfcluster;
219  std::auto_ptr<reco::PFClusterMETCollection> pfclustermetcoll;
220  pfclustermetcoll.reset (new reco::PFClusterMETCollection);
221 
222  pfclustermetcoll->push_back( pfcluster.addInfo(input, commonMETdata) );
223  event.put( pfclustermetcoll );
224  }
225 
227  {
229  event.getByLabel(inputLabel, input);
230 
231  CommonMETData commonMETdata;
232 
234  std::auto_ptr<reco::GenMETCollection> genmetcoll;
235  genmetcoll.reset (new reco::GenMETCollection);
236  genmetcoll->push_back( gen.addInfo(input, &commonMETdata, globalThreshold, onlyFiducial,applyFiducialThresholdForFractions, usePt) );
237  event.put( genmetcoll );
238  }
239 
241  {
243  event.getByLabel(inputLabel, input);
244 
245  CommonMETData commonMETdata;
246 
247  METAlgo algo;
248  algo.run(input, &commonMETdata, globalThreshold);
249 
250  math::XYZTLorentzVector p4( commonMETdata.mex, commonMETdata.mey, 0.0, commonMETdata.met);
251  math::XYZPoint vtx(0,0,0);
252  reco::MET met( commonMETdata.sumet, p4, vtx );
253  std::auto_ptr<reco::METCollection> metcoll;
254  metcoll.reset(new reco::METCollection);
255  metcoll->push_back( met );
256  event.put( metcoll );
257  }
258 
259 }
T getParameter(std::string const &) const
virtual CommonMETData run(edm::Handle< edm::View< reco::Candidate > > candidates, double globalThreshold=0.0)
Definition: METAlgo.cc:16
void produce_CaloMET(edm::Event &event)
Definition: METProducer.cc:154
reco::MET CalculateTCMET(edm::Event &event, const edm::EventSetup &setup)
Definition: TCMETAlgo.cc:161
reco::GenMET addInfo(edm::Handle< edm::View< reco::Candidate > > particles, CommonMETData *met, double globalThreshold=0, bool onlyFiducial=false, bool applyFiducialThresholdForFractions=false, bool usePt=false)
edm::InputTag inputLabel
Definition: METProducer.h:59
bool calculateSignificance_
Definition: METProducer.h:65
reco::PFClusterMET addInfo(edm::Handle< edm::View< reco::Candidate > > PFClusterCandidates, CommonMETData met)
std::vector< reco::GenMET > GenMETCollection
collection of GenMET objects
std::string alias
Definition: METProducer.h:62
void produce_else(edm::Event &event)
Definition: METProducer.cc:240
void produce_TCMET(edm::Event &event, const edm::EventSetup &setup)
Definition: METProducer.cc:179
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:23
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
std::vector< reco::PFClusterMET > PFClusterMETCollection
collection of PFClusterMET objects
Definition: MET.h:32
bool applyFiducialThresholdForFractions
Definition: METProducer.h:79
double p4[4]
Definition: TauolaWrapper.h:92
void calculateBaseCaloMET(edm::Handle< edm::View< reco::Candidate > > towers, CommonMETData met, const metsig::SignAlgoResolutions &resolutions, bool noHF, double globalthreshold)
vector< PseudoJet > jets
void produce_GenMET(edm::Event &event)
Definition: METProducer.cc:226
Structure containing data common to all types of MET.
Definition: CommonMETData.h:22
void setSignificanceMatrix(const TMatrixD &matrix)
Definition: MET.cc:185
void configure(const edm::ParameterSet &iConfig, int myResponseFunctionType)
Definition: TCMETAlgo.cc:65
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
TCMETAlgo tcMetAlgo_
Definition: METProducer.h:84
reco::CaloMET addInfo(edm::Handle< edm::View< reco::Candidate > > towers, CommonMETData met, bool noHF, double globalThreshold)
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
TMatrixD getSignificanceMatrix() const
double globalThreshold
Definition: METProducer.h:73
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
edm::InputTag jetsLabel_
Definition: METProducer.h:67
void produce_PFClusterMET(edm::Event &event)
Definition: METProducer.cc:210
metsig::SignAlgoResolutions * resolutions_
Definition: METProducer.h:66
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
void produce_PFMET(edm::Event &event)
Definition: METProducer.cc:187
reco::PFMET addInfo(edm::Handle< edm::View< reco::Candidate > > PFCandidates, CommonMETData met)
void runSignificance(metsig::SignAlgoResolutions &resolutions, edm::Handle< edm::View< reco::PFJet > > jets)
METProducer(const edm::ParameterSet &)
Definition: METProducer.cc:55
std::string METtype
Definition: METProducer.h:61
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:119