test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ZToMuMuGammaAnalyzer.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <iomanip>
3 //
4 
6 //#include "CommonTools/UtilAlgos/interface/DeltaR.h"
8 
19 using namespace std;
20 
21 
23 {
24 
25  fName_ = pset.getParameter<std::string>("analyzerName");
26 
27  verbosity_ = pset.getUntrackedParameter<int>("Verbosity");
28  prescaleFactor_ = pset.getUntrackedParameter<int>("prescaleFactor",1);
29  standAlone_ = pset.getParameter<bool>("standAlone");
30  outputFileName_ = pset.getParameter<string>("OutputFileName");
31  isHeavyIon_ = pset.getUntrackedParameter<bool>("isHeavyIon",false);
32 
33  // triggerEvent_ = pset.getParameter<edm::InputTag>("triggerEvent");
34  triggerEvent_token_ = consumes<trigger::TriggerEvent>(pset.getParameter<edm::InputTag>("triggerEvent"));
35 
36  offline_pvToken_ = consumes<reco::VertexCollection>(pset.getUntrackedParameter<edm::InputTag>("offlinePV", edm::InputTag("offlinePrimaryVertices")));
37 
38  useTriggerFiltering_ = pset.getParameter<bool>("useTriggerFiltering");
39  splitHistosEBEE_ = pset.getParameter<bool>("splitHistosEBEE");
40  use2DHistos_ = pset.getParameter<bool>("use2DHistos");
41  makeProfiles_ = pset.getParameter<bool>("makeProfiles");
42 
43  photon_token_ = consumes<vector<reco::Photon> >(pset.getParameter<edm::InputTag>("phoProducer"));
44  muon_token_ = consumes<vector<reco::Muon> >(pset.getParameter<edm::InputTag>("muonProducer"));
45  pfCandidates_ = consumes<reco::PFCandidateCollection>(pset.getParameter<edm::InputTag>("pfCandidates"));
46 
47 
48  photonIsoValmap_token_ = consumes<edm::ValueMap<std::vector<reco::PFCandidateRef> > >(pset.getParameter<edm::InputTag>("particleBasedIso"));
49 
50 
51  barrelRecHit_token_ = consumes<edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > >(pset.getParameter<edm::InputTag>("barrelRecHitProducer"));
52 
53  endcapRecHit_token_ = consumes<edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > >(pset.getParameter<edm::InputTag>("endcapRecHitProducer"));
54 
55  beamSpot_token_ = consumes<reco::BeamSpot>(pset.getParameter<edm::InputTag>("beamSpot"));
56 
57  // Muon selection
58  muonMinPt_ = pset.getParameter<double>("muonMinPt");
59  minPixStripHits_ = pset.getParameter<int>("minPixStripHits");
60  muonMaxChi2_ = pset.getParameter<double>("muonMaxChi2");
61  muonMaxDxy_ = pset.getParameter<double>("muonMaxDxy");
62  muonMatches_ = pset.getParameter<int>("muonMatches");
63  validPixHits_ = pset.getParameter<int>("validPixHits");
64  validMuonHits_ = pset.getParameter<int>("validMuonHits");
65  muonTrackIso_ = pset.getParameter<double>("muonTrackIso");
66  muonTightEta_ = pset.getParameter<double>("muonTightEta");
67  // Dimuon selection
68  minMumuInvMass_ = pset.getParameter<double>("minMumuInvMass");
69  maxMumuInvMass_ = pset.getParameter<double>("maxMumuInvMass");
70  // Photon selection
71  photonMinEt_ = pset.getParameter<double>("photonMinEt");
72  photonMaxEta_ = pset.getParameter<double>("photonMaxEta");
73  photonTrackIso_ = pset.getParameter<double>("photonTrackIso");
74  // mumuGamma selection
75  nearMuonDr_ = pset.getParameter<double>("nearMuonDr");
76  nearMuonHcalIso_ = pset.getParameter<double>("nearMuonHcalIso");
77  farMuonEcalIso_ = pset.getParameter<double>("farMuonEcalIso");
78  farMuonTrackIso_ = pset.getParameter<double>("farMuonTrackIso");
79  farMuonMinPt_ = pset.getParameter<double>("farMuonMinPt");
80  minMumuGammaInvMass_ = pset.getParameter<double>("minMumuGammaInvMass");
81  maxMumuGammaInvMass_ = pset.getParameter<double>("maxMumuGammaInvMass");
82 
83  parameters_ = pset;
84 
85 }
86 
88 
90 {
91  nEvt_=0;
92  nEntry_=0;
93 
94  dbe_ = 0;
96 
97  double eMin = parameters_.getParameter<double>("eMin");
98  double eMax = parameters_.getParameter<double>("eMax");
99  int eBin = parameters_.getParameter<int>("eBin");
100 
101  double etMin = parameters_.getParameter<double>("etMin");
102  double etMax = parameters_.getParameter<double>("etMax");
103  int etBin = parameters_.getParameter<int>("etBin");
104 
105  double sumMin = parameters_.getParameter<double>("sumMin");
106  double sumMax = parameters_.getParameter<double>("sumMax");
107  int sumBin = parameters_.getParameter<int>("sumBin");
108 
109  double etaMin = parameters_.getParameter<double>("etaMin");
110  double etaMax = parameters_.getParameter<double>("etaMax");
111  int etaBin = parameters_.getParameter<int>("etaBin");
112 
113  double phiMin = parameters_.getParameter<double>("phiMin");
114  double phiMax = parameters_.getParameter<double>("phiMax");
115  int phiBin = parameters_.getParameter<int>("phiBin");
116 
117  double r9Min = parameters_.getParameter<double>("r9Min");
118  double r9Max = parameters_.getParameter<double>("r9Max");
119  int r9Bin = parameters_.getParameter<int>("r9Bin");
120 
121  double hOverEMin = parameters_.getParameter<double>("hOverEMin");
122  double hOverEMax = parameters_.getParameter<double>("hOverEMax");
123  int hOverEBin = parameters_.getParameter<int>("hOverEBin");
124 
125 // double xMin = parameters_.getParameter<double>("xMin");
126 // double xMax = parameters_.getParameter<double>("xMax");
127 // int xBin = parameters_.getParameter<int>("xBin");
128 
129 // double yMin = parameters_.getParameter<double>("yMin");
130 // double yMax = parameters_.getParameter<double>("yMax");
131 // int yBin = parameters_.getParameter<int>("yBin");
132 
133  double numberMin = parameters_.getParameter<double>("numberMin");
134  double numberMax = parameters_.getParameter<double>("numberMax");
135  int numberBin = parameters_.getParameter<int>("numberBin");
136 
137 // double zMin = parameters_.getParameter<double>("zMin");
138 // double zMax = parameters_.getParameter<double>("zMax");
139 // int zBin = parameters_.getParameter<int>("zBin");
140 
141 // double rMin = parameters_.getParameter<double>("rMin");
142 // double rMax = parameters_.getParameter<double>("rMax");
143 // int rBin = parameters_.getParameter<int>("rBin");
144 
145 // double dPhiTracksMin = parameters_.getParameter<double>("dPhiTracksMin");
146 // double dPhiTracksMax = parameters_.getParameter<double>("dPhiTracksMax");
147 // int dPhiTracksBin = parameters_.getParameter<int>("dPhiTracksBin");
148 
149 // double dEtaTracksMin = parameters_.getParameter<double>("dEtaTracksMin");
150 // double dEtaTracksMax = parameters_.getParameter<double>("dEtaTracksMax");
151 // int dEtaTracksBin = parameters_.getParameter<int>("dEtaTracksBin");
152 
153  double sigmaIetaMin = parameters_.getParameter<double>("sigmaIetaMin");
154  double sigmaIetaMax = parameters_.getParameter<double>("sigmaIetaMax");
155  int sigmaIetaBin = parameters_.getParameter<int>("sigmaIetaBin");
156 
157 // double eOverPMin = parameters_.getParameter<double>("eOverPMin");
158 // double eOverPMax = parameters_.getParameter<double>("eOverPMax");
159 // int eOverPBin = parameters_.getParameter<int>("eOverPBin");
160 
161 // double chi2Min = parameters_.getParameter<double>("chi2Min");
162 // double chi2Max = parameters_.getParameter<double>("chi2Max");
163 // int chi2Bin = parameters_.getParameter<int>("chi2Bin");
164 
165 
166  int reducedEtBin = etBin/4;
167  int reducedEtaBin = etaBin/4;
168  int reducedSumBin = sumBin/4;
169  int reducedR9Bin = r9Bin/4;
170 
172 
173  if (dbe_) {
174 
175 
176  dbe_->setCurrentFolder("Egamma/"+fName_+"/ZToMuMuGamma");
177 
178  h1_mumuInvMass_[0] = dbe_->book1D("mumuInvMass","Two muon invariant mass: M (GeV)",etBin,etMin,etMax);
179  h1_mumuGammaInvMass_[0] = dbe_->book1D("mumuGammaInvMass","Two-muon plus gamma invariant mass: M (GeV)",etBin,etMin,etMax);
180  h1_mumuGammaInvMass_[1] = dbe_->book1D("mumuGammaInvMassBarrel","Two-muon plus gamma invariant mass: M (GeV)",etBin,etMin,etMax);
181  h1_mumuGammaInvMass_[2] = dbe_->book1D("mumuGammaInvMassEndcap","Two-muon plus gamma invariant mass: M (GeV)",etBin,etMin,etMax);
182 
184 
186  h_nRecoVtx_ = dbe_->book1D("nOfflineVtx","# of Offline Vertices",80, -0.5, 79.5);
187 
188  //ENERGY
189  h_phoE_[0] = dbe_->book1D("phoE","Energy;E (GeV)",eBin,eMin,eMax);
190  h_phoSigmaEoverE_[0] = dbe_->book1D("phoSigmaEoverE","All Ecal: #sigma_{E}/E;#sigma_{E}/E",eBin,eMin,eMax);
191  h_phoEt_[0] = dbe_->book1D("phoEt","E_{T};E_{T} (GeV)", etBin,etMin,etMax);
192 
193  //NUMBER OF PHOTONS
194  h_nPho_[0] = dbe_->book1D("nPho", "Number of Photons per Event;# #gamma", numberBin,numberMin,numberMax);
195 
196  //GEOMETRICAL
197  h_phoEta_[0] = dbe_->book1D("phoEta", "#eta;#eta",etaBin,etaMin,etaMax);
198  h_phoPhi_[0] = dbe_->book1D("phoPhi", "#phi;#phi",phiBin,phiMin,phiMax);
199 
200  h_scEta_[0] = dbe_->book1D("scEta", "SuperCluster #eta;#eta",etaBin,etaMin,etaMax);
201  h_scPhi_[0] = dbe_->book1D("scPhi", "SuperCluster #phi;#phi",phiBin,phiMin,phiMax);
202 
203  //SHOWER SHAPE
204  h_r9_[0] = dbe_->book1D("r9","R9;R9",r9Bin,r9Min, r9Max);
205  h_e1x5_[0] = dbe_->book1D("e1x5","E1x5;E1X5 (GeV)",reducedEtBin,etMin,etMax);
206  h_e2x5_[0] = dbe_->book1D("e2x5","E2x5;E2X5 (GeV)",reducedEtBin,etMin,etMax);
207  h_r1x5_[0] = dbe_->book1D("r1x5","r1x5;r1X5 (GeV)",reducedEtBin,etMin,etMax);
208  h_r2x5_[0] = dbe_->book1D("r2x5","r2x5;r2X5 (GeV)",reducedEtBin,etMin,etMax);
209  h_phoSigmaIetaIeta_[0] = dbe_->book1D("phoSigmaIetaIeta","#sigma_{i#etai#eta};#sigma_{i#etai#eta}",sigmaIetaBin,sigmaIetaMin,sigmaIetaMax);
210  //TRACK ISOLATION
211  h_nTrackIsolSolid_[0] = dbe_->book1D("nIsoTracksSolid","Number Of Tracks in the Solid Iso Cone;# tracks",numberBin,numberMin,numberMax);
212  h_nTrackIsolHollow_[0] = dbe_->book1D("nIsoTracksHollow","Number Of Tracks in the Hollow Iso Cone;# tracks",numberBin,numberMin,numberMax);
213  h_trackPtSumSolid_[0] = dbe_->book1D("isoPtSumSolid","Track P_{T} Sum in the Solid Iso Cone;P_{T} (GeV)",sumBin,sumMin,sumMax);
214  h_trackPtSumHollow_[0] = dbe_->book1D("isoPtSumHollow","Track P_{T} Sum in the Hollow Iso Cone;P_{T} (GeV)",sumBin,sumMin,sumMax);
215  //CALORIMETER ISOLATION VARIABLES
216  h_ecalSum_[0] = dbe_->book1D("ecalSum","Ecal Sum in the Iso Cone;E (GeV)",sumBin,sumMin,sumMax);
217  h_hcalSum_[0] = dbe_->book1D("hcalSum","Hcal Sum in the Iso Cone;E (GeV)",sumBin,sumMin,sumMax);
218  h_hOverE_[0] = dbe_->book1D("hOverE","H/E;H/E",hOverEBin,hOverEMin,hOverEMax);
219  h_h1OverE_[0] = dbe_->book1D("h1OverE","H/E for Depth 1;H/E",hOverEBin,hOverEMin,hOverEMax);
220  h_h2OverE_[0] = dbe_->book1D("h2OverE","H/E for Depth 2;H/E",hOverEBin,hOverEMin,hOverEMax);
221  string histname = "newhOverE";
222  h_newhOverE_[0] = dbe_->book1D(histname+"All", "new H/E: All Ecal",100,0., 0.1) ;
223  // Information from Particle Flow
224  histname = "chargedHadIso";
225  h_chHadIso_[0]= dbe_->book1D(histname+"All", "PF chargedHadIso: All Ecal",etBin,etMin,20.);
226  histname = "neutralHadIso";
227  h_nHadIso_[0]= dbe_->book1D(histname+"All", "PF neutralHadIso: All Ecal",etBin,etMin,20.);
228  histname = "photonIso";
229  h_phoIso_[0]= dbe_->book1D(histname+"All", "PF photonIso: All Ecal",etBin,etMin,20.);
230  histname = "nCluOutMustache";
231  h_nCluOutsideMustache_[0]= dbe_->book1D(histname+"All", "PF number of clusters outside Mustache: All Ecal",50,0.,50.);
232  histname = "etOutMustache";
233  h_etOutsideMustache_[0]= dbe_->book1D(histname+"All", "PF et outside Mustache: All Ecal",etBin,etMin,20.);
234  histname = "pfMVA";
235  h_pfMva_[0]= dbe_->book1D(histname+"All", "PF MVA output: All Ecal",50,-1.,2.);
237  histname = "SumPtOverPhoPt_ChHad_Cleaned";
238  h_SumPtOverPhoPt_ChHad_Cleaned_[0]= dbe_->book1D(histname+"All", "Pf Cand Sum Pt Over photon pt Charged Hadrons: All Ecal",etBin,etMin,2.);
239  histname = "SumPtOverPhoPt_NeuHad_Cleaned";
240  h_SumPtOverPhoPt_NeuHad_Cleaned_[0]= dbe_->book1D(histname+"All", "Pf Cand Sum Pt Over photon pt Neutral Hadrons: All Ecal",etBin,etMin,2.);
241  histname = "SumPtOverPhoPt_Pho_Cleaned";
242  h_SumPtOverPhoPt_Pho_Cleaned_[0]= dbe_->book1D(histname+"All", "Pf Cand Sum Pt Over photon pt Photons Hadrons: All Ecal",etBin,etMin,2.);
243  histname = "dRPhoPFcand_ChHad_Cleaned";
244  h_dRPhoPFcand_ChHad_Cleaned_[0]= dbe_->book1D(histname+"All", "dR(pho,cand) Charged Hadrons : All Ecal",etBin,etMin,0.7);
245  histname = "dRPhoPFcand_NeuHad_Cleaned";
246  h_dRPhoPFcand_NeuHad_Cleaned_[0]= dbe_->book1D(histname+"All", "dR(pho,cand) Neutral Hadrons : All Ecal",etBin,etMin,0.7);
247  histname = "dRPhoPFcand_Pho_Cleaned";
248  h_dRPhoPFcand_Pho_Cleaned_[0]= dbe_->book1D(histname+"All", "dR(pho,cand) Photons : All Ecal",etBin,etMin,0.7);
249  //
250  histname = "SumPtOverPhoPt_ChHad_unCleaned";
251  h_SumPtOverPhoPt_ChHad_unCleaned_[0]= dbe_->book1D(histname+"All", "Pf Cand Sum Pt Over photon pt Charged Hadrons : All Ecal",etBin,etMin,2.);
252  histname = "SumPtOverPhoPt_NeuHad_unCleaned";
253  h_SumPtOverPhoPt_NeuHad_unCleaned_[0]= dbe_->book1D(histname+"All", "Pf Cand Sum Pt Over photon pt Neutral Hadrons : All Ecal",etBin,etMin,2.);
254  histname = "SumPtOverPhoPt_Pho_unCleaned";
255  h_SumPtOverPhoPt_Pho_unCleaned_[0]= dbe_->book1D(histname+"All", "Pf Cand Sum Pt Over photon pt Photons: All Ecal",etBin,etMin,2.);
256  histname = "dRPhoPFcand_ChHad_unCleaned";
257  h_dRPhoPFcand_ChHad_unCleaned_[0]= dbe_->book1D(histname+"All", "dR(pho,cand) Charged Hadrons : All Ecal",etBin,etMin,0.7);
258  histname = "dRPhoPFcand_NeuHad_unCleaned";
259  h_dRPhoPFcand_NeuHad_unCleaned_[0]= dbe_->book1D(histname+"All", "dR(pho,cand) Neutral Hadrons : All Ecal",etBin,etMin,0.7);
260  histname = "dRPhoPFcand_Pho_unCleaned";
261  h_dRPhoPFcand_Pho_unCleaned_[0]= dbe_->book1D(histname+"All", "dR(pho,cand) Photons: All Ecal",etBin,etMin,0.7);
262 
263 
264 
265 
266  // if(splitHistosEBEE_){
267  // NUMBER OF PHOTONS
268  h_nPho_[1] = dbe_->book1D("nPhoBarrel","Number of Photons per Event;# #gamma", numberBin,numberMin,numberMax);
269  h_nPho_[2] = dbe_->book1D("nPhoEndcap","Number of Photons per Event;# #gamma", numberBin,numberMin,numberMax);
270  //EB ENERGY
271  h_phoE_[1] = dbe_->book1D("phoEBarrel","Energy for Barrel;E (GeV)",eBin,eMin,eMax);
272  h_phoSigmaEoverE_[1] = dbe_->book1D("phoSigmaEoverEBarrel","Barrel: #sigma_E/E;#sigma_{E}/E",eBin,eMin,eMax);
273  h_phoEt_[1] = dbe_->book1D("phoEtBarrel","E_{T};E_{T} (GeV)", etBin,etMin,etMax);
274  //EE ENERGY
275  h_phoEt_[2] = dbe_->book1D("phoEtEndcap","E_{T};E_{T} (GeV)", etBin,etMin,etMax);
276  h_phoE_[2] = dbe_->book1D("phoEEndcap","Energy for Endcap;E (GeV)",eBin,eMin,eMax);
277  h_phoSigmaEoverE_[2] = dbe_->book1D("phoSigmaEoverEEndcap","Endcap: #sigma_{E}/E;#sigma_{E}/E",eBin,eMin,eMax);
278  //EB GEOMETRICAL
279  h_phoEta_[1] = dbe_->book1D("phoEtaBarrel","#eta;#eta",etaBin,etaMin,etaMax);
280  h_phoPhi_[1] = dbe_->book1D("phoPhiBarrel","#phi;#phi",phiBin,phiMin,phiMax);
281  h_scEta_[1] = dbe_->book1D("scEtaBarrel","SuperCluster #eta;#eta",etaBin,etaMin,etaMax);
282  h_scPhi_[1] = dbe_->book1D("scPhiBarrel","SuperCluster #phi;#phi",phiBin,phiMin,phiMax);
283  //EE GEOMETRICAL
284  h_phoEta_[2] = dbe_->book1D("phoEtaEndcap","#eta;#eta",etaBin,etaMin,etaMax);
285  h_phoPhi_[2] = dbe_->book1D("phoPhiEndcap","#phi;#phi",phiBin,phiMin,phiMax);
286  h_scEta_[2] = dbe_->book1D("scEtaEndcap","SuperCluster #eta;#eta",etaBin,etaMin,etaMax);
287  h_scPhi_[2] = dbe_->book1D("scPhiEndcap","SuperCluster #phi;#phi",phiBin,phiMin,phiMax);
288  //SHOWER SHAPES
289  h_r9_[1] = dbe_->book1D("r9Barrel","R9;R9",r9Bin,r9Min, r9Max);
290  h_r9_[2] = dbe_->book1D("r9Endcap","R9;R9",r9Bin,r9Min, r9Max);
291  h_e1x5_[1] = dbe_->book1D("e1x5Barrel","E1x5;E1X5 (GeV)",reducedEtBin,etMin,etMax);
292  h_e1x5_[2] = dbe_->book1D("e1x5Endcap","E1x5;E1X5 (GeV)",reducedEtBin,etMin,etMax);
293  h_e2x5_[1] = dbe_->book1D("e2x5Barrel","E2x5;E2X5 (GeV)",reducedEtBin,etMin,etMax);
294  h_e2x5_[2] = dbe_->book1D("e2x5Endcap","E2x5;E2X5 (GeV)",reducedEtBin,etMin,etMax);
295  h_r1x5_[1] = dbe_->book1D("r1x5Barrel","r1x5;r1X5 (GeV)",reducedEtBin,etMin,etMax);
296  h_r1x5_[2] = dbe_->book1D("r1x5Endcap","r1x5;r1X5 (GeV)",reducedEtBin,etMin,etMax);
297  h_r2x5_[1] = dbe_->book1D("r2x5Barrel","r2x5;r2X5 (GeV)",reducedEtBin,etMin,etMax);
298  h_r2x5_[2] = dbe_->book1D("r2x5Endcap","r2x5;r2X5 (GeV)",reducedEtBin,etMin,etMax);
299  h_phoSigmaIetaIeta_[1] = dbe_->book1D("phoSigmaIetaIetaBarrel","#sigma_{i#etai#eta};#sigma_{i#etai#eta}",sigmaIetaBin,sigmaIetaMin,sigmaIetaMax);
300  h_phoSigmaIetaIeta_[2] = dbe_->book1D("phoSigmaIetaIetaEndcap","#sigma_{i#etai#eta};#sigma_{i#etai#eta}",sigmaIetaBin,sigmaIetaMin,sigmaIetaMax);
301  // TRACK ISOLATION
302  h_nTrackIsolSolid_[1] = dbe_->book1D("nIsoTracksSolidBarrel","Number Of Tracks in the Solid Iso Cone;# tracks",numberBin,numberMin,numberMax);
303  h_nTrackIsolSolid_[2] = dbe_->book1D("nIsoTracksSolidEndcap","Number Of Tracks in the Solid Iso Cone;# tracks",numberBin,numberMin,numberMax);
304  h_nTrackIsolHollow_[1] = dbe_->book1D("nIsoTracksHollowBarrel","Number Of Tracks in the Hollow Iso Cone;# tracks",numberBin,numberMin,numberMax);
305  h_nTrackIsolHollow_[2] = dbe_->book1D("nIsoTracksHollowEndcap","Number Of Tracks in the Hollow Iso Cone;# tracks",numberBin,numberMin,numberMax);
306  h_trackPtSumSolid_[1] = dbe_->book1D("isoPtSumSolidBarrel","Track P_{T} Sum in the Solid Iso Cone;P_{T} (GeV)",sumBin,sumMin,sumMax);
307  h_trackPtSumSolid_[2] = dbe_->book1D("isoPtSumSolidEndcap","Track P_{T} Sum in the Solid Iso Cone;P_{T} (GeV)",sumBin,sumMin,sumMax);
308  h_trackPtSumHollow_[1] = dbe_->book1D("isoPtSumHollowBarrel","Track P_{T} Sum in the Hollow Iso Cone;P_{T} (GeV)",sumBin,sumMin,sumMax);
309  h_trackPtSumHollow_[2] = dbe_->book1D("isoPtSumHollowEndcap","Track P_{T} Sum in the Hollow Iso Cone;P_{T} (GeV)",sumBin,sumMin,sumMax);
310  // CALORIMETER ISOLATION VARIABLES
311  h_ecalSum_[1] = dbe_->book1D("ecalSumBarrel","Ecal Sum in the Iso Cone;E (GeV)",sumBin,sumMin,sumMax);
312  h_ecalSum_[2] = dbe_->book1D("ecalSumEndcap","Ecal Sum in the Iso Cone;E (GeV)",sumBin,sumMin,sumMax);
313  h_hcalSum_[1] = dbe_->book1D("hcalSumBarrel","Hcal Sum in the Iso Cone;E (GeV)",sumBin,sumMin,sumMax);
314  h_hcalSum_[2] = dbe_->book1D("hcalSumEndcap","Hcal Sum in the Iso Cone;E (GeV)",sumBin,sumMin,sumMax);
315  //H/E
316  // EB
317  h_hOverE_[1] = dbe_->book1D("hOverEBarrel","H/E;H/E",hOverEBin,hOverEMin,hOverEMax);
318  h_h1OverE_[1] = dbe_->book1D("h1OverEBarrel","H/E for Depth 1;H/E",hOverEBin,hOverEMin,hOverEMax);
319  h_h2OverE_[1] = dbe_->book1D("h2OverEBarrel","H/E for Depth 2;H/E",hOverEBin,hOverEMin,hOverEMax);
320  histname = "newhOverE";
321  h_newhOverE_[1] = dbe_->book1D(histname+"Barrel", "new H/E: Barrel",100,0., 0.1) ;
322  //EE
323  h_hOverE_[2] = dbe_->book1D("hOverEEndcap","H/E;H/E",hOverEBin,hOverEMin,hOverEMax);
324  h_h1OverE_[2] = dbe_->book1D("h1OverEEndcap","H/E for Depth 1;H/E",hOverEBin,hOverEMin,hOverEMax);
325  h_h2OverE_[2] = dbe_->book1D("h2OverEEndcap","H/E for Depth 2;H/E",hOverEBin,hOverEMin,hOverEMax);
326  histname = "newhOverE";
327  h_newhOverE_[2] = dbe_->book1D(histname+"Endcap", "new H/E: Endcap",100,0., 0.1) ;
328  // Information from Particle Flow
329  histname = "chargedHadIso";
330  h_chHadIso_[1]= dbe_->book1D(histname+"Barrel", "PF chargedHadIso: Barrel",etBin,etMin,20.);
331  h_chHadIso_[2]= dbe_->book1D(histname+"Endcap", "PF chargedHadIso: Endcap",etBin,etMin,20.);
332  histname = "neutralHadIso";
333  h_nHadIso_[1]= dbe_->book1D(histname+"Barrel", "PF neutralHadIso: Barrel",etBin,etMin,20.);
334  h_nHadIso_[2]= dbe_->book1D(histname+"Endcap", "PF neutralHadIso: Endcap",etBin,etMin,20.);
335  histname = "photonIso";
336  h_phoIso_[1]= dbe_->book1D(histname+"Barrel", "PF photonIso: Barrel",etBin,etMin,20.);
337  h_phoIso_[2]= dbe_->book1D(histname+"Endcap", "PF photonIso: Endcap",etBin,etMin,20.);
338  histname = "nCluOutMustache";
339  h_nCluOutsideMustache_[1]= dbe_->book1D(histname+"Barrel", "PF number of clusters outside Mustache: Barrel",50,0.,50.);
340  h_nCluOutsideMustache_[2]= dbe_->book1D(histname+"Endcap", "PF number of clusters outside Mustache: Endcap",50,0.,50.);
341  histname = "etOutMustache";
342  h_etOutsideMustache_[1]= dbe_->book1D(histname+"Barrel", "PF et outside Mustache: Barrel",etBin,etMin,20.);
343  h_etOutsideMustache_[2]= dbe_->book1D(histname+"Endcap", "PF et outside Mustache: Endcap",etBin,etMin,20.);
344  histname = "pfMVA";
345  h_pfMva_[1]= dbe_->book1D(histname+"Barrel", "PF MVA output: Barrel",50,-1.,2.);
346  h_pfMva_[2]= dbe_->book1D(histname+"Endcap", "PF MVA output: Endcap",50,-1,2.);
348  histname = "SumPtOverPhoPt_ChHad_Cleaned";
349  h_SumPtOverPhoPt_ChHad_Cleaned_[1]= dbe_->book1D(histname+"Barrel","PF Cand Sum Pt Over photon pt Charged Hadrons: Barrel",etBin,etMin,2.);
350  h_SumPtOverPhoPt_ChHad_Cleaned_[2]= dbe_->book1D(histname+"Endcap","PF Cand Sum Pt Over photon pt Charged Hadrons: Endcap",etBin,etMin,2.);
351  histname = "SumPtOverPhoPt_NeuHad_Cleaned";
352  h_SumPtOverPhoPt_NeuHad_Cleaned_[1]= dbe_->book1D(histname+"Barrel","PF Cand Sum Pt Over photon pt Neutral Hadrons: Barrel",etBin,etMin,2.);
353  h_SumPtOverPhoPt_NeuHad_Cleaned_[2]= dbe_->book1D(histname+"Endcap","PF Cand Sum Pt Over photon pt Neutral Hadrons: Endcap",etBin,etMin,2.);
354  histname = "SumPtOverPhoPt_Pho_Cleaned";
355  h_SumPtOverPhoPt_Pho_Cleaned_[1]= dbe_->book1D(histname+"Barrel","PF Cand Sum Pt Over photon pt Photons Hadrons: Barrel",etBin,etMin,2.);
356  h_SumPtOverPhoPt_Pho_Cleaned_[2]= dbe_->book1D(histname+"Endcap","PF Cand Sum Pt Over photon pt Photons Hadrons: Endcap",etBin,etMin,2.);
357  histname = "dRPhoPFcand_ChHad_Cleaned";
358  h_dRPhoPFcand_ChHad_Cleaned_[1]= dbe_->book1D(histname+"Barrel","dR(pho,cand) Charged Hadrons : Barrel",etBin,etMin,0.7);
359  h_dRPhoPFcand_ChHad_Cleaned_[2]= dbe_->book1D(histname+"Endcap","dR(pho,cand) Charged Hadrons : Endcap",etBin,etMin,0.7);
360  histname = "dRPhoPFcand_NeuHad_Cleaned";
361  h_dRPhoPFcand_NeuHad_Cleaned_[1]= dbe_->book1D(histname+"Barrel","dR(pho,cand) Neutral Hadrons : Barrel",etBin,etMin,0.7);
362  h_dRPhoPFcand_NeuHad_Cleaned_[2]= dbe_->book1D(histname+"Endcap","dR(pho,cand) Neutral Hadrons : Endcap",etBin,etMin,0.7);
363  histname = "dRPhoPFcand_Pho_Cleaned";
364  h_dRPhoPFcand_Pho_Cleaned_[1]= dbe_->book1D(histname+"Barrel","dR(pho,cand) Photons : Barrel",etBin,etMin,0.7);
365  h_dRPhoPFcand_Pho_Cleaned_[2]= dbe_->book1D(histname+"Endcap","dR(pho,cand) Photons : Endcap",etBin,etMin,0.7);
366  //
367  histname = "SumPtOverPhoPt_ChHad_unCleaned";
368  h_SumPtOverPhoPt_ChHad_unCleaned_[1]= dbe_->book1D(histname+"Barrel","PF Cand Sum Pt Over photon pt Charged Hadrons: Barrel",etBin,etMin,2.);
369  h_SumPtOverPhoPt_ChHad_unCleaned_[2]= dbe_->book1D(histname+"Endcap","PF Cand Sum Pt Over photon pt Charged Hadrons: Endcap",etBin,etMin,2.);
370  histname = "SumPtOverPhoPt_NeuHad_unCleaned";
371  h_SumPtOverPhoPt_NeuHad_unCleaned_[1]= dbe_->book1D(histname+"Barrel","PF Cand Sum Pt Over photon pt Neutral Hadrons: Barrel",etBin,etMin,2.);
372  h_SumPtOverPhoPt_NeuHad_unCleaned_[2]= dbe_->book1D(histname+"Endcap","PF Cand Sum Pt Over photon pt Neutral Hadrons: Endcap",etBin,etMin,2.);
373  histname = "SumPtOverPhoPt_Pho_unCleaned";
374  h_SumPtOverPhoPt_Pho_unCleaned_[1]= dbe_->book1D(histname+"Barrel","PF Cand Sum Pt Over photon pt Photons: Barrel",etBin,etMin,2.);
375  h_SumPtOverPhoPt_Pho_unCleaned_[2]= dbe_->book1D(histname+"Endcap","PF Cand Sum Pt Over photon pt Photons: Endcap",etBin,etMin,2.);
376  histname = "dRPhoPFcand_ChHad_unCleaned";
377  h_dRPhoPFcand_ChHad_unCleaned_[1]= dbe_->book1D(histname+"Barrel","dR(pho,cand) Charged Hadrons : Barrel",etBin,etMin,0.7);
378  h_dRPhoPFcand_ChHad_unCleaned_[2]= dbe_->book1D(histname+"Endcap","dR(pho,cand) Charged Hadrons : Endcap",etBin,etMin,0.7);
379  histname = "dRPhoPFcand_NeuHad_unCleaned";
380  h_dRPhoPFcand_NeuHad_unCleaned_[1]= dbe_->book1D(histname+"Barrel","dR(pho,cand) Neutral Hadrons : Barrel",etBin,etMin,0.7);
381  h_dRPhoPFcand_NeuHad_unCleaned_[2]= dbe_->book1D(histname+"Endcap","dR(pho,cand) Neutral Hadrons : Endcap",etBin,etMin,0.7);
382  histname = "dRPhoPFcand_Pho_unCleaned";
383  h_dRPhoPFcand_Pho_unCleaned_[1]= dbe_->book1D(histname+"Barrel","dR(pho,cand) Photons: Barrel",etBin,etMin,0.7);
384  h_dRPhoPFcand_Pho_unCleaned_[2]= dbe_->book1D(histname+"Endcap","dR(pho,cand) Photons: Endcap",etBin,etMin,0.7);
385 
386 
387 
388  // }//end if(splitHistosEBEE)
389 
390 
392  if(makeProfiles_){
393  // p_r9VsEt_[0] = dbe_->bookProfile("r9VsEt","Avg R9 vs E_{T};E_{T} (GeV);R9",etBin,etMin,etMax,r9Bin,r9Min,r9Max);
394  p_r9VsEt_[1] = dbe_->bookProfile("r9VsEtBarrel","Avg R9 vs E_{T};E_{T} (GeV);R9",etBin,etMin,etMax,r9Bin,r9Min,r9Max);
395  p_r9VsEt_[2] = dbe_->bookProfile("r9VsEtEndcap","Avg R9 vs E_{T};E_{T} (GeV);R9",etBin,etMin,etMax,r9Bin,r9Min,r9Max);
396  p_r9VsEta_[0] = dbe_->bookProfile("r9VsEta","Avg R9 vs #eta;#eta;R9",etaBin,etaMin,etaMax,r9Bin,r9Min,r9Max);
397  //
398  p_sigmaIetaIetaVsEta_[0] = dbe_->bookProfile("sigmaIetaIetaVsEta","Avg #sigma_{i#etai#eta} vs #eta;#eta;#sigma_{i#etai#eta}",etaBin,etaMin,etaMax,sigmaIetaBin,sigmaIetaMin,sigmaIetaMax);
399  //
400  // p_e1x5VsEt_[0] = dbe_->bookProfile("e1x5VsEt","Avg E1x5 vs E_{T};E_{T} (GeV);E1X5 (GeV)",etBin,etMin,etMax,etBin,etMin,etMax);
401  p_e1x5VsEt_[1] = dbe_->bookProfile("e1x5VsEtBarrel","Avg E1x5 vs E_{T};E_{T} (GeV);E1X5 (GeV)",etBin,etMin,etMax,etBin,etMin,etMax);
402  p_e1x5VsEt_[2] = dbe_->bookProfile("e1x5VsEtEndcap","Avg E1x5 vs E_{T};E_{T} (GeV);E1X5 (GeV)",etBin,etMin,etMax,etBin,etMin,etMax);
403  p_e1x5VsEta_[0] = dbe_->bookProfile("e1x5VsEta","Avg E1x5 vs #eta;#eta;E1X5 (GeV)",etaBin,etaMin,etaMax,etBin,etMin,etMax);
404  //
405  //p_e2x5VsEt_[0] = dbe_->bookProfile("e2x5VsEt","Avg E2x5 vs E_{T};E_{T} (GeV);E2X5 (GeV)",etBin,etMin,etMax,etBin,etMin,etMax);
406  p_e2x5VsEt_[1] = dbe_->bookProfile("e2x5VsEtBarrel","Avg E2x5 vs E_{T};E_{T} (GeV);E2X5 (GeV)",etBin,etMin,etMax,etBin,etMin,etMax);
407  p_e2x5VsEt_[2] = dbe_->bookProfile("e2x5VsEtEndcap","Avg E2x5 vs E_{T};E_{T} (GeV);E2X5 (GeV)",etBin,etMin,etMax,etBin,etMin,etMax);
408  p_e2x5VsEta_[0] = dbe_->bookProfile("e2x5VsEta","Avg E2x5 vs #eta;#eta;E2X5 (GeV)",etaBin,etaMin,etaMax,etBin,etMin,etMax);
409  //
410  // p_r1x5VsEt_[0] = dbe_->bookProfile("r1x5VsEt","Avg R1x5 vs E_{T};E_{T} (GeV);R1X5",etBin,etMin,etMax,r9Bin,r9Min,r9Max);
411  p_r1x5VsEt_[1] = dbe_->bookProfile("r1x5VsEtBarrel","Avg R1x5 vs E_{T};E_{T} (GeV);R1X5",etBin,etMin,etMax,r9Bin,r9Min,r9Max);
412  p_r1x5VsEt_[2] = dbe_->bookProfile("r1x5VsEtEndcap","Avg R1x5 vs E_{T};E_{T} (GeV);R1X5",etBin,etMin,etMax,r9Bin,r9Min,r9Max);
413  p_r1x5VsEta_[0] = dbe_->bookProfile("r1x5VsEta","Avg R1x5 vs #eta;#eta;R1X5",etaBin,etaMin,etaMax,r9Bin,r9Min,r9Max);
414 
415  // p_r2x5VsEt_[0] = dbe_->bookProfile("r2x5VsEt","Avg R2x5 vs E_{T};E_{T} (GeV);R2X5",etBin,etMin,etMax,r9Bin,r9Min,r9Max);
416  p_r2x5VsEt_[1] = dbe_->bookProfile("r2x5VsEtBarrel","Avg R2x5 vs E_{T};E_{T} (GeV);R2X5",etBin,etMin,etMax,r9Bin,r9Min,r9Max);
417  p_r2x5VsEt_[2] = dbe_->bookProfile("r2x5VsEtEndcap","Avg R2x5 vs E_{T};E_{T} (GeV);R2X5",etBin,etMin,etMax,r9Bin,r9Min,r9Max);
418  p_r2x5VsEta_[0] = dbe_->bookProfile("r2x5VsEta","Avg R2x5 vs #eta;#eta;R2X5",etaBin,etaMin,etaMax,r9Bin,r9Min,r9Max);
419  //
420  //p_nTrackIsolSolidVsEt_[0] = dbe_->bookProfile("nIsoTracksSolidVsEt","Avg Number Of Tracks in the Solid Iso Cone vs E_{T};E_{T};# tracks",etBin,etMin,etMax,numberBin,numberMin,numberMax);
421  p_nTrackIsolSolidVsEt_[1] = dbe_->bookProfile("nIsoTracksSolidVsEtBarrel","Avg Number Of Tracks in the Solid Iso Cone vs E_{T};E_{T};# tracks",etBin,etMin,etMax,numberBin,numberMin,numberMax);
422  p_nTrackIsolSolidVsEt_[2] = dbe_->bookProfile("nIsoTracksSolidVsEtEndcap","Avg Number Of Tracks in the Solid Iso Cone vs E_{T};E_{T};# tracks",etBin,etMin,etMax,numberBin,numberMin,numberMax);
423  p_nTrackIsolSolidVsEta_[0] = dbe_->bookProfile("nIsoTracksSolidVsEta","Avg Number Of Tracks in the Solid Iso Cone vs #eta;#eta;# tracks",etaBin,etaMin, etaMax,numberBin,numberMin,numberMax);
424  //
425  // p_nTrackIsolHollowVsEt_[0] = dbe_->bookProfile("nIsoTracksHollowVsEt","Avg Number Of Tracks in the Hollow Iso Cone vs E_{T};E_{T};# tracks",etBin,etMin,etMax,numberBin,numberMin,numberMax);
426  p_nTrackIsolHollowVsEt_[1] = dbe_->bookProfile("nIsoTracksHollowVsEtBarrel","Avg Number Of Tracks in the Hollow Iso Cone vs E_{T};E_{T};# tracks",etBin,etMin,etMax,numberBin,numberMin,numberMax);
427  p_nTrackIsolHollowVsEt_[2] = dbe_->bookProfile("nIsoTracksHollowVsEtEndcap","Avg Number Of Tracks in the Hollow Iso Cone vs E_{T};E_{T};# tracks",etBin,etMin,etMax,numberBin,numberMin,numberMax);
428  p_nTrackIsolHollowVsEta_[0] = dbe_->bookProfile("nIsoTracksHollowVsEta","Avg Number Of Tracks in the Hollow Iso Cone vs #eta;#eta;# tracks",etaBin,etaMin, etaMax,numberBin,numberMin,numberMax);
429  //
430  //p_trackPtSumSolidVsEt_[0] = dbe_->bookProfile("isoPtSumSolidVsEt","Avg Track P_{T} Sum in the Solid Iso Cone vs E_{T};E_{T} (GeV);P_{T} (GeV)",etBin,etMin,etMax,sumBin,sumMin,sumMax);
431  p_trackPtSumSolidVsEt_[1] = dbe_->bookProfile("isoPtSumSolidVsEtBarrel","Avg Track P_{T} Sum in the Solid Iso Cone vs E_{T};E_{T} (GeV);P_{T} (GeV)",etBin,etMin,etMax,sumBin,sumMin,sumMax);
432  p_trackPtSumSolidVsEt_[2] = dbe_->bookProfile("isoPtSumSolidVsEtEndcap","Avg Track P_{T} Sum in the Solid Iso Cone vs E_{T};E_{T} (GeV);P_{T} (GeV)",etBin,etMin,etMax,sumBin,sumMin,sumMax);
433  p_trackPtSumSolidVsEta_[0] = dbe_->bookProfile("isoPtSumSolidVsEta","Avg Track P_{T} Sum in the Solid Iso Cone vs #eta;#eta;P_{T} (GeV)",etaBin,etaMin, etaMax,sumBin,sumMin,sumMax);
434  //
435  //p_trackPtSumHollowVsEt_[0] = dbe_->bookProfile("isoPtSumHollowVsEt","Avg Track P_{T} Sum in the Hollow Iso Cone vs E_{T};E_{T} (GeV);P_{T} (GeV)",etBin,etMin,etMax,sumBin,sumMin,sumMax);
436  p_trackPtSumHollowVsEt_[1] = dbe_->bookProfile("isoPtSumHollowVsEtBarrel","Avg Track P_{T} Sum in the Hollow Iso Cone vs E_{T};E_{T} (GeV);P_{T} (GeV)",etBin,etMin,etMax,sumBin,sumMin,sumMax);
437  p_trackPtSumHollowVsEt_[2] = dbe_->bookProfile("isoPtSumHollowVsEtEndcap","Avg Track P_{T} Sum in the Hollow Iso Cone vs E_{T};E_{T} (GeV);P_{T} (GeV)",etBin,etMin,etMax,sumBin,sumMin,sumMax);
438  p_trackPtSumHollowVsEta_[0] = dbe_->bookProfile("isoPtSumHollowVsEta","Avg Track P_{T} Sum in the Hollow Iso Cone vs #eta;#eta;P_{T} (GeV)",etaBin,etaMin, etaMax,sumBin,sumMin,sumMax);
439  //
440  // p_ecalSumVsEt_[0] = dbe_->bookProfile("ecalSumVsEt","Avg Ecal Sum in the Iso Cone vs E_{T};E_{T} (GeV);E (GeV)",etBin,etMin, etMax,sumBin,sumMin,sumMax);
441  p_ecalSumVsEt_[1] = dbe_->bookProfile("ecalSumVsEtBarrel","Avg Ecal Sum in the Iso Cone vs E_{T};E_{T} (GeV);E (GeV)",etBin,etMin, etMax,sumBin,sumMin,sumMax);
442  p_ecalSumVsEt_[2] = dbe_->bookProfile("ecalSumVsEtEndcap","Avg Ecal Sum in the Iso Cone vs E_{T};E_{T} (GeV);E (GeV)",etBin,etMin, etMax,sumBin,sumMin,sumMax);
443  p_ecalSumVsEta_[0] = dbe_->bookProfile("ecalSumVsEta","Avg Ecal Sum in the Iso Cone vs #eta;#eta;E (GeV)",etaBin,etaMin, etaMax,sumBin,sumMin,sumMax);
444  //
445  // p_hcalSumVsEt_[0] = dbe_->bookProfile("hcalSumVsEt","Avg Hcal Sum in the Iso Cone vs E_{T};E_{T} (GeV);E (GeV)",etBin,etMin, etMax,sumBin,sumMin,sumMax);
446  p_hcalSumVsEt_[1] = dbe_->bookProfile("hcalSumVsEtBarrel","Avg Hcal Sum in the Iso Cone vs E_{T};E_{T} (GeV);E (GeV)",etBin,etMin, etMax,sumBin,sumMin,sumMax);
447  p_hcalSumVsEt_[2] = dbe_->bookProfile("hcalSumVsEtEndcap","Avg Hcal Sum in the Iso Cone vs E_{T};E_{T} (GeV);E (GeV)",etBin,etMin, etMax,sumBin,sumMin,sumMax);
448  p_hcalSumVsEta_[0] = dbe_->bookProfile("hcalSumVsEta","Avg Hcal Sum in the Iso Cone vs #eta;#eta;E (GeV)",etaBin,etaMin, etaMax,sumBin,sumMin,sumMax);
449  //h over e
450  // p_hOverEVsEt_[0] = dbe_->bookProfile("hOverEVsEt","Avg H/E vs Et;E_{T} (GeV);H/E",etBin,etMin,etMax,hOverEBin,hOverEMin,hOverEMax);
451  p_hOverEVsEt_[1] = dbe_->bookProfile("p_hOverEVsEtBarrel","Avg H/E vs Et;E_{T} (GeV);H/E",etBin,etMin,etMax,hOverEBin,hOverEMin,hOverEMax);
452  p_hOverEVsEt_[2] = dbe_->bookProfile("p_hOverEVsEtEndcap","Avg H/E vs Et;E_{T} (GeV);H/E",etBin,etMin,etMax,hOverEBin,hOverEMin,hOverEMax);
453  p_hOverEVsEta_[0] = dbe_->bookProfile("p_hOverEVsEta","Avg H/E vs #eta;#eta;H/E",etaBin,etaMin,etaMax,hOverEBin,hOverEMin,hOverEMax);
454  // sigmaE/E
455  histname = "sigmaEoverEVsNVtx";
456  p_phoSigmaEoverEVsNVtx_[1] = dbe_->bookProfile(histname+"Barrel","Photons #sigma_{E}/E vs N_{vtx}: Barrel; N_{vtx}; #sigma_{E}/E ",80, -0.5, 79.5, 100,0., 0.08, "");
457  p_phoSigmaEoverEVsNVtx_[2] = dbe_->bookProfile(histname+"Endcap","Photons #sigma_{E}/E vs N_{vtx}: Endcap; N_{vtx}; #sigma_{E}/E",80, -0.5, 79.5, 100,0., 0.08, "");
458 
459 
460 
461  }
462 
463 
465 
466  if(use2DHistos_){
467 
468  //SHOWER SHAPE
469  //r9
470  h2_r9VsEt_[0] = dbe_->book2D("r9VsEt2D","R9 vs E_{T};E_{T} (GeV);R9",reducedEtBin,etMin,etMax,reducedR9Bin,r9Min,r9Max);
471  h2_r9VsEt_[1] = dbe_->book2D("r9VsEt2DBarrel","R9 vs E_{T};E_{T} (GeV);R9",reducedEtBin,etMin,etMax,reducedR9Bin,r9Min,r9Max);
472  h2_r9VsEt_[2] = dbe_->book2D("r9VsEt2DEndcap","R9 vs E_{T};E_{T} (GeV);R9",reducedEtBin,etMin,etMax,reducedR9Bin,r9Min,r9Max);
473  h2_r9VsEta_[0] = dbe_->book2D("r9VsEta2D","R9 vs #eta;#eta;R9",reducedEtaBin,etaMin,etaMax,reducedR9Bin,r9Min,r9Max);
474  //sigmaIetaIeta
475  h2_sigmaIetaIetaVsEta_[0] = dbe_->book2D("sigmaIetaIetaVsEta2D","#sigma_{i#etai#eta} vs #eta;#eta;#sigma_{i#etai#eta}",reducedEtaBin,etaMin,etaMax,sigmaIetaBin,sigmaIetaMin,sigmaIetaMax);
476  //e1x5
477  h2_e1x5VsEt_[0] = dbe_->book2D("e1x5VsEt2D","E1x5 vs E_{T};E_{T} (GeV);E1X5 (GeV)",reducedEtBin,etMin,etMax,reducedEtBin,etMin,etMax);
478  h2_e1x5VsEt_[1] = dbe_->book2D("e1x5VsEt2DBarrel","E1x5 vs E_{T};E_{T} (GeV);E1X5 (GeV)",reducedEtBin,etMin,etMax,reducedEtBin,etMin,etMax);
479  h2_e1x5VsEt_[2] = dbe_->book2D("e1x5VsEt2DEndcap","E1x5 vs E_{T};E_{T} (GeV);E1X5 (GeV)",reducedEtBin,etMin,etMax,reducedEtBin,etMin,etMax);
480  h2_e1x5VsEta_[0] = dbe_->book2D("e1x5VsEta2D","E1x5 vs #eta;#eta;E1X5 (GeV)",reducedEtaBin,etaMin,etaMax,reducedEtBin,etMin,etMax);
481  //e2x5
482  h2_e2x5VsEt_[0] = dbe_->book2D("e2x5VsEt2D","E2x5 vs E_{T};E_{T} (GeV);E2X5 (GeV)",reducedEtBin,etMin,etMax,reducedEtBin,etMin,etMax);
483  h2_e2x5VsEt_[1] = dbe_->book2D("e2x5VsEt2DBarrel","E2x5 vs E_{T};E_{T} (GeV);E2X5 (GeV)",reducedEtBin,etMin,etMax,reducedEtBin,etMin,etMax);
484  h2_e2x5VsEt_[2] = dbe_->book2D("e2x5VsEt2DEndcap","E2x5 vs E_{T};E_{T} (GeV);E2X5 (GeV)",reducedEtBin,etMin,etMax,reducedEtBin,etMin,etMax);
485  h2_e2x5VsEta_[0] = dbe_->book2D("e2x5VsEta2D","E2x5 vs #eta;#eta;E2X5 (GeV)",reducedEtaBin,etaMin,etaMax,reducedEtBin,etMin,etMax);
486  //r1x5
487  h2_r1x5VsEt_[0] = dbe_->book2D("r1x5VsEt2D","R1x5 vs E_{T};E_{T} (GeV);R1X5",reducedEtBin,etMin,etMax,reducedR9Bin,r9Min,r9Max);
488  h2_r1x5VsEt_[1] = dbe_->book2D("r1x5VsEt2DBarrel","R1x5 vs E_{T};E_{T} (GeV);R1X5",reducedEtBin,etMin,etMax,reducedR9Bin,r9Min,r9Max);
489  h2_r1x5VsEt_[2] = dbe_->book2D("r1x5VsEt2DEndcap","R1x5 vs E_{T};E_{T} (GeV);R1X5",reducedEtBin,etMin,etMax,reducedR9Bin,r9Min,r9Max);
490  h2_r1x5VsEta_[0] = dbe_->book2D("r1x5VsEta2D","R1x5 vs #eta;#eta;R1X5",reducedEtaBin,etaMin,etaMax,reducedR9Bin,r9Min,r9Max);
491  //r2x5
492  h2_r2x5VsEt_[0] = dbe_->book2D("r2x5VsEt2D","R2x5 vs E_{T};E_{T} (GeV);R2X5",reducedEtBin,etMin,etMax,reducedR9Bin,r9Min,r9Max);
493  h2_r2x5VsEt_[1] = dbe_->book2D("r2x5VsEt2DBarrel","R2x5 vs E_{T};E_{T} (GeV);R2X5",reducedEtBin,etMin,etMax,reducedR9Bin,r9Min,r9Max);
494  h2_r2x5VsEt_[2] = dbe_->book2D("r2x5VsEt2DEndcap","R2x5 vs E_{T};E_{T} (GeV);R2X5",reducedEtBin,etMin,etMax,reducedR9Bin,r9Min,r9Max);
495  h2_r2x5VsEta_[0] = dbe_->book2D("r2x5VsEta2D","R2x5 vs #eta;#eta;R2X5",reducedEtaBin,etaMin,etaMax,reducedR9Bin,r9Min,r9Max);
496  //TRACK ISOLATION
497  //nTrackIsolSolid
498  h2_nTrackIsolSolidVsEt_[0] = dbe_->book2D("nIsoTracksSolidVsEt2D","Number Of Tracks in the Solid Iso Cone vs E_{T};E_{T};# tracks",reducedEtBin,etMin, etMax,numberBin,numberMin,numberMax);
499  h2_nTrackIsolSolidVsEta_[0] = dbe_->book2D("nIsoTracksSolidVsEta2D","Number Of Tracks in the Solid Iso Cone vs #eta;#eta;# tracks",reducedEtaBin,etaMin, etaMax,numberBin,numberMin,numberMax);
500  //nTrackIsolHollow
501  h2_nTrackIsolHollowVsEt_[0] = dbe_->book2D("nIsoTracksHollowVsEt2D","Number Of Tracks in the Hollow Iso Cone vs E_{T};E_{T};# tracks",reducedEtBin,etMin, etMax,numberBin,numberMin,numberMax);
502  h2_nTrackIsolHollowVsEta_[0] = dbe_->book2D("nIsoTracksHollowVsEta2D","Number Of Tracks in the Hollow Iso Cone vs #eta;#eta;# tracks",reducedEtaBin,etaMin, etaMax,numberBin,numberMin,numberMax);
503  //trackPtSumSolid
504  h2_trackPtSumSolidVsEt_[0] = dbe_->book2D("isoPtSumSolidVsEt2D","Track P_{T} Sum in the Solid Iso Cone;E_{T} (GeV);P_{T} (GeV)",reducedEtBin,etMin, etMax,reducedSumBin,sumMin,sumMax);
505  h2_trackPtSumSolidVsEta_[0] = dbe_->book2D("isoPtSumSolidVsEta2D","Track P_{T} Sum in the Solid Iso Cone;#eta;P_{T} (GeV)",reducedEtaBin,etaMin, etaMax,reducedSumBin,sumMin,sumMax);
506  //trackPtSumHollow
507  h2_trackPtSumHollowVsEt_[0] = dbe_->book2D("isoPtSumHollowVsEt2D","Track P_{T} Sum in the Hollow Iso Cone;E_{T} (GeV);P_{T} (GeV)",reducedEtBin,etMin, etMax,reducedSumBin,sumMin,sumMax);
508  h2_trackPtSumHollowVsEta_[0] = dbe_->book2D("isoPtSumHollowVsEta2D","Track P_{T} Sum in the Hollow Iso Cone;#eta;P_{T} (GeV)",reducedEtaBin,etaMin, etaMax,reducedSumBin,sumMin,sumMax);
509  //CALORIMETER ISOLATION VARIABLES
510  //ecal sum
511  h2_ecalSumVsEt_[0] = dbe_->book2D("ecalSumVsEt2D","Ecal Sum in the Iso Cone;E_{T} (GeV);E (GeV)",reducedEtBin,etMin, etMax,reducedSumBin,sumMin,sumMax);
512  h2_ecalSumVsEta_[0] = dbe_->book2D("ecalSumVsEta2D","Ecal Sum in the Iso Cone;#eta;E (GeV)",reducedEtaBin,etaMin, etaMax,reducedSumBin,sumMin,sumMax);
513  //hcal sum
514  h2_hcalSumVsEt_[0] = dbe_->book2D("hcalSumVsEt2D","Hcal Sum in the Iso Cone;E_{T} (GeV);E (GeV)",reducedEtBin,etMin, etMax,reducedSumBin,sumMin,sumMax);
515  h2_hcalSumVsEta_[0] = dbe_->book2D("hcalSumVsEta2D","Hcal Sum in the Iso Cone;#eta;E (GeV)",reducedEtaBin,etaMin, etaMax,reducedSumBin,sumMin,sumMax);
516 
517  }
518 
519 
520 
521 
522 
523 
524  }//end if(dbe_)
525 
526 }//end BeginJob
527 
529 {
530  using namespace edm;
531 
532  if (nEvt_% prescaleFactor_ ) return;
533  nEvt_++;
534  LogInfo("ZToMuMuGammaAnalyzer") << "ZToMuMuGammaAnalyzer Analyzing event number: " << e.id() << " Global Counter " << nEvt_ <<"\n";
535 
536  // Get the trigger results
537  bool validTriggerEvent=true;
538  edm::Handle<trigger::TriggerEvent> triggerEventHandle;
539  trigger::TriggerEvent triggerEvent;
540  e.getByToken(triggerEvent_token_,triggerEventHandle);
541  if(!triggerEventHandle.isValid()) {
542  edm::LogInfo("PhotonAnalyzer") << "Error! Can't get the product: triggerEvent_token_" << endl;
543  validTriggerEvent=false;
544  }
545  if(validTriggerEvent) triggerEvent = *(triggerEventHandle.product());
546 
547  // Get the reconstructed photons
548  // bool validPhotons=true;
549  Handle<reco::PhotonCollection> photonHandle;
550  reco::PhotonCollection photonCollection;
551  e.getByToken(photon_token_ , photonHandle);
552  if ( !photonHandle.isValid()) {
553  edm::LogInfo("ZToMuMuGammaAnalyzer") << "Error! Can't get the product: photon_token_" << endl;
554  //validPhotons=false;
555  }
556  // if(validPhotons) photonCollection = *(photonHandle.product());
557 
558  // Get the PF refined cluster collection
559  Handle<reco::PFCandidateCollection> pfCandidateHandle;
560  e.getByToken(pfCandidates_,pfCandidateHandle);
561  if (!pfCandidateHandle.isValid()) {
562  edm::LogError("PhotonValidator") << "Error! Can't get the product pfCandidates "<< std::endl ;
563  }
564 
565  edm::Handle<edm::ValueMap<std::vector<reco::PFCandidateRef> > > phoToParticleBasedIsoMapHandle;
566  edm::ValueMap<std::vector<reco::PFCandidateRef> > phoToParticleBasedIsoMap;
567  if ( fName_ == "zmumugammaGedValidation") {
568  e.getByToken(photonIsoValmap_token_,phoToParticleBasedIsoMapHandle);
569  // e.getByLabel("particleBasedIsolation",valueMapPhoPFCandIso_,phoToParticleBasedIsoMapHandle);
570  if ( ! phoToParticleBasedIsoMapHandle.isValid()) {
571  edm::LogInfo("PhotonValidator") << "Error! Can't get the product: valueMap photons to particle based iso " << std::endl;
572 
573  }
574  phoToParticleBasedIsoMap = *(phoToParticleBasedIsoMapHandle.product());
575  }
576 
577 
578 
579  // Get the reconstructed muons
580  bool validMuons=true;
581  Handle<reco::MuonCollection> muonHandle;
582  reco::MuonCollection muonCollection;
583  e.getByToken(muon_token_, muonHandle);
584  if ( !muonHandle.isValid()) {
585  edm::LogInfo("ZToMuMuGammaAnalyzer") << "Error! Can't get the product: muon_token_" << endl;
586  validMuons=false;
587  }
588  if(validMuons) muonCollection = *(muonHandle.product());
589 
590  // Get the beam spot
592  e.getByToken(beamSpot_token_, bsHandle);
593  if (!bsHandle.isValid()) {
594  edm::LogError("TrackerOnlyConversionProducer") << "Error! Can't get the product primary Vertex Collection "<< "\n";
595  return;
596  }
597  const reco::BeamSpot &thebs = *bsHandle.product();
598 
599  //Prepare list of photon-related HLT filter names
600  vector<int> Keys;
601  for(uint filterIndex=0;filterIndex<triggerEvent.sizeFilters();++filterIndex){ //loop over all trigger filters in event (i.e. filters passed)
602  string label = triggerEvent.filterTag(filterIndex).label();
603  if(label.find( "Photon" ) != string::npos ) { //get photon-related filters
604  for(uint filterKeyIndex=0;filterKeyIndex<triggerEvent.filterKeys(filterIndex).size();++filterKeyIndex){ //loop over keys to objects passing this filter
605  Keys.push_back(triggerEvent.filterKeys(filterIndex)[filterKeyIndex]); //add keys to a vector for later reference
606  }
607  }
608  }
609 
610  // sort Keys vector in ascending order
611  // and erases duplicate entries from the vector
612  sort(Keys.begin(),Keys.end());
613  for ( uint i=0 ; i<Keys.size() ; )
614  {
615  if (i!=(Keys.size()-1))
616  {
617  if (Keys[i]==Keys[i+1]) Keys.erase(Keys.begin()+i+1) ;
618  else ++i ;
619  }
620  else ++i ;
621  }
622 
624  e.getByToken(offline_pvToken_, vtxH);
625  h_nRecoVtx_ ->Fill (float(vtxH->size()));
626 
627 
628  //photon counters
629  int nPho = 0;
630  int nPhoBarrel = 0;
631  int nPhoEndcap = 0;
632 
634  if ( muonCollection.size() < 2 ) return;
635 
636 
637 
638  for( reco::MuonCollection::const_iterator iMu = muonCollection.begin(); iMu != muonCollection.end(); iMu++) {
639  if ( !basicMuonSelection (*iMu) ) continue;
640 
641  for( reco::MuonCollection::const_iterator iMu2 = iMu+1; iMu2 != muonCollection.end(); iMu2++) {
642  if ( !basicMuonSelection (*iMu2) ) continue;
643  if ( iMu->charge()*iMu2->charge() > 0) continue;
644 
645  if ( !muonSelection(*iMu,thebs) && !muonSelection(*iMu2,thebs) ) continue;
646 
647  float mumuMass = mumuInvMass(*iMu,*iMu2) ;
648  if ( mumuMass < minMumuInvMass_ || mumuMass > maxMumuInvMass_ ) continue;
649 
650  h1_mumuInvMass_[0] -> Fill (mumuMass);
651 
652  if ( photonHandle->size() < 1 ) continue;
653 
654  reco::Muon nearMuon;
655  reco::Muon farMuon;
656  for(unsigned int iPho=0; iPho < photonHandle->size(); iPho++) {
657  reco::PhotonRef aPho(reco::PhotonRef(photonHandle, iPho));
658  //
659  double dr1 = deltaR((*iMu).eta(), aPho->eta(), (*iMu).phi(), aPho->phi());
660  double dr2 = deltaR((*iMu2).eta(), aPho->eta(), (*iMu2).phi(), aPho->phi());
661  double drNear = dr1;
662  if (dr1 < dr2) {
663  nearMuon =*iMu ; farMuon = *iMu2; drNear = dr1;
664  } else {
665  nearMuon = *iMu2; farMuon = *iMu; drNear = dr2;
666  }
667  //
668  if ( nearMuon.isolationR03().hadEt > nearMuonHcalIso_ ) continue;
669  if ( farMuon.isolationR03().sumPt > farMuonTrackIso_ ) continue;
670  if ( farMuon.isolationR03().emEt > farMuonEcalIso_ ) continue;
671  if ( farMuon.pt() < farMuonMinPt_ ) continue;
672  if ( drNear > nearMuonDr_) continue;
673  //
674  if ( !photonSelection (aPho) ) continue;
675  float mumuGammaMass = mumuGammaInvMass(*iMu,*iMu2,aPho) ;
676  if ( mumuGammaMass < minMumuGammaInvMass_ || mumuGammaMass > maxMumuGammaInvMass_ ) continue;
677  //
678  //counter: number of photons
679  int iDet=0;
680  if ( aPho->isEB() || aPho->isEE() ) {
681  nPho++;
682  }
683  if ( aPho->isEB() ) {
684  iDet=1;
685  nPhoBarrel++;
686  }
687  if ( aPho->isEE() ) {
688  iDet=2;
689  nPhoEndcap++;
690  }
691 
692 
693  //PHOTON RELATED HISTOGRAMS
694 
695  h1_mumuGammaInvMass_[0] ->Fill (mumuGammaMass);
696  h1_mumuGammaInvMass_[iDet] ->Fill (mumuGammaMass);
697  //ENERGY
698  h_phoE_[0] ->Fill (aPho->energy());
699  h_phoSigmaEoverE_[0] ->Fill( aPho->getCorrectedEnergyError(aPho->getCandidateP4type())/aPho->energy() );
700  h_phoEt_[0] ->Fill (aPho->et());
701  h_phoE_[iDet] ->Fill (aPho->energy());
702  h_phoSigmaEoverE_[iDet] ->Fill( aPho->getCorrectedEnergyError(aPho->getCandidateP4type())/aPho->energy() );
703  p_phoSigmaEoverEVsNVtx_[iDet] ->Fill( float(vtxH->size()), aPho->getCorrectedEnergyError(aPho->getCandidateP4type())/aPho->energy() );
704  h_phoEt_[iDet] ->Fill (aPho->et());
705  //GEOMETRICAL
706  h_phoEta_[0] ->Fill (aPho->eta());
707  h_phoPhi_[0] ->Fill (aPho->phi());
708  h_scEta_[0] ->Fill (aPho->superCluster()->eta());
709  h_scPhi_[0] ->Fill (aPho->superCluster()->phi());
710  h_phoEta_[iDet] ->Fill (aPho->eta());
711  h_phoPhi_[iDet] ->Fill (aPho->phi());
712  h_scEta_[iDet] ->Fill (aPho->superCluster()->eta());
713  h_scPhi_[iDet] ->Fill (aPho->superCluster()->phi());
714  //SHOWER SHAPE
715  h_r9_[0] ->Fill (aPho->r9());
716  h_e1x5_[0]->Fill(aPho->e1x5());
717  h_e2x5_[0]->Fill(aPho->e2x5());
718  h_r1x5_[0]->Fill(aPho->r1x5());
719  h_r2x5_[0]->Fill(aPho->r2x5());
720  h_phoSigmaIetaIeta_[0] ->Fill(aPho->sigmaIetaIeta());
721  //
722  h_r9_[iDet] ->Fill (aPho->r9());
723  h_e1x5_[iDet] ->Fill(aPho->e1x5());
724  h_e2x5_[iDet] ->Fill(aPho->e2x5());
725  h_r1x5_[iDet] ->Fill( aPho->r1x5());
726  h_r2x5_[iDet] ->Fill(aPho->r2x5());
727  h_phoSigmaIetaIeta_[iDet] ->Fill(aPho->sigmaIetaIeta());
728  //TRACK ISOLATION
729  h_nTrackIsolSolid_[0] ->Fill(aPho->nTrkSolidConeDR04());
730  h_nTrackIsolHollow_[0] ->Fill(aPho->nTrkHollowConeDR04());
731  h_trackPtSumSolid_[0] ->Fill(aPho->trkSumPtSolidConeDR04());
732  h_trackPtSumHollow_[0] ->Fill(aPho->trkSumPtSolidConeDR04());
733  h_nTrackIsolSolid_[iDet] ->Fill(aPho->nTrkSolidConeDR04());
734  h_nTrackIsolHollow_[iDet] ->Fill(aPho->nTrkHollowConeDR04());
735  h_trackPtSumSolid_[iDet] ->Fill(aPho->trkSumPtSolidConeDR04());
736  h_trackPtSumHollow_[iDet] ->Fill(aPho->trkSumPtSolidConeDR04());
737  //CALORIMETER ISOLATION
738  h_ecalSum_[0] ->Fill(aPho->ecalRecHitSumEtConeDR04());
739  h_hcalSum_[0] ->Fill(aPho->hcalTowerSumEtConeDR04());
740  h_hOverE_[0] ->Fill(aPho->hadTowOverEm());
741  h_h1OverE_[0] ->Fill(aPho->hadTowDepth1OverEm());
742  h_h2OverE_[0] ->Fill(aPho->hadTowDepth2OverEm());
743  h_newhOverE_[0]->Fill( aPho->hadTowOverEm());
744  h_ecalSum_[iDet] ->Fill(aPho->ecalRecHitSumEtConeDR04());
745  h_hcalSum_[iDet] ->Fill(aPho->hcalTowerSumEtConeDR04());
746  h_hOverE_[iDet] ->Fill(aPho->hadTowOverEm());
747  h_h1OverE_[iDet] ->Fill(aPho->hadTowDepth1OverEm());
748  h_h2OverE_[iDet] ->Fill(aPho->hadTowDepth2OverEm());
749  h_newhOverE_[iDet]->Fill( aPho->hadTowOverEm());
750  // Isolation from particle flow
751  h_chHadIso_[0]-> Fill (aPho->chargedHadronIso());
752  h_nHadIso_[0]-> Fill (aPho->neutralHadronIso());
753  h_phoIso_[0]-> Fill (aPho->photonIso());
754  h_nCluOutsideMustache_[0]->Fill(float(aPho->nClusterOutsideMustache()));
755  h_etOutsideMustache_[0]->Fill(aPho->etOutsideMustache());
756  h_pfMva_[0]->Fill(aPho->pfMVA());
757  h_chHadIso_[iDet]-> Fill (aPho->chargedHadronIso());
758  h_nHadIso_[iDet]-> Fill (aPho->neutralHadronIso());
759  h_phoIso_[iDet]-> Fill (aPho->photonIso());
760  h_nCluOutsideMustache_[iDet]->Fill(float(aPho->nClusterOutsideMustache()));
761  h_etOutsideMustache_[iDet]->Fill(aPho->etOutsideMustache());
762  h_pfMva_[iDet]->Fill(aPho->pfMVA());
763 
765  if ( fName_ == "zmumugammaGedValidation") {
766 
767  float SumPtIsoValCh = 0.;
768  float SumPtIsoValNh = 0.;
769  float SumPtIsoValPh = 0.;
770 
771  float SumPtIsoValCleanCh = 0.;
772  float SumPtIsoValCleanNh = 0.;
773  float SumPtIsoValCleanPh = 0.;
774 
775  for(unsigned int lCand=0; lCand < pfCandidateHandle->size(); lCand++) {
776  reco::PFCandidateRef pfCandRef(reco::PFCandidateRef(pfCandidateHandle,lCand));
777  float dR= deltaR(aPho->eta(), aPho->phi(),pfCandRef->eta(), pfCandRef->phi());
778  if ( dR<0.4) {
780  reco::PFCandidate::ParticleType type = pfCandRef->particleId();
781  if ( type == reco::PFCandidate::e ) continue;
782  if ( type == reco::PFCandidate::gamma && pfCandRef->mva_nothing_gamma() > 0.) continue;
783 
784  if( type == reco::PFCandidate::h ) {
785  SumPtIsoValCh += pfCandRef->pt();
786  h_dRPhoPFcand_ChHad_unCleaned_[0]->Fill(dR);
787  h_dRPhoPFcand_ChHad_unCleaned_[iDet]->Fill(dR);
788  }
789  if( type == reco::PFCandidate::h0 ) {
790  SumPtIsoValNh += pfCandRef->pt();
791  h_dRPhoPFcand_NeuHad_unCleaned_[0]->Fill(dR);
792  h_dRPhoPFcand_NeuHad_unCleaned_[iDet]->Fill(dR);
793  }
794  if( type == reco::PFCandidate::gamma ) {
795  SumPtIsoValPh += pfCandRef->pt();
796  h_dRPhoPFcand_Pho_unCleaned_[0]->Fill(dR);
797  h_dRPhoPFcand_Pho_unCleaned_[iDet]->Fill(dR);
798  }
800  bool skip=false;
801  for( std::vector<reco::PFCandidateRef>::const_iterator i = phoToParticleBasedIsoMap[aPho].begin(); i != phoToParticleBasedIsoMap[aPho].end(); ++i ) {
802  // std::cout << " PhotonValidator PfCand pt " << pfCandRef->pt() << " id " <<pfCandRef->particleId() << " and in the map " << (*i)->pt() << " type " << (*i)->particleId() << std::endl;
803  if ( (*i) == pfCandRef ) {
804  skip=true;
805  }
806  } // loop over the PFCandidates flagged as overlapping with the photon
807 
808  if ( skip ) continue;
809  if( type == reco::PFCandidate::h ) {
810  SumPtIsoValCleanCh += pfCandRef->pt();
811  h_dRPhoPFcand_ChHad_Cleaned_[0]->Fill(dR);
812  h_dRPhoPFcand_ChHad_Cleaned_[iDet]->Fill(dR);
813  }
814  if( type == reco::PFCandidate::h0 ) {
815  SumPtIsoValCleanNh += pfCandRef->pt();
816  h_dRPhoPFcand_NeuHad_Cleaned_[0]->Fill(dR);
817  h_dRPhoPFcand_NeuHad_Cleaned_[iDet]->Fill(dR);
818  }
819  if( type == reco::PFCandidate::gamma ) {
820  SumPtIsoValCleanPh += pfCandRef->pt();
821  h_dRPhoPFcand_Pho_Cleaned_[0]->Fill(dR);
822  h_dRPhoPFcand_Pho_Cleaned_[iDet]->Fill(dR);
823  }
824 
825  } // dr=0.4
826  } // loop over all PF Candidates
827 
828  h_SumPtOverPhoPt_ChHad_Cleaned_[0]->Fill(SumPtIsoValCleanCh/aPho->pt());
829  h_SumPtOverPhoPt_NeuHad_Cleaned_[0]->Fill(SumPtIsoValCleanNh/aPho->pt());
830  h_SumPtOverPhoPt_Pho_Cleaned_[0]->Fill(SumPtIsoValCleanPh/aPho->pt());
831  h_SumPtOverPhoPt_ChHad_unCleaned_[0]->Fill(SumPtIsoValCh/aPho->pt());
832  h_SumPtOverPhoPt_NeuHad_unCleaned_[0]->Fill(SumPtIsoValNh/aPho->pt());
833  h_SumPtOverPhoPt_Pho_unCleaned_[0]->Fill(SumPtIsoValPh/aPho->pt());
834  //
835  h_SumPtOverPhoPt_ChHad_Cleaned_[iDet]->Fill(SumPtIsoValCleanCh/aPho->pt());
836  h_SumPtOverPhoPt_NeuHad_Cleaned_[iDet]->Fill(SumPtIsoValCleanNh/aPho->pt());
837  h_SumPtOverPhoPt_Pho_Cleaned_[iDet]->Fill(SumPtIsoValCleanPh/aPho->pt());
838  h_SumPtOverPhoPt_ChHad_unCleaned_[iDet]->Fill(SumPtIsoValCh/aPho->pt());
839  h_SumPtOverPhoPt_NeuHad_unCleaned_[iDet]->Fill(SumPtIsoValNh/aPho->pt());
840  h_SumPtOverPhoPt_Pho_unCleaned_[iDet]->Fill(SumPtIsoValPh/aPho->pt());
841  } // only for zmumugammaGedValidation
842 
843 
844 
845 
846  if ( makeProfiles_ ) {
847  p_r9VsEt_[iDet] ->Fill (aPho->et(),aPho->r9());
848  p_r9VsEta_[0]->Fill (aPho->eta(),aPho->r9());
849  p_e1x5VsEt_[iDet] ->Fill(aPho->et(), aPho->e1x5());
850  p_e1x5VsEta_[0]->Fill(aPho->eta(),aPho->e1x5());
851  p_e2x5VsEt_[iDet] ->Fill(aPho->et(), aPho->e2x5());
852  p_e2x5VsEta_[0]->Fill(aPho->eta(),aPho->e2x5());
853  p_r1x5VsEt_[iDet] ->Fill(aPho->et(), aPho->r1x5());
854  p_r1x5VsEta_[0]->Fill(aPho->eta(),aPho->r1x5());
855  p_r2x5VsEt_[iDet] ->Fill(aPho->et(), aPho->r2x5());
856  p_r2x5VsEta_[0]->Fill(aPho->eta(),aPho->r2x5());
857  //
858  p_sigmaIetaIetaVsEta_[0] ->Fill(aPho->eta(),aPho->sigmaIetaIeta());
859  p_nTrackIsolSolidVsEt_[iDet] ->Fill(aPho->et(), aPho->nTrkSolidConeDR04());
860  p_nTrackIsolSolidVsEta_[0] ->Fill(aPho->eta(),aPho->nTrkSolidConeDR04());
861  p_nTrackIsolHollowVsEt_[iDet] ->Fill(aPho->et(), aPho->nTrkHollowConeDR04());
862  p_nTrackIsolHollowVsEta_[0] ->Fill(aPho->eta(),aPho->nTrkHollowConeDR04());
863  p_trackPtSumSolidVsEt_[iDet] ->Fill(aPho->et(), aPho->trkSumPtSolidConeDR04());
864  p_trackPtSumSolidVsEta_[0] ->Fill(aPho->eta(),aPho->trkSumPtSolidConeDR04());
865  p_trackPtSumHollowVsEt_[iDet] ->Fill(aPho->et(), aPho->trkSumPtHollowConeDR04());
866  p_trackPtSumHollowVsEta_[0] ->Fill(aPho->eta(),aPho->trkSumPtHollowConeDR04());
867  //
868  p_ecalSumVsEt_[iDet] ->Fill(aPho->et(), aPho->ecalRecHitSumEtConeDR04());
869  p_ecalSumVsEta_[0] ->Fill(aPho->eta(),aPho->ecalRecHitSumEtConeDR04());
870  p_hcalSumVsEt_[iDet] ->Fill(aPho->et(), aPho->hcalTowerSumEtConeDR04());
871  p_hcalSumVsEta_[0] ->Fill(aPho->eta(),aPho->hcalTowerSumEtConeDR04());
872  p_hOverEVsEt_[iDet] ->Fill(aPho->et(), aPho->hadTowOverEm());
873  p_hOverEVsEta_[0] ->Fill(aPho->eta(),aPho->hadTowOverEm());
874 
875  }
876 
878  if(use2DHistos_){
879  //SHOWER SHAPE
880  h2_r9VsEt_[iDet] ->Fill (aPho->et(),aPho->r9());
881  h2_r9VsEta_[0]->Fill (aPho->eta(),aPho->r9());
882  h2_e1x5VsEt_[iDet] ->Fill(aPho->et(), aPho->e1x5());
883  h2_e1x5VsEta_[0]->Fill(aPho->eta(),aPho->e1x5());
884  h2_e2x5VsEta_[0]->Fill(aPho->eta(),aPho->e2x5());
885  h2_e2x5VsEt_[iDet] ->Fill(aPho->et(), aPho->e2x5());
886  h2_r1x5VsEta_[0]->Fill(aPho->eta(),aPho->r1x5());
887  h2_r1x5VsEt_[iDet] ->Fill(aPho->et(), aPho->r1x5());
888  h2_r2x5VsEt_[iDet] ->Fill(aPho->et(), aPho->r2x5());
889  h2_r2x5VsEta_[0]->Fill(aPho->eta(),aPho->r2x5());
890  h2_sigmaIetaIetaVsEta_[0] ->Fill(aPho->eta(),aPho->sigmaIetaIeta());
891  //TRACK ISOLATION
892  h2_nTrackIsolSolidVsEt_[0] ->Fill(aPho->et(), aPho->nTrkSolidConeDR04());
893  h2_nTrackIsolSolidVsEta_[0] ->Fill(aPho->eta(),aPho->nTrkSolidConeDR04());
894  h2_nTrackIsolHollowVsEt_[0] ->Fill(aPho->et(), aPho->nTrkHollowConeDR04());
895  h2_nTrackIsolHollowVsEta_[0] ->Fill(aPho->eta(),aPho->nTrkHollowConeDR04());
896  h2_trackPtSumSolidVsEt_[0] ->Fill(aPho->et(), aPho->trkSumPtSolidConeDR04());
897  h2_trackPtSumSolidVsEta_[0] ->Fill(aPho->eta(),aPho->trkSumPtSolidConeDR04());
898  h2_trackPtSumHollowVsEt_[0] ->Fill(aPho->et(), aPho->trkSumPtHollowConeDR04());
899  h2_trackPtSumHollowVsEta_[0] ->Fill(aPho->eta(),aPho->trkSumPtHollowConeDR04());
900  //CALORIMETER ISOLATION
901  h2_ecalSumVsEt_[iDet] ->Fill(aPho->et(), aPho->ecalRecHitSumEtConeDR04());
902  h2_ecalSumVsEta_[0] ->Fill(aPho->eta(),aPho->ecalRecHitSumEtConeDR04());
903  h2_hcalSumVsEt_[iDet] ->Fill(aPho->et(), aPho->hcalTowerSumEtConeDR04());
904  h2_hcalSumVsEta_[0] ->Fill(aPho->eta(),aPho->hcalTowerSumEtConeDR04());
905 
906  }
907 
908  } //end photon loop
909 
910  h_nPho_[0] ->Fill (float(nPho));
911  h_nPho_[1] ->Fill (float(nPhoBarrel));
912  h_nPho_[2] ->Fill (float(nPhoEndcap));
913 
914  } //end inner muon loop
915 
916  } //end outer muon loop
917 
918 }//End of Analyze method
919 
921 {
922  if(!standAlone_){dbe_->setCurrentFolder("Egamma/"+fName_+"/ZToMuMuGamma");}
923 }
924 
926 {
927  //dbe_->showDirStructure();
928  if(standAlone_){
929  dbe_->setCurrentFolder("Egamma/"+fName_+"/ZToMuMuGamma");
930  dbe_->save(outputFileName_);
931  }
932 }
933 
935  bool result=true;
936  if (!mu.innerTrack().isNonnull()) result=false;
937  if (!mu.globalTrack().isNonnull()) result=false;
938  if ( !mu.isGlobalMuon() ) result=false;
939  if ( mu.pt() < muonMinPt_ ) result=false;
940  if ( fabs(mu.eta())>2.4 ) result=false;
941 
942  int pixHits=0;
943  int tkHits=0;
944  if ( mu.innerTrack().isNonnull() ) {
945  pixHits=mu.innerTrack()->hitPattern().numberOfValidPixelHits();
946  tkHits=mu.innerTrack()->hitPattern().numberOfValidStripHits();
947  }
948 
949  if ( pixHits+tkHits < minPixStripHits_ ) result=false;
950 
951  return result;
952 }
953 
955  bool result=true;
956  if ( mu.globalTrack()->normalizedChi2() > muonMaxChi2_ ) result=false;
957  if ( fabs( mu.globalTrack()->dxy(beamSpot)) > muonMaxDxy_ ) result=false;
958  if ( mu.numberOfMatches() < muonMatches_ ) result=false;
959 
960  if ( mu.track()-> hitPattern().numberOfValidPixelHits() < validPixHits_ ) result=false;
961  if ( mu.globalTrack()->hitPattern().numberOfValidMuonHits() < validMuonHits_ ) result=false;
962  if ( !mu.isTrackerMuon() ) result=false;
963  // track isolation
964  if ( mu.isolationR03().sumPt > muonTrackIso_ ) result=false;
965  if ( fabs(mu.eta())> muonTightEta_ ) result=false;
966 
967  return result;
968 }
969 
971  bool result=true;
972  if ( pho->pt() < photonMinEt_ ) result=false;
973  if ( fabs(pho->eta())> photonMaxEta_ ) result=false;
974  if ( pho->isEBEEGap() ) result=false;
975 
976  double EtCorrHcalIso = pho->hcalTowerSumEtConeDR03() - 0.005*pho->pt();
977  double EtCorrTrkIso = pho->trkSumPtHollowConeDR03() - 0.002*pho->pt();
978 
979 
980  if (pho->r9() <=0.9) {
981  if (pho->isEB() && (pho->hadTowOverEm()>0.075 || pho->sigmaIetaIeta() > 0.014)) result=false;
982  if (pho->isEE() && (pho->hadTowOverEm()>0.075 || pho->sigmaIetaIeta() > 0.034)) result=false;
984  if (EtCorrHcalIso>4.0) result=false;
985  if (EtCorrTrkIso>4.0) result=false ;
986  if ( pho->chargedHadronIso() > 4 ) result=false;
987 
988  } else {
989  if (pho->isEB() && (pho->hadTowOverEm()>0.082 || pho->sigmaIetaIeta() > 0.014)) result=false;
990  if (pho->isEE() && (pho->hadTowOverEm()>0.075 || pho->sigmaIetaIeta() > 0.034)) result=false;
992  if (EtCorrHcalIso>50.0) result=false;
993  if (EtCorrTrkIso>50.0) result=false;
994  if ( pho->chargedHadronIso() > 4 ) result=false;
995 
996  }
997 
998 
999 
1000  return result;
1001 }
1002 
1004  {
1005  math::XYZTLorentzVector p12 = mu1.p4()+mu2.p4() ;
1006  float mumuMass2 = p12.Dot(p12) ;
1007  float invMass = sqrt(mumuMass2) ;
1008  return invMass ;
1009  }
1010 
1012  {
1013  math::XYZTLorentzVector p12 = mu1.p4()+mu2.p4()+pho->p4() ;
1014  float Mass2 = p12.Dot(p12) ;
1015  float invMass = sqrt(Mass2) ;
1016  return invMass ;
1017  }
1018 
type
Definition: HCALResponse.h:21
float hadEt
hcal sum-Et
Definition: MuonIsolation.h:9
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
ParticleType
particle types
Definition: PFCandidate.h:43
float sumPt
sum-pt of tracks
Definition: MuonIsolation.h:7
bool muonSelection(const reco::Muon &m, const reco::BeamSpot &bs)
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:25
virtual float pt() const
transverse momentum
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
virtual TrackRef innerTrack() const
Definition: Muon.h:48
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
bool isTrackerMuon() const
Definition: Muon.h:219
virtual TrackRef track() const
reference to a Track
Definition: Muon.h:49
bool isGlobalMuon() const
Definition: Muon.h:218
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
virtual void analyze(const edm::Event &, const edm::EventSetup &)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
virtual float eta() const
momentum pseudorapidity
T sqrt(T t)
Definition: SSEVec.h:48
float emEt
ecal sum-Et
Definition: MuonIsolation.h:8
tuple result
Definition: query.py:137
float mumuInvMass(const reco::Muon &m1, const reco::Muon &m2)
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1268
const int mu
Definition: Constants.h:22
float mumuGammaInvMass(const reco::Muon &mu1, const reco::Muon &mu2, const reco::PhotonRef &pho)
ZToMuMuGammaAnalyzer(const edm::ParameterSet &)
DQMStore * dbe_
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
Definition: Muon.cc:60
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
bool photonSelection(const reco::PhotonRef &p)
std::vector< size_type > Keys
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
edm::EventID id() const
Definition: EventBase.h:56
#define begin
Definition: vmac.h:30
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2540
bool basicMuonSelection(const reco::Muon &m)
volatile std::atomic< bool > shutdown_flag false
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1082
virtual void endRun(const edm::Run &, const edm::EventSetup &)
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
const MuonIsolation & isolationR03() const
Definition: Muon.h:158
Definition: Run.h:41
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:54