CMS 3D CMS Logo

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 () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

TH1F * en_
 
TH1F * eta_
 
edm::EDGetTokenT< std::vector< pat::Jet > > inputToken_
 
TH1F * mult_
 
TH1F * phi_
 
TH1F * pt_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, ESInputTag const &tag)
 
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 TopJetAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 4 of file TopJetAnalyzer.cc.

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

4  :
5  inputToken_ (consumes<std::vector<pat::Jet> >(cfg.getParameter<edm::InputTag>("input" ))),
6  verbose_(cfg.getParameter<bool> ("verbose"))
7 {
9 
10  mult_ = fs->make<TH1F>("mult", "multiplicity (jets)", 30, 0 , 30);
11  en_ = fs->make<TH1F>("en" , "energy (jets)", 60, 0., 300.);
12  pt_ = fs->make<TH1F>("pt" , "pt (jets)", 60, 0., 300.);
13  eta_ = fs->make<TH1F>("eta" , "eta (jets)", 30, -3., 3.);
14  phi_ = fs->make<TH1F>("phi" , "phi (jets)", 40, -4., 4.);
15 }
T getParameter(std::string const &) const
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< std::vector< pat::Jet > > inputToken_
TopJetAnalyzer::~TopJetAnalyzer ( )
override

Definition at line 17 of file TopJetAnalyzer.cc.

18 {
19 }

Member Function Documentation

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

Definition at line 22 of file TopJetAnalyzer.cc.

References gather_cfg::cout, en_, eta_, alignBH_cfg::fixed, edm::Event::getByToken(), mps_fire::i, inputToken_, metsig::jet, fwrapper::jets, RecoTauValidation_cfi::lineWidth, mult_, phi_, pt_, and verbose_.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 101 of file TopJetAnalyzer.cc.

102 {
103 }
void TopJetAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 105 of file TopJetAnalyzer.cc.

106 {
107 }

Member Data Documentation

TH1F* TopJetAnalyzer::en_
private

Definition at line 32 of file TopJetAnalyzer.h.

Referenced by analyze(), and TopJetAnalyzer().

TH1F* TopJetAnalyzer::eta_
private

Definition at line 34 of file TopJetAnalyzer.h.

Referenced by analyze(), and TopJetAnalyzer().

edm::EDGetTokenT<std::vector<pat::Jet> > TopJetAnalyzer::inputToken_
private

Definition at line 28 of file TopJetAnalyzer.h.

Referenced by analyze().

TH1F* TopJetAnalyzer::mult_
private

Definition at line 31 of file TopJetAnalyzer.h.

Referenced by analyze(), and TopJetAnalyzer().

TH1F* TopJetAnalyzer::phi_
private

Definition at line 35 of file TopJetAnalyzer.h.

Referenced by analyze(), and TopJetAnalyzer().

TH1F* TopJetAnalyzer::pt_
private

Definition at line 33 of file TopJetAnalyzer.h.

Referenced by analyze(), and TopJetAnalyzer().

bool TopJetAnalyzer::verbose_
private

Definition at line 29 of file TopJetAnalyzer.h.

Referenced by analyze().