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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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
 
std::string inputType
 
edm::InputTag jetsLabel_
 
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
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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 42 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::ParameterSet::getParameter(), jetsLabel_, 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"))
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  }
T getParameter(std::string const &) const
edm::InputTag inputLabel
Definition: METProducer.h:59
bool calculateSignificance_
Definition: METProducer.h:65
std::string alias
Definition: METProducer.h:62
bool applyFiducialThresholdForFractions
Definition: METProducer.h:79
std::string inputType
Definition: METProducer.h:60
void configure(const edm::ParameterSet &iConfig, int myResponseFunctionType)
Definition: TCMETAlgo.cc:65
TCMETAlgo tcMetAlgo_
Definition: METProducer.h:84
double globalThreshold
Definition: METProducer.h:73
edm::InputTag jetsLabel_
Definition: METProducer.h:67
metsig::SignAlgoResolutions * resolutions_
Definition: METProducer.h:66
std::string METtype
Definition: METProducer.h:61
virtual cms::METProducer::~METProducer ( )
inlinevirtual

Definition at line 46 of file METProducer.h.

46 { }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 119 of file METProducer.cc.

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

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  }
void produce_CaloMET(edm::Event &event)
Definition: METProducer.cc:154
void produce_else(edm::Event &event)
Definition: METProducer.cc:240
void produce_TCMET(edm::Event &event, const edm::EventSetup &setup)
Definition: METProducer.cc:179
void produce_GenMET(edm::Event &event)
Definition: METProducer.cc:226
void produce_PFClusterMET(edm::Event &event)
Definition: METProducer.cc:210
void produce_PFMET(edm::Event &event)
Definition: METProducer.cc:187
std::string METtype
Definition: METProducer.h:61
void METProducer::produce_CaloMET ( edm::Event event)
private

Definition at line 154 of file METProducer.cc.

References CaloSpecificAlgo::addInfo(), SignCaloSpecificAlgo::calculateBaseCaloMET(), calculateSignificance_, SignCaloSpecificAlgo::getSignificance(), SignCaloSpecificAlgo::getSignificanceMatrix(), globalThreshold, LaserDQM_cfg::input, inputLabel, noHF, resolutions_, METAlgo::run(), reco::CaloMET::SetMetSignificance(), and reco::MET::setSignificanceMatrix().

Referenced by produce().

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  }
virtual CommonMETData run(edm::Handle< edm::View< reco::Candidate > > candidates, double globalThreshold=0.0)
Definition: METAlgo.cc:16
edm::InputTag inputLabel
Definition: METProducer.h:59
bool calculateSignificance_
Definition: METProducer.h:65
void calculateBaseCaloMET(edm::Handle< edm::View< reco::Candidate > > towers, CommonMETData met, const metsig::SignAlgoResolutions &resolutions, bool noHF, double globalthreshold)
Structure containing data common to all types of MET.
Definition: CommonMETData.h:22
void setSignificanceMatrix(const TMatrixD &matrix)
Definition: MET.cc:185
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
metsig::SignAlgoResolutions * resolutions_
Definition: METProducer.h:66
void SetMetSignificance(double metsig)
Definition: CaloMET.h:76
void METProducer::produce_else ( edm::Event event)
private

Definition at line 240 of file METProducer.cc.

References globalThreshold, LaserDQM_cfg::input, inputLabel, CaloMET_cfi::met, CommonMETData::met, CommonMETData::mex, CommonMETData::mey, p4, METAlgo::run(), and CommonMETData::sumet.

Referenced by produce().

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  }
virtual CommonMETData run(edm::Handle< edm::View< reco::Candidate > > candidates, double globalThreshold=0.0)
Definition: METAlgo.cc:16
edm::InputTag inputLabel
Definition: METProducer.h:59
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
Definition: MET.h:32
double p4[4]
Definition: TauolaWrapper.h:92
Structure containing data common to all types of MET.
Definition: CommonMETData.h:22
double globalThreshold
Definition: METProducer.h:73
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
void METProducer::produce_GenMET ( edm::Event event)
private

Definition at line 226 of file METProducer.cc.

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

