CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
cms::METProducer Class Reference

#include <METProducer.h>

Inheritance diagram for cms::METProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 METProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
virtual ~METProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void produce_CaloMET (edm::Event &event)
 
void produce_else (edm::Event &event)
 
void produce_GenMET (edm::Event &event)
 
void produce_PFClusterMET (edm::Event &event)
 
void produce_PFMET (edm::Event &event)
 
void produce_TCMET (edm::Event &event, const edm::EventSetup &setup)
 

Private Attributes

std::string alias
 
bool applyFiducialThresholdForFractions
 
bool calculateSignificance_
 
double globalThreshold
 
edm::InputTag inputLabel
 
edm::EDGetTokenT< edm::View
< reco::Candidate > > 
inputToken_
 
std::string inputType
 
edm::InputTag jetsLabel_
 
edm::EDGetTokenT< edm::View
< reco::PFJet > > 
jetToken_
 
std::string METtype
 
bool noHF
 
bool onlyFiducial
 
metsig::SignAlgoResolutionsresolutions_
 
TCMETAlgo tcMetAlgo_
 
bool usePt
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 46 of file METProducer.h.

Constructor & Destructor Documentation

METProducer::METProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 55 of file METProducer.cc.

References alias, applyFiducialThresholdForFractions, calculateSignificance_, TCMETAlgo::configure(), edm::EDConsumerBase::consumesCollector(), edm::ParameterSet::getParameter(), jetsLabel_, jetToken_, METtype, noHF, onlyFiducial, resolutions_, tcMetAlgo_, and usePt.

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"))
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  }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
Definition: METProducer.h:68
edm::InputTag inputLabel
Definition: METProducer.h:63
bool calculateSignificance_
Definition: METProducer.h:71
std::string alias
Definition: METProducer.h:66
edm::EDGetTokenT< edm::View< reco::PFJet > > jetToken_
Definition: METProducer.h:91
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
bool applyFiducialThresholdForFractions
Definition: METProducer.h:85
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::string inputType
Definition: METProducer.h:64
TCMETAlgo tcMetAlgo_
Definition: METProducer.h:94
double globalThreshold
Definition: METProducer.h:79
edm::InputTag jetsLabel_
Definition: METProducer.h:73
metsig::SignAlgoResolutions * resolutions_
Definition: METProducer.h:72
void configure(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iConsumesCollector)
Definition: TCMETAlgo.cc:65
std::string METtype
Definition: METProducer.h:65
virtual cms::METProducer::~METProducer ( )
inlinevirtual

Definition at line 50 of file METProducer.h.

50 { }

Member Function Documentation

void METProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 112 of file METProducer.cc.

References METtype, produce_CaloMET(), produce_else(), produce_GenMET(), produce_PFClusterMET(), produce_PFMET(), and produce_TCMET().

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  }
void produce_CaloMET(edm::Event &event)
Definition: METProducer.cc:147
void produce_else(edm::Event &event)
Definition: METProducer.cc:244
void produce_TCMET(edm::Event &event, const edm::EventSetup &setup)
Definition: METProducer.cc:172
void produce_GenMET(edm::Event &event)
Definition: METProducer.cc:230
void produce_PFClusterMET(edm::Event &event)
Definition: METProducer.cc:214
void produce_PFMET(edm::Event &event)
Definition: METProducer.cc:180
std::string METtype
Definition: METProducer.h:65
void METProducer::produce_CaloMET ( edm::Event event)
private

Definition at line 147 of file METProducer.cc.

References CaloSpecificAlgo::addInfo(), SignCaloSpecificAlgo::calculateBaseCaloMET(), calculateSignificance_, SignCaloSpecificAlgo::getSignificance(), SignCaloSpecificAlgo::getSignificanceMatrix(), globalThreshold, input, inputToken_, noHF, edm::Handle< T >::product(), resolutions_, METAlgo::run(), reco::CaloMET::SetMetSignificance(), and reco::MET::setSignificanceMatrix().

Referenced by produce().

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  }
edm::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
Definition: METProducer.h:68
bool calculateSignificance_
Definition: METProducer.h:71
static std::string const input
Definition: EdmProvDump.cc:44
CommonMETData run(const edm::View< reco::Candidate > &candidates, double globalThreshold=0.0)
Definition: METAlgo.cc:16
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
void setSignificanceMatrix(const TMatrixD &matrix)
Definition: MET.cc:185
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
TMatrixD getSignificanceMatrix() const
double globalThreshold
Definition: METProducer.h:79
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
metsig::SignAlgoResolutions * resolutions_
Definition: METProducer.h:72
void SetMetSignificance(double metsig)
Definition: CaloMET.h:76
void METProducer::produce_else ( edm::Event event)
private

Definition at line 244 of file METProducer.cc.

References globalThreshold, input, inputToken_, CaloMET_cfi::met, CommonMETData::met, CommonMETData::mex, CommonMETData::mey, p4, edm::Handle< T >::product(), METAlgo::run(), and CommonMETData::sumet.

Referenced by produce().

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  }
tuple met
____________________________________________________________________________||
Definition: CaloMET_cfi.py:7
edm::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
Definition: METProducer.h:68
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:23
static std::string const input
Definition: EdmProvDump.cc:44
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
CommonMETData run(const edm::View< reco::Candidate > &candidates, double globalThreshold=0.0)
Definition: METAlgo.cc:16
Definition: MET.h:32
double p4[4]
Definition: TauolaWrapper.h:92
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
double globalThreshold
Definition: METProducer.h:79
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
T const * product() const
Definition: Handle.h:81
void METProducer::produce_GenMET ( edm::Event event)
private

Definition at line 230 of file METProducer.cc.

