test
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
PatZjetsJetAnalyzer Class Reference
Inheritance diagram for PatZjetsJetAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 PatZjetsJetAnalyzer (const edm::ParameterSet &)
 
 ~PatZjetsJetAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual void endJob () override
 

Private Attributes

std::map< std::string, TH1F * > histContainer_
 
edm::EDGetTokenT< edm::View
< pat::Jet > > 
srcToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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 15 of file PatZjetsJetAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 36 of file PatZjetsJetAnalyzer.cc.

36  :
39 {
40 }
T getUntrackedParameter(std::string const &, T const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< pat::Jet > > srcToken_
std::map< std::string, TH1F * > histContainer_
PatZjetsJetAnalyzer::~PatZjetsJetAnalyzer ( )

Definition at line 42 of file PatZjetsJetAnalyzer.cc.

43 {
44 }

Member Function Documentation

void PatZjetsJetAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 47 of file PatZjetsJetAnalyzer.cc.

References pat::Jet::emEnergyFraction(), reco::LeafCandidate::eta(), edm::Event::getByToken(), pat::Jet::getCaloConstituent(), pat::Jet::getCaloConstituents(), histContainer_, i, metsig::jet, fwrapper::jets, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), and srcToken_.

48 {
49  // get electron collection
51  iEvent.getByToken(srcToken_,jets);
52 
53  // loop jets
54  for(edm::View<pat::Jet>::const_iterator ijet=jets->begin(); ijet!=jets->end(); ++ijet){
55  // fill simple histograms
56  pat::Jet jet = ijet->correctedJet("had", "uds");
57  histContainer_["pt" ]->Fill( jet.pt () );
58  histContainer_["eta" ]->Fill( jet.eta() );
59  histContainer_["phi" ]->Fill( jet.phi() );
60  histContainer_["emf" ]->Fill( jet.emEnergyFraction() );
61  for(unsigned int i=0; i<jet.getCaloConstituents().size(); ++i){
62  histContainer_["dEta"]->Fill( jet.getCaloConstituent(i)->eta()-jet.eta() );
63  }
64  }
65 }
int i
Definition: DBlmapReader.cc:9
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
virtual float pt() const
transverse momentum
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
virtual float phi() const
momentum azimuthal angle
virtual float eta() const
momentum pseudorapidity
CaloTowerPtr getCaloConstituent(unsigned fIndex) const
convert generic constituent to specific type
Definition: Jet.cc:98
vector< PseudoJet > jets
float emEnergyFraction() const
returns the jet electromagnetic energy fraction
Definition: Jet.h:280
std::vector< CaloTowerPtr > const & getCaloConstituents() const
Definition: Jet.cc:132
edm::EDGetTokenT< edm::View< pat::Jet > > srcToken_
std::map< std::string, TH1F * > histContainer_
Analysis-level calorimeter jet class.
Definition: Jet.h:73
void PatZjetsJetAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 68 of file PatZjetsJetAnalyzer.cc.

References histContainer_, and TFileService::make().

69 {
70  // register to the TFileService
72 
73  // book histograms:
74  histContainer_["pt" ]=fs->make<TH1F>("pt" , "pt" , 150, 0., 150.);
75  histContainer_["eta" ]=fs->make<TH1F>("eta" , "eta" , 50, 0., 5.);
76  histContainer_["phi" ]=fs->make<TH1F>("phi" , "phi" , 60, 3.14, 3.14);
77  histContainer_["emf" ]=fs->make<TH1F>("emf" , "emf" , 40, 0., 1.);
78  histContainer_["dEta"]=fs->make<TH1F>("dEta" , "dEta" , 40, 0., 1.);
79 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::map< std::string, TH1F * > histContainer_
void PatZjetsJetAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 82 of file PatZjetsJetAnalyzer.cc.

83 {
84 }

Member Data Documentation

std::map<std::string,TH1F*> PatZjetsJetAnalyzer::histContainer_
private

Definition at line 30 of file PatZjetsJetAnalyzer.cc.

Referenced by analyze(), and beginJob().

edm::EDGetTokenT<edm::View<pat::Jet> > PatZjetsJetAnalyzer::srcToken_
private

Definition at line 33 of file PatZjetsJetAnalyzer.cc.

Referenced by analyze().