CMS 3D CMS Logo

JetAnalyzer_HeavyIons_matching.h
Go to the documentation of this file.
1 #ifndef JetAnalyzer_HeavyIons_matching_H
2 #define JetAnalyzer_HeavyIons_matching_H
3 
4 //
5 // Jet Tester class for heavy ion jets. for DQM jet analysis monitoring
6 // For CMSSW_7_5_X, especially reading background subtracted jets
7 // author: Raghav Kunnawalkam Elayavalli,
8 // April 6th 2015
9 // Rutgers University, email: raghav.k.e at CERN dot CH
10 //
11 // The logic for the matching is taken from Pawan Kumar Netrakanti's macro analysis level macro available here
12 // https://github.com/pawannetrakanti/UserCode/blob/master/JetRAA/jetmatch.C
13 //
14 
15 #include <memory>
16 #include <fstream>
22 
30 
39 
45 
46 // include the basic jet for the PuPF jets.
49 // include the pf candidates
51 // include the voronoi subtraction
54 // include the centrality variables
56 
63 
68 #include <map>
69 #include <string>
70 #include <vector>
71 #include <algorithm>
72 #include <set>
73 #include <utility>
74 
76 public:
79 
80  void analyze(const edm::Event &, const edm::EventSetup &) override;
81  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
82 
83  // calojet1token = vscalo
84  // calojet2token = pucalo
85 
86 private:
89 
96 
97  //Tokens
103 
109 
117 
123 
131 
137 
138  struct MyJet {
139  int id;
140  float pt;
141  float eta;
142  float phi;
143  };
144 
145  typedef std::pair<MyJet, MyJet> ABJetPair;
146 
149  bool operator()(const ABJetPair &A1, const ABJetPair &A2) const {
150  MyJet jet1_pair1 = A1.first;
151  MyJet jet2_pair1 = A1.second;
152  MyJet jet1_pair2 = A2.first;
153  MyJet jet2_pair2 = A2.second;
154  float delr1 = deltaRR(jet1_pair1.eta, jet1_pair1.phi, jet2_pair1.eta, jet2_pair1.phi);
155  float delr2 = deltaRR(jet1_pair2.eta, jet1_pair2.phi, jet2_pair2.eta, jet2_pair2.phi);
156 
157  return ((delr1 < delr2) && (jet1_pair1.pt > jet1_pair2.pt));
158  }
159  };
160 
161  typedef std::multiset<ABJetPair, CompareMatchedJets> ABMatchedJets;
162  typedef std::multiset<ABJetPair>::iterator ABItr;
163 
164  static float deltaRR(float eta1, float phi1, float eta2, float phi2) {
165  float deta = eta1 - eta2;
166  float dphi = fabs(phi1 - phi2);
167  if (dphi > M_PI)
168  dphi -= 2 * M_PI;
169  float dr = sqrt(deta * deta + dphi * dphi);
170  return dr;
171  }
172 };
173 
174 #endif
edm::EDGetTokenT< reco::PFJetCollection > pfJetsToken_
bool operator()(const ABJetPair &A1, const ABJetPair &A2) const
A-B jet match.
void analyze(const edm::Event &, const edm::EventSetup &) override
T sqrt(T t)
Definition: SSEVec.h:19
std::multiset< ABJetPair >::iterator ABItr
#define M_PI
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< reco::CaloJetCollection > caloJet1Token_
static float deltaRR(float eta1, float phi1, float eta2, float phi2)
JetAnalyzer_HeavyIons_matching(const edm::ParameterSet &)
edm::EDGetTokenT< reco::JPTJetCollection > jptJetsToken_
edm::EDGetTokenT< reco::CaloJetCollection > caloJet2Token_
std::multiset< ABJetPair, CompareMatchedJets > ABMatchedJets
Definition: Run.h:45
edm::EDGetTokenT< reco::BasicJetCollection > basicJetsToken_