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>
24 
32 
41 
47 
48 // include the basic jet for the PuPF jets.
51 // include the pf candidates
53 // include the voronoi subtraction
56 // include the centrality variables
58 
65 
70 #include <map>
71 #include <string>
72 #include <vector>
73 #include <algorithm>
74 #include <set>
75 #include <utility>
76 
78 public:
81 
82  void analyze(const edm::Event &, const edm::EventSetup &) override;
83  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
84 
85  // calojet1token = vscalo
86  // calojet2token = pucalo
87 
88 private:
91 
98 
99  //Tokens
105 
111 
119 
125 
133 
139 
140  struct MyJet {
141  int id;
142  float pt;
143  float eta;
144  float phi;
145  };
146 
147  typedef std::pair<MyJet, MyJet> ABJetPair;
148 
151  bool operator()(const ABJetPair &A1, const ABJetPair &A2) const {
152  MyJet jet1_pair1 = A1.first;
153  MyJet jet2_pair1 = A1.second;
154  MyJet jet1_pair2 = A2.first;
155  MyJet jet2_pair2 = A2.second;
156  float delr1 = deltaRR(jet1_pair1.eta, jet1_pair1.phi, jet2_pair1.eta, jet2_pair1.phi);
157  float delr2 = deltaRR(jet1_pair2.eta, jet1_pair2.phi, jet2_pair2.eta, jet2_pair2.phi);
158 
159  return ((delr1 < delr2) && (jet1_pair1.pt > jet1_pair2.pt));
160  }
161  };
162 
163  typedef std::multiset<ABJetPair, CompareMatchedJets> ABMatchedJets;
164  typedef std::multiset<ABJetPair>::iterator ABItr;
165 
166  static float deltaRR(float eta1, float phi1, float eta2, float phi2) {
167  float deta = eta1 - eta2;
168  float dphi = fabs(phi1 - phi2);
169  if (dphi > M_PI)
170  dphi -= 2 * M_PI;
171  float dr = sqrt(deta * deta + dphi * dphi);
172  return dr;
173  }
174 };
175 
176 #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_