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 
62 
67 #include <map>
68 #include <string>
69 #include <vector>
70 #include <algorithm>
71 #include <set>
72 #include <utility>
73 
75 public:
78 
79  void analyze(const edm::Event &, const edm::EventSetup &) override;
80  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
81 
82  // calojet1token = vscalo
83  // calojet2token = pucalo
84 
85 private:
88 
95 
96  //Tokens
102 
108 
116 
122 
130 
136 
137  struct MyJet {
138  int id;
139  float pt;
140  float eta;
141  float phi;
142  };
143 
144  typedef std::pair<MyJet, MyJet> ABJetPair;
145 
148  bool operator()(const ABJetPair &A1, const ABJetPair &A2) const {
149  MyJet jet1_pair1 = A1.first;
150  MyJet jet2_pair1 = A1.second;
151  MyJet jet1_pair2 = A2.first;
152  MyJet jet2_pair2 = A2.second;
153  float delr1 = deltaRR(jet1_pair1.eta, jet1_pair1.phi, jet2_pair1.eta, jet2_pair1.phi);
154  float delr2 = deltaRR(jet1_pair2.eta, jet1_pair2.phi, jet2_pair2.eta, jet2_pair2.phi);
155 
156  return ((delr1 < delr2) && (jet1_pair1.pt > jet1_pair2.pt));
157  }
158  };
159 
160  typedef std::multiset<ABJetPair, CompareMatchedJets> ABMatchedJets;
161  typedef std::multiset<ABJetPair>::iterator ABItr;
162 
163  static float deltaRR(float eta1, float phi1, float eta2, float phi2) {
164  float deta = eta1 - eta2;
165  float dphi = fabs(phi1 - phi2);
166  if (dphi > M_PI)
167  dphi -= 2 * M_PI;
168  float dr = sqrt(deta * deta + dphi * dphi);
169  return dr;
170  }
171 };
172 
173 #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:23
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_