Referenced by produce().

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  }
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
std::vector< reco::GenMET > GenMETCollection
collection of GenMET objects
bool applyFiducialThresholdForFractions
Definition: METProducer.h:79
Structure containing data common to all types of MET.
Definition: CommonMETData.h:22
double globalThreshold
Definition: METProducer.h:73
void METProducer::produce_PFClusterMET ( edm::Event event)
private

Definition at line 210 of file METProducer.cc.

References PFClusterSpecificAlgo::addInfo(), globalThreshold, LaserDQM_cfg::input, inputLabel, and METAlgo::run().

Referenced by produce().

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  }
virtual CommonMETData run(edm::Handle< edm::View< reco::Candidate > > candidates, double globalThreshold=0.0)
Definition: METAlgo.cc:16
edm::InputTag inputLabel
Definition: METProducer.h:59
reco::PFClusterMET addInfo(edm::Handle< edm::View< reco::Candidate > > PFClusterCandidates, CommonMETData met)
std::vector< reco::PFClusterMET > PFClusterMETCollection
collection of PFClusterMET objects
Structure containing data common to all types of MET.
Definition: CommonMETData.h:22
double globalThreshold
Definition: METProducer.h:73
void METProducer::produce_PFMET ( edm::Event event)
private

Definition at line 187 of file METProducer.cc.

References PFSpecificAlgo::addInfo(), calculateSignificance_, globalThreshold, LaserDQM_cfg::input, inputLabel, fwrapper::jets, jetsLabel_, resolutions_, METAlgo::run(), and PFSpecificAlgo::runSignificance().

Referenced by produce().

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  }
virtual CommonMETData run(edm::Handle< edm::View< reco::Candidate > > candidates, double globalThreshold=0.0)
Definition: METAlgo.cc:16
edm::InputTag inputLabel
Definition: METProducer.h:59
bool calculateSignificance_
Definition: METProducer.h:65
vector< PseudoJet > jets
Structure containing data common to all types of MET.
Definition: CommonMETData.h:22
double globalThreshold
Definition: METProducer.h:73
edm::InputTag jetsLabel_
Definition: METProducer.h:67
metsig::SignAlgoResolutions * resolutions_
Definition: METProducer.h:66
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
reco::PFMET addInfo(edm::Handle< edm::View< reco::Candidate > > PFCandidates, CommonMETData met)
void runSignificance(metsig::SignAlgoResolutions &resolutions, edm::Handle< edm::View< reco::PFJet > > jets)
void METProducer::produce_TCMET ( edm::Event event,
const edm::EventSetup setup 
)
private

Definition at line 179 of file METProducer.cc.

References TCMETAlgo::CalculateTCMET(), and tcMetAlgo_.

Referenced by produce().

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

Member Data Documentation

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

Definition at line 62 of file METProducer.h.

Referenced by METProducer().

bool cms::METProducer::applyFiducialThresholdForFractions
private

Definition at line 79 of file METProducer.h.

Referenced by METProducer(), and produce_GenMET().

bool cms::METProducer::calculateSignificance_
private

Definition at line 65 of file METProducer.h.

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

double cms::METProducer::globalThreshold
private
edm::InputTag cms::METProducer::inputLabel
private
std::string cms::METProducer::inputType
private

Definition at line 60 of file METProducer.h.

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

Definition at line 67 of file METProducer.h.

Referenced by METProducer(), and produce_PFMET().

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

Definition at line 61 of file METProducer.h.

Referenced by METProducer(), and produce().

bool cms::METProducer::noHF
private

Definition at line 70 of file METProducer.h.

Referenced by METProducer(), and produce_CaloMET().

bool cms::METProducer::onlyFiducial
private

Definition at line 76 of file METProducer.h.

Referenced by METProducer(), and produce_GenMET().

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

Definition at line 66 of file METProducer.h.

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

TCMETAlgo cms::METProducer::tcMetAlgo_
private

Definition at line 84 of file METProducer.h.

Referenced by METProducer(), and produce_TCMET().

bool cms::METProducer::usePt
private

Definition at line 82 of file METProducer.h.

Referenced by METProducer(), and produce_GenMET().