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 Types | Private Member Functions | Private Attributes
MixedGenMEtProducer Class Reference

#include <MixedGenMEtProducer.h>

Inheritance diagram for MixedGenMEtProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MixedGenMEtProducer (const edm::ParameterSet &)
 
 ~MixedGenMEtProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

enum  { kPF, kCalo }
 

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

bool isMC_
 
edm::InputTag srcGenParticles1_
 
edm::InputTag srcGenParticles2_
 
edm::InputTag srcRemovedMuons_
 
int type_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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

Produce generator level missing transverse energy for "hybrid" event consisting of of gen. Z –> mu+ mu- event plus embedded simulated tau decay products

Author
Christian Veelken, LLR
Version
Revision:
1.2
Id:
MixedGenMEtProducer.h,v 1.2 2013/03/29 15:55:19 veelken Exp

Definition at line 22 of file MixedGenMEtProducer.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
kPF 
kCalo 

Definition at line 34 of file MixedGenMEtProducer.h.

Constructor & Destructor Documentation

MixedGenMEtProducer::MixedGenMEtProducer ( const edm::ParameterSet cfg)
explicit

Definition at line 13 of file MixedGenMEtProducer.cc.

References Exception, edm::ParameterSet::getParameter(), isMC_, kCalo, kPF, edm::InputTag::label(), srcGenParticles1_, srcGenParticles2_, srcRemovedMuons_, AlCaHLTBitMon_QueryRunRegistry::string, and type_.

14 {
15  srcGenParticles1_ = cfg.getParameter<edm::InputTag>("srcGenParticles1");
16  srcGenParticles2_ = cfg.getParameter<edm::InputTag>("srcGenParticles2");
17 
18  srcRemovedMuons_ = cfg.getParameter<edm::InputTag>("srcRemovedMuons");
19 
20  std::string type_string = cfg.getParameter<std::string>("type");
21  if ( type_string == "pf" ) type_ = kPF;
22  else if ( type_string == "calo" ) type_ = kCalo;
23  else throw cms::Exception("Configuration")
24  << "Invalid Configuration Parameter 'type' = " << type_string << " !!\n";
25 
26  isMC_ = cfg.getParameter<bool>("isMC");
27  int numCollections = 0;
28  if ( srcGenParticles1_.label() != "" ) ++numCollections;
29  if ( srcGenParticles2_.label() != "" ) ++numCollections;
30  if ( numCollections != 2 && isMC_ )
31  throw cms::Exception("Configuration")
32  << "Collections 'srcGenParticles1' and 'srcGenParticles2' must both be specified in case Embedding is run on Monte Carlo !!\n";
33  if ( numCollections != 1 && !isMC_ )
34  throw cms::Exception("Configuration")
35  << "Either collection 'srcGenParticles1' or 'srcGenParticles2' must be specified in case Embedding is run on Data !!\n";
36 
37  produces<reco::GenMETCollection>();
38 }
T getParameter(std::string const &) const
edm::InputTag srcRemovedMuons_
edm::InputTag srcGenParticles2_
std::string const & label() const
Definition: InputTag.h:36
edm::InputTag srcGenParticles1_
MixedGenMEtProducer::~MixedGenMEtProducer ( )
inline

Definition at line 26 of file MixedGenMEtProducer.h.

26 {}

Member Function Documentation

void MixedGenMEtProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 58 of file MixedGenMEtProducer.cc.

References SpecificGenMETData::ChargedEMEtFraction, SpecificGenMETData::ChargedHadEtFraction, miniAODValidation_cff::genParticles1, edm::Event::getByLabel(), SpecificGenMETData::InvisibleEtFraction, isMC_, kCalo, edm::InputTag::label(), SpecificGenMETData::MuonEtFraction, SpecificGenMETData::NeutralEMEtFraction, SpecificGenMETData::NeutralHadEtFraction, edm::Event::put(), srcGenParticles1_, srcGenParticles2_, srcRemovedMuons_, and type_.

59 {
61  double genSumEt = 0.;
62 
63  if ( srcGenParticles1_.label() != "" ) {
65  evt.getByLabel(srcGenParticles1_, genParticles1);
66  sumNeutrinoP4s(*genParticles1, type_ == kCalo, genMEtP4, genSumEt);
67  }
68  if ( srcGenParticles2_.label() != "" ) {
70  evt.getByLabel(srcGenParticles2_, genParticles2);
71  sumNeutrinoP4s(*genParticles2, type_ == kCalo, genMEtP4, genSumEt);
72  }
73 
74  if ( isMC_ ) {
76  edm::Handle<CandidateView> removedMuons;
77  evt.getByLabel(srcRemovedMuons_, removedMuons);
78  for ( CandidateView::const_iterator removedMuon = removedMuons->begin();
79  removedMuon != removedMuons->end(); ++removedMuon ) {
80  if ( type_ == kCalo ) genMEtP4 -= removedMuon->p4();
81  genSumEt -= removedMuon->et();
82  }
83  }
84 
85  std::auto_ptr<reco::GenMETCollection> genMETs(new reco::GenMETCollection());
86  SpecificGenMETData genMEtData; // WARNING: not filled
87  genMEtData.NeutralEMEtFraction = 0.;
88  genMEtData.NeutralHadEtFraction = 0.;
89  genMEtData.ChargedEMEtFraction = 0.;
90  genMEtData.ChargedHadEtFraction = 0.;
91  genMEtData.MuonEtFraction = 0.;
92  genMEtData.InvisibleEtFraction = 0.;
93  reco::Candidate::Point vtx(0.0, 0.0, 0.0);
94  genMETs->push_back(reco::GenMET(genMEtData, genSumEt, genMEtP4, vtx));
95 
96  evt.put(genMETs);
97 }
edm::InputTag srcRemovedMuons_
std::vector< reco::GenMET > GenMETCollection
collection of GenMET objects
edm::View< reco::Candidate > CandidateView
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
edm::InputTag srcGenParticles2_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
std::string const & label() const
Definition: InputTag.h:36
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
edm::InputTag srcGenParticles1_

Member Data Documentation

bool MixedGenMEtProducer::isMC_
private

Definition at line 36 of file MixedGenMEtProducer.h.

Referenced by MixedGenMEtProducer(), and produce().

edm::InputTag MixedGenMEtProducer::srcGenParticles1_
private

Definition at line 31 of file MixedGenMEtProducer.h.

Referenced by MixedGenMEtProducer(), and produce().

edm::InputTag MixedGenMEtProducer::srcGenParticles2_
private

Definition at line 32 of file MixedGenMEtProducer.h.

Referenced by MixedGenMEtProducer(), and produce().

edm::InputTag MixedGenMEtProducer::srcRemovedMuons_
private

Definition at line 33 of file MixedGenMEtProducer.h.

Referenced by MixedGenMEtProducer(), and produce().

int MixedGenMEtProducer::type_
private