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.
2 
3 
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 }
16 
18 {
19 }
20 
21 void
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->size()<1 || !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 }
100 
102 {
103 }
104 
106 {
107 }
108 
109 
virtual void analyze(const edm::Event &, const edm::EventSetup &)
int i
Definition: DBlmapReader.cc:9
tuple cfg
Definition: looper.py:293
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
virtual void endJob()
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
vector< PseudoJet > jets
TopJetAnalyzer(const edm::ParameterSet &)
edm::EDGetTokenT< std::vector< pat::Jet > > inputToken_
virtual void beginJob()
tuple cout
Definition: gather_cfg.py:145
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")