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