test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GammaJetAnalysis.cc
Go to the documentation of this file.
1 //
15 #include "TTree.h"
16 #include "TFile.h"
17 #include "TClonesArray.h"
18 #include <iostream>
19 #include <vector>
20 #include <set>
21 #include <map>
22 #include <boost/regex.hpp>
23 
24 inline void HERE(const char *msg) {
25  if (0 && msg) edm::LogWarning("GammaJetAnalysis") << msg;
26 }
27 
28 double getNeutralPVCorr(double eta, int intNPV, double area, bool isMC_) {
29  double NPV = static_cast<double>(intNPV);
30  double etaArray[101] = {-5, -4.9, -4.8, -4.7, -4.6, -4.5, -4.4, -4.3, -4.2, -4.1, -4, -3.9, -3.8, -3.7, -3.6, -3.5, -3.4, -3.3, -3.2, -3.1, -3, -2.9, -2.8, -2.7, -2.6, -2.5, -2.4, -2.3, -2.2, -2.1, -2, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5};
31  int ind = -1;
32  for(int i=0; i<100; ++i){
33  if(eta > etaArray[i] && eta < etaArray[i+1]){
34  ind = i;
35  break;
36  }
37  }
38  if(ind < 0) return 0;
39  double pt_density;
40  if(isMC_){
41  double p0[100] = {0.08187, 0.096718, 0.11565, 0.12115, 0.12511, 0.12554, 0.13858, 0.14282, 0.14302, 0.15054, 0.14136, 0.14992, 0.13812, 0.13771, 0.13165, 0.12609, 0.12446, 0.11311, 0.13771, 0.16401, 0.20454, 0.27899, 0.34242, 0.43096, 0.50742, 0.59683, 0.66877, 0.68664, 0.69541, 0.66873, 0.64175, 0.61097, 0.58524, 0.5712, 0.55752, 0.54869, 0.31073, 0.22667, 0.55614, 0.55962, 0.54348, 0.53206, 0.51594, 0.49928, 0.49139, 0.48766, 0.49157, 0.49587, 0.50109, 0.5058, 0.51279, 0.51515, 0.51849, 0.52607, 0.52362, 0.52169, 0.53579, 0.54821, 0.56262, 0.58355, 0.58809, 0.57525, 0.52539, 0.53505, 0.52307, 0.52616, 0.52678, 0.53536, 0.55141, 0.58107, 0.60556, 0.62601, 0.60897, 0.59018, 0.49593, 0.40462, 0.32052, 0.24436, 0.18867, 0.12591, 0.095421, 0.090578, 0.078767, 0.11797, 0.14057, 0.14614, 0.15232, 0.14742, 0.15647, 0.14947, 0.15805, 0.14467, 0.14526, 0.14081, 0.1262, 0.12429, 0.11951, 0.11146, 0.095677, 0.083126};
42  double p1[100] = {0.26831, 0.30901, 0.37017, 0.38747, 0.41547, 0.45237, 0.49963, 0.54074, 0.54949, 0.5937, 0.56904, 0.60766, 0.58042, 0.59823, 0.58535, 0.54594, 0.58403, 0.601, 0.65401, 0.65049, 0.65264, 0.6387, 0.60646, 0.59669, 0.55561, 0.5053, 0.42889, 0.37264, 0.36456, 0.36088, 0.36728, 0.37439, 0.38779, 0.40133, 0.40989, 0.41722, 0.47539, 0.49848, 0.42642, 0.42431, 0.42113, 0.41285, 0.41003, 0.41116, 0.41231, 0.41634, 0.41795, 0.41806, 0.41786, 0.41765, 0.41779, 0.41961, 0.42144, 0.42192, 0.4209, 0.41885, 0.4163, 0.4153, 0.41864, 0.4257, 0.43018, 0.43218, 0.43798, 0.42723, 0.42185, 0.41349, 0.40553, 0.39132, 0.3779, 0.37055, 0.36522, 0.37057, 0.38058, 0.43259, 0.51052, 0.55918, 0.60178, 0.60995, 0.64087, 0.65554, 0.65308, 0.65654, 0.60466, 0.58678, 0.54392, 0.58277, 0.59651, 0.57916, 0.60744, 0.56882, 0.59323, 0.5499, 0.54003, 0.49938, 0.4511, 0.41499, 0.38676, 0.36955, 0.30803, 0.26659};
43  double p2[100] = {0.00080918, 0.00083447, 0.0011378, 0.0011221, 0.0013613, 0.0016362, 0.0015854, 0.0019131, 0.0017474, 0.0020078, 0.001856, 0.0020331, 0.0020823, 0.001898, 0.0020096, 0.0016464, 0.0032413, 0.0045615, 0.0054495, 0.0057584, 0.0058982, 0.0058956, 0.0055109, 0.0051433, 0.0042098, 0.0032096, 0.00044089, -0.0003884, -0.0007059, -0.00092769, -0.001116, -0.0010437, -0.00080318, -0.00044142, 6.7232e-05, 0.00055265, -0.0014486, -0.0020432, 0.0015121, 0.0016343, 0.0015638, 0.0015707, 0.0014403, 0.0012886, 0.0011684, 0.00099089, 0.00091497, 0.00087915, 0.00084703, 0.00084542, 0.00087419, 0.00088013, 0.00090493, 0.00095853, 0.0010389, 0.0011191, 0.0012643, 0.0013833, 0.001474, 0.0015401, 0.0015582, 0.0014265, 0.00087453, 0.00086639, 0.00042986, -5.0257e-06, -0.00053124, -0.00086417, -0.0011228, -0.0011749, -0.0010068, -0.00083012, -0.00062906, 0.00021515, 0.0028714, 0.0038835, 0.0047212, 0.0051427, 0.0055762, 0.0055872, 0.0054989, 0.0053033, 0.0044519, 0.0032223, 0.0017641, 0.0021165, 0.0019909, 0.0021061, 0.0020322, 0.0018357, 0.0019829, 0.001683, 0.0018553, 0.0015304, 0.0015822, 0.0013119, 0.0010745, 0.0010808, 0.00080678, 0.00079756};
44  pt_density = p0[ind] + p1[ind]*(NPV - 1) + p2[ind]*(NPV - 1)*(NPV - 1);
45  }
46  else{
47  double p0[100] = {0.12523, 0.14896, 0.17696, 0.19376, 0.20038, 0.21353, 0.25069, 0.27089, 0.29124, 0.31947, 0.31781, 0.35453, 0.35424, 0.38159, 0.39453, 0.4003, 0.34798, 0.26303, 0.24824, 0.22857, 0.22609, 0.26793, 0.30096, 0.37637, 0.44461, 0.55692, 0.70328, 0.72458, 0.75065, 0.73569, 0.72485, 0.69933, 0.69804, 0.70775, 0.70965, 0.71439, 0.72189, 0.73691, 0.74847, 0.74968, 0.73467, 0.70115, 0.6732, 0.65971, 0.65724, 0.67751, 0.69569, 0.70905, 0.71815, 0.72119, 0.72128, 0.71645, 0.70588, 0.68958, 0.66978, 0.65959, 0.66889, 0.68713, 0.71063, 0.74283, 0.75153, 0.74733, 0.73335, 0.71346, 0.70168, 0.69445, 0.68841, 0.67761, 0.67654, 0.6957, 0.70276, 0.71057, 0.68176, 0.64651, 0.49156, 0.38366, 0.31375, 0.24127, 0.21395, 0.17783, 0.19026, 0.21486, 0.24689, 0.3434, 0.40184, 0.39876, 0.3873, 0.36462, 0.36337, 0.32777, 0.328, 0.29868, 0.28087, 0.25713, 0.22466, 0.20784, 0.19798, 0.18054, 0.15022, 0.12811};
48  double p1[100] = {0.26829, 0.30825, 0.37034, 0.38736, 0.41645, 0.45985, 0.51433, 0.56215, 0.5805, 0.63926, 0.62007, 0.67895, 0.66015, 0.68817, 0.67975, 0.64161, 0.70887, 0.74454, 0.80197, 0.78873, 0.77892, 0.74943, 0.70034, 0.6735, 0.60774, 0.53312, 0.42132, 0.36279, 0.3547, 0.35014, 0.35655, 0.3646, 0.37809, 0.38922, 0.39599, 0.40116, 0.40468, 0.40645, 0.40569, 0.4036, 0.39874, 0.39326, 0.39352, 0.39761, 0.40232, 0.40729, 0.41091, 0.41247, 0.413, 0.41283, 0.41289, 0.4134, 0.41322, 0.41185, 0.40769, 0.40193, 0.39707, 0.39254, 0.39274, 0.3989, 0.40474, 0.40758, 0.40788, 0.40667, 0.40433, 0.40013, 0.39371, 0.38154, 0.36723, 0.3583, 0.35148, 0.35556, 0.36172, 0.41073, 0.50629, 0.57068, 0.62972, 0.65188, 0.69954, 0.72967, 0.74333, 0.76148, 0.71418, 0.69062, 0.63065, 0.67117, 0.68278, 0.66028, 0.68147, 0.62494, 0.64452, 0.58685, 0.57076, 0.52387, 0.47132, 0.42637, 0.39554, 0.37989, 0.31825, 0.27969};
49  double p2[100] = {-0.0014595, -0.0014618, -0.0011988, -0.00095404, -5.3893e-05, 0.00018901, 0.00012553, 0.0004172, 0.00020229, 0.00051942, 0.00052088, 0.00076727, 0.0010407, 0.0010184, 0.0013442, 0.0011271, 0.0032841, 0.0045259, 0.0051803, 0.0054477, 0.0055691, 0.0056668, 0.0053084, 0.0050978, 0.0042061, 0.003321, 0.00045155, 0.00021376, 0.0001178, -2.6836e-05, -0.00017689, -0.00014723, 0.00016887, 0.00067322, 0.0012952, 0.0019229, 0.0024702, 0.0028854, 0.0031576, 0.003284, 0.0032643, 0.0031061, 0.0028377, 0.0025386, 0.0022583, 0.0020448, 0.001888, 0.0017968, 0.0017286, 0.0016989, 0.0017014, 0.0017302, 0.0017958, 0.0018891, 0.0020609, 0.0022876, 0.0025391, 0.0028109, 0.0030294, 0.0031867, 0.0032068, 0.0030755, 0.0028181, 0.0023893, 0.0018359, 0.0012192, 0.00061654, 0.00016088, -0.00015204, -0.00019503, -3.7236e-05, 0.00016663, 0.00033833, 0.00082988, 0.0034005, 0.0042941, 0.0050884, 0.0052612, 0.0055901, 0.0054357, 0.0052671, 0.0049174, 0.0042236, 0.0031138, 0.0011733, 0.0014057, 0.0010843, 0.0010992, 0.0007966, 0.00052196, 0.00053029, 0.00021273, 0.00041664, 0.00010455, 0.00015173, -9.7827e-05, -0.0010859, -0.0013748, -0.0016641, -0.0016887};
50  pt_density = p0[ind] + p1[ind]*(NPV - 1) + p2[ind]*(NPV - 1)*(NPV - 1);
51  }
52  double ECorr = pt_density*area*cosh(eta);
53  return ECorr;
54 }
55 
56 // -------------------------------------------------
57 
58 inline
59 unsigned int helper_findTrigger(const std::vector<std::string>& list,
60  const std::string& name)
61 {
62  boost::regex re(std::string("^(")+name+"|"+name+"_v\\d*)$");
63  for (unsigned int i = 0,n = list.size() ; i < n ; ++i) {
64  if(boost::regex_match(list[i],re)) return i;
65  }
66  return list.size();
67 }
68 
69 // -------------------------------------------------
70 
72  hltPrescaleProvider_(iConfig, consumesCollector(), *this) {
73 
74  // set parameters
75  debug_ = iConfig.getUntrackedParameter<int>("debug", 0);
76  debugHLTTrigNames = iConfig.getUntrackedParameter<int>("debugHLTTrigNames",1);
77  debugEvent = iConfig.getUntrackedParameter<unsigned int>("debugEvent",0);
78  pfMETColl = iConfig.getParameter<edm::InputTag>("PFMETColl");
79  pfType1METColl = iConfig.getParameter<edm::InputTag>("PFMETTYPE1Coll");
80  rhoCollection_ = iConfig.getParameter<edm::InputTag>("rhoColl");
81  photonCollName_ = iConfig.getParameter<std::string>("photonCollName");
82  pfJetCollName_ = iConfig.getParameter<std::string>("pfJetCollName");
83  pfJetCorrName_ = iConfig.getParameter<std::string>("pfJetCorrName");
84  genJetCollName_ = iConfig.getParameter<std::string>("genJetCollName");
85  genParticleCollName_ = iConfig.getParameter<std::string>("genParticleCollName");
86  genEventInfoName_ = iConfig.getParameter<std::string>("genEventInfoName");
87  hbheRecHitName_ = iConfig.getParameter<std::string>("hbheRecHitName");
88  hfRecHitName_ = iConfig.getParameter<std::string>("hfRecHitName");
89  hoRecHitName_ = iConfig.getParameter<std::string>("hoRecHitName");
90  rootHistFilename_ = iConfig.getParameter<std::string>("rootHistFilename");
91  pvCollName_ = iConfig.getParameter<std::string>("pvCollName");
92  prodProcess_ = "MYGAMMA";
93  if (iConfig.exists("prodProcess"))
94  prodProcess_ = iConfig.getUntrackedParameter<std::string>("prodProcess");
95 
96  allowNoPhoton_ = iConfig.getParameter<bool>("allowNoPhoton");
97  photonPtMin_ = iConfig.getParameter<double>("photonPtMin");
98  photonJetDPhiMin_ = iConfig.getParameter<double>("photonJetDPhiMin");
99  jetEtMin_ = iConfig.getParameter<double>("jetEtMin");
100  jet2EtMax_ = iConfig.getParameter<double>("jet2EtMax");
101  jet3EtMax_ = iConfig.getParameter<double>("jet3EtMax");
102  photonTrigNamesV_ = iConfig.getParameter<std::vector<std::string>>("photonTriggers");
103  jetTrigNamesV_ = iConfig.getParameter<std::vector<std::string>>("jetTriggers");
104  writeTriggerPrescale_= iConfig.getParameter<bool>("writeTriggerPrescale");
105  doPFJets_ = iConfig.getParameter<bool>("doPFJets");
106  doGenJets_ = iConfig.getParameter<bool>("doGenJets");
107  workOnAOD_ = iConfig.getParameter<int>("workOnAOD");
108  ignoreHLT_ = iConfig.getUntrackedParameter<bool>("ignoreHLT",false);
109 
110  eventWeight_ = 1.0;
111  eventPtHat_ = 0.;
112  nProcessed_ = 0;
113 
114  //Get the tokens
115  // FAST FIX
116  if (workOnAOD_ < 2) { // origin data file
117  tok_Photon_ = consumes<reco::PhotonCollection>(photonCollName_);
118  tok_PFJet_ = consumes<reco::PFJetCollection>(pfJetCollName_);
119  tok_GenJet_ = consumes<std::vector<reco::GenJet> >(genJetCollName_);
120  tok_GenPart_ = consumes<std::vector<reco::GenParticle> >(genParticleCollName_);
121  tok_GenEvInfo_ = consumes<GenEventInfoProduct>(genEventInfoName_);
122  tok_HBHE_ = consumes<edm::SortedCollection<HBHERecHit,edm::StrictWeakOrdering<HBHERecHit> > >(hbheRecHitName_);
123  tok_HF_ = consumes<edm::SortedCollection<HFRecHit,edm::StrictWeakOrdering<HFRecHit> > >(hfRecHitName_);
124  tok_HO_ = consumes<edm::SortedCollection<HORecHit,edm::StrictWeakOrdering<HORecHit> > >(hoRecHitName_);
125  tok_loosePhoton_ = consumes<edm::ValueMap<Bool_t> >(edm::InputTag("PhotonIDProdGED","PhotonCutBasedIDLoose"));
126  tok_tightPhoton_ = consumes<edm::ValueMap<Bool_t> >(edm::InputTag("PhotonIDProdGED:PhotonCutBasedIDTight"));
127  tok_PFCand_ = consumes<reco::PFCandidateCollection>(edm::InputTag("particleFlow"));
128  tok_Vertex_ = consumes<reco::VertexCollection>(edm::InputTag("offlinePrimaryVertices"));
129  tok_GsfElec_ = consumes<reco::GsfElectronCollection>(edm::InputTag("gsfElectrons"));
130  tok_Rho_ = consumes<double>(rhoCollection_);
131  tok_Conv_ = consumes<reco::ConversionCollection>(edm::InputTag("allConversions"));
132  tok_BS_ = consumes<reco::BeamSpot>(edm::InputTag("offlineBeamSpot"));
133  tok_PV_ = consumes<std::vector<reco::Vertex> >(pvCollName_);
134  tok_PFMET_ = consumes<reco::PFMETCollection>(pfMETColl);
135  tok_PFType1MET_ = consumes<reco::PFMETCollection>(pfType1METColl);
136  tok_TrigRes_ = consumes<edm::TriggerResults>(edm::InputTag("TriggerResults::HLT"));
137 
138  } else {
139  // FAST FIX
140  const char* prod= "GammaJetProd";
141  if (prodProcess_.size()==0) {
142  edm::LogError("GammaJetAnalysis") << "prodProcess needs to be defined";
144  }
145  const char* an= prodProcess_.c_str();
146  edm::LogWarning("GammaJetAnalysis") << "FAST FIX: changing " << photonCollName_
147  << " to" << edm::InputTag(prod,photonCollName_,an);
148  tok_Photon_ = consumes<reco::PhotonCollection>(edm::InputTag(prod,photonCollName_,an));
149  tok_PFJet_ = consumes<reco::PFJetCollection>(edm::InputTag(prod,pfJetCollName_,an));
150  tok_GenJet_ = consumes<std::vector<reco::GenJet> >(edm::InputTag(prod,genJetCollName_,an));
151  tok_GenPart_ = consumes<std::vector<reco::GenParticle> >(edm::InputTag(prod,genParticleCollName_,an));
152  tok_GenEvInfo_ = consumes<GenEventInfoProduct>(edm::InputTag(prod,genEventInfoName_,an));
153  tok_HBHE_ = consumes<edm::SortedCollection<HBHERecHit,edm::StrictWeakOrdering<HBHERecHit> > >(edm::InputTag(prod,hbheRecHitName_,an));
154  tok_HF_ = consumes<edm::SortedCollection<HFRecHit,edm::StrictWeakOrdering<HFRecHit> > >(edm::InputTag(prod,hfRecHitName_,an));
155  tok_HO_ = consumes<edm::SortedCollection<HORecHit,edm::StrictWeakOrdering<HORecHit> > >(edm::InputTag(prod,hoRecHitName_,an));
156  //tok_loosePhoton_ = consumes<edm::ValueMap<Bool_t> >(edm::InputTag("PhotonIDProdGED","PhotonCutBasedIDLoose"));
157  //tok_tightPhoton_ = consumes<edm::ValueMap<Bool_t> >(edm::InputTag("PhotonIDProdGED:PhotonCutBasedIDTight"));
158  tok_loosePhotonV_ = consumes<std::vector<Bool_t> >(edm::InputTag(prod,"PhotonIDProdGED:PhotonCutBasedIDLoose",an));
159  tok_tightPhotonV_ = consumes<std::vector<Bool_t> >(edm::InputTag(prod,"PhotonIDProdGED:PhotonCutBasedIDTight",an));
160  tok_PFCand_ = consumes<reco::PFCandidateCollection>(edm::InputTag(prod,"particleFlow",an));
161  tok_Vertex_ = consumes<reco::VertexCollection>(edm::InputTag(prod,"offlinePrimaryVertices",an));
162  tok_GsfElec_ = consumes<reco::GsfElectronCollection>(edm::InputTag(prod,"gedGsfElectrons",an));
163  tok_Rho_ = consumes<double>(edm::InputTag(prod,rhoCollection_.label(),an));
164  tok_Conv_ = consumes<reco::ConversionCollection>(edm::InputTag(prod,"allConversions",an));
165  tok_BS_ = consumes<reco::BeamSpot>(edm::InputTag(prod,"offlineBeamSpot",an));
166  tok_PV_ = consumes<std::vector<reco::Vertex> >(edm::InputTag(prod,pvCollName_,an));
167  tok_PFMET_ = consumes<reco::PFMETCollection>(edm::InputTag(prod,pfMETColl.label(),an));
168  tok_PFType1MET_ = consumes<reco::PFMETCollection>(edm::InputTag(prod,pfType1METColl.label(),an));
169  TString HLTlabel = "TriggerResults::HLT";
170  if (prodProcess_.find("reRECO")!=std::string::npos)
171  HLTlabel.ReplaceAll("HLT","reHLT");
172  tok_TrigRes_ = consumes<edm::TriggerResults>(edm::InputTag(prod,HLTlabel.Data(),an));
173  }
174 }
175 
177 
178 //
179 // member functions
180 //
181 
182 // ------------ method called to for each event ------------
184  nProcessed_++;
185 
186  edm::LogInfo("GammaJetAnalysis") << "nProcessed=" << nProcessed_ << "\n";
187 
188  // 1st. Get Photons //
190  iEvent.getByToken(tok_Photon_, photons);
191  if(!photons.isValid()) {
192  edm::LogWarning("GammaJetAnalysis") << "Could not find PhotonCollection named "
193  << photonCollName_;
194  return;
195  }
196 
197  if ((photons->size()==0) && !allowNoPhoton_) {
198  if (debug_>0) edm::LogInfo("GammaJetAnalysis") << "No photons in the event";
199  return;
200  }
201 
202  nPhotons_= photons->size();
203  edm::LogInfo("GammaJetAnalysis") << "nPhotons_=" << nPhotons_;
204 
205  // Get photon quality flags
206  edm::Handle<edm::ValueMap<Bool_t> > loosePhotonQual, tightPhotonQual;
207  edm::Handle<std::vector<Bool_t> > loosePhotonQual_Vec, tightPhotonQual_Vec;
208  if (workOnAOD_ < 2) {
209  iEvent.getByToken(tok_loosePhoton_, loosePhotonQual);
210  iEvent.getByToken(tok_tightPhoton_, tightPhotonQual);
211  if (!loosePhotonQual.isValid() || !tightPhotonQual.isValid()) {
212  edm::LogWarning("GammaJetAnalysis") << "Failed to get photon quality flags";
213  return;
214  }
215  }
216  else {
217  iEvent.getByToken(tok_loosePhotonV_, loosePhotonQual_Vec);
218  iEvent.getByToken(tok_tightPhotonV_, tightPhotonQual_Vec);
219  if (!loosePhotonQual_Vec.isValid() || !tightPhotonQual_Vec.isValid()) {
220  edm::LogWarning("GammaJetAnalysis") << "Failed to get photon quality flags (vec)";
221  return;
222  }
223  }
224 
225  // sort photons by Et //
226  // counter is needed later to get the reference to the ptr
227  std::set<PhotonPair, PhotonPairComp> photonpairset;
228  int counter=0;
229  for(reco::PhotonCollection::const_iterator it=photons->begin(); it!=photons->end(); ++it) {
230  //HERE(Form("photon counter=%d",counter));
231  const reco::Photon* photon=&(*it);
232  //if(loosePhotonQual.isValid()){
233  photonpairset.insert( PhotonPair(photon, photon->pt(), counter) );
234  counter++;
235  //}
236  }
237 
238  HERE(Form("photonpairset.size=%d",int(photonpairset.size())));
239 
240  if ((photonpairset.size()==0) && !allowNoPhoton_) {
241  if (debug_>0) edm::LogInfo("GammaJetAnalysis") << "No good quality photons in the event";
242  return;
243  }
244 
246  // TAG = Highest Et photon
248 
249  // find highest Et photon //
250  PhotonPair photon_tag;
251  PhotonPair photon_2nd;
252  counter=0;
253  for(std::set<PhotonPair, PhotonPairComp>::const_iterator it=photonpairset.begin(); it!=photonpairset.end(); ++it) {
254  PhotonPair photon=(*it);
255  ++counter;
256  if(counter==1) photon_tag = photon;
257  else if (counter==2) photon_2nd = photon;
258  else break;
259  }
260 
261  if (counter==0) {
262  edm::LogWarning("GammaJetAnalysis") << "Code bug";
263  return;
264  }
265 
266  HERE(Form("counter=%d",counter));
267 
268  // cut on photon pt
269  if (photon_tag.isValid() && ( photon_tag.pt() < photonPtMin_ )) {
270  if (debug_>0) edm::LogInfo("GammaJetAnalysis") << "largest photonPt=" << photon_tag.pt();
271  return;
272  }
273 
274  HERE("aa");
275 
276  // 2nd. Get Jets
278  nPFJets_=0;
279  nGenJets_=0;
280 
281  unsigned int anyJetCount=0;
282 
283  if (doPFJets_) {
284  iEvent.getByToken(tok_PFJet_,pfjets);
285  if(!pfjets.isValid()) {
286  edm::LogWarning("GammaJetAnalysis") << "Could not find PFJetCollection named " << pfJetCollName_;
287  return;
288  }
289  anyJetCount+= pfjets->size();
290  nPFJets_ = pfjets->size();
291  }
292 
293  HERE(Form("anyJetCount=%d",anyJetCount));
294 
295  if (anyJetCount==0) {
296  if (debug_>0) edm::LogInfo("GammaJetAnalysis") << "Event contains no jets";
297  return;
298  }
299  if (debug_>0) edm::LogInfo("GammaJetAnalysis") << "nPhotons=" << nPhotons_
300  << ", nPFJets=" << nPFJets_;
301 
302  HERE(Form("nPhotons_=%d, nPFJets_=%d",nPhotons_,nPFJets_));
303 
304  // 3rd. Check the trigger
305  photonTrigFired_.clear();
306  photonTrigPrescale_.clear();
307  jetTrigFired_.clear();
308  jetTrigPrescale_.clear();
309 
310  HERE("trigger");
311 
312  // HLT Trigger
313  // assign "trig fired" if no triggers are specified
314  bool photonTrigFlag= (photonTrigNamesV_.size()==0) ? true : false;
315  bool jetTrigFlag= (jetTrigNamesV_.size()==0) ? true : false;
316  if ((photonTrigNamesV_.size()==1) &&
317  (photonTrigNamesV_[0].length()==0)) photonTrigFlag=true;
318  if ((jetTrigNamesV_.size()==1) &&
319  (jetTrigNamesV_[0].length()==0)) jetTrigFlag=true;
320 
321  // If needed, process trigger information
322  if (!photonTrigFlag || !jetTrigFlag) {
323  // check the triggers
325  if( !iEvent.getByToken(tok_TrigRes_,triggerResults) ) {
326  edm::LogWarning("GammaJetAnalysis") << "Could not find TriggerResults::HLT";
327  return;
328  }
329  const edm::TriggerNames &evTrigNames =iEvent.triggerNames(*triggerResults);
330 
331  if (debugHLTTrigNames>0) {
332  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "debugHLTTrigNames is on";
333  const std::vector<std::string> *trNames= & evTrigNames.triggerNames();
334  for (size_t i=0; i<trNames->size(); ++i) {
335  if (trNames->at(i).find("_Photon")!=std::string::npos) {
336  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << " - " << trNames->at(i);
337  }
338  }
339  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << " ";
341  }
342 
343  size_t id = 0;
344  for (size_t i=0; i<photonTrigNamesV_.size(); ++i) {
345  const std::string trigName=photonTrigNamesV_.at(i);
346  id= helper_findTrigger(evTrigNames.triggerNames(),trigName);
347  if (id==evTrigNames.size()) {
348  photonTrigFired_.push_back(0);
349  photonTrigPrescale_.push_back(-1);
350  continue;
351  }
352  int fired= triggerResults->accept(id);
353  if (fired) photonTrigFlag=true;
354  photonTrigFired_.push_back(fired);
355  if (!writeTriggerPrescale_) photonTrigPrescale_.push_back(-1);
356  else {
357  // for triggers with two L1 seeds this fails
358  std::pair<int,int> prescaleVals= hltPrescaleProvider_.prescaleValues(iEvent,evSetup, evTrigNames.triggerName(id));
359  photonTrigPrescale_.push_back(prescaleVals.first * prescaleVals.second);
360  }
361  }
362  for (size_t i=0; i<jetTrigNamesV_.size(); ++i) {
363  const std::string trigName=jetTrigNamesV_.at(i);
364  id= helper_findTrigger(evTrigNames.triggerNames(),trigName);
365  if (id==evTrigNames.size()) {
366  jetTrigFired_.push_back(0);
367  jetTrigPrescale_.push_back(-1);
368  continue;
369  }
370  int fired= triggerResults->accept(id);
371  if (fired) jetTrigFlag=true;
372  jetTrigFired_.push_back(fired);
373  std::pair<int,int> prescaleVals = hltPrescaleProvider_.prescaleValues(iEvent,evSetup,evTrigNames.triggerName(id));
374  jetTrigPrescale_.push_back(prescaleVals.first * prescaleVals.second);
375  }
376  }
377 
378  if (!photonTrigFlag && !jetTrigFlag) {
379  if (debug_>0) edm::LogInfo("GammaJetAnalysis") << "no trigger fired";
380  return;
381  }
382 
383  HERE("start isolation");
384 
385  tagPho_pfiso_mycharged03.clear();
386 
390  iEvent.getByToken(tok_PFCand_, pfHandle);
391 
393  iEvent.getByToken(tok_Vertex_, vtxHandle);
394 
396  iEvent.getByToken(tok_GsfElec_, gsfElectronHandle);
397  edm::Handle<double> rhoHandle_2012;
398  iEvent.getByToken(tok_Rho_, rhoHandle_2012);
399  rho2012_ = *(rhoHandle_2012.product());
400  //rho2012_ = -1e6;
401 
403  iEvent.getByToken(tok_Conv_, convH);
404  edm::Handle<reco::BeamSpot> beamSpotHandle;
405  iEvent.getByToken(tok_BS_, beamSpotHandle);
406 
407  HERE("doGenJets");
408 
409  if(doGenJets_){
410  // Get GenJets
411  iEvent.getByToken(tok_GenJet_,genjets);
412  if(!genjets.isValid()) {
413  edm::LogWarning("GammaJetAnalysis") << "Could not find GenJet vector named "
414  << genJetCollName_;
415  return;
416  }
417  nGenJets_= genjets->size();
418 
419  // Get GenParticles
420  iEvent.getByToken(tok_GenPart_,genparticles);
421  if(!genparticles.isValid()) {
422  edm::LogWarning("GammaJetAnalysis") << "Could not find GenParticle vector named " << genParticleCollName_;
423  return;
424  }
425 
426  // Get weights
427  edm::Handle<GenEventInfoProduct> genEventInfoProduct;
428  iEvent.getByToken(tok_GenEvInfo_, genEventInfoProduct);
429  if(!genEventInfoProduct.isValid()){
430  edm::LogWarning("GammaJetAnalysis") << "Could not find GenEventInfoProduct named " << genEventInfoName_;
431  return;
432  }
433  eventWeight_ = genEventInfoProduct->weight();
434  eventPtHat_ = 0.;
435  if (genEventInfoProduct->hasBinningValues()) {
436  eventPtHat_ = genEventInfoProduct->binningValues()[0];
437  }
438  }
439 
440  runNumber_ = iEvent.id().run();
441  lumiBlock_ = iEvent.id().luminosityBlock();
442  eventNumber_ = iEvent.id().event();
443 
444  HERE(Form("runNumber=%d, eventNumber=%d",runNumber_,eventNumber_));
445 
446  // fill tag photon variables
447  if (!photon_tag.isValid()) {
448  tagPho_pt_=-1;
449  pho_2nd_pt_=-1;
450  tagPho_energy_=-1;
451  tagPho_eta_=0;
452  tagPho_phi_=0;
453  tagPho_sieie_=0;
454  tagPho_HoE_=0;
455  tagPho_r9_=0;
462  tagPho_pfiso_mycharged03.clear();
465  tagPho_idTight_=0;
466  tagPho_idLoose_=0;
467  tagPho_genPt_=0;
469  tagPho_genEta_=0;
470  tagPho_genPhi_=0;
472  }
473  else {
474  HERE("bb");
475 
476  tagPho_pt_ = photon_tag.photon()->pt();
477  pho_2nd_pt_ = (photon_2nd.photon()) ? photon_2nd.photon()->pt() : -1.;
478  tagPho_energy_ = photon_tag.photon()->energy();
479  tagPho_eta_ = photon_tag.photon()->eta();
480  tagPho_phi_ = photon_tag.photon()->phi();
481  tagPho_sieie_ = photon_tag.photon()->sigmaIetaIeta();
482  tagPho_HoE_ = photon_tag.photon()->hadTowOverEm();
483  tagPho_r9_ = photon_tag.photon()->r9();
484  tagPho_pixelSeed_ = photon_tag.photon()->hasPixelSeed();
488  tagPho_HcalIsoDR0412_ = photon_tag.photon()->hcalTowerSumEtConeDR04() + (photon_tag.photon()->hadronicOverEm() - photon_tag.photon()->hadTowOverEm())*(photon_tag.photon()->energy()/cosh((photon_tag.photon()->eta())));
489 
490  HERE("tt");
491 
492  tagPho_pfiso_myphoton03_ = pfEcalIso(photon_tag.photon(), pfHandle, 0.3, 0.0, 0.070, 0.015, 0.0, 0.0, 0.0, reco::PFCandidate::gamma);
493  tagPho_pfiso_myneutral03_ = pfHcalIso(photon_tag.photon(), pfHandle, 0.3, 0.0, reco::PFCandidate::h0);
494  HERE("calc charged pfiso");
495  tagPho_pfiso_mycharged03.push_back(pfTkIsoWithVertex(photon_tag.photon(), pfHandle, vtxHandle, 0.3, 0.02, 0.02, 0.0, 0.2, 0.1, reco::PFCandidate::h));
496 
497  HERE("got isolation");
498 
499  //tagPho_ConvSafeEleVeto_ = ((int)ConversionTools::hasMatchedPromptElectron(photon_tag.photon()->superCluster(), gsfElectronHandle, convH, beamSpotHandle->position()));
501 
502  HERE("get id");
503  if (workOnAOD_ < 2) {
504  HERE(Form("workOnAOD_<2. loose photon qual size=%d",int(loosePhotonQual->size())));
505 
506  edm::Ref<reco::PhotonCollection> photonRef(photons, photon_tag.idx());
507  HERE(Form("got photon ref, photon_tag.idx()=%d",photon_tag.idx()));
508 
509  //std::cout << "loosePhotonQual->at(photon_tag.idx())=" << loosePhotonQual->at(photon_tag.idx()) << std::endl;
510 
511  tagPho_idLoose_ = (loosePhotonQual.isValid()) ? (*loosePhotonQual)[photonRef] : -1;
512  tagPho_idTight_ = (tightPhotonQual.isValid()) ? (*tightPhotonQual)[photonRef] : -1;
513  }
514  else {
515  tagPho_idLoose_ = (loosePhotonQual_Vec.isValid()) ? loosePhotonQual_Vec->at(photon_tag.idx()) : -1;
516  tagPho_idTight_ = (tightPhotonQual_Vec.isValid()) ? tightPhotonQual_Vec->at(photon_tag.idx()) : -1;
517  }
518 
519  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "photon tag ID = "
520  << tagPho_idLoose_ << " and "
521  << tagPho_idTight_;
522 
523  HERE(Form("tagPhoID= %d and %d",tagPho_idLoose_,tagPho_idTight_));
524 
525  HERE("reset pho gen");
526 
527  tagPho_genPt_=0;
529  tagPho_genEta_=0;
530  tagPho_genPhi_=0;
532  if (doGenJets_) {
533  tagPho_genDeltaR_=9999.;
534  for (std::vector<reco::GenParticle>::const_iterator itmc=genparticles->begin();
535  itmc!=genparticles->end(); itmc++) {
536  if (itmc->status() == 1 && itmc->pdgId()==22) {
538  itmc->eta(),itmc->phi());
539  if (dR < tagPho_genDeltaR_) {
540  tagPho_genPt_ = itmc->pt();
541  tagPho_genEnergy_ = itmc->energy();
542  tagPho_genEta_ = itmc->eta();
543  tagPho_genPhi_ = itmc->phi();
545  }
546  }
547  }
548  }
549  }
550 
551  HERE("run over PFJets");
552 
553  // Run over PFJets //
554 
555  if(doPFJets_ && (nPFJets_>0)){
556 
557  // Get RecHits in HB and HE
559  iEvent.getByToken(tok_HBHE_,hbhereco);
560  if(!hbhereco.isValid() && !workOnAOD_) {
561  edm::LogWarning("GammaJetAnalysis") << "Could not find HBHERecHit named "
562  << hbheRecHitName_;
563  return;
564  }
565 
566  // Get RecHits in HF
568  iEvent.getByToken(tok_HF_,hfreco);
569  if(!hfreco.isValid() && !workOnAOD_) {
570  edm::LogWarning("GammaJetAnalysis") << "Could not find HFRecHit named "
571  << hfRecHitName_;
572  return;
573  }
574 
575  // Get RecHits in HO
577  iEvent.getByToken(tok_HO_,horeco);
578  if(!horeco.isValid() && !workOnAOD_) {
579  edm::LogWarning("GammaJetAnalysis") << "Could not find HORecHit named "
580  << hoRecHitName_;
581  return;
582  }
583 
584  HERE("get geometry");
585 
586  // Get geometry
587  edm::ESHandle<CaloGeometry> geoHandle;
588  evSetup.get<CaloGeometryRecord>().get(geoHandle);
589  const CaloSubdetectorGeometry *HBGeom = geoHandle->getSubdetectorGeometry(DetId::Hcal, 1);
590  const CaloSubdetectorGeometry *HEGeom = geoHandle->getSubdetectorGeometry(DetId::Hcal, 2);
591  const CaloSubdetectorGeometry *HOGeom = geoHandle->getSubdetectorGeometry(DetId::Hcal, 3);
592  const CaloSubdetectorGeometry *HFGeom = geoHandle->getSubdetectorGeometry(DetId::Hcal, 4);
593 
594  HERE("work");
595 
596  int HBHE_n = 0;
597  if (hbhereco.isValid()) {
598  for(edm::SortedCollection<HBHERecHit,edm::StrictWeakOrdering<HBHERecHit>>::const_iterator ith=hbhereco->begin(); ith!=hbhereco->end(); ++ith){
599  HBHE_n++;
600  if(iEvent.id().event() == debugEvent){
601  if (debug_>1)
602  edm::LogInfo("GammaJetAnalysis") << (*ith).id().ieta() << " "
603  << (*ith).id().iphi();
604  }
605  }
606  }
607  int HF_n = 0;
608  if (hfreco.isValid()) {
609  for(edm::SortedCollection<HFRecHit,edm::StrictWeakOrdering<HFRecHit>>::const_iterator ith=hfreco->begin(); ith!=hfreco->end(); ++ith){
610  HF_n++;
611  if(iEvent.id().event() == debugEvent){
612  }
613  }
614  }
615  int HO_n = 0;
616  if (horeco.isValid()) {
617  for(edm::SortedCollection<HORecHit,edm::StrictWeakOrdering<HORecHit>>::const_iterator ith=horeco->begin(); ith!=horeco->end(); ++ith){
618  HO_n++;
619  if(iEvent.id().event() == debugEvent){
620  }
621  }
622  }
623 
624  HERE("Get primary vertices");
625 
626  // Get primary vertices
628  iEvent.getByToken(tok_PV_,pv);
629  if(!pv.isValid()) {
630  edm::LogWarning("GammaJetAnalysis") << "Could not find Vertex named "
631  << pvCollName_;
632  return;
633  }
634  pf_NPV_ = 0;
635  for(std::vector<reco::Vertex>::const_iterator it=pv->begin(); it!=pv->end(); ++it){
636  if(!it->isFake() && it->ndof() > 4) ++pf_NPV_;
637  }
638 
639  HERE("get corrector");
640 
641  // Get jet corrections
642  const JetCorrector* correctorPF = JetCorrector::getJetCorrector(pfJetCorrName_,evSetup);
643 
644  // sort jets by corrected et
645  std::set<PFJetCorretPair, PFJetCorretPairComp> pfjetcorretpairset;
646  for(reco::PFJetCollection::const_iterator it=pfjets->begin(); it!=pfjets->end(); ++it) {
647  const reco::PFJet* jet=&(*it);
648  // do not let the jet to be close to the tag photon
649  if (deltaR(photon_tag,jet)<0.5) continue;
650  double jec = correctorPF->correction(*it, iEvent, evSetup);
651  pfjetcorretpairset.insert( PFJetCorretPair(jet, jec));
652  }
653 
654  PFJetCorretPair pfjet_probe;
655  PFJetCorretPair pf_2ndjet;
656  PFJetCorretPair pf_3rdjet;
657  int jet_cntr=0;
658  for(std::set<PFJetCorretPair, PFJetCorretPairComp>::const_iterator it=pfjetcorretpairset.begin(); it!=pfjetcorretpairset.end(); ++it) {
659  PFJetCorretPair jet=(*it);
660  ++jet_cntr;
661  if(jet_cntr==1) pfjet_probe = jet;
662  else if(jet_cntr==2) pf_2ndjet = jet;
663  else if(jet_cntr==3) pf_3rdjet = jet;
664  //else break; // don't break for the statistics
665  }
666 
667  HERE("reached selection");
668 
669  // Check selection
670  int failSelPF = 0;
671 
672  if (!pfjet_probe.isValid()) failSelPF |= 1;
673  else {
674  if (pfjet_probe.scaledEt() < jetEtMin_) failSelPF |= 2;
675  if (calc_dPhi(photon_tag,pfjet_probe) < photonJetDPhiMin_) failSelPF |= 3;
676  if (deltaR(photon_tag,pfjet_probe.jet())<0.5) failSelPF |= 4;
677  if (pf_2ndjet.isValid() && (pf_2ndjet.scaledEt() > jet2EtMax_))
678  failSelPF |= 5;
679  if (pf_3rdjet.isValid() && (pf_3rdjet.scaledEt() > jet3EtMax_))
680  failSelPF |= 6;
681  }
682 
683  if (!failSelPF) {
684  // put values into 3rd jet quantities
685  if (pf_3rdjet.isValid()) {
686  pf_thirdjet_et_ = pf_3rdjet.jet()->et();
687  pf_thirdjet_pt_ = pf_3rdjet.jet()->pt();
688  pf_thirdjet_p_ = pf_3rdjet.jet()->p();
689  pf_thirdjet_px_ = pf_3rdjet.jet()->px();
690  pf_thirdjet_py_ = pf_3rdjet.jet()->py();
691  pf_thirdjet_E_ = pf_3rdjet.jet()->energy();
692  pf_thirdjet_eta_= pf_3rdjet.jet()->eta();
693  pf_thirdjet_phi_= pf_3rdjet.jet()->phi();
694  pf_thirdjet_scale_= pf_3rdjet.scale();
695  }
696  else {
697  pf_thirdjet_et_ = 0;
702  }
703 
704  HERE("fill PF jet");
705 
706  int types = 0;
707  int ntypes = 0;
708 
710  // Get PF constituents and fill HCAL towers
712 
713  // fill jet variables
714  // First start from a second jet, then fill the first jet
715  PFJetCorretPair pfjet_probe_store = pfjet_probe;
716  for (int iJet=2; iJet>0; iJet--) {
717  // prepare the container
719 
720  if (iJet==2) pfjet_probe= pf_2ndjet;
721  else pfjet_probe = pfjet_probe_store;
722 
723  if(!pfjet_probe.jet()) {
724  if (iJet==2) {
725  // put zeros into 2nd jet quantities
727  } else {
728  edm::LogWarning("GammaJetAnalysis") << "error in the code: leading pf jet is null";
729  }
730  continue;
731  }
732 
733  HERE("work further");
734 
735  // temporary variables
736  std::map<int,std::pair<int,std::set<float>>> ppfjet_rechits;
737  std::map<float,int> ppfjet_clusters;
738 
739  // fill the values
740  ppfjet_pt_ = pfjet_probe.jet()->pt();
741  ppfjet_p_ = pfjet_probe.jet()->p();
742  ppfjet_eta_ = pfjet_probe.jet()->eta();
743  ppfjet_area_ = pfjet_probe.jet()->jetArea();
744  ppfjet_E_ = pfjet_probe.jet()->energy();
746  ppfjet_phi_ = pfjet_probe.jet()->phi();
749  ppfjet_nConstituents_ = pfjet_probe.jet()->nConstituents();
753  ppfjet_scale_ = pfjet_probe.scale();
754  ppfjet_ntwrs_=0;
757 
758  HERE("Get PF constituents");
759 
760  // Get PF constituents and fill HCAL towers
761  std::vector<reco::PFCandidatePtr> probeconst=pfjet_probe.jet()->getPFConstituents();
762  HERE(Form("probeconst.size=%d",int(probeconst.size())));
763  int iPF=0;
764  for(std::vector<reco::PFCandidatePtr>::const_iterator it=probeconst.begin(); it!=probeconst.end(); ++it){
765  bool hasTrack = false;
766  if (!(*it)) HERE("\tnull probeconst iterator value\n");
767  reco::PFCandidate::ParticleType candidateType = (*it)->particleId();
768  iPF++;
769  HERE(Form("iPF=%d",iPF));
770 
771  // store information
772  switch(candidateType){
774  ppfjet_unkown_E_ += (*it)->energy();
775  ppfjet_unkown_px_ += (*it)->px();
776  ppfjet_unkown_py_ += (*it)->py();
777  ppfjet_unkown_pz_ += (*it)->pz();
778  ppfjet_unkown_EcalE_ += (*it)->ecalEnergy();
780  continue;
782  {
783  ppfjet_had_E_.push_back((*it)->energy());
784  ppfjet_had_px_.push_back((*it)->px());
785  ppfjet_had_py_.push_back((*it)->py());
786  ppfjet_had_pz_.push_back((*it)->pz());
787  ppfjet_had_EcalE_.push_back((*it)->ecalEnergy());
788  ppfjet_had_rawHcalE_.push_back((*it)->rawHcalEnergy());
789  ppfjet_had_id_.push_back(0);
790  ppfjet_had_ntwrs_.push_back(0);
791  ppfjet_had_n_++;
792 
793  if(doGenJets_){
794  float gendr = 99999;
795  float genE = 0;
796  int genpdgId = 0;
797  for(std::vector<reco::GenParticle>::const_iterator itmc = genparticles->begin(); itmc != genparticles->end(); itmc++){
798  if(itmc->status() == 1 && itmc->pdgId() > 100){
799  double dr = deltaR((*it)->eta(),(*it)->phi(),itmc->eta(),itmc->phi());
800  if(dr < gendr){
801  gendr = dr;
802  genE = itmc->energy();
803  genpdgId = itmc->pdgId();
804  }
805  }
806  }
807  ppfjet_had_E_mctruth_.push_back(genE);
808  ppfjet_had_mcpdgId_.push_back(genpdgId);
809  }
810 
811  reco::TrackRef trackRef = (*it)->trackRef();
812  if(trackRef.isNonnull()){
813  reco::Track track = *trackRef;
814  ppfjet_candtrack_px_.push_back(track.px());
815  ppfjet_candtrack_py_.push_back(track.py());
816  ppfjet_candtrack_pz_.push_back(track.pz());
817  ppfjet_candtrack_EcalE_.push_back((*it)->ecalEnergy());
819  hasTrack = true;
821  }
822  else{
823  ppfjet_had_candtrackind_.push_back(-2);
824  }
825  }
826  break;
828  ppfjet_electron_E_ += (*it)->energy();
829  ppfjet_electron_px_ += (*it)->px();
830  ppfjet_electron_py_ += (*it)->py();
831  ppfjet_electron_pz_ += (*it)->pz();
832  ppfjet_electron_EcalE_ += (*it)->ecalEnergy();
834  continue;
836  ppfjet_muon_E_ += (*it)->energy();
837  ppfjet_muon_px_ += (*it)->px();
838  ppfjet_muon_py_ += (*it)->py();
839  ppfjet_muon_pz_ += (*it)->pz();
840  ppfjet_muon_EcalE_ += (*it)->ecalEnergy();
841  ppfjet_muon_n_++;
842  continue;
844  ppfjet_photon_E_ += (*it)->energy();
845  ppfjet_photon_px_ += (*it)->px();
846  ppfjet_photon_py_ += (*it)->py();
847  ppfjet_photon_pz_ += (*it)->pz();
848  ppfjet_photon_EcalE_ += (*it)->ecalEnergy();
850  continue;
852  {
853  ppfjet_had_E_.push_back((*it)->energy());
854  ppfjet_had_px_.push_back((*it)->px());
855  ppfjet_had_py_.push_back((*it)->py());
856  ppfjet_had_pz_.push_back((*it)->pz());
857  ppfjet_had_EcalE_.push_back((*it)->ecalEnergy());
858  ppfjet_had_rawHcalE_.push_back((*it)->rawHcalEnergy());
859  ppfjet_had_id_.push_back(1);
860  ppfjet_had_candtrackind_.push_back(-1);
861  ppfjet_had_ntwrs_.push_back(0);
862  ppfjet_had_n_++;
863 
864  if(doGenJets_){
865  float gendr = 99999;
866  float genE = 0;
867  int genpdgId = 0;
868  for(std::vector<reco::GenParticle>::const_iterator itmc = genparticles->begin(); itmc != genparticles->end(); itmc++){
869  if(itmc->status() == 1 && itmc->pdgId() > 100){
870  double dr = deltaR((*it)->eta(),(*it)->phi(),itmc->eta(),itmc->phi());
871  if(dr < gendr){
872  gendr = dr;
873  genE = itmc->energy();
874  genpdgId = itmc->pdgId();
875  }
876  }
877  }
878  ppfjet_had_E_mctruth_.push_back(genE);
879  ppfjet_had_mcpdgId_.push_back(genpdgId);
880  }
881 
882  break;
883  }
885  {
886  ppfjet_had_E_.push_back((*it)->energy());
887  ppfjet_had_px_.push_back((*it)->px());
888  ppfjet_had_py_.push_back((*it)->py());
889  ppfjet_had_pz_.push_back((*it)->pz());
890  ppfjet_had_EcalE_.push_back((*it)->ecalEnergy());
891  ppfjet_had_rawHcalE_.push_back((*it)->rawHcalEnergy());
892  ppfjet_had_id_.push_back(2);
893  ppfjet_had_candtrackind_.push_back(-1);
894  ppfjet_had_ntwrs_.push_back(0);
895  ppfjet_had_n_++;
896 
897  if(doGenJets_){
898  float gendr = 99999;
899  float genE = 0;
900  int genpdgId = 0;
901  for(std::vector<reco::GenParticle>::const_iterator itmc = genparticles->begin(); itmc != genparticles->end(); itmc++){
902  if(itmc->status() == 1 && itmc->pdgId() > 100){
903  double dr = deltaR((*it)->eta(),(*it)->phi(),itmc->eta(),itmc->phi());
904  if(dr < gendr){
905  gendr = dr;
906  genE = itmc->energy();
907  genpdgId = itmc->pdgId();
908  }
909  }
910  }
911  ppfjet_had_E_mctruth_.push_back(genE);
912  ppfjet_had_mcpdgId_.push_back(genpdgId);
913  }
914 
915  break;
916  }
918  {
919  ppfjet_had_E_.push_back((*it)->energy());
920  ppfjet_had_px_.push_back((*it)->px());
921  ppfjet_had_py_.push_back((*it)->py());
922  ppfjet_had_pz_.push_back((*it)->pz());
923  ppfjet_had_EcalE_.push_back((*it)->ecalEnergy());
924  ppfjet_had_rawHcalE_.push_back((*it)->rawHcalEnergy());
925  ppfjet_had_id_.push_back(3);
926  ppfjet_had_candtrackind_.push_back(-1);
927  ppfjet_had_ntwrs_.push_back(0);
928  ppfjet_had_n_++;
929 
930  if(doGenJets_){
931  float gendr = 99999;
932  float genE = 0;
933  int genpdgId = 0;
934  for(std::vector<reco::GenParticle>::const_iterator itmc = genparticles->begin(); itmc != genparticles->end(); itmc++){
935  if(itmc->status() == 1 && itmc->pdgId() > 100){
936  double dr = deltaR((*it)->eta(),(*it)->phi(),itmc->eta(),itmc->phi());
937  if(dr < gendr){
938  gendr = dr;
939  genE = itmc->energy();
940  genpdgId = itmc->pdgId();
941  }
942  }
943  }
944  ppfjet_had_E_mctruth_.push_back(genE);
945  ppfjet_had_mcpdgId_.push_back(genpdgId);
946  }
947 
948  break;
949  }
950  }
951 
952  float HFHAD_E = 0;
953  float HFEM_E = 0;
954  int HFHAD_n_ = 0;
955  int HFEM_n_ = 0;
956  int HF_type_ = 0;
957  int maxElement=(*it)->elementsInBlocks().size();
958  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "maxElement=" << maxElement;
959  if (workOnAOD_==1) {
960  maxElement=0;
961  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "forced 0";
962  }
963  HERE(Form("maxElement=%d",maxElement));
964  for(int e=0; e<maxElement; ++e){
965  // Get elements from block
966  reco::PFBlockRef blockRef = (*it)->elementsInBlocks()[e].first;
967  const edm::OwnVector<reco::PFBlockElement>& elements = blockRef->elements();
968  for(unsigned iEle=0; iEle<elements.size(); iEle++) {
969  if(elements[iEle].index() == (*it)->elementsInBlocks()[e].second){
970  if(elements[iEle].type() == reco::PFBlockElement::HCAL){ // Element is HB or HE
971  HF_type_ |= 0x1;
972  // Get cluster and hits
973  reco::PFClusterRef clusterref = elements[iEle].clusterRef();
974  reco::PFCluster cluster = *clusterref;
975  double cluster_dR = deltaR(ppfjet_eta_,ppfjet_phi_,cluster.eta(),cluster.phi());
976  if(ppfjet_clusters.count(cluster_dR) == 0){
977  ppfjet_clusters[cluster_dR] = ppfjet_cluster_n_;
978  ppfjet_cluster_eta_.push_back(cluster.eta());
979  ppfjet_cluster_phi_.push_back(cluster.phi());
980  ppfjet_cluster_dR_.push_back(cluster_dR);
982  }
983  int cluster_ind = ppfjet_clusters[cluster_dR];
984  std::vector<std::pair<DetId,float>> hitsAndFracs = cluster.hitsAndFractions();
985 
986  // Run over hits and match
987  int nHits = hitsAndFracs.size();
988  for(int iHit=0; iHit<nHits; iHit++){
989  int etaPhiPF = getEtaPhi(hitsAndFracs[iHit].first);
990 
991  for(edm::SortedCollection<HBHERecHit,edm::StrictWeakOrdering<HBHERecHit>>::const_iterator ith=hbhereco->begin(); ith!=hbhereco->end(); ++ith){
992  int etaPhiRecHit = getEtaPhi((*ith).id());
993  if(etaPhiPF == etaPhiRecHit){
995  if(ppfjet_rechits.count((*ith).id()) == 0){
996  ppfjet_twr_ieta_.push_back((*ith).id().ieta());
997  ppfjet_twr_iphi_.push_back((*ith).id().iphi());
998  ppfjet_twr_depth_.push_back((*ith).id().depth());
999  ppfjet_twr_subdet_.push_back((*ith).id().subdet());
1000  ppfjet_twr_hade_.push_back((*ith).energy());
1001  ppfjet_twr_frac_.push_back(hitsAndFracs[iHit].second);
1002  ppfjet_rechits[(*ith).id()].second.insert(hitsAndFracs[iHit].second);
1003  ppfjet_twr_hadind_.push_back(ppfjet_had_n_ - 1);
1004  ppfjet_twr_elmttype_.push_back(0);
1005  ppfjet_twr_clusterind_.push_back(cluster_ind);
1006  if(hasTrack){
1008  }
1009  else{
1010  ppfjet_twr_candtrackind_.push_back(-1);
1011  }
1012  switch((*ith).id().subdet()){
1014  {
1015  const CaloCellGeometry *thisCell = HBGeom->getGeometry((*ith).id().rawId());
1016  const CaloCellGeometry::CornersVec& cv = thisCell->getCorners();
1017  float avgeta = (cv[0].eta() + cv[2].eta())/2.0;
1018  float avgphi = (static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].phi()))/2.0;
1019  if((cv[0].phi() < cv[2].phi()) && (debug_>1)) edm::LogInfo("GammaJetAnalysis") << "pHB" << cv[0].phi() << " " << cv[2].phi();
1020  if(cv[0].phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].phi()))/2.0;
1021  ppfjet_twr_dR_.push_back(deltaR(ppfjet_eta_,ppfjet_phi_,avgeta,avgphi));
1022  break;
1023  }
1025  {
1026  const CaloCellGeometry *thisCell = HEGeom->getGeometry((*ith).id().rawId());
1027  const CaloCellGeometry::CornersVec& cv = thisCell->getCorners();
1028  float avgeta = (cv[0].eta() + cv[2].eta())/2.0;
1029  float avgphi = (static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].phi()))/2.0;
1030  if((cv[0].phi() < cv[2].phi()) && (debug_>1)) edm::LogInfo("GammaJetAnalysis") << "pHE" << cv[0].phi() << " " << cv[2].phi();
1031  if(cv[0].phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].phi()))/2.0;
1032  ppfjet_twr_dR_.push_back(deltaR(ppfjet_eta_,ppfjet_phi_,avgeta,avgphi));
1033  break;
1034  }
1035  default:
1036  ppfjet_twr_dR_.push_back(-1);
1037  break;
1038  }
1039  ppfjet_rechits[(*ith).id()].first = ppfjet_ntwrs_;
1040  ++ppfjet_ntwrs_;
1041  }
1042  else if(ppfjet_rechits[(*ith).id()].second.count(hitsAndFracs[iHit].second) == 0){
1043  ppfjet_twr_frac_.at(ppfjet_rechits[(*ith).id()].first) += hitsAndFracs[iHit].second;
1044  if(cluster_dR < ppfjet_cluster_dR_.at(ppfjet_twr_clusterind_.at(ppfjet_rechits[(*ith).id()].first))){
1045  ppfjet_twr_clusterind_.at(ppfjet_rechits[(*ith).id()].first) = cluster_ind;
1046  }
1047  ppfjet_rechits[(*ith).id()].second.insert(hitsAndFracs[iHit].second);
1048  }
1049  } // Test if ieta,iphi matches
1050  } // Loop over rechits
1051  } // Loop over hits
1052  } // Test if element is from HCAL
1053  else if(elements[iEle].type() == reco::PFBlockElement::HFHAD){ // Element is HF
1054  types |= 0x2;
1055  ntypes++;
1056  HFHAD_n_++;
1057  HF_type_ |= 0x2;
1058 
1060 
1061  for(edm::SortedCollection<HFRecHit,edm::StrictWeakOrdering<HFRecHit>>::const_iterator ith=hfreco->begin(); ith!=hfreco->end(); ++ith){
1062  if((*ith).id().depth() == 1) continue; // Remove long fibers
1063  const CaloCellGeometry *thisCell = HFGeom->getGeometry((*ith).id().rawId());
1064  const CaloCellGeometry::CornersVec& cv = thisCell->getCorners();
1065 
1066  bool passMatch = false;
1067  if((*it)->eta() < cv[0].eta() && (*it)->eta() > cv[2].eta()){
1068  if((*it)->phi() < cv[0].phi() && (*it)->phi() > cv[2].phi()) passMatch = true;
1069  else if(cv[0].phi() < cv[2].phi()){
1070  if((*it)->phi() < cv[0].phi()) passMatch = true;
1071  else if((*it)->phi() > cv[2].phi()) passMatch = true;
1072  }
1073  }
1074 
1075  if(passMatch){
1076  ppfjet_had_ntwrs_.at(ppfjet_had_n_ - 1)++;
1077  ppfjet_twr_ieta_.push_back((*ith).id().ieta());
1078  ppfjet_twr_iphi_.push_back((*ith).id().iphi());
1079  ppfjet_twr_depth_.push_back((*ith).id().depth());
1080  ppfjet_twr_subdet_.push_back((*ith).id().subdet());
1081  ppfjet_twr_hade_.push_back((*ith).energy());
1082  ppfjet_twr_frac_.push_back(1.0);
1083  ppfjet_twr_hadind_.push_back(ppfjet_had_n_ - 1);
1084  ppfjet_twr_elmttype_.push_back(1);
1085  ppfjet_twr_clusterind_.push_back(-1);
1086  ppfjet_twr_candtrackind_.push_back(-1);
1087  float avgeta = (cv[0].eta() + cv[2].eta())/2.0;
1088  float avgphi = (static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].phi()))/2.0;
1089  if((cv[0].phi() < cv[2].phi()) && (debug_>1)) edm::LogInfo("GammaJetAnalysis") << "pHFhad" << cv[0].phi() << " " << cv[2].phi();
1090  if(cv[0].phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].phi()))/2.0;
1091  ppfjet_twr_dR_.push_back(deltaR(ppfjet_eta_,ppfjet_phi_,avgeta,avgphi));
1092  ++ppfjet_ntwrs_;
1093  HFHAD_E += (*ith).energy();
1094  }
1095  }
1096  }
1097  else if(elements[iEle].type() == reco::PFBlockElement::HFEM){ // Element is HF
1098  types |= 0x4;
1099  ntypes++;
1100  HFEM_n_++;
1101  HF_type_ |= 0x4;
1102 
1103  for(edm::SortedCollection<HFRecHit,edm::StrictWeakOrdering<HFRecHit>>::const_iterator ith=hfreco->begin(); ith!=hfreco->end(); ++ith){
1104  if((*ith).id().depth() == 2) continue; // Remove short fibers
1105  const CaloCellGeometry *thisCell = HFGeom->getGeometry((*ith).id().rawId());
1106  const CaloCellGeometry::CornersVec& cv = thisCell->getCorners();
1107 
1108  bool passMatch = false;
1109  if((*it)->eta() < cv[0].eta() && (*it)->eta() > cv[2].eta()){
1110  if((*it)->phi() < cv[0].phi() && (*it)->phi() > cv[2].phi()) passMatch = true;
1111  else if(cv[0].phi() < cv[2].phi()){
1112  if((*it)->phi() < cv[0].phi()) passMatch = true;
1113  else if((*it)->phi() > cv[2].phi()) passMatch = true;
1114  }
1115  }
1116 
1117  if(passMatch){
1118  ppfjet_had_ntwrs_.at(ppfjet_had_n_ - 1)++;
1119  ppfjet_twr_ieta_.push_back((*ith).id().ieta());
1120  ppfjet_twr_iphi_.push_back((*ith).id().iphi());
1121  ppfjet_twr_depth_.push_back((*ith).id().depth());
1122  ppfjet_twr_subdet_.push_back((*ith).id().subdet());
1123  ppfjet_twr_hade_.push_back((*ith).energy());
1124  ppfjet_twr_frac_.push_back(1.0);
1125  ppfjet_twr_hadind_.push_back(ppfjet_had_n_ - 1);
1126  ppfjet_twr_elmttype_.push_back(2);
1127  ppfjet_twr_clusterind_.push_back(-1);
1128  ppfjet_twr_candtrackind_.push_back(-1);
1129  float avgeta = (cv[0].eta() + cv[2].eta())/2.0;
1130  float avgphi = (static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].phi()))/2.0;
1131  if((cv[0].phi() < cv[2].phi()) && (debug_>1)) edm::LogInfo("GammaJetAnalysis") << "pHFem" << cv[0].phi() << " " << cv[2].phi();
1132  if(cv[0].phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].phi()))/2.0;
1133  ppfjet_twr_dR_.push_back(deltaR(ppfjet_eta_,ppfjet_phi_,avgeta,avgphi));
1134  ++ppfjet_ntwrs_;
1135  HFEM_E += (*ith).energy();
1136  }
1137  }
1138  }
1139  else if(elements[iEle].type() == reco::PFBlockElement::HO){ // Element is HO
1140  types |= 0x8;
1141  ntypes++;
1142  HF_type_ |= 0x8;
1143  reco::PFClusterRef clusterref = elements[iEle].clusterRef();
1144  reco::PFCluster cluster = *clusterref;
1145  double cluster_dR = deltaR(ppfjet_eta_,ppfjet_phi_,cluster.eta(),cluster.phi());
1146  if(ppfjet_clusters.count(cluster_dR) == 0){
1147  ppfjet_clusters[cluster_dR] = ppfjet_cluster_n_;
1148  ppfjet_cluster_eta_.push_back(cluster.eta());
1149  ppfjet_cluster_phi_.push_back(cluster.phi());
1150  ppfjet_cluster_dR_.push_back(cluster_dR);
1152  }
1153  int cluster_ind = ppfjet_clusters[cluster_dR];
1154 
1155  std::vector<std::pair<DetId,float>> hitsAndFracs = cluster.hitsAndFractions();
1156  int nHits = hitsAndFracs.size();
1157  for(int iHit=0; iHit<nHits; iHit++){
1158  int etaPhiPF = getEtaPhi(hitsAndFracs[iHit].first);
1159 
1160  for(edm::SortedCollection<HORecHit,edm::StrictWeakOrdering<HORecHit>>::const_iterator ith=horeco->begin(); ith!=horeco->end(); ++ith){
1161  int etaPhiRecHit = getEtaPhi((*ith).id());
1162  if(etaPhiPF == etaPhiRecHit){
1163  ppfjet_had_ntwrs_.at(ppfjet_had_n_ - 1)++;
1164  if(ppfjet_rechits.count((*ith).id()) == 0){
1165  ppfjet_twr_ieta_.push_back((*ith).id().ieta());
1166  ppfjet_twr_iphi_.push_back((*ith).id().iphi());
1167  ppfjet_twr_depth_.push_back((*ith).id().depth());
1168  ppfjet_twr_subdet_.push_back((*ith).id().subdet());
1169  ppfjet_twr_hade_.push_back((*ith).energy());
1170  ppfjet_twr_frac_.push_back(hitsAndFracs[iHit].second);
1171  ppfjet_rechits[(*ith).id()].second.insert(hitsAndFracs[iHit].second);
1172  ppfjet_twr_hadind_.push_back(ppfjet_had_n_ - 1);
1173  ppfjet_twr_elmttype_.push_back(3);
1174  ppfjet_twr_clusterind_.push_back(cluster_ind);
1175  if(hasTrack){
1177  }
1178  else{
1179  ppfjet_twr_candtrackind_.push_back(-1);
1180  }
1181  const CaloCellGeometry *thisCell = HOGeom->getGeometry((*ith).id().rawId());
1182  const CaloCellGeometry::CornersVec& cv = thisCell->getCorners();
1183  float avgeta = (cv[0].eta() + cv[2].eta())/2.0;
1184  float avgphi = (static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].phi()))/2.0;
1185  if((cv[0].phi() < cv[2].phi()) && (debug_>1)) edm::LogInfo("GammaJetAnalysis") << "pHO" << cv[0].phi() << " " << cv[2].phi();
1186  if(cv[0].phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast<double>(cv[0].phi()) + static_cast<double>(cv[2].phi()))/2.0;
1187 
1188  ppfjet_twr_dR_.push_back(deltaR(ppfjet_eta_,ppfjet_phi_,avgeta,avgphi));
1189  ppfjet_rechits[(*ith).id()].first = ppfjet_ntwrs_;
1190  ++ppfjet_ntwrs_;
1191  }
1192  else if(ppfjet_rechits[(*ith).id()].second.count(hitsAndFracs[iHit].second) == 0){
1193  ppfjet_twr_frac_.at(ppfjet_rechits[(*ith).id()].first) += hitsAndFracs[iHit].second;
1194  if(cluster_dR < ppfjet_cluster_dR_.at(ppfjet_twr_clusterind_.at(ppfjet_rechits[(*ith).id()].first))){
1195  ppfjet_twr_clusterind_.at(ppfjet_rechits[(*ith).id()].first) = cluster_ind;
1196  }
1197  ppfjet_rechits[(*ith).id()].second.insert(hitsAndFracs[iHit].second);
1198  }
1199  } // Test if ieta,iphi match
1200  } // Loop over rechits
1201  } // Loop over hits
1202  } // Test if element is from HO
1203  } // Test for right element index
1204  } // Loop over elements
1205  } // Loop over elements in blocks
1206  switch(candidateType){
1208  ppfjet_had_emf_.push_back(HFEM_E/(HFEM_E + HFHAD_E));
1209  break;
1211  ppfjet_had_emf_.push_back(-1);
1212  break;
1213  default:
1214  ppfjet_had_emf_.push_back(-1);
1215  break;
1216  }
1217  } // Loop over PF constitutents
1218 
1219  if(doGenJets_){
1220  // fill genjet variables
1221  ppfjet_gendr_ = 99999.;
1222  ppfjet_genpt_ = 0;
1223  ppfjet_genp_ = 0;
1224  for(std::vector<reco::GenJet>::const_iterator it=genjets->begin(); it!=genjets->end(); ++it){
1225  const reco::GenJet* jet=&(*it);
1226  double dr=deltaR(jet, pfjet_probe.jet());
1227  if(dr<ppfjet_gendr_) {
1228  ppfjet_gendr_ = dr;
1229  ppfjet_genpt_ = jet->pt();
1230  ppfjet_genp_ = jet->p();
1231  ppfjet_genE_ = jet->energy();
1232  }
1233  }
1234  } // doGenJets_
1235  if (iJet==2) {
1237  }
1238  }
1239  // double jer= (ppfjet_genpt_==double(0)) ?
1240  // 0. : pfjet_probe.jet()->et()/ppfjet_genpt_;
1242 
1245  iEvent.getByToken(tok_PFMET_, pfmet_h);
1246  if (!pfmet_h.isValid()) {
1247  edm::LogWarning("GammaJetAnalysis") << " could not find " << pfMETColl;
1248  return;
1249  }
1250  met_value_ = pfmet_h->begin()->et();
1251  met_phi_ = pfmet_h->begin()->phi();
1252  met_sumEt_ = pfmet_h->begin()->sumEt();
1253 
1255  iEvent.getByToken(tok_PFType1MET_, pfmetType1_h);
1256  if ( pfmetType1_h.isValid()) {
1257  metType1_value_ = pfmetType1_h->begin()->et();
1258  metType1_phi_ = pfmetType1_h->begin()->phi();
1259  metType1_sumEt_ = pfmetType1_h->begin()->sumEt();
1260  }
1261  else {
1262  // do we need an exception here?
1263  metType1_value_ = -999.;
1264  metType1_phi_ = -999.;
1265  metType1_sumEt_ = -999.;
1266  }
1267 
1268 
1269  // fill photon+jet variables
1270  pf_tree_->Fill();
1271  }
1272  }
1273  return;
1274 
1275 }
1276 
1277 // ------------ method called once each job just before starting event loop ------------
1279 {
1280  rootfile_ = new TFile(rootHistFilename_.c_str(), "RECREATE");
1281  if (doPFJets_) {
1282  pf_tree_ = new TTree("pf_gammajettree", "tree for gamma+jet balancing using PFJets");
1283  assert(pf_tree_);
1284  }
1285 
1286  for (int iJet=0; iJet<2; iJet++) {
1287  bool doJet=doPFJets_;
1288  if (!doJet) continue;
1289  if (iJet>0) continue; // ! caloJet are no longer there, so store only once
1290  TTree *tree= pf_tree_;
1291 
1292  // Event triggers
1293  tree->Branch("photonTrig_fired", &photonTrigFired_);
1294  tree->Branch("photonTrig_prescale", &photonTrigPrescale_);
1295  tree->Branch("jetTrig_fired", &jetTrigFired_);
1296  tree->Branch("jetTrig_prescale", &jetTrigPrescale_);
1297 
1298  // Event info
1299  tree->Branch("RunNumber",&runNumber_, "RunNumber/I");
1300  tree->Branch("LumiBlock",&lumiBlock_, "LumiBlock/I");
1301  tree->Branch("EventNumber",&eventNumber_, "EventNumber/I");
1302  tree->Branch("EventWeight",&eventWeight_, "EventWeight/F");
1303  tree->Branch("EventPtHat",&eventPtHat_, "EventPtHat/F");
1304 
1305  // Photon info
1306  tree->Branch("rho2012", &rho2012_, "rho2012/F");
1307  tree->Branch("tagPho_pt", &tagPho_pt_, "tagPho_pt/F");
1308  tree->Branch("pho_2nd_pt", &pho_2nd_pt_, "pho_2nd_pt/F");
1309  tree->Branch("tagPho_energy", &tagPho_energy_, "tagPho_energy/F");
1310  tree->Branch("tagPho_eta", &tagPho_eta_, "tagPho_eta/F");
1311  tree->Branch("tagPho_phi", &tagPho_phi_, "tagPho_phi/F");
1312  tree->Branch("tagPho_sieie", &tagPho_sieie_, "tagPho_sieie/F");
1313  tree->Branch("tagPho_HoE", &tagPho_HoE_, "tagPho_HoE/F");
1314  tree->Branch("tagPho_r9", &tagPho_r9_, "tagPho_r9/F");
1315  tree->Branch("tagPho_EcalIsoDR04",&tagPho_EcalIsoDR04_, "tagPho_EcalIsoDR04/F");
1316  tree->Branch("tagPho_HcalIsoDR04",&tagPho_HcalIsoDR04_, "tagPho_HcalIsoDR04/F");
1317  tree->Branch("tagPho_HcalIsoDR0412",&tagPho_HcalIsoDR0412_, "tagPho_HcalIsoDR0412/F");
1318  tree->Branch("tagPho_TrkIsoHollowDR04",&tagPho_TrkIsoHollowDR04_, "tagPho_TrkIsoHollowDR04/F");
1319  tree->Branch("tagPho_pfiso_myphoton03",&tagPho_pfiso_myphoton03_, "tagPho_pfiso_myphoton03/F");
1320  tree->Branch("tagPho_pfiso_myneutral03",&tagPho_pfiso_myneutral03_, "tagPho_pfiso_myneutral03/F");
1321  tree->Branch("tagPho_pfiso_mycharged03","std::vector<std::vector<float> >", &tagPho_pfiso_mycharged03);
1322  tree->Branch("tagPho_pixelSeed", &tagPho_pixelSeed_, "tagPho_pixelSeed/I");
1323  tree->Branch("tagPho_ConvSafeEleVeto", &tagPho_ConvSafeEleVeto_, "tagPho_ConvSafeEleVeto/I");
1324  tree->Branch("tagPho_idTight",&tagPho_idTight_, "tagPho_idTight/I");
1325  tree->Branch("tagPho_idLoose",&tagPho_idLoose_, "tagPho_idLoose/I");
1326  // gen.info on photon
1327  if(doGenJets_){
1328  tree->Branch("tagPho_genPt",&tagPho_genPt_, "tagPho_genPt/F");
1329  tree->Branch("tagPho_genEnergy",&tagPho_genEnergy_,"tagPho_genEnergy/F");
1330  tree->Branch("tagPho_genEta",&tagPho_genEta_, "tagPho_genEta/F");
1331  tree->Branch("tagPho_genPhi",&tagPho_genPhi_, "tagPho_genPhi/F");
1332  tree->Branch("tagPho_genDeltaR",&tagPho_genDeltaR_,"tagPho_genDeltaR/F");
1333  }
1334  // counters
1335  tree->Branch("nPhotons",&nPhotons_, "nPhotons/I");
1336  tree->Branch("nGenJets",&nGenJets_, "nGenJets/I");
1337  }
1338 
1340 
1341  if (doPFJets_) {
1342 
1343  pf_tree_->Branch("nPFJets",&nPFJets_, "nPFJets/I");
1344 
1345  // Leading jet info
1346  pf_tree_->Branch("ppfjet_pt",&ppfjet_pt_, "ppfjet_pt/F");
1347  pf_tree_->Branch("ppfjet_p",&ppfjet_p_, "ppfjet_p/F");
1348  pf_tree_->Branch("ppfjet_E",&ppfjet_E_, "ppfjet_E/F");
1349  pf_tree_->Branch("ppfjet_E_NPVcorr",&ppfjet_E_NPVcorr_, "ppfjet_E_NPVcorr/F");
1350  pf_tree_->Branch("ppfjet_area",&ppfjet_area_, "ppfjet_area/F");
1351  pf_tree_->Branch("ppfjet_eta",&ppfjet_eta_, "ppfjet_eta/F");
1352  pf_tree_->Branch("ppfjet_phi",&ppfjet_phi_, "ppfjet_phi/F");
1353  pf_tree_->Branch("ppfjet_scale",&ppfjet_scale_, "ppfjet_scale/F");
1354  pf_tree_->Branch("ppfjet_NeutralHadronFrac", &ppfjet_NeutralHadronFrac_, "ppfjet_NeutralHadronFrac/F");
1355  pf_tree_->Branch("ppfjet_NeutralEMFrac", &ppfjet_NeutralEMFrac_, "ppfjet_NeutralEMFrac/F");
1356  pf_tree_->Branch("ppfjet_nConstituents", &ppfjet_nConstituents_, "ppfjet_nConstituents/I");
1357  pf_tree_->Branch("ppfjet_ChargedHadronFrac", &ppfjet_ChargedHadronFrac_, "ppfjet_ChargedHadronFrac/F");
1358  pf_tree_->Branch("ppfjet_ChargedMultiplicity", &ppfjet_ChargedMultiplicity_, "ppfjet_ChargedMultiplicity/F");
1359  pf_tree_->Branch("ppfjet_ChargedEMFrac", &ppfjet_ChargedEMFrac_, "ppfjet_ChargedEMFrac/F");
1360  if(doGenJets_){
1361  pf_tree_->Branch("ppfjet_genpt",&ppfjet_genpt_, "ppfjet_genpt/F");
1362  pf_tree_->Branch("ppfjet_genp",&ppfjet_genp_, "ppfjet_genp/F");
1363  pf_tree_->Branch("ppfjet_genE",&ppfjet_genE_, "ppfjet_genE/F");
1364  pf_tree_->Branch("ppfjet_gendr",&ppfjet_gendr_, "ppfjet_gendr/F");
1365  }
1366  pf_tree_->Branch("ppfjet_unkown_E",&ppfjet_unkown_E_, "ppfjet_unkown_E/F");
1367  pf_tree_->Branch("ppfjet_electron_E",&ppfjet_electron_E_, "ppfjet_electron_E/F");
1368  pf_tree_->Branch("ppfjet_muon_E",&ppfjet_muon_E_, "ppfjet_muon_E/F");
1369  pf_tree_->Branch("ppfjet_photon_E",&ppfjet_photon_E_, "ppfjet_photon_E/F");
1370  pf_tree_->Branch("ppfjet_unkown_px",&ppfjet_unkown_px_, "ppfjet_unkown_px/F");
1371  pf_tree_->Branch("ppfjet_electron_px",&ppfjet_electron_px_, "ppfjet_electron_px/F");
1372  pf_tree_->Branch("ppfjet_muon_px",&ppfjet_muon_px_, "ppfjet_muon_px/F");
1373  pf_tree_->Branch("ppfjet_photon_px",&ppfjet_photon_px_, "ppfjet_photon_px/F");
1374  pf_tree_->Branch("ppfjet_unkown_py",&ppfjet_unkown_py_, "ppfjet_unkown_py/F");
1375  pf_tree_->Branch("ppfjet_electron_py",&ppfjet_electron_py_, "ppfjet_electron_py/F");
1376  pf_tree_->Branch("ppfjet_muon_py",&ppfjet_muon_py_, "ppfjet_muon_py/F");
1377  pf_tree_->Branch("ppfjet_photon_py",&ppfjet_photon_py_, "ppfjet_photon_py/F");
1378  pf_tree_->Branch("ppfjet_unkown_pz",&ppfjet_unkown_pz_, "ppfjet_unkown_pz/F");
1379  pf_tree_->Branch("ppfjet_electron_pz",&ppfjet_electron_pz_, "ppfjet_electron_pz/F");
1380  pf_tree_->Branch("ppfjet_muon_pz",&ppfjet_muon_pz_, "ppfjet_muon_pz/F");
1381  pf_tree_->Branch("ppfjet_photon_pz",&ppfjet_photon_pz_, "ppfjet_photon_pz/F");
1382  pf_tree_->Branch("ppfjet_unkown_EcalE",&ppfjet_unkown_EcalE_, "ppfjet_unkown_EcalE/F");
1383  pf_tree_->Branch("ppfjet_electron_EcalE",&ppfjet_electron_EcalE_, "ppfjet_electron_EcalE/F");
1384  pf_tree_->Branch("ppfjet_muon_EcalE",&ppfjet_muon_EcalE_, "ppfjet_muon_EcalE/F");
1385  pf_tree_->Branch("ppfjet_photon_EcalE",&ppfjet_photon_EcalE_, "ppfjet_photon_EcalE/F");
1386  pf_tree_->Branch("ppfjet_unkown_n",&ppfjet_unkown_n_, "ppfjet_unkown_n/I");
1387  pf_tree_->Branch("ppfjet_electron_n",&ppfjet_electron_n_, "ppfjet_electron_n/I");
1388  pf_tree_->Branch("ppfjet_muon_n",&ppfjet_muon_n_, "ppfjet_muon_n/I");
1389  pf_tree_->Branch("ppfjet_photon_n",&ppfjet_photon_n_, "ppfjet_photon_n/I");
1390  pf_tree_->Branch("ppfjet_had_n",&ppfjet_had_n_, "ppfjet_had_n/I");
1391  pf_tree_->Branch("ppfjet_had_E",&ppfjet_had_E_);
1392  pf_tree_->Branch("ppfjet_had_px",&ppfjet_had_px_);
1393  pf_tree_->Branch("ppfjet_had_py",&ppfjet_had_py_);
1394  pf_tree_->Branch("ppfjet_had_pz",&ppfjet_had_pz_);
1395  pf_tree_->Branch("ppfjet_had_EcalE",&ppfjet_had_EcalE_);
1396  pf_tree_->Branch("ppfjet_had_rawHcalE",&ppfjet_had_rawHcalE_);
1397  pf_tree_->Branch("ppfjet_had_emf",&ppfjet_had_emf_);
1398  pf_tree_->Branch("ppfjet_had_id",&ppfjet_had_id_);
1399  pf_tree_->Branch("ppfjet_had_candtrackind",&ppfjet_had_candtrackind_);
1400  if(doGenJets_){
1401  pf_tree_->Branch("ppfjet_had_E_mctruth",&ppfjet_had_E_mctruth_);
1402  pf_tree_->Branch("ppfjet_had_mcpdgId",&ppfjet_had_mcpdgId_);
1403  }
1404  pf_tree_->Branch("ppfjet_had_ntwrs",&ppfjet_had_ntwrs_);
1405  pf_tree_->Branch("ppfjet_ntwrs",&ppfjet_ntwrs_, "ppfjet_ntwrs/I");
1406  pf_tree_->Branch("ppfjet_twr_ieta",&ppfjet_twr_ieta_);
1407  pf_tree_->Branch("ppfjet_twr_iphi",&ppfjet_twr_iphi_);
1408  pf_tree_->Branch("ppfjet_twr_depth",&ppfjet_twr_depth_);
1409  pf_tree_->Branch("ppfjet_twr_subdet",&ppfjet_twr_subdet_);
1410  pf_tree_->Branch("ppfjet_twr_hade",&ppfjet_twr_hade_);
1411  pf_tree_->Branch("ppfjet_twr_frac",&ppfjet_twr_frac_);
1412  pf_tree_->Branch("ppfjet_twr_candtrackind",&ppfjet_twr_candtrackind_);
1413  pf_tree_->Branch("ppfjet_twr_hadind",&ppfjet_twr_hadind_);
1414  pf_tree_->Branch("ppfjet_twr_elmttype",&ppfjet_twr_elmttype_);
1415  pf_tree_->Branch("ppfjet_twr_dR",&ppfjet_twr_dR_);
1416  pf_tree_->Branch("ppfjet_twr_clusterind",&ppfjet_twr_clusterind_);
1417  pf_tree_->Branch("ppfjet_cluster_n",&ppfjet_cluster_n_, "ppfjet_cluster_n/I");
1418  pf_tree_->Branch("ppfjet_cluster_eta",&ppfjet_cluster_eta_);
1419  pf_tree_->Branch("ppfjet_cluster_phi",&ppfjet_cluster_phi_);
1420  pf_tree_->Branch("ppfjet_cluster_dR",&ppfjet_cluster_dR_);
1421  pf_tree_->Branch("ppfjet_ncandtracks",&ppfjet_ncandtracks_, "ppfjet_ncandtracks/I");
1422  pf_tree_->Branch("ppfjet_candtrack_px",&ppfjet_candtrack_px_);
1423  pf_tree_->Branch("ppfjet_candtrack_py",&ppfjet_candtrack_py_);
1424  pf_tree_->Branch("ppfjet_candtrack_pz",&ppfjet_candtrack_pz_);
1425  pf_tree_->Branch("ppfjet_candtrack_EcalE",&ppfjet_candtrack_EcalE_);
1426 
1427  // Subleading jet info
1428  pf_tree_->Branch("pfjet2_pt",&pfjet2_pt_, "pfjet2_pt/F");
1429  pf_tree_->Branch("pfjet2_p",&pfjet2_p_, "pfjet2_p/F");
1430  pf_tree_->Branch("pfjet2_E",&pfjet2_E_, "pfjet2_E/F");
1431  pf_tree_->Branch("pfjet2_E_NPVcorr",&pfjet2_E_NPVcorr_, "pfjet2_E_NPVcorr/F");
1432  pf_tree_->Branch("pfjet2_area",&pfjet2_area_, "pfjet2_area/F");
1433  pf_tree_->Branch("pfjet2_eta",&pfjet2_eta_, "pfjet2_eta/F");
1434  pf_tree_->Branch("pfjet2_phi",&pfjet2_phi_, "pfjet2_phi/F");
1435  pf_tree_->Branch("pfjet2_scale",&pfjet2_scale_, "pfjet2_scale/F");
1436  pf_tree_->Branch("pfjet2_NeutralHadronFrac", &pfjet2_NeutralHadronFrac_, "pfjet2_NeutralHadronFrac/F");
1437  pf_tree_->Branch("pfjet2_NeutralEMFrac", &pfjet2_NeutralEMFrac_, "pfjet2_NeutralEMFrac/F");
1438  pf_tree_->Branch("pfjet2_nConstituents", &pfjet2_nConstituents_, "pfjet2_nConstituents/I");
1439  pf_tree_->Branch("pfjet2_ChargedHadronFrac", &pfjet2_ChargedHadronFrac_, "pfjet2_ChargedHadronFrac/F");
1440  pf_tree_->Branch("pfjet2_ChargedMultiplicity", &pfjet2_ChargedMultiplicity_, "pfjet2_ChargedMultiplicity/F");
1441  pf_tree_->Branch("pfjet2_ChargedEMFrac", &pfjet2_ChargedEMFrac_, "pfjet2_ChargedEMFrac/F");
1442  if(doGenJets_){
1443  pf_tree_->Branch("pfjet2_genpt",&pfjet2_genpt_, "pfjet2_genpt/F");
1444  pf_tree_->Branch("pfjet2_genp",&pfjet2_genp_, "pfjet2_genp/F");
1445  pf_tree_->Branch("pfjet2_genE",&pfjet2_genE_, "pfjet2_genE/F");
1446  pf_tree_->Branch("pfjet2_gendr",&pfjet2_gendr_, "pfjet2_gendr/F");
1447  }
1448  pf_tree_->Branch("pfjet2_unkown_E",&pfjet2_unkown_E_, "pfjet2_unkown_E/F");
1449  pf_tree_->Branch("pfjet2_electron_E",&pfjet2_electron_E_, "pfjet2_electron_E/F");
1450  pf_tree_->Branch("pfjet2_muon_E",&pfjet2_muon_E_, "pfjet2_muon_E/F");
1451  pf_tree_->Branch("pfjet2_photon_E",&pfjet2_photon_E_, "pfjet2_photon_E/F");
1452  pf_tree_->Branch("pfjet2_unkown_px",&pfjet2_unkown_px_, "pfjet2_unkown_px/F");
1453  pf_tree_->Branch("pfjet2_electron_px",&pfjet2_electron_px_, "pfjet2_electron_px/F");
1454  pf_tree_->Branch("pfjet2_muon_px",&pfjet2_muon_px_, "pfjet2_muon_px/F");
1455  pf_tree_->Branch("pfjet2_photon_px",&pfjet2_photon_px_, "pfjet2_photon_px/F");
1456  pf_tree_->Branch("pfjet2_unkown_py",&pfjet2_unkown_py_, "pfjet2_unkown_py/F");
1457  pf_tree_->Branch("pfjet2_electron_py",&pfjet2_electron_py_, "pfjet2_electron_py/F");
1458  pf_tree_->Branch("pfjet2_muon_py",&pfjet2_muon_py_, "pfjet2_muon_py/F");
1459  pf_tree_->Branch("pfjet2_photon_py",&pfjet2_photon_py_, "pfjet2_photon_py/F");
1460  pf_tree_->Branch("pfjet2_unkown_pz",&pfjet2_unkown_pz_, "pfjet2_unkown_pz/F");
1461  pf_tree_->Branch("pfjet2_electron_pz",&pfjet2_electron_pz_, "pfjet2_electron_pz/F");
1462  pf_tree_->Branch("pfjet2_muon_pz",&pfjet2_muon_pz_, "pfjet2_muon_pz/F");
1463  pf_tree_->Branch("pfjet2_photon_pz",&pfjet2_photon_pz_, "pfjet2_photon_pz/F");
1464  pf_tree_->Branch("pfjet2_unkown_EcalE",&pfjet2_unkown_EcalE_, "pfjet2_unkown_EcalE/F");
1465  pf_tree_->Branch("pfjet2_electron_EcalE",&pfjet2_electron_EcalE_, "pfjet2_electron_EcalE/F");
1466  pf_tree_->Branch("pfjet2_muon_EcalE",&pfjet2_muon_EcalE_, "pfjet2_muon_EcalE/F");
1467  pf_tree_->Branch("pfjet2_photon_EcalE",&pfjet2_photon_EcalE_, "pfjet2_photon_EcalE/F");
1468  pf_tree_->Branch("pfjet2_unkown_n",&pfjet2_unkown_n_, "pfjet2_unkown_n/I");
1469  pf_tree_->Branch("pfjet2_electron_n",&pfjet2_electron_n_, "pfjet2_electron_n/I");
1470  pf_tree_->Branch("pfjet2_muon_n",&pfjet2_muon_n_, "pfjet2_muon_n/I");
1471  pf_tree_->Branch("pfjet2_photon_n",&pfjet2_photon_n_, "pfjet2_photon_n/I");
1472  pf_tree_->Branch("pfjet2_had_n",&pfjet2_had_n_, "pfjet2_had_n/I");
1473  pf_tree_->Branch("pfjet2_had_E",&pfjet2_had_E_);
1474  pf_tree_->Branch("pfjet2_had_px",&pfjet2_had_px_);
1475  pf_tree_->Branch("pfjet2_had_py",&pfjet2_had_py_);
1476  pf_tree_->Branch("pfjet2_had_pz",&pfjet2_had_pz_);
1477  pf_tree_->Branch("pfjet2_had_EcalE",&pfjet2_had_EcalE_);
1478  pf_tree_->Branch("pfjet2_had_rawHcalE",&pfjet2_had_rawHcalE_);
1479  pf_tree_->Branch("pfjet2_had_emf",&pfjet2_had_emf_);
1480  pf_tree_->Branch("pfjet2_had_id",&pfjet2_had_id_);
1481  pf_tree_->Branch("pfjet2_had_candtrackind",&pfjet2_had_candtrackind_);
1482  if(doGenJets_){
1483  pf_tree_->Branch("pfjet2_had_E_mctruth",&pfjet2_had_E_mctruth_);
1484  pf_tree_->Branch("pfjet2_had_mcpdgId",&pfjet2_had_mcpdgId_);
1485  }
1486  pf_tree_->Branch("pfjet2_had_ntwrs",&pfjet2_had_ntwrs_);
1487  pf_tree_->Branch("pfjet2_ntwrs",&pfjet2_ntwrs_, "pfjet2_ntwrs/I");
1488  pf_tree_->Branch("pfjet2_twr_ieta",&pfjet2_twr_ieta_);
1489  pf_tree_->Branch("pfjet2_twr_iphi",&pfjet2_twr_iphi_);
1490  pf_tree_->Branch("pfjet2_twr_depth",&pfjet2_twr_depth_);
1491  pf_tree_->Branch("pfjet2_twr_subdet",&pfjet2_twr_subdet_);
1492  pf_tree_->Branch("pfjet2_twr_hade",&pfjet2_twr_hade_);
1493  pf_tree_->Branch("pfjet2_twr_frac",&pfjet2_twr_frac_);
1494  pf_tree_->Branch("pfjet2_twr_candtrackind",&pfjet2_twr_candtrackind_);
1495  pf_tree_->Branch("pfjet2_twr_hadind",&pfjet2_twr_hadind_);
1496  pf_tree_->Branch("pfjet2_twr_elmttype",&pfjet2_twr_elmttype_);
1497  pf_tree_->Branch("pfjet2_twr_dR",&pfjet2_twr_dR_);
1498  pf_tree_->Branch("pfjet2_twr_clusterind",&pfjet2_twr_clusterind_);
1499  pf_tree_->Branch("pfjet2_cluster_n",&pfjet2_cluster_n_, "pfjet2_cluster_n/I");
1500  pf_tree_->Branch("pfjet2_cluster_eta",&pfjet2_cluster_eta_);
1501  pf_tree_->Branch("pfjet2_cluster_phi",&pfjet2_cluster_phi_);
1502  pf_tree_->Branch("pfjet2_cluster_dR",&pfjet2_cluster_dR_);
1503  pf_tree_->Branch("pfjet2_ncandtracks",&pfjet2_ncandtracks_, "pfjet2_ncandtracks/I");
1504  pf_tree_->Branch("pfjet2_candtrack_px",&pfjet2_candtrack_px_);
1505  pf_tree_->Branch("pfjet2_candtrack_py",&pfjet2_candtrack_py_);
1506  pf_tree_->Branch("pfjet2_candtrack_pz",&pfjet2_candtrack_pz_);
1507  pf_tree_->Branch("pfjet2_candtrack_EcalE",&pfjet2_candtrack_EcalE_);
1508 
1509  // third pf jet
1510  pf_tree_->Branch("pf_thirdjet_et", &pf_thirdjet_et_, "pf_thirdjet_et/F");
1511  pf_tree_->Branch("pf_thirdjet_pt", &pf_thirdjet_pt_, "pf_thirdjet_pt/F");
1512  pf_tree_->Branch("pf_thirdjet_p", &pf_thirdjet_p_, "pf_thirdjet_p/F");
1513  pf_tree_->Branch("pf_thirdjet_px", &pf_thirdjet_px_, "pf_thirdjet_px/F");
1514  pf_tree_->Branch("pf_thirdjet_py", &pf_thirdjet_py_, "pf_thirdjet_py/F");
1515  pf_tree_->Branch("pf_thirdjet_E", &pf_thirdjet_E_, "pf_thirdjet_E/F");
1516  pf_tree_->Branch("pf_thirdjet_eta", &pf_thirdjet_eta_, "pf_thirdjet_eta/F");
1517  pf_tree_->Branch("pf_thirdjet_phi", &pf_thirdjet_phi_, "pf_thirdjet_phi/F");
1518  pf_tree_->Branch("pf_thirdjet_scale", &pf_thirdjet_scale_, "pf_thirdjet_scale/F");
1519 
1520  pf_tree_->Branch("met_value", &met_value_, "met_value/F");
1521  pf_tree_->Branch("met_phi", &met_phi_, "met_phi/F");
1522  pf_tree_->Branch("met_sumEt", &met_sumEt_, "met_sumEt/F");
1523  pf_tree_->Branch("metType1_value", &metType1_value_, "metType1_value/F");
1524  pf_tree_->Branch("metType1_phi", &metType1_phi_, "metType1_phi/F");
1525  pf_tree_->Branch("metType1_sumEt", &metType1_sumEt_, "metType1_sumEt/F");
1526  pf_tree_->Branch("pf_NPV",&pf_NPV_, "pf_NPV/I");
1527  }
1528 
1529  return;
1530 }
1531 
1532 // ------------ method called once each job just after ending the event loop ------------
1533 void
1535  rootfile_->cd();
1536 
1537  if(doPFJets_){
1538  pf_tree_->Write();
1539  }
1540  // write miscItems
1541  // Save info about the triggers and other misc items
1542  {
1543  rootfile_->cd();
1544  rootfile_->mkdir("miscItems");
1545  rootfile_->cd("miscItems");
1546  misc_tree_= new TTree("misc_tree","tree for misc.info");
1547  misc_tree_->Branch("ignoreHLT",&ignoreHLT_,"ignoreHLT/O");
1548  misc_tree_->Branch("doPFJets",&doPFJets_,"doPFJets/O");
1549  misc_tree_->Branch("doGenJets",&doGenJets_,"doGenJets/O");
1550  misc_tree_->Branch("workOnAOD",&workOnAOD_,"workOnAOD/O");
1551  misc_tree_->Branch("photonTriggerNames",&photonTrigNamesV_);
1552  misc_tree_->Branch("jetTriggerNames",&jetTrigNamesV_);
1553  misc_tree_->Branch("nProcessed",&nProcessed_,"nProcessed/l");
1554  // put time stamp
1555  time_t ltime;
1556  ltime=time(NULL);
1557  TString str = TString(asctime(localtime(&ltime)));
1558  if (str[str.Length()-1]=='\n') str.Remove(str.Length()-1,1);
1559  TObjString date(str);
1560  date.Write(str.Data());
1561  misc_tree_->Fill();
1562  misc_tree_->Write();
1563  rootfile_->cd();
1564  }
1565 
1566  rootfile_->Close();
1567 }
1568 
1569 
1570 // ---------------------------------------------------------------------
1571 
1573  const edm::EventSetup &setup) {
1574  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "beginRun()";
1575 
1576  if (!ignoreHLT_) {
1577  int noPhotonTrigger= (photonTrigNamesV_.size()==0) ? 1:0;
1578  int noJetTrigger= (jetTrigNamesV_.size()==0) ? 1:0;
1579  if (!noPhotonTrigger &&
1580  (photonTrigNamesV_.size()==1) &&
1581  (photonTrigNamesV_[0].length()==0)) noPhotonTrigger=1;
1582  if (!noJetTrigger &&
1583  (jetTrigNamesV_.size()==1) &&
1584  (jetTrigNamesV_[0].length()==0)) noJetTrigger=1;
1585  if (noPhotonTrigger && noJetTrigger) {
1586  ignoreHLT_=true;
1587  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "HLT trigger ignored: no trigger requested";
1588  }
1589  } else {
1590  // clear trigger names, if needed
1591  photonTrigNamesV_.clear();
1592  jetTrigNamesV_.clear();
1593  }
1594 
1595  if (!ignoreHLT_) {
1596  if (debug_>0) edm::LogInfo("GammaJetAnalysis") << "Initializing trigger information for individual run";
1597  bool changed(true);
1598  std::string processName="HLT";
1599  if (hltPrescaleProvider_.init(iRun,setup,processName,changed)) {
1600  // if init returns TRUE, initialisation has succeeded!
1601  if (changed) {
1602  // The HLT config has actually changed wrt the previous Run, hence rebook your
1603  // histograms or do anything else dependent on the revised HLT config
1604  }
1605  }
1606  else {
1607  // if init returns FALSE, initialisation has NOT succeeded, which indicates a problem
1608  // with the file and/or code and needs to be investigated!
1610  << " HLT config extraction failure with process name " << processName;
1611  // In this case, all access methods will return empty values!
1612  }
1613  }
1614 }
1615 
1616 // ---------------------------------------------------------------------
1617 
1618 // helper function
1619 
1620 float GammaJetAnalysis::pfEcalIso(const reco::Photon* localPho1, edm::Handle<reco::PFCandidateCollection> pfHandle, float dRmax, float dRVetoBarrel, float dRVetoEndcap, float etaStripBarrel, float etaStripEndcap, float energyBarrel, float energyEndcap, reco::PFCandidate::ParticleType pfToUse) {
1621  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "Inside pfEcalIso";
1622  reco::Photon* localPho = localPho1->clone();
1623  float dRVeto;
1624  float etaStrip;
1625 
1626  if (localPho->isEB()) {
1627  dRVeto = dRVetoBarrel;
1628  etaStrip = etaStripBarrel;
1629  } else {
1630  dRVeto = dRVetoEndcap;
1631  etaStrip = etaStripEndcap;
1632  }
1633  const reco::PFCandidateCollection* forIsolation = pfHandle.product();
1634  int nsize = forIsolation->size();
1635  float sum = 0;
1636  for (int i=0; i<nsize; i++) {
1637  const reco::PFCandidate& pfc = (*forIsolation)[i];
1638  if (pfc.particleId() == pfToUse) {
1639  // Do not include the PFCandidate associated by SC Ref to the reco::Photon
1640  if(pfc.superClusterRef().isNonnull() && localPho->superCluster().isNonnull()) {
1641  if (pfc.superClusterRef() == localPho->superCluster())
1642  continue;
1643  }
1644 
1645  if (localPho->isEB()) {
1646  if (fabs(pfc.pt()) < energyBarrel)
1647  continue;
1648  } else {
1649  if (fabs(pfc.energy()) < energyEndcap)
1650  continue;
1651  }
1652  // Shift the photon direction vector according to the PF vertex
1653  math::XYZPoint pfvtx = pfc.vertex();
1654  math::XYZVector photon_directionWrtVtx(localPho->superCluster()->x() - pfvtx.x(),
1655  localPho->superCluster()->y() - pfvtx.y(),
1656  localPho->superCluster()->z() - pfvtx.z());
1657 
1658  float dEta = fabs(photon_directionWrtVtx.Eta() - pfc.momentum().Eta());
1659  float dR = deltaR(photon_directionWrtVtx.Eta(), photon_directionWrtVtx.Phi(), pfc.momentum().Eta(), pfc.momentum().Phi());
1660 
1661  if (dEta < etaStrip)
1662  continue;
1663 
1664  if(dR > dRmax || dR < dRVeto)
1665  continue;
1666 
1667  sum += pfc.pt();
1668  }
1669  }
1670  return sum;
1671 }
1672 
1673 // ---------------------------------------------------------------------
1674 
1676  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "Inside pfHcalIso";
1677  return pfEcalIso(localPho, pfHandle, dRmax, dRveto, dRveto, 0.0, 0.0, 0.0, 0.0, pfToUse);
1678 
1679 }
1680 
1681 // ---------------------------------------------------------------------
1682 
1683 std::vector<float> GammaJetAnalysis::pfTkIsoWithVertex(const reco::Photon* localPho1, edm::Handle<reco::PFCandidateCollection> pfHandle, edm::Handle<reco::VertexCollection> vtxHandle, float dRmax, float dRvetoBarrel, float dRvetoEndcap, float ptMin, float dzMax, float dxyMax, reco::PFCandidate::ParticleType pfToUse) {
1684 
1685  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "Inside pfTkIsoWithVertex()";
1686  reco::Photon* localPho = localPho1->clone();
1687 
1688  float dRveto;
1689  if (localPho->isEB())
1690  dRveto = dRvetoBarrel;
1691  else
1692  dRveto = dRvetoEndcap;
1693 
1694  std::vector<float> result;
1695  const reco::PFCandidateCollection* forIsolation = pfHandle.product();
1696 
1697  //Calculate isolation sum separately for each vertex
1698  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "vtxHandle->size() = " << vtxHandle->size();
1699  for(unsigned int ivtx=0; ivtx<(vtxHandle->size()); ++ivtx) {
1700  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "Vtx " << ivtx;
1701  // Shift the photon according to the vertex
1702  reco::VertexRef vtx(vtxHandle, ivtx);
1703  math::XYZVector photon_directionWrtVtx(localPho->superCluster()->x() - vtx->x(),
1704  localPho->superCluster()->y() - vtx->y(),
1705  localPho->superCluster()->z() - vtx->z());
1706  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "pfTkIsoWithVertex :: Will Loop over the PFCandidates";
1707  float sum = 0;
1708  // Loop over the PFCandidates
1709  for(unsigned i=0; i<forIsolation->size(); i++) {
1710  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "inside loop";
1711  const reco::PFCandidate& pfc = (*forIsolation)[i];
1712 
1713  //require that PFCandidate is a charged hadron
1714  if (debug_>1) {
1715  edm::LogInfo("GammaJetAnalysis") << "pfToUse=" << pfToUse;
1716  edm::LogInfo("GammaJetAnalysis") << "pfc.particleId()=" << pfc.particleId();
1717  }
1718 
1719  if (pfc.particleId() == pfToUse) {
1720  if (debug_>1) {
1721  edm::LogInfo("GammaJetAnalysis") << "\n ***** HERE pfc.particleId() == pfToUse ";
1722  edm::LogInfo("GammaJetAnalysis") << "pfc.pt()=" << pfc.pt();
1723  }
1724  if (pfc.pt() < ptMin) continue;
1725 
1726  float dz = fabs(pfc.trackRef()->dz(vtx->position()));
1727  if (dz > dzMax) continue;
1728 
1729  float dxy = fabs(pfc.trackRef()->dxy(vtx->position()));
1730  if(fabs(dxy) > dxyMax) continue;
1731  float dR = deltaR(photon_directionWrtVtx.Eta(), photon_directionWrtVtx.Phi(), pfc.momentum().Eta(), pfc.momentum().Phi());
1732  if(dR > dRmax || dR < dRveto) continue;
1733  sum += pfc.pt();
1734  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "pt=" << pfc.pt();
1735  }
1736  }
1737  if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "sum=" << sum;
1738  sum = sum*1.0;
1739  result.push_back(sum);
1740  }
1741  if (debug_>1) {
1742  edm::LogInfo("GammaJetAnalysis") << "Will return result";
1743  edm::LogInfo("GammaJetAnalysis") << "result" << &result;
1744  edm::LogInfo("GammaJetAnalysis") << "Result returned";
1745  }
1746  return result;
1747 }
1748 
1749 // ---------------------------------------------------------------------
1750 
1752  ppfjet_pt_ = ppfjet_p_ = ppfjet_E_ = 0;
1758  ppfjet_ChargedEMFrac_ = 0.;
1760  // Reset particle variables
1766  ppfjet_had_n_ = 0;
1767  ppfjet_ntwrs_ = 0;
1768  ppfjet_cluster_n_ = 0;
1769  ppfjet_ncandtracks_ = 0;
1770 
1771  ppfjet_had_E_.clear();
1772  ppfjet_had_px_.clear();
1773  ppfjet_had_py_.clear();
1774  ppfjet_had_pz_.clear();
1775  ppfjet_had_EcalE_.clear();
1776  ppfjet_had_rawHcalE_.clear();
1777  ppfjet_had_emf_.clear();
1778  ppfjet_had_E_mctruth_.clear();
1779  ppfjet_had_id_.clear();
1780  ppfjet_had_candtrackind_.clear();
1781  ppfjet_had_mcpdgId_.clear();
1782  ppfjet_had_ntwrs_.clear();
1783  ppfjet_twr_ieta_.clear();
1784  ppfjet_twr_iphi_.clear();
1785  ppfjet_twr_depth_.clear();
1786  ppfjet_twr_subdet_.clear();
1787  ppfjet_twr_candtrackind_.clear();
1788  ppfjet_twr_hadind_.clear();
1789  ppfjet_twr_elmttype_.clear();
1790  ppfjet_twr_hade_.clear();
1791  ppfjet_twr_frac_.clear();
1792  ppfjet_twr_dR_.clear();
1793  ppfjet_twr_clusterind_.clear();
1794  ppfjet_cluster_eta_.clear();
1795  ppfjet_cluster_phi_.clear();
1796  ppfjet_cluster_dR_.clear();
1797  ppfjet_candtrack_px_.clear();
1798  ppfjet_candtrack_py_.clear();
1799  ppfjet_candtrack_pz_.clear();
1800  ppfjet_candtrack_EcalE_.clear();
1801 
1802 }
1803 
1804 // ---------------------------------------------------------------------
1805 
1808  pfjet2_p_ = ppfjet_p_;
1809  pfjet2_E_ = ppfjet_E_;
1821 
1826 
1832 
1838 
1844 
1850 
1856 
1865 
1870 
1880 
1884 
1889 
1895 }
1896 
1897 // ---------------------------------------------------------------------
1898 
1899 double GammaJetAnalysis::deltaR(const reco::Jet* j1, const reco::Jet* j2)
1900 {
1901  double deta = j1->eta()-j2->eta();
1902  double dphi = std::fabs(j1->phi()-j2->phi());
1903  if(dphi>3.1415927) dphi = 2*3.1415927 - dphi;
1904  return std::sqrt(deta*deta + dphi*dphi);
1905 }
1906 
1907 // ---------------------------------------------------------------------
1908 
1909 double GammaJetAnalysis::deltaR(const double eta1, const double phi1, const double eta2, const double phi2)
1910 {
1911  double deta = eta1 - eta2;
1912  double dphi = std::fabs(phi1 - phi2);
1913  if(dphi>3.1415927) dphi = 2*3.1415927 - dphi;
1914  return std::sqrt(deta*deta + dphi*dphi);
1915 }
1916 
1917 // ---------------------------------------------------------------------
1918 
1919 /*
1920 // DetId rawId bits xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1921 // 1111222 3333345555556666666
1922 // 1 = detector
1923 // 2 = subdetector
1924 // 3 = depth
1925 // 4 = zside: 0 = negative z, 1 = positive z \
1926 // 5 = abs(ieta) | ieta,iphi
1927 // 6 = abs(iphi) /
1928 */
1929 
1930 // ---------------------------------------------------------------------
1931 
1933 {
1934  return id.rawId() & 0x3FFF; // Get 14 least-significant digits
1935 }
1936 
1937 // ---------------------------------------------------------------------
1938 
1940 {
1941  return id.rawId() & 0x3FFF; // Get 14 least-significant digits
1942 }
1943 
1944 // ---------------------------------------------------------------------
1945 
1946 
1947 //define this as a plug-in
1948 
RunNumber_t run() const
Definition: EventID.h:39
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
virtual Photon * clone() const
returns a clone of the candidate
T getUntrackedParameter(std::string const &, T const &) const
void copy_leadingPfJetVars_to_pfJet2()
std::vector< float > ppfjet_cluster_phi_
int i
Definition: DBlmapReader.cc:9
float hcalTowerSumEtConeDR04() const
Hcal isolation sum.
Definition: Photon.h:388
bool isValid() const
std::vector< int > pfjet2_twr_ieta_
std::vector< int > pfjet2_had_id_
edm::EDGetTokenT< std::vector< Bool_t > > tok_tightPhotonV_
std::vector< int > pfjet2_twr_iphi_
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:215
void idx(int set_idx)
ParticleType
particle types
Definition: PFCandidate.h:44
std::vector< float > pfjet2_candtrack_px_
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
std::vector< float > ppfjet_had_py_
std::vector< float > ppfjet_candtrack_px_
edm::EDGetTokenT< reco::ConversionCollection > tok_Conv_
edm::EDGetTokenT< GenEventInfoProduct > tok_GenEvInfo_
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:47
virtual double energy() const final
energy
std::vector< int > pfjet2_twr_hadind_
std::vector< float > ppfjet_candtrack_pz_
std::vector< int > pfjet2_twr_elmttype_
edm::EDGetTokenT< reco::PFCandidateCollection > tok_PFCand_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
std::vector< int > photonTrigFired_
std::vector< float > pfjet2_cluster_dR_
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::EDGetTokenT< edm::SortedCollection< HFRecHit, edm::StrictWeakOrdering< HFRecHit > > > tok_HF_
float chargedHadronEnergyFraction() const
chargedHadronEnergyFraction
Definition: PFJet.h:100
Base class for all types of Jets.
Definition: Jet.h:20
std::vector< float > ppfjet_had_E_
edm::EDGetTokenT< double > tok_Rho_
edm::EDGetTokenT< edm::TriggerResults > tok_TrigRes_
std::vector< int > ppfjet_twr_ieta_
assert(m_qm.get())
std::vector< int > ppfjet_twr_hadind_
size_type size() const
Definition: OwnVector.h:264
std::string hoRecHitName_
std::vector< int > ppfjet_twr_subdet_
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< int > ppfjet_had_candtrackind_
virtual double phi() const final
momentum azimuthal angle
#define NULL
Definition: scimark2.h:8
float ecalRecHitSumEtConeDR04() const
Definition: Photon.h:386
const reco::PFJet * jet(void) const
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:192
std::vector< float > pfTkIsoWithVertex(const reco::Photon *localPho1, edm::Handle< reco::PFCandidateCollection > pfHandle, edm::Handle< reco::VertexCollection > vtxHandle, float dRmax, float dRvetoBarrel, float dRvetoEndcap, float ptMin, float dzMax, float dxyMax, reco::PFCandidate::ParticleType pfToUse)
std::string prodProcess_
std::string hbheRecHitName_
std::vector< float > pfjet2_had_E_
Strings::size_type size() const
Definition: TriggerNames.cc:39
edm::EDGetTokenT< reco::PFMETCollection > tok_PFMET_
edm::EDGetTokenT< reco::VertexCollection > tok_Vertex_
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:622
std::vector< float > pfjet2_had_EcalE_
std::vector< float > pfjet2_cluster_eta_
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
unsigned int debugEvent
edm::EDGetTokenT< reco::BeamSpot > tok_BS_
int chargedMultiplicity() const
chargedMultiplicity
Definition: PFJet.h:155
std::vector< float > pfjet2_candtrack_py_
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
Jets made from PFObjects.
Definition: PFJet.h:21
std::vector< int > pfjet2_twr_candtrackind_
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:163
std::string photonCollName_
std::vector< int > pfjet2_twr_clusterind_
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::vector< int > pfjet2_twr_depth_
tuple result
Definition: mps_fire.py:84
std::vector< int > pfjet2_had_candtrackind_
std::vector< float > ppfjet_twr_frac_
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:433
dictionary elements
U second(std::pair< T, U > const &p)
edm::EDGetTokenT< std::vector< reco::GenParticle > > tok_GenPart_
std::vector< int > ppfjet_had_id_
float neutralEmEnergyFraction() const
neutralEmEnergyFraction
Definition: PFJet.h:152
float met_value_
MET info.
std::vector< int > jetTrigPrescale_
int iEvent
Definition: GenABIO.cc:230
std::vector< int > ppfjet_twr_clusterind_
edm::EDGetTokenT< edm::SortedCollection< HORecHit, edm::StrictWeakOrdering< HORecHit > > > tok_HO_
std::string rootHistFilename_
std::string hfRecHitName_
std::vector< float > pfjet2_had_E_mctruth_
std::vector< float > ppfjet_candtrack_py_
float pfEcalIso(const reco::Photon *localPho1, edm::Handle< reco::PFCandidateCollection > pfHandle, float dRmax, float dRVetoBarrel, float dRVetoEndcap, float etaStripBarrel, float etaStripEndcap, float energyBarrel, float energyEndcap, reco::PFCandidate::ParticleType pfToUse)
std::vector< float > pfjet2_had_py_
float pfHcalIso(const reco::Photon *localPho, edm::Handle< reco::PFCandidateCollection > pfHandle, float dRmax, float dRveto, reco::PFCandidate::ParticleType pfToUse)
std::vector< float > ppfjet_cluster_dR_
T sqrt(T t)
Definition: SSEVec.h:18
edm::EDGetTokenT< reco::PhotonCollection > tok_Photon_
double scale(void) const
float ppfjet_ChargedMultiplicity_
bool isValid() const
float sigmaIetaIeta() const
Definition: Photon.h:224
std::vector< float > ppfjet_twr_hade_
std::vector< int > ppfjet_twr_elmttype_
unsigned int helper_findTrigger(const std::vector< std::string > &list, const std::string &name)
std::vector< float > ppfjet_had_rawHcalE_
edm::InputTag rhoCollection_
edm::EDGetTokenT< std::vector< Bool_t > > tok_loosePhotonV_
std::vector< int > ppfjet_twr_depth_
edm::EDGetTokenT< edm::ValueMap< Bool_t > > tok_tightPhoton_
const reco::Photon * photon(void) const
virtual const Point & vertex() const
vertex position (overwritten by PF...)
Definition: PFCandidate.cc:647
Jets made from MC generator particles.
Definition: GenJet.h:24
float neutralHadronEnergyFraction() const
neutralHadronEnergyFraction
Definition: PFJet.h:104
std::vector< float > pfjet2_candtrack_pz_
std::vector< float > pfjet2_twr_frac_
virtual double py() const final
y coordinate of momentum vector
float hadTowOverEm() const
the ration of hadronic energy in towers behind the BCs in the SC and the SC energy ...
Definition: Photon.h:210
edm::InputTag pfMETColl
edm::InputTag pfType1METColl
std::vector< float > pfjet2_had_rawHcalE_
static std::string const triggerResults
Definition: EdmProvDump.cc:41
float hadronicOverEm() const
the total hadronic over electromagnetic fraction
Definition: Photon.h:203
void beginRun(const edm::Run &, const edm::EventSetup &)
std::string genParticleCollName_
bool isValid() const
Definition: HandleBase.h:75
double p2[4]
Definition: TauolaWrapper.h:90
virtual void beginJob()
std::vector< float > ppfjet_twr_dR_
std::vector< float > ppfjet_candtrack_EcalE_
std::vector< float > ppfjet_cluster_eta_
dictionary cv
Definition: cuy.py:362
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:634
std::vector< float > pfjet2_cluster_phi_
std::string pfJetCollName_
double getNeutralPVCorr(double eta, int intNPV, double area, bool isMC_)
Definition: DetId.h:18
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
float chargedEmEnergyFraction() const
chargedEmEnergyFraction
Definition: PFJet.h:144
virtual Vector momentum() const final
spatial momentum vector
std::vector< std::string > photonTrigNamesV_
T const * product() const
Definition: Handle.h:81
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
std::vector< int > jetTrigFired_
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
edm::EDGetTokenT< reco::PFJetCollection > tok_PFJet_
std::vector< float > ppfjet_had_E_mctruth_
edm::EDGetTokenT< edm::ValueMap< Bool_t > > tok_loosePhoton_
bool hasPixelSeed() const
Bool flagging photons having a non-zero size vector of Ref to electornPixel seeds.
Definition: Photon.h:75
std::vector< std::string > jetTrigNamesV_
const T & get() const
Definition: EventSetup.h:56
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
Definition: JetCorrector.cc:50
edm::EDGetTokenT< std::vector< reco::Vertex > > tok_PV_
std::pair< int, int > prescaleValues(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
Combined L1T (pair.first) and HLT (pair.second) prescales per HLT path.
std::vector< int > pfjet2_had_ntwrs_
std::string genEventInfoName_
virtual double p() const final
magnitude of momentum vector
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
std::string const & label() const
Definition: InputTag.h:36
double deltaR(const reco::Jet *j1, const reco::Jet *j2)
bool isEB() const
Definition: Photon.h:120
int getEtaPhi(const DetId id)
float trkSumPtHollowConeDR04() const
Definition: Photon.h:402
std::vector< float > pfjet2_twr_hade_
edm::EDGetTokenT< edm::SortedCollection< HBHERecHit, edm::StrictWeakOrdering< HBHERecHit > > > tok_HBHE_
edm::EventID id() const
Definition: EventBase.h:59
std::string genJetCollName_
void HERE(const char *msg)
double scaledEt() const
std::string pvCollName_
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
std::vector< float > pfjet2_had_emf_
HLTPrescaleProvider hltPrescaleProvider_
double p1[4]
Definition: TauolaWrapper.h:89
virtual float jetArea() const
get jet area
Definition: Jet.h:105
virtual int nConstituents() const
of constituents
Definition: Jet.h:65
std::vector< float > ppfjet_had_px_
std::vector< int > ppfjet_had_mcpdgId_
static std::atomic< unsigned int > counter
std::vector< float > pfjet2_twr_dR_
GammaJetAnalysis(const edm::ParameterSet &)
float r9() const
Definition: Photon.h:227
std::vector< float > pfjet2_had_pz_
edm::EDGetTokenT< reco::GsfElectronCollection > tok_GsfElec_
float pfjet2_ChargedMultiplicity_
double pt(void) const
std::vector< int > pfjet2_twr_subdet_
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
Definition: PFJet.cc:52
virtual double px() const final
x coordinate of momentum vector
std::vector< int > ppfjet_twr_iphi_
virtual double et() const final
transverse energy
std::vector< int > photonTrigPrescale_
std::vector< int > ppfjet_had_ntwrs_
edm::EDGetTokenT< std::vector< reco::GenJet > > tok_GenJet_
std::vector< float > ppfjet_had_pz_
virtual double eta() const final
momentum pseudorapidity
std::vector< float > pfjet2_candtrack_EcalE_
std::vector< int > pfjet2_had_mcpdgId_
edm::EDGetTokenT< reco::PFMETCollection > tok_PFType1MET_
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:166
virtual ParticleType particleId() const
Definition: PFCandidate.h:373
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::vector< float > ppfjet_had_emf_
std::vector< int > ppfjet_twr_candtrackind_
virtual void endJob()
float calc_dPhi(const PhotonPair &pho, const JetPair_type &jet)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
std::vector< std::vector< float > > tagPho_pfiso_mycharged03
std::vector< float > ppfjet_had_EcalE_
std::vector< float > pfjet2_had_px_
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:628
std::string pfJetCorrName_
Definition: Run.h:43
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
virtual double pt() const final
transverse momentum
reco::SuperClusterRef superClusterRef() const
return a reference to the corresponding SuperCluster if any
Definition: PFCandidate.cc:600