CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PhotonAnalyzer.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <iomanip>
3 //
4 
6 
7 
19 using namespace std;
20 
21 
23 {
24 
25  fName_ = pset.getUntrackedParameter<string>("Name");
26  verbosity_ = pset.getUntrackedParameter<int>("Verbosity");
27 
28  prescaleFactor_ = pset.getUntrackedParameter<int>("prescaleFactor",1);
29 
30  photonProducer_ = pset.getParameter<string>("phoProducer");
31  photonCollection_ = pset.getParameter<string>("photonCollection");
32 
33  barrelRecHitProducer_ = pset.getParameter<string>("barrelRecHitProducer");
34  barrelRecHitCollection_ = pset.getParameter<string>("barrelRecHitCollection");
35 
36  endcapRecHitProducer_ = pset.getParameter<string>("endcapRecHitProducer");
37  endcapRecHitCollection_ = pset.getParameter<string>("endcapRecHitCollection");
38 
39  triggerEvent_ = pset.getParameter<edm::InputTag>("triggerEvent");
40 
41  minPhoEtCut_ = pset.getParameter<double>("minPhoEtCut");
42  invMassEtCut_ = pset.getParameter<double>("invMassEtCut");
43 
44  cutStep_ = pset.getParameter<double>("cutStep");
45  numberOfSteps_ = pset.getParameter<int>("numberOfSteps");
46 
47  useBinning_ = pset.getParameter<bool>("useBinning");
48  useTriggerFiltering_ = pset.getParameter<bool>("useTriggerFiltering");
49 
50  standAlone_ = pset.getParameter<bool>("standAlone");
51  outputFileName_ = pset.getParameter<string>("OutputFileName");
52 
53  isolationStrength_ = pset.getParameter<int>("isolationStrength");
54 
55  isHeavyIon_ = pset.getUntrackedParameter<bool>("isHeavyIon",false);
56 
57  parameters_ = pset;
58 
59  histo_index_photons_ = 0;
60  histo_index_conversions_ = 0;
61  histo_index_efficiency_ = 0;
62  histo_index_invMass_ = 0;
63 }
64 
65 
66 
68 
69 
71 {
72 
73  nEvt_=0;
74  nEntry_=0;
75 
76  dbe_ = 0;
78 
79 
80 
81  double eMin = parameters_.getParameter<double>("eMin");
82  double eMax = parameters_.getParameter<double>("eMax");
83  int eBin = parameters_.getParameter<int>("eBin");
84 
85  double etMin = parameters_.getParameter<double>("etMin");
86  double etMax = parameters_.getParameter<double>("etMax");
87  int etBin = parameters_.getParameter<int>("etBin");
88 
89  double sumMin = parameters_.getParameter<double>("sumMin");
90  double sumMax = parameters_.getParameter<double>("sumMax");
91  int sumBin = parameters_.getParameter<int>("sumBin");
92 
93  double etaMin = parameters_.getParameter<double>("etaMin");
94  double etaMax = parameters_.getParameter<double>("etaMax");
95  int etaBin = parameters_.getParameter<int>("etaBin");
96 
97  double phiMin = parameters_.getParameter<double>("phiMin");
98  double phiMax = parameters_.getParameter<double>("phiMax");
99  int phiBin = parameters_.getParameter<int>("phiBin");
100 
101  double r9Min = parameters_.getParameter<double>("r9Min");
102  double r9Max = parameters_.getParameter<double>("r9Max");
103  int r9Bin = parameters_.getParameter<int>("r9Bin");
104 
105  double hOverEMin = parameters_.getParameter<double>("hOverEMin");
106  double hOverEMax = parameters_.getParameter<double>("hOverEMax");
107  int hOverEBin = parameters_.getParameter<int>("hOverEBin");
108 
109  double xMin = parameters_.getParameter<double>("xMin");
110  double xMax = parameters_.getParameter<double>("xMax");
111  int xBin = parameters_.getParameter<int>("xBin");
112 
113  double yMin = parameters_.getParameter<double>("yMin");
114  double yMax = parameters_.getParameter<double>("yMax");
115  int yBin = parameters_.getParameter<int>("yBin");
116 
117  double numberMin = parameters_.getParameter<double>("numberMin");
118  double numberMax = parameters_.getParameter<double>("numberMax");
119  int numberBin = parameters_.getParameter<int>("numberBin");
120 
121  double zMin = parameters_.getParameter<double>("zMin");
122  double zMax = parameters_.getParameter<double>("zMax");
123  int zBin = parameters_.getParameter<int>("zBin");
124 
125  double rMin = parameters_.getParameter<double>("rMin");
126  double rMax = parameters_.getParameter<double>("rMax");
127  int rBin = parameters_.getParameter<int>("rBin");
128 
129  double dPhiTracksMin = parameters_.getParameter<double>("dPhiTracksMin");
130  double dPhiTracksMax = parameters_.getParameter<double>("dPhiTracksMax");
131  int dPhiTracksBin = parameters_.getParameter<int>("dPhiTracksBin");
132 
133  double dEtaTracksMin = parameters_.getParameter<double>("dEtaTracksMin");
134  double dEtaTracksMax = parameters_.getParameter<double>("dEtaTracksMax");
135  int dEtaTracksBin = parameters_.getParameter<int>("dEtaTracksBin");
136 
137  double sigmaIetaMin = parameters_.getParameter<double>("sigmaIetaMin");
138  double sigmaIetaMax = parameters_.getParameter<double>("sigmaIetaMax");
139  int sigmaIetaBin = parameters_.getParameter<int>("sigmaIetaBin");
140 
141  double eOverPMin = parameters_.getParameter<double>("eOverPMin");
142  double eOverPMax = parameters_.getParameter<double>("eOverPMax");
143  int eOverPBin = parameters_.getParameter<int>("eOverPBin");
144 
145  double chi2Min = parameters_.getParameter<double>("chi2Min");
146  double chi2Max = parameters_.getParameter<double>("chi2Max");
147  int chi2Bin = parameters_.getParameter<int>("chi2Bin");
148 
149 
150  int reducedEtBin = etBin/4;
151  int reducedEtaBin = etaBin/4;
152  int reducedSumBin = sumBin/4;
153  int reducedR9Bin = r9Bin/4;
154 
155 
156  parts_.push_back("AllEcal");
157  parts_.push_back("Barrel");
158  parts_.push_back("Endcaps");
159 
160  types_.push_back("All");
161  types_.push_back("GoodCandidate");
162  types_.push_back("Background");
163 
164 
165 
167 
168  if (dbe_) {
169 
170  dbe_->setCurrentFolder("Egamma/PhotonAnalyzer");
171 
172  //int values stored in MEs to keep track of how many histograms are in each folder
173  totalNumberOfHistos_efficiencyFolder = dbe_->bookInt("numberOfHistogramsInEfficiencyFolder");
174  totalNumberOfHistos_photonsFolder = dbe_->bookInt("numberOfHistogramsInPhotonsFolder");
175  totalNumberOfHistos_conversionsFolder = dbe_->bookInt("numberOfHistogramsInConversionsFolder");
176  totalNumberOfHistos_invMassFolder = dbe_->bookInt("numberOfHistogramsInInvMassFolder");
177 
178 
179  //Efficiency histograms
180 
181  dbe_->setCurrentFolder("Egamma/PhotonAnalyzer/Efficiencies");
182 
183  //don't number these histograms with the "bookHisto" method, since they'll be erased in the offline client
184  h_phoEta_Loose_ = dbe_->book1D("phoEtaLoose","Loose Photon #eta",etaBin,etaMin,etaMax);
185  h_phoEta_Tight_ = dbe_->book1D("phoEtaTight","Tight Photon #eta",etaBin,etaMin,etaMax);
186  h_phoEt_Loose_ = dbe_->book1D("phoEtLoose", "Loose Photon E_{T}",etBin,etMin,etMax);
187  h_phoEt_Tight_ = dbe_->book1D("phoEtTight", "Tight Photon E_{T}",etBin,etMin,etMax);
188 
189 
190  h_phoEta_preHLT_ = dbe_->book1D("phoEtaPreHLT", "Photon #eta: before HLT",etaBin,etaMin,etaMax);
191  h_phoEta_postHLT_ = dbe_->book1D("phoEtaPostHLT","Photon #eta: after HLT",etaBin,etaMin,etaMax);
192  h_phoEt_preHLT_ = dbe_->book1D("phoEtPreHLT", "Photon E_{T}: before HLT",etBin,etMin,etMax);
193  h_phoEt_postHLT_ = dbe_->book1D("phoEtPostHLT", "Photon E_{T}: after HLT",etBin,etMin,etMax);
194 
195  h_convEta_Loose_ = dbe_->book1D("convEtaLoose","Converted Loose Photon #eta",etaBin,etaMin,etaMax);
196  h_convEta_Tight_ = dbe_->book1D("convEtaTight","Converted Tight Photon #eta",etaBin,etaMin,etaMax);
197  h_convEt_Loose_ = dbe_->book1D("convEtLoose", "Converted Loose Photon E_{T}",etBin,etMin,etMax);
198  h_convEt_Tight_ = dbe_->book1D("convEtTight", "Converted Tight Photon E_{T}",etBin,etMin,etMax);
199 
200  h_phoEta_Vertex_ = dbe_->book1D("phoEtaVertex","Converted Photons before valid vertex cut: #eta",etaBin,etaMin,etaMax);
201 
202 
203  vector<MonitorElement*> temp1DVectorEta;
204  vector<MonitorElement*> temp1DVectorPhi;
205  vector<vector<MonitorElement*> > temp2DVectorPhi;
206 
207 
208  for(int cut = 0; cut != numberOfSteps_; ++cut){ //looping over Et cut values
209  for(uint type=0;type!=types_.size();++type){ //looping over isolation type
210  currentFolder_.str("");
211  currentFolder_ << "Egamma/PhotonAnalyzer/" << types_[type] << "Photons/Et above " << (cut+1)*cutStep_ << " GeV/Conversions";
212  dbe_->setCurrentFolder(currentFolder_.str());
213 
214  temp1DVectorEta.push_back(dbe_->book1D("phoConvEtaForEfficiency","Converted Photon #eta;#eta",etaBin,etaMin,etaMax));
215  for(uint part=0;part!=parts_.size();++part){
216  temp1DVectorPhi.push_back(dbe_->book1D("phoConvPhiForEfficiency"+parts_[part],"Converted Photon #phi;#phi",phiBin,phiMin,phiMax));
217  }
218  temp2DVectorPhi.push_back(temp1DVectorPhi);
219  temp1DVectorPhi.clear();
220  }
221  h_phoConvEtaForEfficiency_.push_back(temp1DVectorEta);
222  temp1DVectorEta.clear();
223  h_phoConvPhiForEfficiency_.push_back(temp2DVectorPhi);
224  temp2DVectorPhi.clear();
225  }
226 
227 
228 
229 
230  //Invariant mass plots
231 
232  dbe_->setCurrentFolder("Egamma/PhotonAnalyzer/InvMass");
233 
234  h_invMassAllPhotons_ = bookHisto("invMassAllIsolatedPhotons","Two photon invariant mass: All isolated photons;M (GeV)",etBin,etMin,etMax);
235  h_invMassZeroWithTracks_= bookHisto("invMassZeroWithTracks", "Two photon invariant mass: Neither has tracks;M (GeV)", etBin,etMin,etMax);
236  h_invMassOneWithTracks_ = bookHisto("invMassOneWithTracks", "Two photon invariant mass: Only one has tracks;M (GeV)", etBin,etMin,etMax);
237  h_invMassTwoWithTracks_ = bookHisto("invMassTwoWithTracks", "Two photon invariant mass: Both have tracks;M (GeV)", etBin,etMin,etMax);
238 
239 
241 
242  //ENERGY VARIABLES
243 
244  book3DHistoVector(h_phoE_, "1D","phoE","Energy;E (GeV)",eBin,eMin,eMax);
245  book3DHistoVector(h_phoEt_, "1D","phoEt","E_{T};E_{T} (GeV)", etBin,etMin,etMax);
246 
247  //NUMBER OF PHOTONS
248 
249  book3DHistoVector(h_nPho_, "1D","nPho","Number of Photons per Event;# #gamma",numberBin,numberMin,numberMax);
250 
251  //GEOMETRICAL VARIABLES
252 
253  //photon eta/phi
254  book2DHistoVector(h_phoEta_, "1D","phoEta","#eta;#eta",etaBin,etaMin,etaMax) ;
255  book3DHistoVector(h_phoPhi_, "1D","phoPhi","#phi;#phi",phiBin,phiMin,phiMax) ;
256 
257  //supercluster eta/phi
258  book2DHistoVector(h_scEta_, "1D","scEta","SuperCluster #eta;#eta",etaBin,etaMin,etaMax) ;
259  book3DHistoVector(h_scPhi_, "1D","scPhi","SuperCluster #phi;#phi",phiBin,phiMin,phiMax) ;
260 
261  //SHOWER SHAPE VARIABLES
262 
263  //r9
264  book3DHistoVector(h_r9_, "1D","r9","R9;R9",r9Bin,r9Min, r9Max);
265  book2DHistoVector(h_r9VsEt_, "2D","r9VsEt2D","R9 vs E_{T};E_{T} (GeV);R9",reducedEtBin,etMin,etMax,reducedR9Bin,r9Min,r9Max);
266  book2DHistoVector(p_r9VsEt_, "Profile","r9VsEt","Avg R9 vs E_{T};E_{T} (GeV);R9",etBin,etMin,etMax,r9Bin,r9Min,r9Max);
267  book2DHistoVector(h_r9VsEta_, "2D","r9VsEta2D","R9 vs #eta;#eta;R9",reducedEtaBin,etaMin,etaMax,reducedR9Bin,r9Min,r9Max);
268  book2DHistoVector(p_r9VsEta_, "Profile","r9VsEta","Avg R9 vs #eta;#eta;R9",etaBin,etaMin,etaMax,r9Bin,r9Min,r9Max);
269 
270  //sigma ieta ieta
271  book3DHistoVector(h_phoSigmaIetaIeta_, "1D","phoSigmaIetaIeta","#sigma_{i#etai#eta};#sigma_{i#etai#eta}",sigmaIetaBin,sigmaIetaMin,sigmaIetaMax);
272  book2DHistoVector(h_sigmaIetaIetaVsEta_, "2D","sigmaIetaIetaVsEta2D","#sigma_{i#etai#eta} vs #eta;#eta;#sigma_{i#etai#eta}",reducedEtaBin,etaMin,etaMax,sigmaIetaBin,sigmaIetaMin,sigmaIetaMax);
273  book2DHistoVector(p_sigmaIetaIetaVsEta_, "Profile","sigmaIetaIetaVsEta","Avg #sigma_{i#etai#eta} vs #eta;#eta;#sigma_{i#etai#eta}",etaBin,etaMin,etaMax,sigmaIetaBin,sigmaIetaMin,sigmaIetaMax);
274 
275  //e1x5
276  book2DHistoVector(h_e1x5VsEt_, "2D","e1x5VsEt2D","E1x5 vs E_{T};E_{T} (GeV);E1X5 (GeV)",reducedEtBin,etMin,etMax,reducedEtBin,etMin,etMax);
277  book2DHistoVector(p_e1x5VsEt_, "Profile","e1x5VsEt","Avg E1x5 vs E_{T};E_{T} (GeV);E1X5 (GeV)",etBin,etMin,etMax,etBin,etMin,etMax);
278  book2DHistoVector(h_e1x5VsEta_, "2D","e1x5VsEta2D","E1x5 vs #eta;#eta;E1X5 (GeV)",reducedEtaBin,etaMin,etaMax,reducedEtBin,etMin,etMax);
279  book2DHistoVector(p_e1x5VsEta_, "Profile","e1x5VsEta","Avg E1x5 vs #eta;#eta;E1X5 (GeV)",etaBin,etaMin,etaMax,etBin,etMin,etMax);
280 
281  //e2x5
282  book2DHistoVector(h_e2x5VsEt_, "2D","e2x5VsEt2D","E2x5 vs E_{T};E_{T} (GeV);E2X5 (GeV)",reducedEtBin,etMin,etMax,reducedEtBin,etMin,etMax);
283  book2DHistoVector(p_e2x5VsEt_, "Profile","e2x5VsEt","Avg E2x5 vs E_{T};E_{T} (GeV);E2X5 (GeV)",etBin,etMin,etMax,etBin,etMin,etMax);
284  book2DHistoVector(h_e2x5VsEta_, "2D","e2x5VsEta2D","E2x5 vs #eta;#eta;E2X5 (GeV)",reducedEtaBin,etaMin,etaMax,reducedEtBin,etMin,etMax);
285  book2DHistoVector(p_e2x5VsEta_, "Profile","e2x5VsEta","Avg E2x5 vs #eta;#eta;E2X5 (GeV)",etaBin,etaMin,etaMax,etBin,etMin,etMax);
286 
287  //r1x5
288  book2DHistoVector(h_r1x5VsEt_, "2D","r1x5VsEt2D","R1x5 vs E_{T};E_{T} (GeV);R1X5",reducedEtBin,etMin,etMax,reducedR9Bin,r9Min,r9Max);
289  book2DHistoVector(p_r1x5VsEt_, "Profile","r1x5VsEt","Avg R1x5 vs E_{T};E_{T} (GeV);R1X5",etBin,etMin,etMax,r9Bin,r9Min,r9Max);
290  book2DHistoVector(h_r1x5VsEta_, "2D","r1x5VsEta2D","R1x5 vs #eta;#eta;R1X5",reducedEtaBin,etaMin,etaMax,reducedR9Bin,r9Min,r9Max);
291  book2DHistoVector(p_r1x5VsEta_, "Profile","r1x5VsEta","Avg R1x5 vs #eta;#eta;R1X5",etaBin,etaMin,etaMax,r9Bin,r9Min,r9Max);
292 
293  //r2x5
294  book2DHistoVector( h_r2x5VsEt_ ,"2D","r2x5VsEt2D","R2x5 vs E_{T};E_{T} (GeV);R2X5",reducedEtBin,etMin,etMax,reducedR9Bin,r9Min,r9Max);
295  book2DHistoVector( p_r2x5VsEt_ ,"Profile","r2x5VsEt","Avg R2x5 vs E_{T};E_{T} (GeV);R2X5",etBin,etMin,etMax,r9Bin,r9Min,r9Max);
296  book2DHistoVector( h_r2x5VsEta_ ,"2D","r2x5VsEta2D","R2x5 vs #eta;#eta;R2X5",reducedEtaBin,etaMin,etaMax,reducedR9Bin,r9Min,r9Max);
297  book2DHistoVector( p_r2x5VsEta_ ,"Profile","r2x5VsEta","Avg R2x5 vs #eta;#eta;R2X5",etaBin,etaMin,etaMax,r9Bin,r9Min,r9Max);
298 
299  //maxEXtalOver3x3
300  book2DHistoVector( h_maxEXtalOver3x3VsEt_ ,"2D","maxEXtalOver3x3VsEt2D","(Max Xtal E)/E3x3 vs E_{T};E_{T} (GeV);(Max Xtal E)/E3x3",reducedEtBin,etMin,etMax,r9Bin,r9Min,r9Max);
301  book2DHistoVector( p_maxEXtalOver3x3VsEt_ ,"Profile","maxEXtalOver3x3VsEt","Avg (Max Xtal E)/E3x3 vs E_{T};E_{T} (GeV);(Max Xtal E)/E3x3",etBin,etMin,etMax,r9Bin,r9Min,r9Max);
302  book2DHistoVector( h_maxEXtalOver3x3VsEta_ ,"2D","maxEXtalOver3x3VsEta2D","(Max Xtal E)/E3x3 vs #eta;#eta;(Max Xtal E)/E3x3",reducedEtaBin,etaMin,etaMax,r9Bin,r9Min,r9Max);
303  book2DHistoVector( p_maxEXtalOver3x3VsEta_ ,"Profile","maxEXtalOver3x3VsEta","Avg (Max Xtal E)/E3x3 vs #eta;#eta;(Max Xtal E)/E3x3",etaBin,etaMin,etaMax,r9Bin,r9Min,r9Max);
304 
305 
306  //TRACK ISOLATION VARIABLES
307 
308  //nTrackIsolSolid
309  book2DHistoVector( h_nTrackIsolSolid_ ,"1D","nIsoTracksSolid","Number Of Tracks in the Solid Iso Cone;# tracks",numberBin,numberMin,numberMax);
310  book2DHistoVector( h_nTrackIsolSolidVsEt_ ,"2D","nIsoTracksSolidVsEt2D","Number Of Tracks in the Solid Iso Cone vs E_{T};E_{T};# tracks",reducedEtBin,etMin, etMax,numberBin,numberMin,numberMax);
311  book2DHistoVector( p_nTrackIsolSolidVsEt_ ,"Profile","nIsoTracksSolidVsEt","Avg Number Of Tracks in the Solid Iso Cone vs E_{T};E_{T};# tracks",etBin,etMin,etMax,numberBin,numberMin,numberMax);
312  book2DHistoVector( h_nTrackIsolSolidVsEta_ ,"2D","nIsoTracksSolidVsEta2D","Number Of Tracks in the Solid Iso Cone vs #eta;#eta;# tracks",reducedEtaBin,etaMin, etaMax,numberBin,numberMin,numberMax);
313  book2DHistoVector( p_nTrackIsolSolidVsEta_ ,"Profile","nIsoTracksSolidVsEta","Avg Number Of Tracks in the Solid Iso Cone vs #eta;#eta;# tracks",etaBin,etaMin, etaMax,numberBin,numberMin,numberMax);
314 
315  //nTrackIsolHollow
316  book2DHistoVector( h_nTrackIsolHollow_ ,"1D","nIsoTracksHollow","Number Of Tracks in the Hollow Iso Cone;# tracks",numberBin,numberMin,numberMax);
317  book2DHistoVector( h_nTrackIsolHollowVsEt_ ,"2D","nIsoTracksHollowVsEt2D","Number Of Tracks in the Hollow Iso Cone vs E_{T};E_{T};# tracks",reducedEtBin,etMin, etMax,numberBin,numberMin,numberMax);
318  book2DHistoVector( p_nTrackIsolHollowVsEt_ ,"Profile","nIsoTracksHollowVsEt","Avg Number Of Tracks in the Hollow Iso Cone vs E_{T};E_{T};# tracks",etBin,etMin,etMax,numberBin,numberMin,numberMax);
319  book2DHistoVector( h_nTrackIsolHollowVsEta_ ,"2D","nIsoTracksHollowVsEta2D","Number Of Tracks in the Hollow Iso Cone vs #eta;#eta;# tracks",reducedEtaBin,etaMin, etaMax,numberBin,numberMin,numberMax);
320  book2DHistoVector( p_nTrackIsolHollowVsEta_ ,"Profile","nIsoTracksHollowVsEta","Avg Number Of Tracks in the Hollow Iso Cone vs #eta;#eta;# tracks",etaBin,etaMin, etaMax,numberBin,numberMin,numberMax);
321 
322  //trackPtSumSolid
323  book2DHistoVector( h_trackPtSumSolid_ ,"1D","isoPtSumSolid","Track P_{T} Sum in the Solid Iso Cone;P_{T} (GeV)",sumBin,sumMin,sumMax);
324  book2DHistoVector( h_trackPtSumSolidVsEt_ ,"2D","isoPtSumSolidVsEt2D","Track P_{T} Sum in the Solid Iso Cone;E_{T} (GeV);P_{T} (GeV)",reducedEtBin,etMin, etMax,reducedSumBin,sumMin,sumMax);
325  book2DHistoVector( p_trackPtSumSolidVsEt_ ,"Profile","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);
326  book2DHistoVector( h_trackPtSumSolidVsEta_ ,"2D","isoPtSumSolidVsEta2D","Track P_{T} Sum in the Solid Iso Cone;#eta;P_{T} (GeV)",reducedEtaBin,etaMin, etaMax,reducedSumBin,sumMin,sumMax);
327  book2DHistoVector( p_trackPtSumSolidVsEta_ ,"Profile","isoPtSumSolidVsEta","Avg Track P_{T} Sum in the Solid Iso Cone vs #eta;#eta;P_{T} (GeV)",etaBin,etaMin, etaMax,sumBin,sumMin,sumMax);
328 
329  //trackPtSumHollow
330  book2DHistoVector( h_trackPtSumHollow_ ,"1D","isoPtSumHollow","Track P_{T} Sum in the Hollow Iso Cone;P_{T} (GeV)",sumBin,sumMin,sumMax);
331  book2DHistoVector( h_trackPtSumHollowVsEt_ ,"2D","isoPtSumHollowVsEt2D","Track P_{T} Sum in the Hollow Iso Cone;E_{T} (GeV);P_{T} (GeV)",reducedEtBin,etMin, etMax,reducedSumBin,sumMin,sumMax);
332  book2DHistoVector( p_trackPtSumHollowVsEt_ ,"Profile","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);
333  book2DHistoVector( h_trackPtSumHollowVsEta_ ,"2D","isoPtSumHollowVsEta2D","Track P_{T} Sum in the Hollow Iso Cone;#eta;P_{T} (GeV)",reducedEtaBin,etaMin, etaMax,reducedSumBin,sumMin,sumMax);
334  book2DHistoVector( p_trackPtSumHollowVsEta_ ,"Profile","isoPtSumHollowVsEta","Avg Track P_{T} Sum in the Hollow Iso Cone vs #eta;#eta;P_{T} (GeV)",etaBin,etaMin, etaMax,sumBin,sumMin,sumMax);
335 
336 
337  //CALORIMETER ISOLATION VARIABLES
338 
339  //ecal sum
340  book2DHistoVector( h_ecalSum_ ,"1D","ecalSum","Ecal Sum in the Iso Cone;E (GeV)",sumBin,sumMin,sumMax);
341  book2DHistoVector( h_ecalSumVsEt_ ,"2D","ecalSumVsEt2D","Ecal Sum in the Iso Cone;E_{T} (GeV);E (GeV)",reducedEtBin,etMin, etMax,reducedSumBin,sumMin,sumMax);
342  book3DHistoVector( p_ecalSumVsEt_ ,"Profile","ecalSumVsEt","Avg Ecal Sum in the Iso Cone vs E_{T};E_{T} (GeV);E (GeV)",etBin,etMin, etMax,sumBin,sumMin,sumMax);
343  book2DHistoVector( h_ecalSumVsEta_ ,"2D","ecalSumVsEta2D","Ecal Sum in the Iso Cone;#eta;E (GeV)",reducedEtaBin,etaMin, etaMax,reducedSumBin,sumMin,sumMax);
344  book2DHistoVector( p_ecalSumVsEta_ ,"Profile","ecalSumVsEta","Avg Ecal Sum in the Iso Cone vs #eta;#eta;E (GeV)",etaBin,etaMin, etaMax,sumBin,sumMin,sumMax);
345 
346  //hcal sum
347  book2DHistoVector( h_hcalSum_ ,"1D","hcalSum","Hcal Sum in the Iso Cone;E (GeV)",sumBin,sumMin,sumMax);
348  book2DHistoVector( h_hcalSumVsEt_ ,"2D","hcalSumVsEt2D","Hcal Sum in the Iso Cone;E_{T} (GeV);E (GeV)",reducedEtBin,etMin, etMax,reducedSumBin,sumMin,sumMax);
349  book3DHistoVector( p_hcalSumVsEt_ ,"Profile","hcalSumVsEt","Avg Hcal Sum in the Iso Cone vs E_{T};E_{T} (GeV);E (GeV)",etBin,etMin, etMax,sumBin,sumMin,sumMax);
350  book2DHistoVector( h_hcalSumVsEta_ ,"2D","hcalSumVsEta2D","Hcal Sum in the Iso Cone;#eta;E (GeV)",reducedEtaBin,etaMin, etaMax,reducedSumBin,sumMin,sumMax);
351  book2DHistoVector( p_hcalSumVsEta_ ,"Profile","hcalSumVsEta","Avg Hcal Sum in the Iso Cone vs #eta;#eta;E (GeV)",etaBin,etaMin, etaMax,sumBin,sumMin,sumMax);
352 
353  //h over e
354  book3DHistoVector( h_hOverE_ ,"1D","hOverE","H/E;H/E",hOverEBin,hOverEMin,hOverEMax);
355  book2DHistoVector( p_hOverEVsEt_ ,"Profile","hOverEVsEt","Avg H/E vs Et;E_{T} (GeV);H/E",etBin,etMin,etMax,hOverEBin,hOverEMin,hOverEMax);
356  book2DHistoVector( p_hOverEVsEta_ ,"Profile","hOverEVsEta","Avg H/E vs #eta;#eta;H/E",etaBin,etaMin,etaMax,hOverEBin,hOverEMin,hOverEMax);
357  book3DHistoVector( h_h1OverE_ ,"1D","h1OverE","H/E for Depth 1;H/E",hOverEBin,hOverEMin,hOverEMax);
358  book3DHistoVector( h_h2OverE_ ,"1D","h2OverE","H/E for Depth 2;H/E",hOverEBin,hOverEMin,hOverEMax);
359 
360 
361  //OTHER VARIABLES
362 
363  //bad channel histograms
364  book2DHistoVector( h_phoEt_BadChannels_ ,"1D","phoEtBadChannels", "Fraction Containing Bad Channels: E_{T};E_{T} (GeV)",etBin,etMin,etMax);
365  book2DHistoVector( h_phoEta_BadChannels_ ,"1D","phoEtaBadChannels","Fraction Containing Bad Channels: #eta;#eta",etaBin,etaMin,etaMax);
366  book2DHistoVector( h_phoPhi_BadChannels_ ,"1D","phoPhiBadChannels","Fraction Containing Bad Channels: #phi;#phi",phiBin,phiMin,phiMax);
367 
368 
370 
371  dbe_->setCurrentFolder("Egamma/PhotonAnalyzer/AllPhotons/Et Above 0 GeV/Conversions");
372 
373  //ENERGY VARIABLES
374 
375  book3DHistoVector( h_phoConvE_ ,"1D","phoConvE","E;E (GeV)",eBin,eMin,eMax);
376  book3DHistoVector( h_phoConvEt_ ,"1D","phoConvEt","E_{T};E_{T} (GeV)",etBin,etMin,etMax);
377 
378  //GEOMETRICAL VARIABLES
379 
380  book2DHistoVector( h_phoConvEta_ ,"1D","phoConvEta","#eta;#eta",etaBin,etaMin,etaMax);
381  book3DHistoVector( h_phoConvPhi_ ,"1D","phoConvPhi","#phi;#phi",phiBin,phiMin,phiMax);
382 
383  //NUMBER OF PHOTONS
384 
385  book3DHistoVector( h_nConv_ ,"1D","nConv","Number Of Conversions per Event ;# conversions",numberBin,numberMin,numberMax);
386 
387  //SHOWER SHAPE VARIABLES
388 
389  book3DHistoVector( h_phoConvR9_ ,"1D","phoConvR9","R9;R9",r9Bin,r9Min,r9Max);
390 
391  //TRACK RELATED VARIABLES
392 
393  book3DHistoVector( h_eOverPTracks_ ,"1D","eOverPTracks","E/P;E/P",eOverPBin,eOverPMin,eOverPMax);
394  book3DHistoVector( h_pOverETracks_ ,"1D","pOverETracks","P/E;P/E",eOverPBin,eOverPMin,eOverPMax);
395 
396  book3DHistoVector( h_dPhiTracksAtVtx_ ,"1D","dPhiTracksAtVtx", "#Delta#phi of Tracks at Vertex;#Delta#phi",dPhiTracksBin,dPhiTracksMin,dPhiTracksMax);
397  book3DHistoVector( h_dPhiTracksAtEcal_ ,"1D","dPhiTracksAtEcal", "Abs(#Delta#phi) of Tracks at Ecal;#Delta#phi",dPhiTracksBin,0.,dPhiTracksMax);
398  book3DHistoVector( h_dEtaTracksAtEcal_ ,"1D","dEtaTracksAtEcal", "#Delta#eta of Tracks at Ecal;#Delta#eta",dEtaTracksBin,dEtaTracksMin,dEtaTracksMax);
399 
400  book3DHistoVector( h_dCotTracks_ ,"1D","dCotTracks","#Deltacot(#theta) of Tracks;#Deltacot(#theta)",dEtaTracksBin,dEtaTracksMin,dEtaTracksMax);
401  book2DHistoVector( p_dCotTracksVsEta_ ,"Profile","dCotTracksVsEta","Avg #Deltacot(#theta) of Tracks vs #eta;#eta;#Deltacot(#theta)",etaBin,etaMin,etaMax,dEtaTracksBin,dEtaTracksMin,dEtaTracksMax);
402 
403  book2DHistoVector( p_nHitsVsEta_ ,"Profile","nHitsVsEta","Avg Number of Hits per Track vs #eta;#eta;# hits",etaBin,etaMin,etaMax,etaBin,0,16);
404 
405  book2DHistoVector( h_tkChi2_ ,"1D","tkChi2","#chi^{2} of Track Fitting;#chi^{2}",chi2Bin,chi2Min,chi2Max);
406  book2DHistoVector( p_tkChi2VsEta_ ,"Profile","tkChi2VsEta","Avg #chi^{2} of Track Fitting vs #eta;#eta;#chi^{2}",etaBin,etaMin,etaMax,chi2Bin,chi2Min,chi2Max);
407 
408  //VERTEX RELATED VARIABLES
409 
410  book2DHistoVector( h_convVtxRvsZ_ ,"2D","convVtxRvsZ","Vertex Position;Z (cm);R (cm)",500,zMin,zMax,rBin,rMin,rMax);
411  book2DHistoVector( h_convVtxZEndcap_ ,"1D","convVtxZEndcap", "Vertex Position: #eta > 1.5;Z (cm)",zBin,zMin,zMax);
412  book2DHistoVector( h_convVtxZ_ ,"1D","convVtxZ", "Vertex Position;Z (cm)",zBin,zMin,zMax);
413  book2DHistoVector( h_convVtxR_ ,"1D","convVtxR", "Vertex Position: #eta < 1;R (cm)",rBin,rMin,rMax);
414  book2DHistoVector( h_convVtxYvsX_ ,"2D","convVtxYvsX","Vertex Position: #eta < 1;X (cm);Y (cm)",xBin,xMin,xMax,yBin,yMin,yMax);
415 
416 
417 
418  book2DHistoVector( h_vertexChi2Prob_ ,"1D","vertexChi2Prob","#chi^{2} Probability of Vertex Fitting;#chi^{2}",100,0.,1.0);
419 
420 
421  }//end if(dbe_)
422 
423 
424 }//end BeginJob
425 
426 
427 
429 {
430  using namespace edm;
431 
432  if (nEvt_% prescaleFactor_ ) return;
433  nEvt_++;
434  LogInfo("PhotonAnalyzer") << "PhotonAnalyzer Analyzing event number: " << e.id() << " Global Counter " << nEvt_ <<"\n";
435 
436  // Get the trigger results
437  bool validTriggerEvent=true;
438  edm::Handle<trigger::TriggerEvent> triggerEventHandle;
439  trigger::TriggerEvent triggerEvent;
440  e.getByLabel(triggerEvent_,triggerEventHandle);
441  if(!triggerEventHandle.isValid()) {
442  edm::LogInfo("PhotonAnalyzer") << "Error! Can't get the product "<< triggerEvent_.label() << endl;
443  validTriggerEvent=false;
444  }
445  if(validTriggerEvent) triggerEvent = *(triggerEventHandle.product());
446 
447  // Get the reconstructed photons
448  bool validPhotons=true;
449  Handle<reco::PhotonCollection> photonHandle;
450  reco::PhotonCollection photonCollection;
451  e.getByLabel(photonProducer_, photonCollection_ , photonHandle);
452  if ( !photonHandle.isValid()) {
453  edm::LogInfo("PhotonAnalyzer") << "Error! Can't get the product "<< photonCollection_ << endl;
454  validPhotons=false;
455  }
456  if(validPhotons) photonCollection = *(photonHandle.product());
457 
458  // Get the PhotonId objects
459  bool validloosePhotonID=true;
460  Handle<edm::ValueMap<bool> > loosePhotonFlag;
461  edm::ValueMap<bool> loosePhotonID;
462  e.getByLabel("PhotonIDProd", "PhotonCutBasedIDLoose", loosePhotonFlag);
463  if ( !loosePhotonFlag.isValid()) {
464  edm::LogInfo("PhotonAnalyzer") << "Error! Can't get the product "<< "PhotonCutBasedIDLoose" << endl;
465  validloosePhotonID=false;
466  }
467  if (validloosePhotonID) loosePhotonID = *(loosePhotonFlag.product());
468 
469  bool validtightPhotonID=true;
470  Handle<edm::ValueMap<bool> > tightPhotonFlag;
471  edm::ValueMap<bool> tightPhotonID;
472  e.getByLabel("PhotonIDProd", "PhotonCutBasedIDTight", tightPhotonFlag);
473  if ( !tightPhotonFlag.isValid()) {
474  edm::LogInfo("PhotonAnalyzer") << "Error! Can't get the product "<< "PhotonCutBasedIDTight" << endl;
475  validtightPhotonID=false;
476  }
477  if (validtightPhotonID) tightPhotonID = *(tightPhotonFlag.product());
478 
479 
480 
481  // Create array to hold #photons/event information
482  int nPho[100][3][3];
483 
484  for (int cut=0; cut!=100; ++cut){
485  for (int type=0; type!=3; ++type){
486  for (int part=0; part!=3; ++part){
487  nPho[cut][type][part] = 0;
488  }
489  }
490  }
491  // Create array to hold #conversions/event information
492  int nConv[100][3][3];
493 
494  for (int cut=0; cut!=100; ++cut){
495  for (int type=0; type!=3; ++type){
496  for (int part=0; part!=3; ++part){
497  nConv[cut][type][part] = 0;
498  }
499  }
500  }
501 
502 
503 
504  //Prepare list of photon-related HLT filter names
505 
506  vector<int> Keys;
507 
508  for(uint filterIndex=0;filterIndex<triggerEvent.sizeFilters();++filterIndex){ //loop over all trigger filters in event (i.e. filters passed)
509 
510  string label = triggerEvent.filterTag(filterIndex).label();
511 
512  if(label.find( "Photon" ) != string::npos ) { //get photon-related filters
513 
514  for(uint filterKeyIndex=0;filterKeyIndex<triggerEvent.filterKeys(filterIndex).size();++filterKeyIndex){ //loop over keys to objects passing this filter
515  Keys.push_back(triggerEvent.filterKeys(filterIndex)[filterKeyIndex]); //add keys to a vector for later reference
516  }
517 
518  }
519 
520  }
521 
522  // sort Keys vector in ascending order
523  // and erases duplicate entries from the vector
524  sort(Keys.begin(),Keys.end());
525  for ( uint i=0 ; i<Keys.size() ; )
526  {
527  if (i!=(Keys.size()-1))
528  {
529  if (Keys[i]==Keys[i+1]) Keys.erase(Keys.begin()+i+1) ;
530  else ++i ;
531  }
532  else ++i ;
533  }
534 
535  //We now have a vector of unique keys to TriggerObjects passing a photon-related filter
536 
537  int photonCounter = 0;
538 
540 
541  for( reco::PhotonCollection::const_iterator iPho = photonCollection.begin(); iPho != photonCollection.end(); iPho++) {
542 
543 
544  //for HLT efficiency plots
545 
546  h_phoEta_preHLT_->Fill((*iPho).eta());
547  h_phoEt_preHLT_->Fill( (*iPho).et());
548 
549 
550  double deltaR=1000.;
551  double deltaRMin=1000.;
552  double deltaRMax=0.05;//sets deltaR threshold for matching photons to trigger objects
553 
554 
555  for (vector<int>::const_iterator objectKey=Keys.begin();objectKey!=Keys.end();objectKey++){ //loop over keys to objects that fired photon triggers
556 
557  deltaR = reco::deltaR(triggerEvent.getObjects()[(*objectKey)].eta(),triggerEvent.getObjects()[(*objectKey)].phi(),(*iPho).superCluster()->eta(),(*iPho).superCluster()->phi());
558  if(deltaR < deltaRMin) deltaRMin = deltaR;
559 
560  }
561 
562  if(deltaRMin > deltaRMax) { //photon fails delta R cut
563  if(useTriggerFiltering_) continue; //throw away photons that haven't passed any photon filters
564  }
565 
566  if(deltaRMin <= deltaRMax) { //photon passes delta R cut
567  h_phoEta_postHLT_->Fill((*iPho).eta() );
568  h_phoEt_postHLT_->Fill( (*iPho).et() );
569  }
570 
571  if ((*iPho).et() < minPhoEtCut_) continue;
572 
573  nEntry_++;
574 
575  edm::Ref<reco::PhotonCollection> photonref(photonHandle, photonCounter);
576  photonCounter++;
577 
578  bool isLoosePhoton(false), isTightPhoton(false);
579  if ( !isHeavyIon_ ) {
580  isLoosePhoton = (loosePhotonID)[photonref];
581  isTightPhoton = (tightPhotonID)[photonref];
582  }
583 
584 
585  //find out which part of the Ecal contains the photon
586 
587  bool phoIsInBarrel=false;
588  bool phoIsInEndcap=false;
589  float etaPho = (*iPho).superCluster()->eta();
590  if ( fabs(etaPho) < 1.479 )
591  phoIsInBarrel=true;
592  else {
593  phoIsInEndcap=true;
594  }
595 
596  int part = 0;
597  if ( phoIsInBarrel ) part = 1;
598  if ( phoIsInEndcap ) part = 2;
599 
601  bool isIsolated=false;
602  if ( isolationStrength_ == 0) isIsolated = isLoosePhoton;
603  if ( isolationStrength_ == 1) isIsolated = isTightPhoton;
604 
605  int type=0;
606  if ( isIsolated ) type=1;
607  if ( !isIsolated ) type=2;
608 
609 
610  //get rechit collection containing this photon
611  bool validEcalRecHits=true;
612  edm::Handle<EcalRecHitCollection> ecalRecHitHandle;
613  EcalRecHitCollection ecalRecHitCollection;
614  if ( phoIsInBarrel ) {
615  // Get handle to barrel rec hits
616  e.getByLabel(barrelRecHitProducer_, barrelRecHitCollection_, ecalRecHitHandle);
617  if (!ecalRecHitHandle.isValid()) {
618  edm::LogError("PhotonAnalyzer") << "Error! Can't get the product "<<barrelRecHitProducer_;
619  validEcalRecHits=false;
620  }
621  }
622  else if ( phoIsInEndcap ) {
623  // Get handle to endcap rec hits
624  e.getByLabel(endcapRecHitProducer_, endcapRecHitCollection_, ecalRecHitHandle);
625  if (!ecalRecHitHandle.isValid()) {
626  edm::LogError("PhotonAnalyzer") << "Error! Can't get the product "<<endcapRecHitProducer_;
627  validEcalRecHits=false;
628  }
629  }
630  if (validEcalRecHits) ecalRecHitCollection = *(ecalRecHitHandle.product());
631 
632 
633  //if ((*iPho).isEBEEGap()) continue; //cut out gap photons
634 
635 
636  //filling histograms to make isolation efficiencies
637  if(isLoosePhoton){
638  h_phoEta_Loose_->Fill((*iPho).eta());
639  h_phoEt_Loose_->Fill( (*iPho).et() );
640  }
641  if(isTightPhoton){
642  h_phoEta_Tight_->Fill((*iPho).eta());
643  h_phoEt_Tight_->Fill( (*iPho).et() );
644  }
645 
646 
647 
648  for (int cut = 0; cut !=numberOfSteps_; ++cut) { //loop over different transverse energy cuts
649  double Et = (*iPho).et();
650  bool passesCuts = false;
651 
652  //sorting the photon into the right Et-dependant folder
653  if ( useBinning_ && Et > (cut+1)*cutStep_ && ( (Et < (cut+2)*cutStep_) | (cut == numberOfSteps_-1) ) ){
654  passesCuts = true;
655  }
656  else if ( !useBinning_ && Et > (cut+1)*cutStep_ ){
657  passesCuts = true;
658  }
659 
660  if (passesCuts){
661 
662  //filling isolation variable histograms
663 
664  //tracker isolation variables
665 
666  fill2DHistoVector(h_nTrackIsolSolid_, (*iPho).nTrkSolidConeDR04(), cut,type);
667  fill2DHistoVector(h_nTrackIsolHollow_,(*iPho).nTrkHollowConeDR04(),cut,type);
668 
669  fill2DHistoVector(h_nTrackIsolSolidVsEta_, (*iPho).eta(),(*iPho).nTrkSolidConeDR04(), cut,type);
670  fill2DHistoVector(p_nTrackIsolSolidVsEta_, (*iPho).eta(),(*iPho).nTrkSolidConeDR04(), cut,type);
671  fill2DHistoVector(h_nTrackIsolHollowVsEta_,(*iPho).eta(),(*iPho).nTrkHollowConeDR04(),cut,type);
672  fill2DHistoVector(p_nTrackIsolHollowVsEta_,(*iPho).eta(),(*iPho).nTrkHollowConeDR04(),cut,type);
673 
674  fill2DHistoVector(h_nTrackIsolSolidVsEt_, (*iPho).et(), (*iPho).nTrkSolidConeDR04(), cut,type);
675  fill2DHistoVector(p_nTrackIsolSolidVsEt_, (*iPho).et(), (*iPho).nTrkSolidConeDR04(), cut,type);
676  fill2DHistoVector(h_nTrackIsolHollowVsEt_, (*iPho).et(), (*iPho).nTrkHollowConeDR04(),cut,type);
677  fill2DHistoVector(p_nTrackIsolHollowVsEt_, (*iPho).et(), (*iPho).nTrkHollowConeDR04(),cut,type);
678 
680 
681  fill2DHistoVector(h_trackPtSumSolid_, (*iPho).trkSumPtSolidConeDR04(),cut,type);
682  fill2DHistoVector(h_trackPtSumHollow_,(*iPho).trkSumPtSolidConeDR04(),cut,type);
683 
684  fill2DHistoVector(h_trackPtSumSolidVsEta_, (*iPho).eta(),(*iPho).trkSumPtSolidConeDR04(), cut,type);
685  fill2DHistoVector(p_trackPtSumSolidVsEta_, (*iPho).eta(),(*iPho).trkSumPtSolidConeDR04(), cut,type);
686  fill2DHistoVector(h_trackPtSumHollowVsEta_,(*iPho).eta(),(*iPho).trkSumPtHollowConeDR04(),cut,type);
687  fill2DHistoVector(p_trackPtSumHollowVsEta_,(*iPho).eta(),(*iPho).trkSumPtHollowConeDR04(),cut,type);
688 
689  fill2DHistoVector(h_trackPtSumSolidVsEt_, (*iPho).et(), (*iPho).trkSumPtSolidConeDR04(), cut,type);
690  fill2DHistoVector(p_trackPtSumSolidVsEt_, (*iPho).et(), (*iPho).trkSumPtSolidConeDR04(), cut,type);
691  fill2DHistoVector(h_trackPtSumHollowVsEt_, (*iPho).et(), (*iPho).trkSumPtHollowConeDR04(),cut,type);
692  fill2DHistoVector(p_trackPtSumHollowVsEt_, (*iPho).et(), (*iPho).trkSumPtHollowConeDR04(),cut,type);
693 
694  //calorimeter isolation variables
695 
696  fill2DHistoVector(h_ecalSum_,(*iPho).ecalRecHitSumEtConeDR04(),cut,type);
697  fill2DHistoVector(h_ecalSumVsEta_,(*iPho).eta(),(*iPho).ecalRecHitSumEtConeDR04(),cut,type);
698  fill2DHistoVector(p_ecalSumVsEta_,(*iPho).eta(),(*iPho).ecalRecHitSumEtConeDR04(),cut,type);
699  fill2DHistoVector(h_ecalSumVsEt_, (*iPho).et(), (*iPho).ecalRecHitSumEtConeDR04(),cut,type);
700  fill3DHistoVector(p_ecalSumVsEt_, (*iPho).et(), (*iPho).ecalRecHitSumEtConeDR04(),cut,type,part);
701 
703 
704  fill2DHistoVector(h_hcalSum_,(*iPho).hcalTowerSumEtConeDR04(),cut,type);
705  fill2DHistoVector(h_hcalSumVsEta_,(*iPho).eta(),(*iPho).hcalTowerSumEtConeDR04(),cut,type);
706  fill2DHistoVector(p_hcalSumVsEta_,(*iPho).eta(),(*iPho).hcalTowerSumEtConeDR04(),cut,type);
707  fill2DHistoVector(h_hcalSumVsEt_, (*iPho).et(), (*iPho).hcalTowerSumEtConeDR04(),cut,type);
708  fill3DHistoVector(p_hcalSumVsEt_, (*iPho).et(), (*iPho).hcalTowerSumEtConeDR04(),cut,type,part);
709 
710  fill3DHistoVector(h_hOverE_,(*iPho).hadronicOverEm(),cut,type,part);
711  fill2DHistoVector(p_hOverEVsEta_,(*iPho).eta(),(*iPho).hadronicOverEm(),cut,type);
712  fill2DHistoVector(p_hOverEVsEt_, (*iPho).et(), (*iPho).hadronicOverEm(),cut,type);
713 
714  fill3DHistoVector(h_h1OverE_,(*iPho).hadronicDepth1OverEm(),cut,type,part);
715  fill3DHistoVector(h_h2OverE_,(*iPho).hadronicDepth2OverEm(),cut,type,part);
716 
717 
718  //filling photon histograms
719 
720  nPho[cut][0][0]++;
721  nPho[cut][0][part]++;
722  nPho[cut][type][0]++;
723  nPho[cut][type][part]++;
724 
725  //energy variables
726 
727  fill3DHistoVector(h_phoE_, (*iPho).energy(),cut,type,part);
728  fill3DHistoVector(h_phoEt_,(*iPho).et(), cut,type,part);
729 
730  //geometrical variables
731 
732  fill2DHistoVector(h_phoEta_,(*iPho).eta(),cut,type);
733  fill2DHistoVector(h_scEta_, (*iPho).superCluster()->eta(),cut,type);
734 
735  fill3DHistoVector(h_phoPhi_,(*iPho).phi(),cut,type,part);
736  fill3DHistoVector(h_scPhi_, (*iPho).superCluster()->phi(),cut,type,part);
737 
738  //shower shape variables
739 
740  fill3DHistoVector(h_r9_,(*iPho).r9(),cut,type,part);
741  fill2DHistoVector(h_r9VsEta_,(*iPho).eta(),(*iPho).r9(),cut,type);
742  fill2DHistoVector(p_r9VsEta_,(*iPho).eta(),(*iPho).r9(),cut,type);
743  fill2DHistoVector(h_r9VsEt_, (*iPho).et(), (*iPho).r9(),cut,type);
744  fill2DHistoVector(p_r9VsEt_, (*iPho).et(), (*iPho).r9(),cut,type);
745 
746  fill2DHistoVector(h_e1x5VsEta_,(*iPho).eta(),(*iPho).e1x5(),cut,type);
747  fill2DHistoVector(p_e1x5VsEta_,(*iPho).eta(),(*iPho).e1x5(),cut,type);
748  fill2DHistoVector(h_e1x5VsEt_, (*iPho).et(), (*iPho).e1x5(),cut,type);
749  fill2DHistoVector(p_e1x5VsEt_, (*iPho).et(), (*iPho).e1x5(),cut,type);
750 
751  fill2DHistoVector(h_e2x5VsEta_,(*iPho).eta(),(*iPho).e2x5(),cut,type);
752  fill2DHistoVector(p_e2x5VsEta_,(*iPho).eta(),(*iPho).e2x5(),cut,type);
753  fill2DHistoVector(h_e2x5VsEt_, (*iPho).et(), (*iPho).e2x5(),cut,type);
754  fill2DHistoVector(p_e2x5VsEt_, (*iPho).et(), (*iPho).e2x5(),cut,type);
755 
756  fill2DHistoVector(h_maxEXtalOver3x3VsEta_,(*iPho).eta(),(*iPho).maxEnergyXtal()/(*iPho).e3x3(),cut,type);
757  fill2DHistoVector(p_maxEXtalOver3x3VsEta_,(*iPho).eta(),(*iPho).maxEnergyXtal()/(*iPho).e3x3(),cut,type);
758  fill2DHistoVector(h_maxEXtalOver3x3VsEt_, (*iPho).et(), (*iPho).maxEnergyXtal()/(*iPho).e3x3(),cut,type);
759  fill2DHistoVector(p_maxEXtalOver3x3VsEt_, (*iPho).et(), (*iPho).maxEnergyXtal()/(*iPho).e3x3(),cut,type);
760 
761  fill2DHistoVector(h_r1x5VsEta_,(*iPho).eta(),(*iPho).r1x5(),cut,type);
762  fill2DHistoVector(p_r1x5VsEta_,(*iPho).eta(),(*iPho).r1x5(),cut,type);
763  fill2DHistoVector(h_r1x5VsEt_, (*iPho).et(), (*iPho).r1x5(),cut,type);
764  fill2DHistoVector(p_r1x5VsEt_, (*iPho).et(), (*iPho).r1x5(),cut,type);
765 
766  fill2DHistoVector(h_r2x5VsEta_,(*iPho).eta(),(*iPho).r2x5(),cut,type);
767  fill2DHistoVector(p_r2x5VsEta_,(*iPho).eta(),(*iPho).r2x5(),cut,type);
768  fill2DHistoVector(h_r2x5VsEt_, (*iPho).et(), (*iPho).r2x5(),cut,type);
769  fill2DHistoVector(p_r2x5VsEt_, (*iPho).et(), (*iPho).r2x5(),cut,type);
770 
771  fill3DHistoVector(h_phoSigmaIetaIeta_,(*iPho).sigmaIetaIeta(),cut,type,part);
772  fill2DHistoVector(h_sigmaIetaIetaVsEta_,(*iPho).eta(),(*iPho).sigmaIetaIeta(),cut,type);
773  fill2DHistoVector(p_sigmaIetaIetaVsEta_,(*iPho).eta(),(*iPho).sigmaIetaIeta(),cut,type);
774 
775 
776 
777  //filling histograms for photons containing a bad ECAL channel
778 
779  bool atLeastOneDeadChannel=false;
780  for(reco::CaloCluster_iterator bcIt = (*iPho).superCluster()->clustersBegin();bcIt != (*iPho).superCluster()->clustersEnd(); ++bcIt) { //loop over basic clusters in SC
781  for(vector< pair<DetId, float> >::const_iterator rhIt = (*bcIt)->hitsAndFractions().begin();rhIt != (*bcIt)->hitsAndFractions().end(); ++rhIt) { //loop over rec hits in basic cluster
782 
783  for(EcalRecHitCollection::const_iterator it = ecalRecHitCollection.begin(); it != ecalRecHitCollection.end(); ++it) { //loop over all rec hits to find the right ones
784  if (rhIt->first == (*it).id() ) { //found the matching rechit
785  if ( (*it).recoFlag() == 9 ) { //has a bad channel
786  atLeastOneDeadChannel=true;
787  break;
788  }
789  }
790  }
791  }
792  }
793  if ( atLeastOneDeadChannel ) {
794  fill2DHistoVector(h_phoPhi_BadChannels_,(*iPho).phi(),cut,type);
795  fill2DHistoVector(h_phoEta_BadChannels_,(*iPho).eta(),cut,type);
796  fill2DHistoVector(h_phoEt_BadChannels_, (*iPho).et(), cut,type);
797  }
798 
799 
800  // filling conversion-related histograms
801  if((*iPho).hasConversionTracks()){
802  nConv[cut][0][0]++;
803  nConv[cut][0][part]++;
804  nConv[cut][type][0]++;
805  nConv[cut][type][part]++;
806  }
807 
808  //loop over conversions (don't forget, we're still inside the photon loop,
809  // i.e. these are all the conversions for this ONE photon, not for all the photons in the event)
810  reco::ConversionRefVector conversions = (*iPho).conversions();
811  for (unsigned int iConv=0; iConv<conversions.size(); iConv++) {
812 
813  reco::ConversionRef aConv=conversions[iConv];
814 
815  if ( aConv->nTracks() <2 ) continue;
816 
817  //fill histogram for denominator of vertex reconstruction efficiency plot
818  if(cut==0) h_phoEta_Vertex_->Fill(aConv->refittedPairMomentum().eta());
819 
820  if ( !(aConv->conversionVertex().isValid()) ) continue;
821 
822  float chi2Prob = ChiSquaredProbability( aConv->conversionVertex().chi2(), aConv->conversionVertex().ndof() );
823 
824  if(chi2Prob<0.0005) continue;
825 
826  fill2DHistoVector(h_vertexChi2Prob_,chi2Prob,cut,type);
827 
828 
829 
830  fill3DHistoVector(h_phoConvE_, (*iPho).energy(),cut,type,part);
831  fill3DHistoVector(h_phoConvEt_,(*iPho).et(),cut,type,part);
832  fill3DHistoVector(h_phoConvR9_,(*iPho).r9(),cut,type,part);
833 
834  if (cut==0 && isLoosePhoton){
835  h_convEta_Loose_->Fill((*iPho).eta());
836  h_convEt_Loose_->Fill( (*iPho).et() );
837  }
838  if (cut==0 && isTightPhoton){
839  h_convEta_Tight_->Fill((*iPho).eta());
840  h_convEt_Tight_->Fill( (*iPho).et() );
841  }
842 
843  fill2DHistoVector(h_phoConvEta_,aConv->refittedPairMomentum().eta(),cut,type);
844  fill3DHistoVector(h_phoConvPhi_,aConv->refittedPairMomentum().phi(),cut,type,part);
845 
846  //we use the photon position because we'll be dividing it by a photon histogram (not a conversion histogram)
847  fill2DHistoVector(h_phoConvEtaForEfficiency_,(*iPho).eta(),cut,type);
848  fill3DHistoVector(h_phoConvPhiForEfficiency_,(*iPho).phi(),cut,type,part);
849 
850 
851  //vertex histograms
852  double convR= sqrt(aConv->conversionVertex().position().perp2());
853  double scalar = aConv->conversionVertex().position().x()*aConv->refittedPairMomentum().x() + aConv->conversionVertex().position().y()*aConv->refittedPairMomentum().y();
854  if ( scalar < 0 ) convR= -convR;
855 
856  fill2DHistoVector(h_convVtxRvsZ_,aConv->conversionVertex().position().z(), convR,cut,type);//trying to "see" R-Z view of tracker
857  fill2DHistoVector(h_convVtxZ_,aConv->conversionVertex().position().z(), cut,type);
858 
859  if(fabs(aConv->caloCluster()[0]->eta()) > 1.5){//trying to "see" tracker endcaps
860  fill2DHistoVector(h_convVtxZEndcap_,aConv->conversionVertex().position().z(), cut,type);
861  }
862  else if(fabs(aConv->caloCluster()[0]->eta()) < 1){//trying to "see" tracker barrel
863  fill2DHistoVector(h_convVtxR_,convR,cut,type);
864  fill2DHistoVector(h_convVtxYvsX_,aConv->conversionVertex().position().x(),aConv->conversionVertex().position().y(),cut,type);
865  }
866 
867  const std::vector<edm::RefToBase<reco::Track> > tracks = aConv->tracks();
868 
869 
870  for (unsigned int i=0; i<tracks.size(); i++) {
871  fill2DHistoVector(h_tkChi2_,tracks[i]->normalizedChi2(),cut,type);
872  fill2DHistoVector(p_tkChi2VsEta_,aConv->caloCluster()[0]->eta(),tracks[i]->normalizedChi2(),cut,type);
873  fill2DHistoVector(p_dCotTracksVsEta_,aConv->caloCluster()[0]->eta(),aConv->pairCotThetaSeparation(),cut,type);
874  fill2DHistoVector(p_nHitsVsEta_,aConv->caloCluster()[0]->eta(),float(tracks[i]->numberOfValidHits()),cut,type);
875  }
876 
877  //calculating delta eta and delta phi of the two tracks
878 
879  float DPhiTracksAtVtx = -99;
880  float dPhiTracksAtEcal= -99;
881  float dEtaTracksAtEcal= -99;
882 
883  float phiTk1= aConv->tracksPin()[0].phi();
884  float phiTk2= aConv->tracksPin()[1].phi();
885  DPhiTracksAtVtx = phiTk1-phiTk2;
886  DPhiTracksAtVtx = phiNormalization( DPhiTracksAtVtx );
887 
888  if (aConv->bcMatchingWithTracks()[0].isNonnull() && aConv->bcMatchingWithTracks()[1].isNonnull() ) {
889  float recoPhi1 = aConv->ecalImpactPosition()[0].phi();
890  float recoPhi2 = aConv->ecalImpactPosition()[1].phi();
891  float recoEta1 = aConv->ecalImpactPosition()[0].eta();
892  float recoEta2 = aConv->ecalImpactPosition()[1].eta();
893 
894  recoPhi1 = phiNormalization(recoPhi1);
895  recoPhi2 = phiNormalization(recoPhi2);
896 
897  dPhiTracksAtEcal = recoPhi1 -recoPhi2;
898  dPhiTracksAtEcal = phiNormalization( dPhiTracksAtEcal );
899  dEtaTracksAtEcal = recoEta1 -recoEta2;
900 
901  }
902 
903 
904  fill3DHistoVector(h_dPhiTracksAtVtx_,DPhiTracksAtVtx,cut,type,part);
905  fill3DHistoVector(h_dPhiTracksAtEcal_,fabs(dPhiTracksAtEcal),cut,type,part);
906  fill3DHistoVector(h_dEtaTracksAtEcal_, dEtaTracksAtEcal,cut,type,part);
907  fill3DHistoVector(h_eOverPTracks_,aConv->EoverPrefittedTracks(),cut,type,part);
908  fill3DHistoVector(h_pOverETracks_,1./aConv->EoverPrefittedTracks(),cut,type,part);
909  fill3DHistoVector(h_dCotTracks_,aConv->pairCotThetaSeparation(),cut,type,part);
910 
911 
912  }//end loop over conversions
913 
914  }//end loop over photons passing cuts
915  }//end loop over transverse energy cuts
916 
917 
918 
919 
920 
921  //make invariant mass plots
922 
923  if (isIsolated && iPho->et()>=invMassEtCut_){
924 
925  for (reco::PhotonCollection::const_iterator iPho2=iPho+1; iPho2!=photonCollection.end(); iPho2++){
926 
927  edm::Ref<reco::PhotonCollection> photonref2(photonHandle, photonCounter); //note: it's correct to use photonCounter and not photonCounter+1
928  //since it has already been incremented earlier
929 
930  bool isTightPhoton2(false), isLoosePhoton2(false);
931 
932  if ( !isHeavyIon_ ) {
933  isTightPhoton2 = (tightPhotonID)[photonref2];
934  isLoosePhoton2 = (loosePhotonID)[photonref2];
935  }
936 
937  bool isIsolated2=false;
938  if ( isolationStrength_ == 0) isIsolated2 = isLoosePhoton2;
939  if ( isolationStrength_ == 1) isIsolated2 = isTightPhoton2;
940 
941  reco::ConversionRefVector conversions = (*iPho).conversions();
942  reco::ConversionRefVector conversions2 = (*iPho2).conversions();
943 
944  if(isIsolated2 && iPho2->et()>=invMassEtCut_){
945 
946  math::XYZTLorentzVector p12 = iPho->p4()+iPho2->p4();
947  float gamgamMass2 = p12.Dot(p12);
948 
949 
950  h_invMassAllPhotons_ -> Fill(sqrt( gamgamMass2 ));
951 
952  if(conversions.size()!=0 && conversions[0]->nTracks() >= 2){
953  if(conversions2.size()!=0 && conversions2[0]->nTracks() >= 2) h_invMassTwoWithTracks_ -> Fill(sqrt( gamgamMass2 ));
954  else h_invMassOneWithTracks_ -> Fill(sqrt( gamgamMass2 ));
955  }
956  else if(conversions2.size()!=0 && conversions2[0]->nTracks() >= 2) h_invMassOneWithTracks_ -> Fill(sqrt( gamgamMass2 ));
957  else h_invMassZeroWithTracks_ -> Fill(sqrt( gamgamMass2 ));
958  }
959 
960  }
961 
962  }
963 
964 
965 
966  }
967 
968 
969  //filling number of photons/conversions per event histograms
970  for (int cut = 0; cut !=numberOfSteps_; ++cut) {
971  for(uint type=0;type!=types_.size();++type){
972  for(uint part=0;part!=parts_.size();++part){
973  h_nPho_[cut][type][part]-> Fill (float(nPho[cut][type][part]));
974  h_nConv_[cut][type][part]-> Fill (float(nConv[cut][type][part]));
975  }
976  }
977  }
978 
979 }//End of Analyze method
980 
982 {
983  if(!standAlone_){
984 
985  dbe_->setCurrentFolder("Egamma/PhotonAnalyzer");
986 
987  //keep track of how many histos are in each folder
988  totalNumberOfHistos_efficiencyFolder->Fill(histo_index_efficiency_);
989  totalNumberOfHistos_invMassFolder->Fill(histo_index_invMass_);
990  totalNumberOfHistos_photonsFolder->Fill(histo_index_photons_);
991  totalNumberOfHistos_conversionsFolder->Fill(histo_index_conversions_);
992 
993  }
994 
995 }
996 
997 
999 {
1000  //dbe_->showDirStructure();
1001  if(standAlone_){
1002  dbe_->setCurrentFolder("Egamma/PhotonAnalyzer");
1003 
1004  //keep track of how many histos are in each folder
1005  totalNumberOfHistos_efficiencyFolder->Fill(histo_index_efficiency_);
1006  totalNumberOfHistos_invMassFolder->Fill(histo_index_invMass_);
1007  totalNumberOfHistos_photonsFolder->Fill(histo_index_photons_);
1008  totalNumberOfHistos_conversionsFolder->Fill(histo_index_conversions_);
1009 
1010 
1011  dbe_->save(outputFileName_);
1012  }
1013 
1014 
1015 }
1016 
1018 
1019 
1020 
1022 {
1023  const float PI = 3.1415927;
1024  const float TWOPI = 2.0*PI;
1025 
1026  if(phi > PI) {phi = phi - TWOPI;}
1027  if(phi < -PI) {phi = phi + TWOPI;}
1028 
1029  return phi;
1030 }
1031 
1032 
1033 void PhotonAnalyzer::fill2DHistoVector(vector<vector<MonitorElement*> >& histoVector,double x, double y, int cut, int type){
1034 
1035  histoVector[cut][0]->Fill(x,y);
1036  if(histoVector[cut].size()>1) histoVector[cut][type]->Fill(x,y); //don't try to fill 2D histos that are only in the "AllPhotons" folder
1037 
1038 }
1039 
1040 void PhotonAnalyzer::fill2DHistoVector(vector<vector<MonitorElement*> >& histoVector, double x, int cut, int type){
1041 
1042  histoVector[cut][0]->Fill(x);
1043  histoVector[cut][type]->Fill(x);
1044 
1045 }
1046 
1047 void PhotonAnalyzer::fill3DHistoVector(vector<vector<vector<MonitorElement*> > >& histoVector,double x, int cut, int type, int part){
1048 
1049  histoVector[cut][0][0]->Fill(x);
1050  histoVector[cut][0][part]->Fill(x);
1051  histoVector[cut][type][0]->Fill(x);
1052  histoVector[cut][type][part]->Fill(x);
1053 
1054 }
1055 
1056 void PhotonAnalyzer::fill3DHistoVector(vector<vector<vector<MonitorElement*> > >& histoVector,double x, double y, int cut, int type, int part){
1057 
1058  histoVector[cut][0][0]->Fill(x,y);
1059  histoVector[cut][0][part]->Fill(x,y);
1060  histoVector[cut][type][0]->Fill(x,y);
1061  histoVector[cut][type][part]->Fill(x,y);
1062 
1063 }
1064 
1065 
1066 MonitorElement* PhotonAnalyzer::bookHisto(string histoName, string title, int bin, double min, double max)
1067 {
1068 
1069  int histo_index = 0;
1070  stringstream histo_number_stream;
1071 
1072  //determining which folder we're in
1073  if(dbe_->pwd().find( "InvMass" ) != string::npos){
1074  histo_index_invMass_++;
1075  histo_index = histo_index_invMass_;
1076  }
1077  if(dbe_->pwd().find( "Efficiencies" ) != string::npos){
1078  histo_index_efficiency_++;
1079  histo_index = histo_index_efficiency_;
1080  }
1081 
1082  histo_number_stream << "h_";
1083  if(histo_index<10) histo_number_stream << "0";
1084  histo_number_stream << histo_index;
1085 
1086  return dbe_->book1D(histo_number_stream.str()+"_"+histoName,title,bin,min,max);
1087 
1088 }
1089 
1090 
1091 void PhotonAnalyzer::book2DHistoVector(vector<vector<MonitorElement*> > &temp2DVector,
1092  string histoType, string histoName, string title,
1093  int xbin, double xmin,double xmax,
1094  int ybin, double ymin, double ymax)
1095 {
1096  int histo_index = 0;
1097 
1098  vector<MonitorElement*> temp1DVector;
1099 // vector<vector<MonitorElement*> > temp2DVector;
1100 
1101  //determining which folder we're in
1102  bool conversionPlot = false;
1103  if(dbe_->pwd().find( "Conversions" ) != string::npos) conversionPlot = true;
1104  bool TwoDPlot = false;
1105  if(histoName.find( "2D" ) != string::npos) TwoDPlot = true;
1106 
1107  if(conversionPlot){
1108  histo_index_conversions_++;
1109  histo_index = histo_index_conversions_;
1110  }
1111  else{
1112  histo_index_photons_++;
1113  histo_index = histo_index_photons_;
1114  }
1115 
1116  stringstream histo_number_stream;
1117  histo_number_stream << "h_";
1118  if(histo_index<10) histo_number_stream << "0";
1119  histo_number_stream << histo_index << "_";
1120 
1121 
1122  for(int cut = 0; cut != numberOfSteps_; ++cut){ //looping over Et cut values
1123 
1124  for(uint type=0;type!=types_.size();++type){ //looping over isolation type
1125 
1126  currentFolder_.str("");
1127  currentFolder_ << "Egamma/PhotonAnalyzer/" << types_[type] << "Photons/Et above " << (cut+1)*cutStep_ << " GeV";
1128  if(conversionPlot) currentFolder_ << "/Conversions";
1129 
1130  dbe_->setCurrentFolder(currentFolder_.str());
1131 
1132  string kind;
1133  if(conversionPlot) kind = " Conversions: ";
1134  else kind = " Photons: ";
1135 
1136  if(histoType=="1D") temp1DVector.push_back(dbe_->book1D( histo_number_stream.str()+histoName,types_[type]+kind+title,xbin,xmin,xmax));
1137  else if(histoType=="2D"){
1138  if((TwoDPlot && type==0) || !TwoDPlot){//only book the 2D plots in the "AllPhotons" folder
1139  temp1DVector.push_back(dbe_->book2D( histo_number_stream.str()+histoName,types_[type]+kind+title,xbin,xmin,xmax,ybin,ymin,ymax));
1140  }
1141  }
1142  else if(histoType=="Profile") temp1DVector.push_back(dbe_->bookProfile( histo_number_stream.str()+histoName,types_[type]+kind+title,xbin,xmin,xmax,ybin,ymin,ymax,""));
1143  else cout << "bad histoType\n";
1144  }
1145 
1146  temp2DVector.push_back(temp1DVector);
1147  temp1DVector.clear();
1148  }
1149 
1150 // return temp2DVector;
1151 
1152 }
1153 
1154 
1155 void PhotonAnalyzer::book3DHistoVector(vector<vector<vector<MonitorElement*> > > &temp3DVector,
1156  string histoType, string histoName, string title,
1157  int xbin, double xmin,double xmax,
1158  int ybin, double ymin, double ymax)
1159 {
1160  int histo_index = 0;
1161 
1162  vector<MonitorElement*> temp1DVector;
1163  vector<vector<MonitorElement*> > temp2DVector;
1164 // vector<vector<vector<MonitorElement*> > > temp3DVector;
1165 
1166 
1167  //determining which folder we're in
1168  bool conversionPlot = false;
1169  if(dbe_->pwd().find( "Conversions" ) != string::npos) conversionPlot = true;
1170 
1171 
1172  if(conversionPlot){
1173  histo_index_conversions_++;
1174  histo_index = histo_index_conversions_;
1175  }
1176  else{
1177  histo_index_photons_++;
1178  histo_index = histo_index_photons_;
1179  }
1180 
1181  stringstream histo_number_stream;
1182  histo_number_stream << "h_";
1183  if(histo_index<10) histo_number_stream << "0";
1184  histo_number_stream << histo_index << "_";
1185 
1186 
1187  for(int cut = 0; cut != numberOfSteps_; ++cut){ //looping over Et cut values
1188 
1189  for(uint type=0;type!=types_.size();++type){ //looping over isolation type
1190 
1191  for(uint part=0;part!=parts_.size();++part){ //looping over different parts of the ecal
1192 
1193  currentFolder_.str("");
1194  currentFolder_ << "Egamma/PhotonAnalyzer/" << types_[type] << "Photons/Et above " << (cut+1)*cutStep_ << " GeV";
1195  if(conversionPlot) currentFolder_ << "/Conversions";
1196 
1197  dbe_->setCurrentFolder(currentFolder_.str());
1198 
1199  string kind;
1200  if(conversionPlot) kind = " Conversions: ";
1201  else kind = " Photons: ";
1202 
1203  if(histoType=="1D") temp1DVector.push_back(dbe_->book1D( histo_number_stream.str()+histoName+parts_[part],types_[type]+kind+parts_[part]+": "+title,xbin,xmin,xmax));
1204  else if(histoType=="2D") temp1DVector.push_back(dbe_->book2D( histo_number_stream.str()+histoName+parts_[part],types_[type]+kind+parts_[part]+": "+title,xbin,xmin,xmax,ybin,ymin,ymax));
1205  else if(histoType=="Profile") temp1DVector.push_back(dbe_->bookProfile( histo_number_stream.str()+histoName+parts_[part],types_[type]+kind+parts_[part]+": "+title,xbin,xmin,xmax,ybin,ymin,ymax,""));
1206  else cout << "bad histoType\n";
1207 
1208 
1209  }
1210 
1211  temp2DVector.push_back(temp1DVector);
1212  temp1DVector.clear();
1213  }
1214 
1215  temp3DVector.push_back(temp2DVector);
1216  temp2DVector.clear();
1217  }
1218 
1219  // return temp3DVector;
1220 }
virtual void endJob()
type
Definition: HCALResponse.h:22
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
virtual void beginJob()
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:27
const std::string & label
Definition: MVAComputer.cc:186
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:514
#define PI
MonitorElement * bookHisto(std::string histoName, std::string title, int bin, double min, double max)
double deltaRMax
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:1898
std::vector< T >::const_iterator const_iterator
#define TWOPI
EgammaCoreTools.
#define min(a, b)
Definition: mlp_lapack.h:161
void fill3DHistoVector(std::vector< std::vector< std::vector< MonitorElement * > > > &histoVector, double x, int cut, int type, int part)
double deltaR(double eta1, double phi1, double eta2, double phi2)
Definition: deltaR.h:19
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:249
void fill2DHistoVector(std::vector< std::vector< MonitorElement * > > &histoVector, double x, int cut, int type)
const T & max(const T &a, const T &b)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
T sqrt(T t)
Definition: SSEVec.h:28
float ChiSquaredProbability(double chiSquared, double nrDOF)
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:828
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
float phiNormalization(float &a)
void book3DHistoVector(std::vector< std::vector< std::vector< MonitorElement * > > > &toFill, std::string histoType, std::string histoName, std::string title, int xbin, double xmin, double xmax, int ybin=1, double ymin=1, double ymax=2)
DQMStore * dbe_
bool etMin(const PFCandidate &cand, double cut)
const_iterator end() const
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
virtual ~PhotonAnalyzer()
tuple cut
Definition: align_tpl.py:88
virtual void endRun(const edm::Run &, const edm::EventSetup &)
tuple tracks
Definition: testEve_cfg.py:39
std::vector< size_type > Keys
part
Definition: HCALResponse.h:21
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
T const * product() const
Definition: Handle.h:74
edm::EventID id() const
Definition: EventBase.h:56
size_type size() const
Size of the RefVector.
Definition: RefVector.h:84
tuple cout
Definition: gather_cfg.py:41
Definition: DDAxes.h:10
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:421
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:642
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
tuple size
Write out results.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232
PhotonAnalyzer(const edm::ParameterSet &)
const_iterator begin() const
Definition: Run.h:32
const std::string & pwd(void) const
Definition: DQMStore.cc:204
void book2DHistoVector(std::vector< std::vector< MonitorElement * > > &toFill, std::string histoType, std::string histoName, std::string title, int xbin, double xmin, double xmax, int ybin=1, double ymin=1, double ymax=2)
Definition: DDAxes.h:10