CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/ElectroWeakAnalysis/ZMuMu/plugins/BjetAnalyzer.cc

Go to the documentation of this file.
00001 #include "FWCore/Framework/interface/EDAnalyzer.h"
00002 #include "FWCore/Utilities/interface/InputTag.h"
00003 #include <iostream>
00004 #include "TH1.h"
00005 
00006 class BjetAnalysis : public edm::EDAnalyzer {
00007 public:
00008   BjetAnalysis(const edm::ParameterSet & cfg);
00009   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00010   //  virtual void endJob();
00011 private:
00012   edm::InputTag src_;
00013   std::vector<unsigned int> matched_, unMatched_;
00014   double  ptMin_, massMin_,massMax_,  etaMin_,  etaMax_,  trkIso_, chi2Cut_;
00015   int nHitCut_;
00016   TH1D *h_GlbMuNofHitsGlbMu_, *h_GlbMuChi2_, *h_TrkMuNofHitsGlbMu_, *h_GlbMuDxy_;
00017 
00018 };
00019 
00020 #include "DataFormats/Candidate/interface/Candidate.h"
00021 #include "DataFormats/Candidate/interface/CandidateFwd.h"
00022 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00023 #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
00024 #include "FWCore/Framework/interface/Event.h"
00025 #include "DataFormats/Common/interface/Handle.h"
00026 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00027 #include "DataFormats/PatCandidates/interface/Muon.h"
00028 #include "DataFormats/PatCandidates/interface/GenericParticle.h"
00029 using namespace std;
00030 using namespace reco;
00031 using namespace edm;
00032 #include "FWCore/ServiceRegistry/interface/Service.h"
00033 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00034 #include "DataFormats/BTauReco/interface/JetTag.h"
00035 
00036 
00037 BjetAnalysis::BjetAnalysis(const edm::ParameterSet & cfg) : 
00038   src_(cfg.getParameter<InputTag>("src")), 
00039   ptMin_(cfg.getUntrackedParameter<double>("ptMin")),
00040   massMin_(cfg.getUntrackedParameter<double>("massMin")),
00041   massMax_(cfg.getUntrackedParameter<double>("massMax")),
00042   etaMin_(cfg.getUntrackedParameter<double>("etaMin")),
00043   etaMax_(cfg.getUntrackedParameter<double>("etaMax")),
00044   trkIso_(cfg.getUntrackedParameter<double>("trkIso")),
00045   chi2Cut_(cfg.getUntrackedParameter<double>("chi2Cut")),
00046   nHitCut_(cfg.getUntrackedParameter<int>("nHitCut"))
00047 {
00048   Service<TFileService> fs;
00049   TFileDirectory trackEffDir = fs->mkdir("QualityOfGlbMu");
00050   h_GlbMuNofHitsGlbMu_= trackEffDir.make<TH1D>("# of Hits of GlobalMuon", "# of Hits of GlobalMuon", 100, 0, 100);
00051   h_TrkMuNofHitsGlbMu_= trackEffDir.make<TH1D>("# of Hits of TrackerMuon", "# of Hits of TrackerMuon", 100, 0, 100);
00052   h_GlbMuChi2_= trackEffDir.make<TH1D>("chi2 of GlobalMuon", "chi2 of GlobalMuon", 100,0,10); 
00053   h_GlbMuDxy_= trackEffDir.make<TH1D>("Dxy of GlobalMuon", "Dxy of GlobalMuon", 1000,-5.,5.); 
00054 }
00055 
00056 /*void BjetAnalysis::endJob() {
00057   cout << src_.encode() << endl ;
00058 
00059 }
00060 */
00061 void BjetAnalysis::analyze(const edm::Event& evt, const edm::EventSetup&) {
00062 
00063 
00064   // Get b tag information
00065   edm::Handle<reco::JetTagCollection> bTagHandle;
00066   evt.getByLabel("trackCountingHighEffBJetTags", bTagHandle);
00067   const reco::JetTagCollection & bTags = *(bTagHandle.product());
00068 
00069   // Loop over jets and study b tag info.
00070   for (unsigned int i = 0; i != bTags.size(); ++i) {
00071     cout<<" Jet "<< i 
00072         <<" has b tag discriminator (trackCountingHighEffBJetTags)= "<<bTags[i].second
00073         << " and jet Pt = "<<bTags[i].first->pt()<<endl;
00074   }
00075 
00076   // Get b tag information
00077   edm::Handle<reco::JetTagCollection> bTagHandle2;
00078   evt.getByLabel("jetProbabilityBJetTags", bTagHandle2);
00079   const reco::JetTagCollection & bTags2 = *(bTagHandle2.product());
00080 
00081   // Loop over jets and study b tag info.
00082   for (unsigned int i = 0; i != bTags2.size(); ++i) {
00083     cout<<" Jet "<< i 
00084         <<" has b tag discriminator (jetProbabilityBJetTags) = "<<bTags2[i].second
00085         << " and jet Pt = "<<bTags2[i].first->pt()<<endl;
00086   }
00087 
00088 
00089   // Get b tag information
00090   edm::Handle<reco::JetTagCollection> bTagHandle3;
00091   evt.getByLabel("jetBProbabilityBJetTags", bTagHandle3);
00092   const reco::JetTagCollection & bTags3 = *(bTagHandle3.product());
00093 
00094   // Loop over jets and study b tag info.
00095   for (unsigned int i = 0; i != bTags3.size(); ++i) {
00096     cout<<" Jet "<< i 
00097         <<" has b tag discriminator (jetBProbabilityBJetTags) = "<<bTags3[i].second
00098         << " and jet Pt = "<<bTags3[i].first->pt()<<endl;
00099   }
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 
00110 }
00111 
00112 
00113 
00114 #include "FWCore/Framework/interface/MakerMacros.h"
00115 
00116 DEFINE_FWK_MODULE(BjetAnalysis);