File indexing completed on 2024-04-06 12:23:59
0001
0002
0003
0004
0005
0006 #include "DataFormats/FWLite/interface/Handle.h"
0007 #include "DataFormats/FWLite/interface/Event.h"
0008 #include "TFile.h"
0009 #include "TH1.h"
0010 #include "TCanvas.h"
0011 #include "TLegend.h"
0012
0013 #if !defined(__CINT__) && !defined(__MAKECINT__)
0014 #include "DataFormats/PatCandidates/interface/Jet.h"
0015 #include "PhysicsTools/SelectorUtils/interface/JetIDSelectionFunctor.h"
0016 #endif
0017
0018 #include <iostream>
0019 #include <cmath> //necessary for absolute function fabs()
0020
0021 using namespace std;
0022
0023 void sk_fwlitecuts() {
0024 JetIDSelectionFunctor jetId(JetIDSelectionFunctor::CRAFT08, JetIDSelectionFunctor::TIGHT);
0025
0026 TFile* file = new TFile("PATLayer1_Output.fromAOD_full.root");
0027 TH1D* hist_jetPt = new TH1D("hist_jetPt", "Jet p_{T}", 20, 0, 100);
0028 fwlite::Event ev(file);
0029
0030
0031 for (ev.toBegin(); !ev.atEnd(); ++ev) {
0032 fwlite::Handle<std::vector<pat::Jet> > h_mu;
0033 h_mu.getByLabel(ev, "cleanLayer1Jets");
0034 if (!h_mu.isValid())
0035 continue;
0036 vector<pat::Jet> const& jets = *h_mu;
0037
0038
0039 vector<pat::Jet>::const_iterator iter;
0040 for (iter = jets.begin(); iter != jets.end(); ++iter) {
0041 if ((iter->pt() > 30) && (fabs(iter->eta()) < 2.1)) {
0042 cout << "Passed kin" << endl;
0043 if (jetId(*iter)) {
0044 cout << "Passed ID" << endl;
0045 hist_jetPt->Fill(iter->pt());
0046 }
0047 }
0048
0049 }
0050 }
0051
0052 hist_jetPt->Draw();
0053 }