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 
31 using namespace std;
32 using namespace reco;
33 using namespace edm;
36 
38  : bTagToken_(consumes<reco::JetTagCollection>(edm::InputTag("trackCountingHighEffBJetTags"))),
39  bTagToken2_(consumes<reco::JetTagCollection>(edm::InputTag("jetProbabilityBJetTags"))),
40  bTagToken3_(consumes<reco::JetTagCollection>(edm::InputTag("jetBProbabilityBJetTags"))),
41  ptMin_(cfg.getUntrackedParameter<double>("ptMin")),
42  massMin_(cfg.getUntrackedParameter<double>("massMin")),
43  massMax_(cfg.getUntrackedParameter<double>("massMax")),
44  etaMin_(cfg.getUntrackedParameter<double>("etaMin")),
45  etaMax_(cfg.getUntrackedParameter<double>("etaMax")),
46  trkIso_(cfg.getUntrackedParameter<double>("trkIso")),
47  chi2Cut_(cfg.getUntrackedParameter<double>("chi2Cut")),
48  nHitCut_(cfg.getUntrackedParameter<int>("nHitCut")) {
50  TFileDirectory trackEffDir = fs->mkdir("QualityOfGlbMu");
51  h_GlbMuNofHitsGlbMu_ = trackEffDir.make<TH1D>("# of Hits of GlobalMuon", "# of Hits of GlobalMuon", 100, 0, 100);
52  h_TrkMuNofHitsGlbMu_ = trackEffDir.make<TH1D>("# of Hits of TrackerMuon", "# of Hits of TrackerMuon", 100, 0, 100);
53  h_GlbMuChi2_ = trackEffDir.make<TH1D>("chi2 of GlobalMuon", "chi2 of GlobalMuon", 100, 0, 10);
54  h_GlbMuDxy_ = trackEffDir.make<TH1D>("Dxy of GlobalMuon", "Dxy of GlobalMuon", 1000, -5., 5.);
55 }
56 
58  // Get b tag information
60  evt.getByToken(bTagToken_, bTagHandle);
61  const reco::JetTagCollection& bTags = *(bTagHandle.product());
62 
63  // Loop over jets and study b tag info.
64  for (unsigned int i = 0; i != bTags.size(); ++i) {
65  cout << " Jet " << i << " has b tag discriminator (trackCountingHighEffBJetTags)= " << bTags[i].second
66  << " and jet Pt = " << bTags[i].first->pt() << endl;
67  }
68 
69  // Get b tag information
71  evt.getByToken(bTagToken2_, bTagHandle2);
72  const reco::JetTagCollection& bTags2 = *(bTagHandle2.product());
73 
74  // Loop over jets and study b tag info.
75  for (unsigned int i = 0; i != bTags2.size(); ++i) {
76  cout << " Jet " << i << " has b tag discriminator (jetProbabilityBJetTags) = " << bTags2[i].second
77  << " and jet Pt = " << bTags2[i].first->pt() << endl;
78  }
79 
80  // Get b tag information
82  evt.getByToken(bTagToken3_, bTagHandle3);
83  const reco::JetTagCollection& bTags3 = *(bTagHandle3.product());
84 
85  // Loop over jets and study b tag info.
86  for (unsigned int i = 0; i != bTags3.size(); ++i) {
87  cout << " Jet " << i << " has b tag discriminator (jetBProbabilityBJetTags) = " << bTags3[i].second
88  << " and jet Pt = " << bTags3[i].first->pt() << endl;
89  }
90 }
91 
93 
BjetAnalysis::bTagToken_
edm::EDGetTokenT< reco::JetTagCollection > bTagToken_
Definition: BjetAnalyzer.cc:13
JetTag.h
Handle.h
BjetAnalysis::h_GlbMuChi2_
TH1D * h_GlbMuChi2_
Definition: BjetAnalyzer.cc:19
BjetAnalysis::etaMax_
double etaMax_
Definition: BjetAnalyzer.cc:17
mps_fire.i
i
Definition: mps_fire.py:428
edm::Handle::product
T const * product() const
Definition: Handle.h:70
BjetAnalysis::h_TrkMuNofHitsGlbMu_
TH1D * h_TrkMuNofHitsGlbMu_
Definition: BjetAnalyzer.cc:19
edm::EDGetTokenT
Definition: EDGetToken.h:33
TFileDirectory::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileDirectory.h:53
edm
HLT enums.
Definition: AlignableModifier.h:19
Muon.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
GenericParticle.h
EDAnalyzer.h
TFileDirectory
Definition: TFileDirectory.h:24
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
BjetAnalysis::bTagToken2_
edm::EDGetTokenT< reco::JetTagCollection > bTagToken2_
Definition: BjetAnalyzer.cc:14
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
GenParticle.h
CandidateFwd.h
MakerMacros.h
BjetAnalysis::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: BjetAnalyzer.cc:57
BjetAnalysis::nHitCut_
int nHitCut_
Definition: BjetAnalyzer.cc:18
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
GenParticleFwd.h
BjetAnalysis::massMax_
double massMax_
Definition: BjetAnalyzer.cc:17
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
BjetAnalysis::chi2Cut_
double chi2Cut_
Definition: BjetAnalyzer.cc:17
edm::AssociationVector
Definition: AssociationVector.h:67
TFileService.h
BjetAnalysis::bTagToken3_
edm::EDGetTokenT< reco::JetTagCollection > bTagToken3_
Definition: BjetAnalyzer.cc:15
TFileService::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
BjetAnalysis::h_GlbMuNofHitsGlbMu_
TH1D * h_GlbMuNofHitsGlbMu_
Definition: BjetAnalyzer.cc:19
edm::Service< TFileService >
createfilelist.int
int
Definition: createfilelist.py:10
TtFullHadKinFitProducer_cfi.bTags
bTags
Definition: TtFullHadKinFitProducer_cfi.py:40
edm::AssociationVector::size
size_type size() const
Definition: AssociationVector.h:227
edm::EventSetup
Definition: EventSetup.h:57
BjetAnalysis::etaMin_
double etaMin_
Definition: BjetAnalyzer.cc:17
InputTag.h
looper.cfg
cfg
Definition: looper.py:297
BjetAnalysis::ptMin_
double ptMin_
Definition: BjetAnalyzer.cc:17
std
Definition: JetResolutionObject.h:76
BjetAnalysis::unMatched_
std::vector< unsigned int > unMatched_
Definition: BjetAnalyzer.cc:16
BjetAnalysis
Definition: BjetAnalyzer.cc:7
BjetAnalysis::matched_
std::vector< unsigned int > matched_
Definition: BjetAnalyzer.cc:16
BjetAnalysis::massMin_
double massMin_
Definition: BjetAnalyzer.cc:17
BjetAnalysis::trkIso_
double trkIso_
Definition: BjetAnalyzer.cc:17
BjetAnalysis::BjetAnalysis
BjetAnalysis(const edm::ParameterSet &cfg)
Definition: BjetAnalyzer.cc:37
Candidate.h
ParameterSet.h
BjetAnalysis::h_GlbMuDxy_
TH1D * h_GlbMuDxy_
Definition: BjetAnalyzer.cc:19
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15