References GenSpecificAlgo::addInfo(), applyFiducialThresholdForFractions, relval_steps::gen(), globalThreshold, input, inputToken_, onlyFiducial, and usePt.

Referenced by produce().

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  }
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::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
Definition: METProducer.h:68
std::vector< reco::GenMET > GenMETCollection
collection of GenMET objects
static std::string const input
Definition: EdmProvDump.cc:44
bool applyFiducialThresholdForFractions
Definition: METProducer.h:85
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
double globalThreshold
Definition: METProducer.h:79
void METProducer::produce_PFClusterMET ( edm::Event event)
private

Definition at line 214 of file METProducer.cc.

References PFClusterSpecificAlgo::addInfo(), globalThreshold, input, inputToken_, edm::Handle< T >::product(), and METAlgo::run().

Referenced by produce().

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  }
edm::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
Definition: METProducer.h:68
reco::PFClusterMET addInfo(edm::Handle< edm::View< reco::Candidate > > PFClusterCandidates, const CommonMETData &met)
static std::string const input
Definition: EdmProvDump.cc:44
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
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
double globalThreshold
Definition: METProducer.h:79
T const * product() const
Definition: Handle.h:81
void METProducer::produce_PFMET ( edm::Event event)
private

Definition at line 180 of file METProducer.cc.

References metsig::SignPFSpecificAlgo::addPFJets(), calculateSignificance_, globalThreshold, input, inputToken_, fwrapper::jets, jetToken_, CommonMETData::met, CommonMETData::mex, CommonMETData::mey, metsig::SignPFSpecificAlgo::mkSignifMatrix(), p4, edm::Handle< T >::product(), resolutions_, PFSpecificAlgo::run(), METAlgo::run(), metsig::SignPFSpecificAlgo::setResolutions(), reco::MET::setSignificanceMatrix(), timingPdfMaker::specific, and CommonMETData::sumet.

Referenced by produce().

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  }
dictionary specific
edm::EDGetTokenT< edm::View< reco::Candidate > > inputToken_
Definition: METProducer.h:68
bool calculateSignificance_
Definition: METProducer.h:71
edm::EDGetTokenT< edm::View< reco::PFJet > > jetToken_
Definition: METProducer.h:91
static std::string const input
Definition: EdmProvDump.cc:44
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
CommonMETData run(const edm::View< reco::Candidate > &candidates, double globalThreshold=0.0)
Definition: METAlgo.cc:16
void addPFJets(const edm::View< reco::PFJet > *PFJets)
void setResolutions(metsig::SignAlgoResolutions *resolutions)
double p4[4]
Definition: TauolaWrapper.h:92
vector< PseudoJet > jets
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
MET made from Particle Flow Candidates.
SpecificPFMETData run(const edm::View< reco::Candidate > &pfCands)
double globalThreshold
Definition: METProducer.h:79
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
T const * product() const
Definition: Handle.h:81
metsig::SignAlgoResolutions * resolutions_
Definition: METProducer.h:72
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
TMatrixD mkSignifMatrix(edm::Handle< edm::View< reco::Candidate > > &PFCandidates)
void METProducer::produce_TCMET ( edm::Event event,
const edm::EventSetup setup 
)
private

Definition at line 172 of file METProducer.cc.

References TCMETAlgo::CalculateTCMET(), and tcMetAlgo_.

Referenced by produce().

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  }
reco::MET CalculateTCMET(edm::Event &event, const edm::EventSetup &setup)
Definition: TCMETAlgo.cc:172
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:23
TCMETAlgo tcMetAlgo_
Definition: METProducer.h:94

Member Data Documentation

std::string cms::METProducer::alias
private

Definition at line 66 of file METProducer.h.

Referenced by METProducer().

bool cms::METProducer::applyFiducialThresholdForFractions
private

Definition at line 85 of file METProducer.h.

Referenced by METProducer(), and produce_GenMET().

bool cms::METProducer::calculateSignificance_
private

Definition at line 71 of file METProducer.h.

Referenced by METProducer(), produce_CaloMET(), and produce_PFMET().

double cms::METProducer::globalThreshold
private
edm::InputTag cms::METProducer::inputLabel
private

Definition at line 63 of file METProducer.h.

edm::EDGetTokenT<edm::View<reco::Candidate> > cms::METProducer::inputToken_
private
std::string cms::METProducer::inputType
private

Definition at line 64 of file METProducer.h.

edm::InputTag cms::METProducer::jetsLabel_
private

Definition at line 73 of file METProducer.h.

Referenced by METProducer().

edm::EDGetTokenT<edm::View<reco::PFJet> > cms::METProducer::jetToken_
private

Definition at line 91 of file METProducer.h.

Referenced by METProducer(), and produce_PFMET().

std::string cms::METProducer::METtype
private

Definition at line 65 of file METProducer.h.

Referenced by METProducer(), and produce().

bool cms::METProducer::noHF
private

Definition at line 76 of file METProducer.h.

Referenced by METProducer(), and produce_CaloMET().

bool cms::METProducer::onlyFiducial
private

Definition at line 82 of file METProducer.h.

Referenced by METProducer(), and produce_GenMET().

metsig::SignAlgoResolutions* cms::METProducer::resolutions_
private

Definition at line 72 of file METProducer.h.

Referenced by METProducer(), produce_CaloMET(), and produce_PFMET().

TCMETAlgo cms::METProducer::tcMetAlgo_
private

Definition at line 94 of file METProducer.h.

Referenced by METProducer(), and produce_TCMET().

bool cms::METProducer::usePt
private

Definition at line 88 of file METProducer.h.

Referenced by METProducer(), and produce_GenMET().