File indexing completed on 2024-04-06 12:25:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #ifndef DIJETRATIO_HH
0023 #define DIJETRATIO_HH
0024
0025 #include <memory>
0026 #include <string>
0027 #include <iostream>
0028 #include <map>
0029 #include <algorithm>
0030
0031
0032 #include "FWCore/Framework/interface/Frameworkfwd.h"
0033 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0034 #include "FWCore/Framework/interface/Event.h"
0035 #include "FWCore/Framework/interface/MakerMacros.h"
0036
0037 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0038 #include "DataFormats/Common/interface/Ref.h"
0039 #include "DataFormats/JetReco/interface/Jet.h"
0040 #include "DataFormats/TrackReco/interface/Track.h"
0041
0042 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
0043 #include "DataFormats/JetReco/interface/PFJetCollection.h"
0044 #include "DataFormats/JetReco/interface/GenJetCollection.h"
0045 #include "DataFormats/JetReco/interface/CaloJet.h"
0046 #include "DataFormats/JetReco/interface/PFJet.h"
0047 #include "DataFormats/JetReco/interface/GenJet.h"
0048 #include "CLHEP/Vector/LorentzVector.h"
0049
0050 #include "TFile.h"
0051 #include "TH1.h"
0052 #include "TH2.h"
0053
0054 const int histoSize = 5;
0055
0056
0057 inline void hInit(TH1F* hJet[], const char* name) {
0058 int const binSize = 35;
0059 float massBin[binSize + 1] = {100, 113, 132, 153, 176, 201, 229, 259, 292, 327, 366, 400,
0060 453, 501, 553, 609, 669, 733, 802, 875, 954, 1038, 1127, 1222,
0061 1323, 1431, 1546, 1667, 1796, 1934, 2079, 2233, 2396, 2569, 2752, 3000};
0062
0063
0064 std::string tit = std::string(name) + "_Eta_innerEtaCut_outerEtaCut";
0065 hJet[0] = new TH1F(tit.c_str(), "DiJet Mass", binSize, massBin);
0066
0067
0068 tit = std::string(name) + "_Eta_0_innerEtaCut";
0069 hJet[1] = new TH1F(tit.c_str(), "DiJet Mass", binSize, massBin);
0070
0071 tit = std::string(name) + "_LeadJetEta";
0072 hJet[2] = new TH1F(tit.c_str(), "1^{st} Leading Jet #eta", 120, -6., 6.);
0073 tit = std::string(name) + "_SecondJetEta";
0074 hJet[3] = new TH1F(tit.c_str(), "2^{nd} Leading Jet #eta", 120, -6., 6.);
0075 tit = std::string(name) + "_numEvents";
0076 hJet[4] = new TH1F(tit.c_str(), "No. of events", 10, 0., 10.);
0077
0078 return;
0079 }
0080
0081 template <class R>
0082 void histoFill(TH1F* jetHisto[], edm::Handle<R> jetsRec, double eta1, double eta2) {
0083
0084 jetHisto[4]->Fill(1.);
0085
0086 if ((*jetsRec).size() >= 2) {
0087 double px1 = (*jetsRec)[0].px();
0088 double py1 = (*jetsRec)[0].py();
0089 double pz1 = (*jetsRec)[0].pz();
0090 double e1 = (*jetsRec)[0].energy();
0091 double jetEta1 = (*jetsRec)[0].eta();
0092 jetHisto[2]->Fill(jetEta1);
0093
0094 double px2 = (*jetsRec)[1].px();
0095 double py2 = (*jetsRec)[1].py();
0096 double pz2 = (*jetsRec)[1].pz();
0097 double e2 = (*jetsRec)[1].energy();
0098 double jetEta2 = (*jetsRec)[1].eta();
0099 jetHisto[3]->Fill(jetEta2);
0100
0101 CLHEP::HepLorentzVector v1(px1, py1, pz1, e1);
0102 CLHEP::HepLorentzVector v2(px2, py2, pz2, e2);
0103 CLHEP::HepLorentzVector v(0., 0., 0., 0.);
0104 v = v1 + v2;
0105 float mass = v.m();
0106
0107 if (fabs(jetEta1) > 0.0 && fabs(jetEta1) < eta1)
0108 if (fabs(jetEta2) > 0.0 && fabs(jetEta2) < eta1)
0109 jetHisto[0]->Fill(mass);
0110
0111 if (fabs(jetEta1) > eta1 && fabs(jetEta1) < eta2)
0112 if (fabs(jetEta2) > eta1 && fabs(jetEta2) < eta2)
0113 jetHisto[1]->Fill(mass);
0114 }
0115 }
0116
0117
0118
0119
0120 template <class Jet>
0121 class DijetRatio : public edm::one::EDAnalyzer<> {
0122 public:
0123 explicit DijetRatio(const edm::ParameterSet&);
0124 ~DijetRatio() override;
0125
0126 typedef std::vector<Jet> JetCollection;
0127 void beginJob() override;
0128 void analyze(const edm::Event&, const edm::EventSetup&) override;
0129 void endJob() override;
0130
0131
0132 std::string fOutputFileName;
0133
0134
0135 std::string m_Mid5CorRecJetsSrc;
0136 std::string m_Mid5CaloJetsSrc;
0137
0138
0139 double m_eta3;
0140 double m_eta4;
0141
0142
0143 static const int hisotNumber = 10;
0144
0145 TH1F* hCalo[hisotNumber];
0146 TH1F* hCor[hisotNumber];
0147
0148
0149 TFile* hOutputFile;
0150 };
0151
0152 #endif