67 theTriggerPathToPass = parameters.
getParameter<
string>(
"triggerPathToPass");
68 thePlotTheseTriggersToo = parameters.
getParameter<vector<string> >(
"plotTheseTriggersToo");
70 theTriggerResultsCollection = parameters.
getParameter<
string>(
"triggerResultsCollection");
74 theMinCaloJetPt = parameters.
getParameter<
double>(
"minCaloJetPt");
75 theMinPhotonEt = parameters.
getParameter<
double>(
"minPhotonEt");
76 theRequirePhotonFound = parameters.
getParameter<
bool>(
"requirePhotonFound");
77 thePlotPhotonMaxEt = parameters.
getParameter<
double>(
"plotPhotonMaxEt");
78 thePlotPhotonMaxEta = parameters.
getParameter<
double>(
"plotPhotonMaxEta");
79 thePlotJetMaxEta = parameters.
getParameter<
double>(
"plotJetMaxEta");
81 isValidHltConfig_ =
false;
91 logTraceName =
"QcdPhotonAnalyzer";
93 LogTrace(logTraceName)<<
"Parameters initialization";
96 theDbe->setCurrentFolder(
"Physics/QcdPhotons");
98 std::stringstream aStringStream;
100 aStringStream << theMinCaloJetPt;
101 aString = aStringStream.str();
104 int numOfTriggersToMonitor = thePlotTheseTriggersToo.size();
105 h_triggers_passed = theDbe->book1D(
"h_triggers_passed",
"Events passing these trigger paths", numOfTriggersToMonitor, 0, numOfTriggersToMonitor);
106 for (
int i=0;
i<numOfTriggersToMonitor;
i++) {
107 h_triggers_passed->setBinLabel(
i+1,thePlotTheseTriggersToo[
i]);
111 h_photon_et = theDbe->book1D(
"h_photon_et",
"#gamma with highest E_{T};E_{T}(#gamma) (GeV)", 20, 0., thePlotPhotonMaxEt);
112 h_photon_eta = theDbe->book1D(
"h_photon_eta",
"#gamma with highest E_{T};#eta(#gamma)", 40, -thePlotPhotonMaxEta, thePlotPhotonMaxEta);
113 h_photon_count_bar = theDbe->book1D(
"h_photon_count_bar",
"Number of #gamma's passing selection (Barrel);Number of #gamma's", 8, -0.5, 7.5);
114 h_photon_count_end = theDbe->book1D(
"h_photon_count_end",
"Number of #gamma's passing selection (Endcap);Number of #gamma's", 8, -0.5, 7.5);
116 h_jet_pt = theDbe->book1D(
"h_jet_pt",
"Jet with highest p_{T} (from "+theCaloJetCollectionLabel.label()+
");p_{T}(1^{st} jet) (GeV)", 20, 0., thePlotPhotonMaxEt);
117 h_jet_eta = theDbe->book1D(
"h_jet_eta",
"Jet with highest p_{T} (from "+theCaloJetCollectionLabel.label()+
");#eta(1^{st} jet)", 20, -thePlotJetMaxEta, thePlotJetMaxEta);
118 h_deltaPhi_photon_jet = theDbe->book1D(
"h_deltaPhi_photon_jet",
"#Delta#phi between Highest E_{T} #gamma and jet;#Delta#phi(#gamma,1^{st} jet)", 20, 0, 3.1415926);
119 h_deltaPhi_jet_jet2 = theDbe->book1D(
"h_deltaPhi_jet_jet2",
"#Delta#phi between Highest E_{T} jet and 2^{nd} jet;#Delta#phi(1^{st} jet,2^{nd} jet)", 20, 0, 3.1415926);
120 h_deltaEt_photon_jet = theDbe->book1D(
"h_deltaEt_photon_jet",
"(E_{T}(#gamma)-p_{T}(jet))/E_{T}(#gamma) when #Delta#phi(#gamma,1^{st} jet) > 2.8;#DeltaE_{T}(#gamma,1^{st} jet)/E_{T}(#gamma)", 20, -1.0, 1.0);
121 h_jet_count = theDbe->book1D(
"h_jet_count",
"Number of "+theCaloJetCollectionLabel.label()+
" (p_{T} > "+aString+
" GeV);Number of Jets", 8, -0.5, 7.5);
122 h_jet2_pt = theDbe->book1D(
"h_jet2_pt",
"Jet with 2^{nd} highest p_{T} (from "+theCaloJetCollectionLabel.label()+
");p_{T}(2^{nd} jet) (GeV)", 20, 0., thePlotPhotonMaxEt);
123 h_jet2_eta = theDbe->book1D(
"h_jet2_eta",
"Jet with 2^{nd} highest p_{T} (from "+theCaloJetCollectionLabel.label()+
");#eta(2^{nd} jet)", 20, -thePlotJetMaxEta, thePlotJetMaxEta);
124 h_jet2_ptOverPhotonEt = theDbe->book1D(
"h_jet2_ptOverPhotonEt",
"p_{T}(2^{nd} highest jet) / E_{T}(#gamma);p_{T}(2^{nd} Jet)/E_{T}(#gamma)", 20, 0.0, 4.0);
125 h_deltaPhi_photon_jet2 = theDbe->book1D(
"h_deltaPhi_photon_jet2",
"#Delta#phi between Highest E_{T} #gamma and 2^{nd} highest jet;#Delta#phi(#gamma,2^{nd} jet)", 20, 0, 3.1415926);
126 h_deltaR_jet_jet2 = theDbe->book1D(
"h_deltaR_jet_jet2",
"#DeltaR between Highest Jet and 2^{nd} Highest;#DeltaR(1^{st} jet,2^{nd} jet)", 30, 0, 6.0);
127 h_deltaR_photon_jet2 = theDbe->book1D(
"h_deltaR_photon_jet2",
"#DeltaR between Highest E_{T} #gamma and 2^{nd} jet;#DeltaR(#gamma, 2^{nd} jet)", 30, 0, 6.0);
130 Float_t bins_et[] = {15,20,30,50,80};
132 h_photon_et_jetcs = theDbe->book1D(
"h_photon_et_jetcs",
"#gamma with highest E_{T} (#eta(jet)<1.45, #eta(#gamma)#eta(jet)>0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
133 h_photon_et_jetco = theDbe->book1D(
"h_photon_et_jetco",
"#gamma with highest E_{T} (#eta(jet)<1.45, #eta(#gamma)#eta(jet)<0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
134 h_photon_et_jetfs = theDbe->book1D(
"h_photon_et_jetfs",
"#gamma with highest E_{T} (1.55<#eta(jet)<2.5, #eta(#gamma)#eta(jet)>0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
135 h_photon_et_jetfo = theDbe->book1D(
"h_photon_et_jetfo",
"#gamma with highest E_{T} (1.55<#eta(jet)<2.5, #eta(#gamma)#eta(jet)<0);E_{T}(#gamma) (GeV)", num_bins_et, bins_et);
136 h_photon_et_jetcs->getTH1F()->Sumw2();
137 h_photon_et_jetco->getTH1F()->Sumw2();
138 h_photon_et_jetfs->getTH1F()->Sumw2();
139 h_photon_et_jetfo->getTH1F()->Sumw2();
141 h_photon_et_ratio_co_cs = theDbe->book1D(
"h_photon_et_ratio_00_co_cs",
"D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)<0) / D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)>0);E_{T}(#gamma) (GeV); ratio", num_bins_et, bins_et);
142 h_photon_et_ratio_fo_fs = theDbe->book1D(
"h_photon_et_ratio_01_fo_fs",
"D(1.55<|#eta(jet)|<2.6, #eta(jet)*#eta(#gamma)<0) / D(1.55<|#eta(jet)|<2.6, #eta(jet)*#eta(#gamma)>0);E_{T}(#gamma) (GeV); ratio", num_bins_et, bins_et);
143 h_photon_et_ratio_cs_fs = theDbe->book1D(
"h_photon_et_ratio_02_cs_fs",
"D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)>0) / D(1.55<|#eta(jet)|<2.6, #eta(jet)*#eta(#gamma)>0);E_{T}(#gamma) (GeV); ratio", num_bins_et, bins_et);
144 h_photon_et_ratio_co_fs = theDbe->book1D(
"h_photon_et_ratio_03_co_fs",
"D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)<0) / D(1.55<|#eta(jet)|<2.6, #eta(jet)*#eta(#gamma)>0);E_{T}(#gamma) (GeV); ratio", num_bins_et, bins_et);
145 h_photon_et_ratio_cs_fo = theDbe->book1D(
"h_photon_et_ratio_04_cs_fo",
"D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)>0) / D(1.55<|#eta(jet)|<2.6, #eta(jet)*#eta(#gamma)<0);E_{T}(#gamma) (GeV); ratio", num_bins_et, bins_et);
146 h_photon_et_ratio_co_fo = theDbe->book1D(
"h_photon_et_ratio_05_co_fo",
"D(|#eta(jet)|<1.45, #eta(jet)*#eta(#gamma)<0) / D(1.55<|#eta(jet)|<2.6, #eta(jet)*#eta(#gamma)<0);E_{T}(#gamma) (GeV); ratio", num_bins_et, bins_et);
147 h_photon_et_ratio_co_cs->getTH1F()->Sumw2();
148 h_photon_et_ratio_fo_fs->getTH1F()->Sumw2();
149 h_photon_et_ratio_cs_fs->getTH1F()->Sumw2();
150 h_photon_et_ratio_co_fs->getTH1F()->Sumw2();
151 h_photon_et_ratio_cs_fo->getTH1F()->Sumw2();
152 h_photon_et_ratio_co_fo->getTH1F()->Sumw2();
162 bool isConfigChanged =
false;
165 isValidHltConfig_ = hltConfigProvider_.init( r, iSetup, theHltMenu, isConfigChanged );
167 num_events_in_run = 0;
175 if( ! isValidHltConfig_ )
return;
177 LogTrace(logTraceName)<<
"Analysis of event # ";
183 if (!HLTresults.
isValid())
return;
185 unsigned int triggerIndex;
190 for (
unsigned int i=0;
i<thePlotTheseTriggersToo.size();
i++) {
192 triggerIndex = hltConfigProvider_.triggerIndex(thePlotTheseTriggersToo[
i]);
193 if (triggerIndex < HLTresults->
size()) passed_HLT = HLTresults->accept(triggerIndex);
194 if (passed_HLT) h_triggers_passed->Fill(i);
199 triggerIndex = hltConfigProvider_.triggerIndex(theTriggerPathToPass);
200 if (triggerIndex < HLTresults->
size()) passed_HLT = HLTresults->accept(triggerIndex);
201 if (!passed_HLT)
return;
209 iEvent.
getByLabel(theVertexCollectionLabel, vertexHandle);
211 double vtx_ndof = -1.0;
213 bool vtx_isFake =
true;
214 if (vertexCollection.size()>0) {
215 vtx_ndof = vertexCollection.begin()->ndof();
216 vtx_z = vertexCollection.begin()->z();
219 if (vtx_isFake || fabs(vtx_z)>15 || vtx_ndof<4)
return;
231 iEvent.
getByLabel(thePhotonCollectionLabel, photonCollection);
234 if (!photonCollection.
isValid())
return;
238 iEvent.
getByLabel(
"reducedEcalRecHitsEB", EBReducedRecHits);
240 iEvent.
getByLabel(
"reducedEcalRecHitsEE", EEReducedRecHits);
245 float photon_et = -9.0;
246 float photon_eta = -9.0;
247 float photon_phi = -9.0;
248 bool photon_passPhotonID =
false;
249 bool found_lead_pho =
false;
250 int photon_count_bar = 0;
251 int photon_count_end = 0;
253 for (PhotonCollection::const_iterator recoPhoton = photonCollection->begin(); recoPhoton!=photonCollection->end(); recoPhoton++){
256 if ( recoPhoton->et() < theMinPhotonEt )
break;
261 float time = -999., outOfTimeChi2 = -999., chi2 = -999.;
262 int flags=-1, severity = -1;
263 const EcalRecHitCollection & rechits = ( recoPhoton->isEB() ? *EBReducedRecHits : *EEReducedRecHits);
265 if( it != rechits.end() ) {
267 outOfTimeChi2 = it->outOfTimeChi2();
269 flags = it->recoFlag();
273 severity = sevlv->severityLevel(
id, rechits);
275 bool isNotSpike = ((recoPhoton->isEB() && (severity!=3 && severity!=4 ) && (
flags != 2) ) || recoPhoton->isEE());
276 if (!isNotSpike)
continue;
279 bool pho_current_passPhotonID =
false;
280 bool pho_current_isEB = recoPhoton->isEB();
281 bool pho_current_isEE = recoPhoton->isEE();
283 if ( pho_current_isEB && (recoPhoton->sigmaIetaIeta() < 0.01 || recoPhoton->hadronicOverEm() < 0.05) ) {
285 pho_current_passPhotonID =
true;
287 }
else if ( pho_current_isEE && (recoPhoton->hadronicOverEm() < 0.05) ) {
289 pho_current_passPhotonID =
true;
293 if (!found_lead_pho) {
294 found_lead_pho =
true;
295 photon_passPhotonID = pho_current_passPhotonID;
296 photon_et = recoPhoton->et();
297 photon_eta = recoPhoton->eta();
298 photon_phi = recoPhoton->phi();
305 if ( theRequirePhotonFound && (!photon_passPhotonID || photon_et<theMinPhotonEt) )
return;
311 iEvent.
getByLabel (theCaloJetCollectionLabel,caloJetCollection);
312 if (!caloJetCollection.
isValid())
return;
315 float jet_eta = -8.0;
316 float jet_phi = -8.0;
318 float jet2_pt = -9.0;
319 float jet2_eta = -9.0;
320 float jet2_phi = -9.0;
322 for (CaloJetCollection::const_iterator i_calojet = caloJetCollection->begin(); i_calojet != caloJetCollection->end(); i_calojet++) {
324 float jet_current_pt = i_calojet->pt();
327 if (
deltaR(i_calojet->eta(), i_calojet->phi(), photon_eta, photon_phi) < 0.5 )
continue;
329 if (jet_current_pt < theMinCaloJetPt)
break;
332 if (jet_current_pt > jet_pt) {
336 jet_pt = jet_current_pt;
337 jet_eta = i_calojet->eta();
338 jet_phi = i_calojet->phi();
339 }
else if (jet_current_pt > jet2_pt) {
340 jet2_pt = jet_current_pt;
341 jet2_eta = i_calojet->eta();
342 jet2_phi = i_calojet->phi();
352 if ( jet_pt > 0.0 ) {
355 h_photon_et ->Fill( photon_et );
356 h_photon_eta ->Fill( photon_eta );
357 h_photon_count_bar->Fill( photon_count_bar );
358 h_photon_count_end->Fill( photon_count_end );
361 if ( fabs(photon_eta)<1.45 && photon_passPhotonID ) {
362 if (fabs(jet_eta)<1.45){
363 if (photon_eta*jet_eta>0) {
364 h_photon_et_jetcs->Fill(photon_et);
366 h_photon_et_jetco->Fill(photon_et);
368 }
else if (jet_eta>1.55 && jet_eta<2.5) {
369 if (photon_eta*jet_eta>0) {
370 h_photon_et_jetfs->Fill(photon_et);
372 h_photon_et_jetfo->Fill(photon_et);
378 h_jet_pt ->Fill( jet_pt );
379 h_jet_eta ->Fill( jet_eta );
380 h_jet_count ->Fill( jet_count );
381 h_deltaPhi_photon_jet ->Fill(
abs(
deltaPhi(photon_phi, jet_phi)) );
382 if (
abs(
deltaPhi(photon_phi,jet_phi))>2.8 ) h_deltaEt_photon_jet->Fill( (photon_et-jet_pt)/photon_et );
385 if ( jet2_pt > 0.0 ) {
386 h_jet2_pt ->Fill( jet2_pt );
387 h_jet2_eta ->Fill( jet2_eta );
388 h_jet2_ptOverPhotonEt ->Fill( jet2_pt/photon_et );
389 h_deltaPhi_photon_jet2->Fill(
abs(
deltaPhi(photon_phi, jet2_phi)) );
390 h_deltaPhi_jet_jet2 ->Fill(
abs(
deltaPhi( jet_phi, jet2_phi)) );
391 h_deltaR_jet_jet2 ->Fill(
deltaR( jet_eta, jet_phi, jet2_eta, jet2_phi) );
392 h_deltaR_photon_jet2 ->Fill(
deltaR(photon_eta, photon_phi, jet2_eta, jet2_phi) );
403 if (num_events_in_run>0) {
404 h_triggers_passed->getTH1F()->Scale(1.0/num_events_in_run);
406 h_photon_et_ratio_co_cs->getTH1F()->Divide( h_photon_et_jetco->getTH1F(), h_photon_et_jetcs->getTH1F() );
407 h_photon_et_ratio_fo_fs->getTH1F()->Divide( h_photon_et_jetfo->getTH1F(), h_photon_et_jetfs->getTH1F() );
408 h_photon_et_ratio_cs_fs->getTH1F()->Divide( h_photon_et_jetcs->getTH1F(), h_photon_et_jetfs->getTH1F() );
409 h_photon_et_ratio_co_fs->getTH1F()->Divide( h_photon_et_jetco->getTH1F(), h_photon_et_jetfs->getTH1F() );
410 h_photon_et_ratio_cs_fo->getTH1F()->Divide( h_photon_et_jetcs->getTH1F(), h_photon_et_jetfo->getTH1F() );
411 h_photon_et_ratio_co_fo->getTH1F()->Divide( h_photon_et_jetco->getTH1F(), h_photon_et_jetfo->getTH1F() );
T getParameter(std::string const &) const
double deltaPhi(float phi1, float phi2)
std::vector< T >::const_iterator const_iterator
void beginJob()
Inizialize parameters for histo binning.
std::vector< Variable::Flags > flags
std::vector< Vertex > VertexCollection
collection of Vertex objects
void endRun(const edm::Run &, const edm::EventSetup &)
QcdPhotonsDQM(const edm::ParameterSet &)
Constructor.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void endJob(void)
Save the histos.
double deltaR(double eta1, double eta2, double phi1, double phi2)
void beginRun(const edm::Run &, const edm::EventSetup &)
T const * product() const
iterator find(key_type k)
virtual ~QcdPhotonsDQM()
Destructor.
void analyze(const edm::Event &, const edm::EventSetup &)
Get the analysis.
tuple size
Write out results.