CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TopJetAnalyzer.cc
Go to the documentation of this file.
3 
4 
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 }
17 
19 {
20 }
21 
22 void
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 }
101 
103 {
104 }
105 
107 {
108 }
109 
110 
edm::InputTag input_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
int i
Definition: DBlmapReader.cc:9
virtual void endJob()
vector< PseudoJet > jets
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
TopJetAnalyzer(const edm::ParameterSet &)
T * make() const
make new ROOT object
virtual void beginJob()
tuple cout
Definition: gather_cfg.py:121
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")