CMS 3D CMS Logo

BjetAnalyzer.cc
Go to the documentation of this file.
4 #include <iostream>
5 #include "TH1.h"
6 
7 class BjetAnalysis : public edm::EDAnalyzer {
8 public:
10  void analyze(const edm::Event&, const edm::EventSetup&) override;
11  // virtual void endJob();
12 private:
16  std::vector<unsigned int> matched_, unMatched_;
18  int nHitCut_;
20 
21 };
22 
32 using namespace std;
33 using namespace reco;
34 using namespace edm;
37 
38 
40  bTagToken_(consumes<reco::JetTagCollection>(edm::InputTag("trackCountingHighEffBJetTags"))),
41  bTagToken2_(consumes<reco::JetTagCollection>(edm::InputTag("jetProbabilityBJetTags"))),
42  bTagToken3_(consumes<reco::JetTagCollection>(edm::InputTag("jetBProbabilityBJetTags"))),
43  ptMin_(cfg.getUntrackedParameter<double>("ptMin")),
44  massMin_(cfg.getUntrackedParameter<double>("massMin")),
45  massMax_(cfg.getUntrackedParameter<double>("massMax")),
46  etaMin_(cfg.getUntrackedParameter<double>("etaMin")),
47  etaMax_(cfg.getUntrackedParameter<double>("etaMax")),
48  trkIso_(cfg.getUntrackedParameter<double>("trkIso")),
49  chi2Cut_(cfg.getUntrackedParameter<double>("chi2Cut")),
50  nHitCut_(cfg.getUntrackedParameter<int>("nHitCut"))
51 {
53  TFileDirectory trackEffDir = fs->mkdir("QualityOfGlbMu");
54  h_GlbMuNofHitsGlbMu_= trackEffDir.make<TH1D>("# of Hits of GlobalMuon", "# of Hits of GlobalMuon", 100, 0, 100);
55  h_TrkMuNofHitsGlbMu_= trackEffDir.make<TH1D>("# of Hits of TrackerMuon", "# of Hits of TrackerMuon", 100, 0, 100);
56  h_GlbMuChi2_= trackEffDir.make<TH1D>("chi2 of GlobalMuon", "chi2 of GlobalMuon", 100,0,10);
57  h_GlbMuDxy_= trackEffDir.make<TH1D>("Dxy of GlobalMuon", "Dxy of GlobalMuon", 1000,-5.,5.);
58 }
59 
61 
62 
63  // Get b tag information
65  evt.getByToken(bTagToken_, bTagHandle);
66  const reco::JetTagCollection & bTags = *(bTagHandle.product());
67 
68  // Loop over jets and study b tag info.
69  for (unsigned int i = 0; i != bTags.size(); ++i) {
70  cout<<" Jet "<< i
71  <<" has b tag discriminator (trackCountingHighEffBJetTags)= "<<bTags[i].second
72  << " and jet Pt = "<<bTags[i].first->pt()<<endl;
73  }
74 
75  // Get b tag information
77  evt.getByToken(bTagToken2_, bTagHandle2);
78  const reco::JetTagCollection & bTags2 = *(bTagHandle2.product());
79 
80  // Loop over jets and study b tag info.
81  for (unsigned int i = 0; i != bTags2.size(); ++i) {
82  cout<<" Jet "<< i
83  <<" has b tag discriminator (jetProbabilityBJetTags) = "<<bTags2[i].second
84  << " and jet Pt = "<<bTags2[i].first->pt()<<endl;
85  }
86 
87 
88  // Get b tag information
90  evt.getByToken(bTagToken3_, bTagHandle3);
91  const reco::JetTagCollection & bTags3 = *(bTagHandle3.product());
92 
93  // Loop over jets and study b tag info.
94  for (unsigned int i = 0; i != bTags3.size(); ++i) {
95  cout<<" Jet "<< i
96  <<" has b tag discriminator (jetBProbabilityBJetTags) = "<<bTags3[i].second
97  << " and jet Pt = "<<bTags3[i].first->pt()<<endl;
98  }
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 }
110 
111 
112 
114 
edm::EDGetTokenT< reco::JetTagCollection > bTagToken2_
Definition: BjetAnalyzer.cc:14
double massMax_
Definition: BjetAnalyzer.cc:17
double chi2Cut_
Definition: BjetAnalyzer.cc:17
TH1D * h_GlbMuDxy_
Definition: BjetAnalyzer.cc:19
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
double massMin_
Definition: BjetAnalyzer.cc:17
std::vector< unsigned int > matched_
Definition: BjetAnalyzer.cc:16
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
double trkIso_
Definition: BjetAnalyzer.cc:17
edm::EDGetTokenT< reco::JetTagCollection > bTagToken_
Definition: BjetAnalyzer.cc:13
BjetAnalysis(const edm::ParameterSet &cfg)
Definition: BjetAnalyzer.cc:39
T * make(const Args &...args) const
make new ROOT object
double etaMax_
Definition: BjetAnalyzer.cc:17
TH1D * h_GlbMuChi2_
Definition: BjetAnalyzer.cc:19
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
T const * product() const
Definition: Handle.h:81
fixed size matrix
HLT enums.
TH1D * h_TrkMuNofHitsGlbMu_
Definition: BjetAnalyzer.cc:19
edm::EDGetTokenT< reco::JetTagCollection > bTagToken3_
Definition: BjetAnalyzer.cc:15
double etaMin_
Definition: BjetAnalyzer.cc:17
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: BjetAnalyzer.cc:60
std::vector< unsigned int > unMatched_
Definition: BjetAnalyzer.cc:16
size_type size() const
TH1D * h_GlbMuNofHitsGlbMu_
Definition: BjetAnalyzer.cc:19