CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HiggsDQM.cc
Go to the documentation of this file.
2 
3 #include <memory>
4 
5 // Framework
14 
15 // Candidate handling
27 
30 
31 //#include "HiggsAnalysis/HiggsToZZ4Leptons/plugins/HZZ4LeptonsElectronAssociationMap.h"
32 //#include "HiggsAnalysis/HiggsToZZ4Leptons/plugins/HZZ4LeptonsMuonAssociationMap.h"
33 
34 // vertexing
35 // Transient tracks
43 
44 // Vertex utilities
47 
48 // Geometry
56 
62 
63 
64 // RECO
65 // Isolation
66 //#include "HiggsAnalysis/HiggsToZZ4Leptons/plugins/CandidateHadIsolation.h"
67 //#include "HiggsAnalysis/HiggsToZZ4Leptons/plugins/CandidateTkIsolation.h"
77 
78 //MET
86 
88 #include "TLorentzVector.h"
89 
90 #include <iostream>
91 #include <iomanip>
92 #include <stdio.h>
93 #include <string>
94 #include <sstream>
95 #include <math.h>
96 
97 using namespace edm;
98 using namespace std;
99 using namespace reco;
100 
102  bool operator()( const Candidate &c1, const Candidate &c2) const {
103  return c1.pt() > c2.pt();
104  }
105 };
106 
107 
108 double HiggsDQM::Distance( const reco::Candidate & c1, const reco::Candidate & c2 ) {
109  return deltaR(c1,c2);
110 }
111 
113  return deltaPhi(c1.p4().phi(),c2.p4().phi());
114 }
115 
116 // This always returns only a positive deltaPhi
117 double HiggsDQM::calcDeltaPhi(double phi1, double phi2) {
118  double deltaPhi = phi1 - phi2;
119  if (deltaPhi < 0) deltaPhi = -deltaPhi;
120  if (deltaPhi > 3.1415926) {
121  deltaPhi = 2 * 3.1415926 - deltaPhi;
122  }
123  return deltaPhi;
124 }
125 
126 //
127 // -- Constructor
128 //
130  //cout<<"Entering HiggsDQM::HiggsDQM: "<<endl;
131 
132  edm::LogInfo("HZZ4LeptonsDQM") << " Creating HZZ4LeptonsDQM " << "\n" ;
133  bei_ = Service<DQMStore>().operator->();
134  typedef std::vector<edm::InputTag> vtag;
135  // Get parameters from configuration file
136  theElecTriggerPathToPass = ps.getParameter<string>("elecTriggerPathToPass");
137  theMuonTriggerPathToPass = ps.getParameter<string>("muonTriggerPathToPass");
138  theTriggerResultsCollection = ps.getParameter<InputTag>("triggerResultsCollection");
139  theMuonCollectionLabel = ps.getParameter<InputTag>("muonCollection");
140  theElectronCollectionLabel = ps.getParameter<InputTag>("electronCollection");
141  theCaloJetCollectionLabel = ps.getParameter<InputTag>("caloJetCollection");
142  theCaloMETCollectionLabel = ps.getParameter<InputTag>("caloMETCollection");
143  thePfMETCollectionLabel = ps.getParameter<InputTag>("pfMETCollection");
144  // just to initialize
145  isValidHltConfig_ = false;
146  // cuts:
147  ptThrMu1_ = ps.getUntrackedParameter<double>("PtThrMu1");
148  ptThrMu2_ = ps.getUntrackedParameter<double>("PtThrMu2");
149 
150 
151 
152  //cout<<"...leaving HiggsDQM::HiggsDQM. "<<endl;
153 }
154 //
155 // -- Destructor
156 //
158  //cout<<"Entering HiggsDQM::~HiggsDQM: "<<endl;
159 
160  edm::LogInfo("HiggsDQM") << " Deleting HiggsDQM " << "\n" ;
161 
162  //cout<<"...leaving HiggsDQM::~HiggsDQM. "<<endl;
163 }
164 //
165 // -- Begin Job
166 //
168  //cout<<"Entering HiggsDQM::beginJob: "<<endl;
169 
170  nLumiSecs_ = 0;
171  nEvents_ = 0;
172  bei_->setCurrentFolder("Physics/Higgs");
173  bookHistos(bei_);
174  pi = 3.14159265;
175 
176 
177  //cout<<"...leaving HiggsDQM::beginJob. "<<endl;
178 }
179 //
180 // -- Begin Run
181 //
182 void HiggsDQM::beginRun(Run const& run, edm::EventSetup const& eSetup) {
183  edm::LogInfo ("HiggsDQM") <<"[HiggsDQM]: Begining of Run";
184  // passed as parameter to HLTConfigProvider::init(), not yet used
185  bool isConfigChanged = false;
186 
187  // isValidHltConfig_ used to short-circuit analyze() in case of problems
188  // const std::string hltProcessName( "HLT" );
189  const std::string hltProcessName = theTriggerResultsCollection.process();
190  isValidHltConfig_ = hltConfigProvider_.init( run, eSetup, hltProcessName, isConfigChanged );
191 
192 }
193 //
194 // -- Begin Luminosity Block
195 //
197  edm::EventSetup const& context) {
198  //cout<<"Entering HiggsDQM::beginLuminosityBlock: "<<endl;
199 
200  edm::LogInfo ("HiggsDQM") <<"[HiggsDQM]: Begin of LS transition";
201 
202  //cout<<"...leaving HiggsDQM::beginLuminosityBlock. "<<endl;
203 }
204 //
205 // -- Book histograms
206 //
208  bei->cd();
209  bei->setCurrentFolder("Physics/Higgs");
210  h_vertex_number = bei->book1D("h_vertex_number", "Number of event vertices in collection", 10,-0.5, 9.5 );
211  h_vertex_chi2 = bei->book1D("h_vertex_chi2" , "Event Vertex #chi^{2}/n.d.o.f." , 100, 0.0, 2.0 );
212  h_vertex_numTrks = bei->book1D("h_vertex_numTrks", "Event Vertex, number of tracks" , 100, -0.5, 99.5 );
213  h_vertex_sumTrks = bei->book1D("h_vertex_sumTrks", "Event Vertex, sum of track pt" , 100, 0.0, 100.0 );
214  h_vertex_d0 = bei->book1D("h_vertex_d0" , "Event Vertex d0" , 100, -10.0, 10.0);
215  h_jet_et = bei->book1D("h_jet_et", "Jet with highest E_{T} (from "+theCaloJetCollectionLabel.label()+");E_{T}(1^{st} jet) (GeV)", 20, 0., 200.0);
216  h_jet2_et = bei->book1D("h_jet2_et", "Jet with 2^{nd} highest E_{T} (from "+theCaloJetCollectionLabel.label()+");E_{T}(2^{nd} jet) (GeV)", 20, 0., 200.0);
217  h_jet_count = bei->book1D("h_jet_count", "Number of "+theCaloJetCollectionLabel.label()+" (E_{T} > 15 GeV);Number of Jets", 8, -0.5, 7.5);
218  h_caloMet = bei->book1D("h_caloMet", "Calo Missing E_{T}; GeV" , 20, 0.0 , 100);
219  h_caloMet_phi = bei->book1D("h_caloMet_phi", "Calo Missing E_{T} #phi;#phi(MET)", 35, -3.5, 3.5 );
220  h_pfMet = bei->book1D("h_pfMet", "Pf Missing E_{T}; GeV" , 20, 0.0 , 100);
221  h_pfMet_phi = bei->book1D("h_pfMet_phi", "Pf Missing E_{T} #phi;#phi(MET)", 35, -3.5, 3.5 );
222  h_eMultiplicity = bei_->book1D("NElectrons","# of electrons per event",10,0.,10.);
223  h_mMultiplicity = bei_->book1D("NMuons","# of muons per event",10,0.,10.);
224  h_ePt = bei_->book1D("ElePt","Pt of electrons",50,0.,100.);
225  h_eEta = bei_->book1D("EleEta","Eta of electrons",100,-5.,5.);
226  h_ePhi = bei_->book1D("ElePhi","Phi of electrons",100,-3.5,3.5);
227  h_mPt_GMTM = bei_->book1D("MuonPt_GMTM","Pt of global+tracker muons",50,0.,100.);
228  h_mEta_GMTM = bei_->book1D("MuonEta_GMTM","Eta of global+tracker muons",60,-3.,3.);
229  h_mPhi_GMTM = bei_->book1D("MuonPhi_GMTM","Phi of global+tracker muons",70,-3.5,3.5);
230  h_mPt_GMPT = bei_->book1D("MuonPt_GMPT","Pt of global prompt-tight muons",50,0.,100.);
231  h_mEta_GMPT = bei_->book1D("MuonEta_GMPT","Eta of global prompt-tight muons",60,-3.,3.);
232  h_mPhi_GMPT = bei_->book1D("MuonPhi_GMPT","Phi of global prompt-tight muons",70,-3.5,3.5);
233  h_mPt_GM = bei_->book1D("MuonPt_GM","Pt of global muons",50,0.,100.);
234  h_mEta_GM = bei_->book1D("MuonEta_GM","Eta of global muons",60,-3.,3.);
235  h_mPhi_GM = bei_->book1D("MuonPhi_GM","Phi of global muons",70,-3.5,3.5);
236  h_mPt_TM = bei_->book1D("MuonPt_TM","Pt of tracker muons",50,0.,100.);
237  h_mEta_TM = bei_->book1D("MuonEta_TM","Eta of tracker muons",60,-3.,3.);
238  h_mPhi_TM = bei_->book1D("MuonPhi_TM","Phi of tracker muons",70,-3.5,3.5);
239  h_mPt_STAM = bei_->book1D("MuonPt_STAM","Pt of STA muons",50,0.,100.);
240  h_mEta_STAM = bei_->book1D("MuonEta_STAM","Eta of STA muons",60,-3.,3.);
241  h_mPhi_STAM = bei_->book1D("MuonPhi_STAM","Phi of STA muons",70,-3.5,3.5);
242  h_eCombIso = bei_->book1D("EleCombIso","CombIso of electrons",100,0.,10.);
243  h_mCombIso = bei_->book1D("MuonCombIso","CombIso of muons",100,0.,10.);
244  h_dimumass_GMGM = bei->book1D("DimuMass_GMGM","Invariant mass of GMGM pairs",100,0.,200.);
245  h_dimumass_GMTM = bei->book1D("DimuMass_GMTM","Invariant mass of GMTM pairs",100,0.,200.);
246  h_dimumass_TMTM = bei->book1D("DimuMass_TMTM","Invariant mass of TMTM pairs",100,0.,200.);
247  h_dielemass = bei->book1D("DieleMass","Invariant mass of EE pairs",100,0.,200.);
248  h_lepcounts = bei->book1D("LeptonCounts","LeptonCounts for multi lepton events",49,0.,49.);
249 
250  bei->cd();
251 
252 }
253 //
254 // -- Analyze
255 //
256 void HiggsDQM::analyze(const edm::Event& e, const edm::EventSetup& eSetup){
257  //cout<<"[HiggsDQM::analyze()] "<<endl;
258 
259 //-------------------------------
260 //--- Trigger Info
261 //-------------------------------
262  // short-circuit if hlt problems
263  if( ! isValidHltConfig_ ) return;
264  // Did it pass certain HLT path?
265  Handle<TriggerResults> HLTresults;
266  e.getByLabel(theTriggerResultsCollection, HLTresults);
267  if ( !HLTresults.isValid() ) return;
268  //unsigned int triggerIndex_elec = hltConfig.triggerIndex(theElecTriggerPathToPass);
269  //unsigned int triggerIndex_muon = hltConfig.triggerIndex(theMuonTriggerPathToPass);
270  bool passed_electron_HLT = true;
271  bool passed_muon_HLT = true;
272  //if (triggerIndex_elec < HLTresults->size()) passed_electron_HLT = HLTresults->accept(triggerIndex_elec);
273  //if (triggerIndex_muon < HLTresults->size()) passed_muon_HLT = HLTresults->accept(triggerIndex_muon);
274  //if ( !(passed_electron_HLT || passed_muon_HLT) ) return;
275 
276 //-------------------------------
277 //--- Vertex Info
278 //-------------------------------
279  Handle<VertexCollection> vertexHandle;
280  e.getByLabel("offlinePrimaryVertices", vertexHandle);
281  if ( vertexHandle.isValid() ){
282  VertexCollection vertexCollection = *(vertexHandle.product());
283  int vertex_number = vertexCollection.size();
284  VertexCollection::const_iterator v = vertexCollection.begin();
285  double vertex_chi2 = v->normalizedChi2(); //v->chi2();
286  double vertex_d0 = sqrt(v->x()*v->x()+v->y()*v->y());
287  //double vertex_ndof = v->ndof();cout << "ndof="<<vertex_ndof<<endl;
288  double vertex_numTrks = v->tracksSize();
289  double vertex_sumTrks = 0.0;
290  for (Vertex::trackRef_iterator vertex_curTrack = v->tracks_begin(); vertex_curTrack!=v->tracks_end(); vertex_curTrack++) {
291  vertex_sumTrks += (*vertex_curTrack)->pt();
292  }
293  h_vertex_number->Fill(vertex_number);
294  h_vertex_chi2->Fill(vertex_chi2);
295  h_vertex_d0 ->Fill(vertex_d0);
296  h_vertex_numTrks->Fill(vertex_numTrks);
297  h_vertex_sumTrks->Fill(vertex_sumTrks);
298  }
299 
300 //-------------------------------
301 //--- Electrons
302 //-------------------------------
303  float nEle=0;
304  Handle<GsfElectronCollection> electronCollection;
305  e.getByLabel(theElectronCollectionLabel, electronCollection);
306  if ( electronCollection.isValid() ){
307  int posEle=0,negEle=0;
308  // If it passed electron HLT and the collection was found, find electrons near Z mass
309  if( passed_electron_HLT ) {
310  for (reco::GsfElectronCollection::const_iterator recoElectron=electronCollection->begin(); recoElectron!=electronCollection->end(); recoElectron++){
311 // cout << "Electron with pt= " << recoElectron->pt() << " and eta" << recoElectron->eta() << " p=" << recoElectron->p() << endl;
312  h_ePt->Fill(recoElectron->pt());
313  h_eEta->Fill(recoElectron->eta());
314  h_ePhi->Fill(recoElectron->phi());
315  if(recoElectron->charge()==1){
316  posEle++;
317  }else if(recoElectron->charge()==-1){
318  negEle++;
319  }
320  // Require electron to pass some basic cuts
321  //if ( recoElectron->et() < 20 || fabs(recoElectron->eta())>2.5 ) continue;
322  // Tighter electron cuts
323  //if ( recoElectron->deltaPhiSuperClusterTrackAtVtx() > 0.58 ||
324  // recoElectron->deltaEtaSuperClusterTrackAtVtx() > 0.01 ||
325  // recoElectron->sigmaIetaIeta() > 0.027 ) continue;
326  } // end of loop over electrons
327  } // end if passed HLT
328  nEle = posEle+negEle; if(nEle>9.) nEle=9.;
329  h_eMultiplicity->Fill(nEle);
330 
331  // Z->ee:
332  unsigned int eleCollectionSize = electronCollection->size();
333  for(unsigned int i=0; i<eleCollectionSize; i++) {
334  const GsfElectron& ele = electronCollection->at(i);
335  double pt = ele.pt();
336  if(pt>ptThrMu1_){
337  for(unsigned int j=i+1; j<eleCollectionSize; j++) {
338  const GsfElectron& ele2 = electronCollection->at(j);
339  double pt2 = ele2.pt();
340  if(pt2>ptThrMu2_){
341  const math::XYZTLorentzVector ZRecoEE (ele.px()+ele2.px(), ele.py()+ele2.py() , ele.pz()+ele2.pz(), ele.p()+ele2.p());
342  h_dielemass->Fill(ZRecoEE.mass());
343  }
344  }
345  }
346  }
347  }
348 
349 
350 
351 //-------------------------------
352 //--- Muons
353 //-------------------------------
354  float nMu=0;
355  Handle<MuonCollection> muonCollection;
356  e.getByLabel(theMuonCollectionLabel,muonCollection);
357  if ( muonCollection.isValid() ){
358  // Find the highest pt muons
359  int posMu=0,negMu=0;
360  TLorentzVector m1, m2;
361  if( passed_muon_HLT ) {
362  for (reco::MuonCollection::const_iterator recoMuon=muonCollection->begin(); recoMuon!=muonCollection->end(); recoMuon++){
363  //cout << "Muon with pt= " << muIter->pt() << " and eta" << muIter->eta() << " p=" << muIter->p() << endl;
364  if(recoMuon->isGlobalMuon()&&recoMuon->isTrackerMuon()){
365  h_mPt_GMTM->Fill(recoMuon->pt());
366  h_mEta_GMTM->Fill(recoMuon->eta());
367  h_mPhi_GMTM->Fill(recoMuon->phi());
368  }else if(recoMuon->isGlobalMuon()&&(muon::isGoodMuon( (*recoMuon),muon::GlobalMuonPromptTight))){
369  h_mPt_GMPT->Fill(recoMuon->pt());
370  h_mEta_GMPT->Fill(recoMuon->eta());
371  h_mPhi_GMPT->Fill(recoMuon->phi());
372  }else if(recoMuon->isGlobalMuon()){
373  h_mPt_GM->Fill(recoMuon->pt());
374  h_mEta_GM->Fill(recoMuon->eta());
375  h_mPhi_GM->Fill(recoMuon->phi());
376  }else if(recoMuon->isTrackerMuon()&&(muon::segmentCompatibility((*recoMuon),reco::Muon::SegmentAndTrackArbitration))){
377  h_mPt_TM->Fill(recoMuon->pt());
378  h_mEta_TM->Fill(recoMuon->eta());
379  h_mPhi_TM->Fill(recoMuon->phi());
380  }else if(recoMuon->isStandAloneMuon()){
381  h_mPt_STAM->Fill(recoMuon->pt());
382  h_mEta_STAM->Fill(recoMuon->eta());
383  h_mPhi_STAM->Fill(recoMuon->phi());
384  }
385  if ( recoMuon->charge()==1 ){
386  posMu++;
387  }else if ( recoMuon->charge()==-1 ){
388  negMu++;
389  }
390  }
391  nMu = posMu+negMu; if(nMu>9.) nMu=9.;
392  h_mMultiplicity->Fill(nMu);
393  }
394 
395  // Z->mumu:
396  unsigned int muonCollectionSize = muonCollection->size();
397  for(unsigned int i=0; i<muonCollectionSize; i++) {
398  const Muon& mu = muonCollection->at(i);
399  //if (!mu.isGlobalMuon()) continue;
400  double pt = mu.pt();
401  if(pt>ptThrMu1_){
402  for(unsigned int j=i+1; j<muonCollectionSize; j++) {
403  const Muon& mu2 = muonCollection->at(j);
404  double pt2 = mu2.pt();
405  if(pt2>ptThrMu2_){
406  // Glb + Glb
407  if(mu.isGlobalMuon() && mu2.isGlobalMuon()){
408  const math::XYZTLorentzVector ZRecoGMGM (mu.px()+mu2.px(), mu.py()+mu2.py() , mu.pz()+mu2.pz(), mu.p()+mu2.p());
409  h_dimumass_GMGM->Fill(ZRecoGMGM.mass());
410  }
411  // Glb + TM
412  else if(mu.isGlobalMuon() && mu2.isTrackerMuon()){
413  const math::XYZTLorentzVector ZRecoGMTM (mu.px()+mu2.px(), mu.py()+mu2.py() , mu.pz()+mu2.pz(), mu.p()+mu2.p());
414  h_dimumass_GMTM->Fill(ZRecoGMTM.mass());
415  }
416  // TM + TM
417  else if(mu.isTrackerMuon() && mu2.isTrackerMuon()){
418  const math::XYZTLorentzVector ZRecoTMTM (mu.px()+mu2.px(), mu.py()+mu2.py() , mu.pz()+mu2.pz(), mu.p()+mu2.p());
419  h_dimumass_TMTM->Fill(ZRecoTMTM.mass());
420  }
421  }
422  }
423  }
424  }
425  }
426 
427 //-------------------------------
428 //--- Jets
429 //-------------------------------
430  Handle<CaloJetCollection> caloJetCollection;
431  e.getByLabel (theCaloJetCollectionLabel,caloJetCollection);
432  if ( caloJetCollection.isValid() ){
433  float jet_et = -8.0;
434  float jet_eta = -8.0;
435  float jet_phi = -8.0;
436  int jet_count = 0;
437  float jet2_et = -9.0;
438  float jet2_eta = -9.0;
439  float jet2_phi = -9.0;
440  for (CaloJetCollection::const_iterator i_calojet = caloJetCollection->begin(); i_calojet != caloJetCollection->end(); i_calojet++) {
441  float jet_current_et = i_calojet->et();
442  // if it overlaps with electron, it is not a jet
443  //if ( electron_et>0.0 && fabs(i_calojet->eta()-electron_eta ) < 0.2 && calcDeltaPhi(i_calojet->phi(), electron_phi ) < 0.2) continue;
444  //if ( electron2_et>0.0&& fabs(i_calojet->eta()-electron2_eta) < 0.2 && calcDeltaPhi(i_calojet->phi(), electron2_phi) < 0.2) continue;
445  // if it has too low Et, throw away
446  if (jet_current_et < 15) continue;
447  jet_count++;
448  if (jet_current_et > jet_et) {
449  jet2_et = jet_et; // 2nd highest jet get's et from current highest
450  jet2_eta = jet_eta;
451  jet2_phi = jet_phi;
452  jet_et = i_calojet->et(); // current highest jet gets et from the new highest
453  jet_eta = i_calojet->eta();
454  jet_phi = i_calojet->phi();
455  } else if (jet_current_et > jet2_et) {
456  jet2_et = i_calojet->et();
457  jet2_eta = i_calojet->eta();
458  jet2_phi = i_calojet->phi();
459  }
460  }
461  if (jet_et>0.0) {
462  h_jet_et ->Fill(jet_et);
463  h_jet_count->Fill(jet_count);
464  }
465  }
466 
467 //-------------------------------
468 //--- MET
469 //-------------------------------
470  Handle<CaloMETCollection> caloMETCollection;
471  e.getByLabel(theCaloMETCollectionLabel, caloMETCollection);
472  if ( caloMETCollection.isValid() ){
473  float caloMet = caloMETCollection->begin()->et();
474  float caloMet_phi = caloMETCollection->begin()->phi();
475  h_caloMet ->Fill(caloMet);
476  h_caloMet_phi ->Fill(caloMet_phi);
477  }
478  Handle<PFMETCollection> pfMETCollection;
479  e.getByLabel(thePfMETCollectionLabel, pfMETCollection);
480  if ( pfMETCollection.isValid() ){
481  float pfMet = pfMETCollection->begin()->et();
482  float pfMet_phi = pfMETCollection->begin()->phi();
483  h_pfMet ->Fill(pfMet);
484  h_pfMet_phi ->Fill(pfMet_phi);
485  }
486 
487 //-------------------------------------
488 //--- Events with more than 2 leptons:
489 //-------------------------------------
490  if(nMu+nEle > 2 && nMu+nEle < 10){
491  if(nMu==0 && nEle==3) h_lepcounts->Fill(0);
492  if(nMu==0 && nEle==4) h_lepcounts->Fill(1);
493  if(nMu==0 && nEle==5) h_lepcounts->Fill(2);
494  if(nMu==0 && nEle==6) h_lepcounts->Fill(3);
495  if(nMu==0 && nEle==7) h_lepcounts->Fill(4);
496  if(nMu==0 && nEle==8) h_lepcounts->Fill(5);
497  if(nMu==0 && nEle==9) h_lepcounts->Fill(6);
498  if(nMu==1 && nEle==2) h_lepcounts->Fill(7);
499  if(nMu==1 && nEle==3) h_lepcounts->Fill(8);
500  if(nMu==1 && nEle==4) h_lepcounts->Fill(9);
501  if(nMu==1 && nEle==5) h_lepcounts->Fill(10);
502  if(nMu==1 && nEle==6) h_lepcounts->Fill(11);
503  if(nMu==1 && nEle==7) h_lepcounts->Fill(12);
504  if(nMu==1 && nEle==8) h_lepcounts->Fill(13);
505  if(nMu==2 && nEle==1) h_lepcounts->Fill(14);
506  if(nMu==2 && nEle==2) h_lepcounts->Fill(15);
507  if(nMu==2 && nEle==3) h_lepcounts->Fill(16);
508  if(nMu==2 && nEle==4) h_lepcounts->Fill(17);
509  if(nMu==2 && nEle==5) h_lepcounts->Fill(18);
510  if(nMu==2 && nEle==6) h_lepcounts->Fill(19);
511  if(nMu==2 && nEle==7) h_lepcounts->Fill(20);
512  if(nMu==3 && nEle==0) h_lepcounts->Fill(21);
513  if(nMu==3 && nEle==1) h_lepcounts->Fill(22);
514  if(nMu==3 && nEle==2) h_lepcounts->Fill(23);
515  if(nMu==3 && nEle==3) h_lepcounts->Fill(24);
516  if(nMu==3 && nEle==4) h_lepcounts->Fill(25);
517  if(nMu==3 && nEle==5) h_lepcounts->Fill(26);
518  if(nMu==3 && nEle==6) h_lepcounts->Fill(27);
519  if(nMu==4 && nEle==0) h_lepcounts->Fill(28);
520  if(nMu==4 && nEle==1) h_lepcounts->Fill(29);
521  if(nMu==4 && nEle==2) h_lepcounts->Fill(30);
522  if(nMu==4 && nEle==3) h_lepcounts->Fill(31);
523  if(nMu==4 && nEle==4) h_lepcounts->Fill(32);
524  if(nMu==4 && nEle==5) h_lepcounts->Fill(33);
525  if(nMu==5 && nEle==0) h_lepcounts->Fill(34);
526  if(nMu==5 && nEle==1) h_lepcounts->Fill(35);
527  if(nMu==5 && nEle==2) h_lepcounts->Fill(36);
528  if(nMu==5 && nEle==3) h_lepcounts->Fill(37);
529  if(nMu==5 && nEle==4) h_lepcounts->Fill(38);
530  if(nMu==6 && nEle==0) h_lepcounts->Fill(39);
531  if(nMu==6 && nEle==1) h_lepcounts->Fill(40);
532  if(nMu==6 && nEle==2) h_lepcounts->Fill(41);
533  if(nMu==6 && nEle==3) h_lepcounts->Fill(42);
534  if(nMu==7 && nEle==0) h_lepcounts->Fill(43);
535  if(nMu==7 && nEle==1) h_lepcounts->Fill(44);
536  if(nMu==7 && nEle==2) h_lepcounts->Fill(45);
537  if(nMu==8 && nEle==0) h_lepcounts->Fill(46);
538  if(nMu==8 && nEle==1) h_lepcounts->Fill(47);
539  if(nMu==9 && nEle==0) h_lepcounts->Fill(48);
540 
541 
542  }
543  if ((nMu+nEle) >= 10)
544  LogDebug("HiggsDQM") <<"WARNING: "<<nMu+nEle<<" leptons in this event: run="<<e.id().run()<<", event="<<e.id().event()<< "\n";
545 // std::cout <<"WARNING: "<<nMu+nEle<<" leptons in this event: run="<<e.id().run()<<", event="<<e.id().event()<< "\n";
546 
547 /* /// channel conditions
548  nElectron=0;
549  nMuon=0;
550  if (decaychannel=="2e2mu") {
551  if ( posEle>=1 && negEle>=1 ) {
552  nElectron=posEle+negEle;
553  }
554  if ( posMu>=1 && negMu>=1 ) {
555  nMuon=posMu+negMu;
556  }
557  }
558  else if (decaychannel=="4e") {
559  if ( posEle>=2 && negEle>=2 ) {
560  nElectron=posEle+negEle;
561  }
562  }
563  else if (decaychannel=="4mu") {
564  if ( posMu>=2 && negMu>=2 ) {
565  nMuon=posMu+negMu;
566  }
567  }
568 
569 
570  // Pairs of EE MuMu
571  int nZEE=0,nZMuMu=0;
572  if (decaychannel=="2e2mu"){
573  Handle<CompositeCandidateCollection> zEECandidates;
574  e.getByLabel(zToEETag_.label(), zEECandidates);
575  for ( CompositeCandidateCollection::const_iterator zIter=zEECandidates->begin(); zIter!= zEECandidates->end(); ++zIter ) {
576 // cout << "Zee mass= " << double(zIter->p4().mass()) << endl;
577  if ( double(zIter->p4().mass())> 12. ){
578  nZEE++;
579  }
580  }
581  Handle<CompositeCandidateCollection> zMuMuCandidates;
582  e.getByLabel(zToMuMuTag_.label(), zMuMuCandidates);
583  for ( CompositeCandidateCollection::const_iterator zIter=zMuMuCandidates->begin(); zIter!= zMuMuCandidates->end(); ++zIter ) {
584 // cout << "Zmumu mass= " << double(zIter->p4().mass()) << endl;
585  if ( zIter->p4().mass()> 12. ){
586  nZMuMu++;
587  }
588  }
589  }
590 
591  // exclusive couples ZEE and ZMUMU
592  if (decaychannel=="4e" ){
593  Handle<CompositeCandidateCollection> higgsCandidates;
594  e.getByLabel(hTozzTo4leptonsTag_.label(), higgsCandidates);
595  for ( CompositeCandidateCollection::const_iterator hIter=higgsCandidates->begin(); hIter!= higgsCandidates->end(); ++hIter ) {
596  if (nZEE<2) nZEE=0;
597  for (size_t ndau=0; ndau<hIter->numberOfDaughters();ndau++){
598  if ( hIter->daughter(ndau)->p4().mass()> 12.){
599  nZEE++;
600  }
601  }
602  }
603  }
604  //
605  if (decaychannel=="4mu" ){
606  Handle<CompositeCandidateCollection> higgsCandidates;
607  e.getByLabel(hTozzTo4leptonsTag_.label(), higgsCandidates);
608  for ( CompositeCandidateCollection::const_iterator hIter=higgsCandidates->begin(); hIter!= higgsCandidates->end(); ++hIter ) {
609  if (nZMuMu<2) nZMuMu=0;
610  for (size_t ndau=0; ndau<hIter->numberOfDaughters();ndau++){
611  if ( hIter->daughter(ndau)->p4().mass()> 12. ){
612  nZMuMu++;
613  }
614  }
615  }
616  }
617 
618  // 4 lepton combinations
619  Handle<CompositeCandidateCollection> higgsCandidates;
620  e.getByLabel(hTozzTo4leptonsTag_.label(), higgsCandidates);
621  int nHiggs=0;
622  for ( CompositeCandidateCollection::const_iterator hIter=higgsCandidates->begin(); hIter!= higgsCandidates->end(); ++hIter ) {
623  if ( hIter->p4().mass()> 100. ){
624  nHiggs++;
625  }
626  }
627 */
628 // cout<<"Z and Higgs candidates: "<<nZEE<<" "<<nZMuMu<<" "<<nHiggs<<endl;
629 
630  //cout<<"[leaving HiggsDQM::analyze()] "<<endl;
631 
632 }
633 //
634 // -- End Luminosity Block
635 //
637 // cout<<"Entering HiggsDQM::endLuminosityBlock: "<<endl;
638 
639  edm::LogInfo ("HiggsDQM") <<"[HiggsDQM]: End of LS transition, performing the DQM client operation";
640 
641  nLumiSecs_++;
642  //cout << "nLumiSecs_: "<< nLumiSecs_ << endl;
643 
644  edm::LogInfo("HiggsDQM") << "====================================================== " << endl << " ===> Iteration # " << nLumiSecs_ << " " << lumiSeg.luminosityBlock() << endl << "====================================================== " << endl;
645 
646 // cout<<"...leaving HiggsDQM::endLuminosityBlock. "<<endl;
647 }
648 //
649 // -- End Run
650 //
651 void HiggsDQM::endRun(edm::Run const& run, edm::EventSetup const& eSetup){
652 // cout<<"Entering HiggsDQM::endRun: "<<endl;
653 
654  //edm::LogVerbatim ("HiggsDQM") <<"[HiggsDQM]: End of Run, saving DQM output ";
655  //int iRun = run.run();
656 
657 // cout<<"...leaving HiggsDQM::endRun. "<<endl;
658 }
659 
660 //
661 // -- End Job
662 //
664 // cout<<"In HiggsDQM::endJob "<<endl;
665  edm::LogInfo("HiggsDQM") <<"[HiggsDQM]: endjob called!";
666 
667 }
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:42
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
virtual double p() const
magnitude of momentum vector
void beginRun(edm::Run const &run, edm::EventSetup const &eSetup)
Definition: HiggsDQM.cc:182
void endJob()
Definition: HiggsDQM.cc:663
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:514
double deltaPhi(float phi1, float phi2)
Definition: VectorUtil.h:30
virtual double pt() const =0
transverse momentum
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:209
bool isTrackerMuon() const
Definition: Muon.h:149
bool isGlobalMuon() const
Definition: Muon.h:148
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
tuple vertexCollection
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
Definition: HiggsDQM.cc:196
void endRun(edm::Run const &run, edm::EventSetup const &eSetup)
Definition: HiggsDQM.cc:651
void bookHistos()
Definition: Histogram.h:33
LuminosityBlockNumber_t luminosityBlock() const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
T sqrt(T t)
Definition: SSEVec.h:28
tuple pfMet
Definition: PFMET_cfi.py:12
void analyze(edm::Event const &e, edm::EventSetup const &eSetup)
Definition: HiggsDQM.cc:256
int j
Definition: DBlmapReader.cc:9
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
Definition: HiggsDQM.cc:636
double Distance(const reco::Candidate &c1, const reco::Candidate &c2)
Definition: HiggsDQM.cc:108
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
double calcDeltaPhi(double phi1, double phi2)
Definition: HiggsDQM.cc:117
double DistancePhi(const reco::Candidate &c1, const reco::Candidate &c2)
Definition: HiggsDQM.cc:112
virtual double px() const
x coordinate of momentum vector
virtual double pt() const
transverse momentum
T const * product() const
Definition: Handle.h:74
virtual double pz() const
z coordinate of momentum vector
edm::EventID id() const
Definition: EventBase.h:56
HiggsDQM(const edm::ParameterSet &ps)
Definition: HiggsDQM.cc:129
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:38
virtual ~HiggsDQM()
Definition: HiggsDQM.cc:157
void bookHistos(DQMStore *bei)
Definition: HiggsDQM.cc:207
bool operator()(const Candidate &c1, const Candidate &c2) const
Definition: HiggsDQM.cc:102
double pi
mathSSE::Vec4< T > v
virtual double py() const
y coordinate of momentum vector
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232
Definition: Run.h:32
void beginJob()
Definition: HiggsDQM.cc:167
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector