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
TopJetAnalyzer Class Reference

#include <TopJetAnalyzer.h>

Inheritance diagram for TopJetAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 TopJetAnalyzer (const edm::ParameterSet &)
 
 ~TopJetAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- 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

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

Private Attributes

TH1F * en_
 
TH1F * eta_
 
edm::InputTag input_
 
TH1F * mult_
 
TH1F * phi_
 
TH1F * pt_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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 13 of file TopJetAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 5 of file TopJetAnalyzer.cc.

References en_, eta_, TFileDirectory::make(), mult_, phi_, and pt_.

5  :
6  input_ (cfg.getParameter<edm::InputTag>("input" )),
7  verbose_(cfg.getParameter<bool> ("verbose"))
8 {
10 
11  mult_ = fs->make<TH1F>("mult", "multiplicity (jets)", 30, 0 , 30);
12  en_ = fs->make<TH1F>("en" , "energy (jets)", 60, 0., 300.);
13  pt_ = fs->make<TH1F>("pt" , "pt (jets)", 60, 0., 300.);
14  eta_ = fs->make<TH1F>("eta" , "eta (jets)", 30, -3., 3.);
15  phi_ = fs->make<TH1F>("phi" , "phi (jets)", 40, -4., 4.);
16 }
edm::InputTag input_
T getParameter(std::string const &) const
T * make() const
make new ROOT object
TopJetAnalyzer::~TopJetAnalyzer ( )

Definition at line 18 of file TopJetAnalyzer.cc.

19 {
20 }

Member Function Documentation

void TopJetAnalyzer::analyze ( const edm::Event evt,
const edm::EventSetup setup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 23 of file TopJetAnalyzer.cc.

References gather_cfg::cout, en_, eta_, edm::Event::getByLabel(), i, input_, metsig::jet, fwrapper::jets, mult_, phi_, pt_, and verbose_.

24 {
26  evt.getByLabel(input_, jets);
27 
28  // fill histograms
29 
30  mult_->Fill( jets->size() );
31  for(std::vector<pat::Jet>::const_iterator jet=jets->begin(); jet!=jets->end(); ++jet){
32  pt_ ->Fill( jet->pt() );
33  en_ ->Fill( jet->energy() );
34  eta_->Fill( jet->eta() );
35  phi_->Fill( jet->phi() );
36  }
37 
38  // produce printout if desired
39 
40  if( jets->size()<1 || !verbose_ )
41  return;
42 
43  int lineWidth = 75;
44  if( jets->begin()->isCaloJet() )
45  lineWidth = 100;
46  else if( jets->begin()->isPFJet() )
47  lineWidth = 120;
48 
49  std::cout << std::setfill('=') << std::setw(lineWidth) << "\n" << std::setfill(' ');
50  std::cout << std::setw( 5) << "jet :"
51  << std::setw(11) << "pt :"
52  << std::setw( 9) << "eta :"
53  << std::setw( 9) << "phi :"
54  << std::setw(11) << "TCHE :"
55  << std::setw(11) << "TCHP :"
56  << std::setw( 9) << "SSVHE :"
57  << std::setw( 9) << "SSVHP :";
58  if( jets->begin()->isCaloJet() ) {
59  std::cout << std::setw( 8) << "emf :"
60  << std::setw(10) << "n90Hits :"
61  << std::setw( 7) << "fHPD";
62  }
63  if( jets->begin()->isPFJet() ) {
64  std::cout << std::setw(9) << "chf : "
65  << std::setw(8) << "nhf : "
66  << std::setw(8) << "cef : "
67  << std::setw(8) << "nef : "
68  << std::setw(6) << "nCh : "
69  << std::setw(6) << "nConst";
70  }
71  std::cout << std::endl
72  << std::setfill('-') << std::setw(lineWidth) << "\n" << std::setfill(' ');
73  unsigned i=0;
74  for(std::vector<pat::Jet>::const_iterator jet=jets->begin(); jet!=jets->end(); ++jet){
75  std::cout << std::setw(3) << i << " : " << std::setprecision(3) << std::fixed
76  << std::setw(8) << jet->pt() << " : "
77  << std::setw(6) << jet->eta() << " : "
78  << std::setw(6) << jet->phi() << " : "
79  << std::setw(8) << jet->bDiscriminator("trackCountingHighEffBJetTags") << " : "
80  << std::setw(8) << jet->bDiscriminator("trackCountingHighPurBJetTags") << " : "
81  << std::setw(6) << jet->bDiscriminator("simpleSecondaryVertexHighEffBJetTags") << " : "
82  << std::setw(6) << jet->bDiscriminator("simpleSecondaryVertexHighPurBJetTags") << " : ";
83  if( jet->isCaloJet() ) {
84  std::cout << std::setw(5) << jet->emEnergyFraction() << " : "
85  << std::setw(7) << jet->jetID().n90Hits << " : "
86  << std::setw(6) << jet->jetID().fHPD;
87  }
88  if( jet->isPFJet() ) {
89  std::cout << std::setw(5) << jet->chargedHadronEnergyFraction() << " : "
90  << std::setw(5) << jet->neutralHadronEnergyFraction() << " : "
91  << std::setw(5) << jet->chargedEmEnergyFraction() << " : "
92  << std::setw(5) << jet->neutralEmEnergyFraction() << " : "
93  << std::setw(3) << jet->chargedMultiplicity() << " : "
94  << std::setw(6) << jet->nConstituents();
95  }
96  std::cout << std::endl;
97  i++;
98  }
99  std::cout << std::setfill('=') << std::setw(lineWidth) << "\n" << std::setfill(' ');
100 }
edm::InputTag input_
int i
Definition: DBlmapReader.cc:9
vector< PseudoJet > jets
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
tuple cout
Definition: gather_cfg.py:121
void TopJetAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 102 of file TopJetAnalyzer.cc.

103 {
104 }
void TopJetAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 106 of file TopJetAnalyzer.cc.

107 {
108 }

Member Data Documentation

TH1F* TopJetAnalyzer::en_
private

Definition at line 30 of file TopJetAnalyzer.h.

Referenced by analyze(), and TopJetAnalyzer().

TH1F* TopJetAnalyzer::eta_
private

Definition at line 32 of file TopJetAnalyzer.h.

Referenced by analyze(), and TopJetAnalyzer().

edm::InputTag TopJetAnalyzer::input_
private

Definition at line 26 of file TopJetAnalyzer.h.

Referenced by analyze().

TH1F* TopJetAnalyzer::mult_
private

Definition at line 29 of file TopJetAnalyzer.h.

Referenced by analyze(), and TopJetAnalyzer().

TH1F* TopJetAnalyzer::phi_
private

Definition at line 33 of file TopJetAnalyzer.h.

Referenced by analyze(), and TopJetAnalyzer().

TH1F* TopJetAnalyzer::pt_
private

Definition at line 31 of file TopJetAnalyzer.h.

Referenced by analyze(), and TopJetAnalyzer().

bool TopJetAnalyzer::verbose_
private

Definition at line 27 of file TopJetAnalyzer.h.

Referenced by analyze().