Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:55:44

0001 #include "DQM/Physics/src/HiggsDQM.h"
0002 
0003 #include <memory>
0004 
0005 // Framework
0006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0007 #include "FWCore/Framework/interface/EventSetup.h"
0008 #include "FWCore/Framework/interface/LuminosityBlock.h"
0009 #include "FWCore/ServiceRegistry/interface/Service.h"
0010 #include "FWCore/ParameterSet/interface/FileInPath.h"
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 #include "FWCore/Framework/interface/Run.h"
0013 #include "DataFormats/Provenance/interface/EventID.h"
0014 
0015 // Candidate handling
0016 #include "DataFormats/Candidate/interface/Candidate.h"
0017 #include "DataFormats/Candidate/interface/CandidateFwd.h"
0018 #include "DataFormats/Candidate/interface/OverlapChecker.h"
0019 #include "DataFormats/Candidate/interface/CompositeCandidate.h"
0020 #include "DataFormats/Candidate/interface/CompositeCandidateFwd.h"
0021 #include "DataFormats/Candidate/interface/CandMatchMap.h"
0022 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0023 #include "DataFormats/MuonReco/interface/Muon.h"
0024 #include "DataFormats/MuonReco/interface/MuonSelectors.h"
0025 #include "DataFormats/VertexReco/interface/Vertex.h"
0026 
0027 #include "DQMServices/Core/interface/DQMStore.h"
0028 
0029 //#include
0030 //"HiggsAnalysis/HiggsToZZ4Leptons/plugins/HZZ4LeptonsElectronAssociationMap.h"
0031 //#include
0032 //"HiggsAnalysis/HiggsToZZ4Leptons/plugins/HZZ4LeptonsMuonAssociationMap.h"
0033 
0034 // vertexing
0035 // Transient tracks
0036 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
0037 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
0038 #include "TrackingTools/Records/interface/TransientTrackRecord.h"
0039 #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"
0040 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0041 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0042 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0043 
0044 // Vertex utilities
0045 #include "DataFormats/VertexReco/interface/Vertex.h"
0046 
0047 // Geometry
0048 #include "DataFormats/Math/interface/Vector3D.h"
0049 #include "DataFormats/Math/interface/LorentzVector.h"
0050 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0051 #include "DataFormats/Common/interface/AssociationVector.h"
0052 #include "DataFormats/Math/interface/Point3D.h"
0053 #include "DataFormats/Math/interface/deltaR.h"
0054 #include "DataFormats/Math/interface/deltaPhi.h"
0055 
0056 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0057 #include "DataFormats/EgammaCandidates/interface/Electron.h"
0058 #include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
0059 #include "DataFormats/DetId/interface/DetId.h"
0060 #include "DataFormats/Common/interface/RefToBase.h"
0061 
0062 // RECO
0063 // Isolation
0064 //#include "HiggsAnalysis/HiggsToZZ4Leptons/plugins/CandidateHadIsolation.h"
0065 //#include "HiggsAnalysis/HiggsToZZ4Leptons/plugins/CandidateTkIsolation.h"
0066 #include "DataFormats/MuonReco/interface/Muon.h"
0067 #include "DataFormats/MuonReco/interface/MuonIsolation.h"
0068 #include "DataFormats/TrackReco/interface/Track.h"
0069 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0070 #include "DataFormats/EgammaCandidates/interface/Photon.h"
0071 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
0072 #include "DataFormats/VertexReco/interface/Vertex.h"
0073 
0074 // MET
0075 #include "DataFormats/METReco/interface/GenMETCollection.h"
0076 #include "DataFormats/METReco/interface/CaloMET.h"
0077 #include "DataFormats/METReco/interface/PFMET.h"
0078 #include "DataFormats/METReco/interface/MET.h"
0079 
0080 #include "DataFormats/Math/interface/LorentzVector.h"
0081 #include "TLorentzVector.h"
0082 
0083 #include <iostream>
0084 #include <iomanip>
0085 #include <cstdio>
0086 #include <string>
0087 #include <sstream>
0088 #include <cmath>
0089 
0090 using namespace edm;
0091 using namespace std;
0092 using namespace reco;
0093 
0094 struct SortCandByDecreasingPt {
0095   bool operator()(const Candidate& c1, const Candidate& c2) const { return c1.pt() > c2.pt(); }
0096 };
0097 
0098 double HiggsDQM::Distance(const reco::Candidate& c1, const reco::Candidate& c2) { return deltaR(c1, c2); }
0099 
0100 double HiggsDQM::DistancePhi(const reco::Candidate& c1, const reco::Candidate& c2) {
0101   return deltaPhi(c1.p4().phi(), c2.p4().phi());
0102 }
0103 
0104 // This always returns only a positive deltaPhi
0105 double HiggsDQM::calcDeltaPhi(double phi1, double phi2) {
0106   double deltaPhi = phi1 - phi2;
0107   if (deltaPhi < 0)
0108     deltaPhi = -deltaPhi;
0109   if (deltaPhi > 3.1415926) {
0110     deltaPhi = 2 * 3.1415926 - deltaPhi;
0111   }
0112   return deltaPhi;
0113 }
0114 
0115 //
0116 // -- Constructor
0117 //
0118 HiggsDQM::HiggsDQM(const edm::ParameterSet& ps) {
0119   // cout<<"Entering  HiggsDQM::HiggsDQM: "<<endl;
0120 
0121   edm::LogInfo("HZZ4LeptonsDQM") << " Creating HZZ4LeptonsDQM "
0122                                  << "\n";
0123 
0124   typedef std::vector<edm::InputTag> vtag;
0125   // Get parameters from configuration file
0126   theElecTriggerPathToPass = ps.getParameter<string>("elecTriggerPathToPass");
0127   theMuonTriggerPathToPass = ps.getParameter<string>("muonTriggerPathToPass");
0128   theTriggerResultsCollectionTag_ = ps.getParameter<InputTag>("triggerResultsCollection");
0129   theCaloJetCollectionLabel_ = ps.getParameter<InputTag>("caloJetCollection");
0130   theTriggerResultsCollection_ = consumes<edm::TriggerResults>(theTriggerResultsCollectionTag_);
0131   theMuonCollectionToken_ = consumes<reco::MuonCollection>(ps.getParameter<InputTag>("muonCollection"));
0132   theElectronCollectionToken_ = consumes<reco::GsfElectronCollection>(ps.getParameter<InputTag>("electronCollection"));
0133   theCaloJetCollectionToken_ = consumes<reco::CaloJetCollection>(theCaloJetCollectionLabel_);
0134   theCaloMETCollectionToken_ = consumes<reco::CaloMETCollection>(ps.getParameter<InputTag>("caloMETCollection"));
0135   thePfMETCollectionToken_ = consumes<reco::PFMETCollection>(ps.getParameter<InputTag>("pfMETCollection"));
0136   vertexToken_ = consumes<reco::VertexCollection>(
0137       ps.getUntrackedParameter<InputTag>("vertexCollection", InputTag("offlinePrimaryVertices")));
0138 
0139   // cuts:
0140   ptThrMu1_ = ps.getUntrackedParameter<double>("PtThrMu1");
0141   ptThrMu2_ = ps.getUntrackedParameter<double>("PtThrMu2");
0142 
0143   nEvents_ = 0;
0144   pi = 3.14159265;
0145   // cout<<"...leaving  HiggsDQM::HiggsDQM. "<<endl;
0146 }
0147 //
0148 // -- Destructor
0149 //
0150 HiggsDQM::~HiggsDQM() {
0151   // cout<<"Entering HiggsDQM::~HiggsDQM: "<<endl;
0152 
0153   edm::LogInfo("HiggsDQM") << " Deleting HiggsDQM "
0154                            << "\n";
0155 
0156   // cout<<"...leaving HiggsDQM::~HiggsDQM. "<<endl;
0157 }
0158 
0159 //
0160 //  -- Book histograms
0161 //
0162 void HiggsDQM::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, edm::EventSetup const&) {
0163   ibooker.setCurrentFolder("Physics/Higgs");
0164 
0165   h_vertex_number = ibooker.book1D("h_vertex_number", "Number of event vertices in collection", 10, -0.5, 9.5);
0166   h_vertex_chi2 = ibooker.book1D("h_vertex_chi2", "Event Vertex #chi^{2}/n.d.o.f.", 100, 0.0, 2.0);
0167   h_vertex_numTrks = ibooker.book1D("h_vertex_numTrks", "Event Vertex, number of tracks", 100, -0.5, 99.5);
0168   h_vertex_sumTrks = ibooker.book1D("h_vertex_sumTrks", "Event Vertex, sum of track pt", 100, 0.0, 100.0);
0169   h_vertex_d0 = ibooker.book1D("h_vertex_d0", "Event Vertex d0", 100, -10.0, 10.0);
0170   h_jet_et =
0171       ibooker.book1D("h_jet_et",
0172                      "Jet with highest E_{T} (from " + theCaloJetCollectionLabel_.label() + ");E_{T}(1^{st} jet) (GeV)",
0173                      20,
0174                      0.,
0175                      200.0);
0176   h_jet2_et = ibooker.book1D(
0177       "h_jet2_et",
0178       "Jet with 2^{nd} highest E_{T} (from " + theCaloJetCollectionLabel_.label() + ");E_{T}(2^{nd} jet) (GeV)",
0179       20,
0180       0.,
0181       200.0);
0182   h_jet_count = ibooker.book1D("h_jet_count",
0183                                "Number of " + theCaloJetCollectionLabel_.label() + " (E_{T} > 15 GeV);Number of Jets",
0184                                8,
0185                                -0.5,
0186                                7.5);
0187   h_caloMet = ibooker.book1D("h_caloMet", "Calo Missing E_{T}; GeV", 20, 0.0, 100);
0188   h_caloMet_phi = ibooker.book1D("h_caloMet_phi", "Calo Missing E_{T} #phi;#phi(MET)", 35, -3.5, 3.5);
0189   h_pfMet = ibooker.book1D("h_pfMet", "Pf Missing E_{T}; GeV", 20, 0.0, 100);
0190   h_pfMet_phi = ibooker.book1D("h_pfMet_phi", "Pf Missing E_{T} #phi;#phi(MET)", 35, -3.5, 3.5);
0191   h_eMultiplicity = ibooker.book1D("NElectrons", "# of electrons per event", 10, 0., 10.);
0192   h_mMultiplicity = ibooker.book1D("NMuons", "# of muons per event", 10, 0., 10.);
0193   h_ePt = ibooker.book1D("ElePt", "Pt of electrons", 50, 0., 100.);
0194   h_eEta = ibooker.book1D("EleEta", "Eta of electrons", 100, -5., 5.);
0195   h_ePhi = ibooker.book1D("ElePhi", "Phi of electrons", 100, -3.5, 3.5);
0196   h_mPt_GMTM = ibooker.book1D("MuonPt_GMTM", "Pt of global+tracker muons", 50, 0., 100.);
0197   h_mEta_GMTM = ibooker.book1D("MuonEta_GMTM", "Eta of global+tracker muons", 60, -3., 3.);
0198   h_mPhi_GMTM = ibooker.book1D("MuonPhi_GMTM", "Phi of global+tracker muons", 70, -3.5, 3.5);
0199   h_mPt_GMPT = ibooker.book1D("MuonPt_GMPT", "Pt of global prompt-tight muons", 50, 0., 100.);
0200   h_mEta_GMPT = ibooker.book1D("MuonEta_GMPT", "Eta of global prompt-tight muons", 60, -3., 3.);
0201   h_mPhi_GMPT = ibooker.book1D("MuonPhi_GMPT", "Phi of global prompt-tight muons", 70, -3.5, 3.5);
0202   h_mPt_GM = ibooker.book1D("MuonPt_GM", "Pt of global muons", 50, 0., 100.);
0203   h_mEta_GM = ibooker.book1D("MuonEta_GM", "Eta of global muons", 60, -3., 3.);
0204   h_mPhi_GM = ibooker.book1D("MuonPhi_GM", "Phi of global muons", 70, -3.5, 3.5);
0205   h_mPt_TM = ibooker.book1D("MuonPt_TM", "Pt of tracker muons", 50, 0., 100.);
0206   h_mEta_TM = ibooker.book1D("MuonEta_TM", "Eta of tracker muons", 60, -3., 3.);
0207   h_mPhi_TM = ibooker.book1D("MuonPhi_TM", "Phi of tracker muons", 70, -3.5, 3.5);
0208   h_mPt_STAM = ibooker.book1D("MuonPt_STAM", "Pt of STA muons", 50, 0., 100.);
0209   h_mEta_STAM = ibooker.book1D("MuonEta_STAM", "Eta of STA muons", 60, -3., 3.);
0210   h_mPhi_STAM = ibooker.book1D("MuonPhi_STAM", "Phi of STA muons", 70, -3.5, 3.5);
0211   h_eCombIso = ibooker.book1D("EleCombIso", "CombIso of electrons", 100, 0., 10.);
0212   h_mCombIso = ibooker.book1D("MuonCombIso", "CombIso of muons", 100, 0., 10.);
0213   h_dimumass_GMGM = ibooker.book1D("DimuMass_GMGM", "Invariant mass of GMGM pairs", 100, 0., 200.);
0214   h_dimumass_GMTM = ibooker.book1D("DimuMass_GMTM", "Invariant mass of GMTM pairs", 100, 0., 200.);
0215   h_dimumass_TMTM = ibooker.book1D("DimuMass_TMTM", "Invariant mass of TMTM pairs", 100, 0., 200.);
0216   h_dielemass = ibooker.book1D("DieleMass", "Invariant mass of EE pairs", 100, 0., 200.);
0217   h_lepcounts = ibooker.book1D("LeptonCounts", "LeptonCounts for multi lepton events", 49, 0., 49.);
0218 
0219   ibooker.cd();
0220 }
0221 //
0222 //  -- Analyze
0223 //
0224 void HiggsDQM::analyze(const edm::Event& e, const edm::EventSetup& eSetup) {
0225   // cout<<"[HiggsDQM::analyze()] "<<endl;
0226 
0227   //-------------------------------
0228   //--- Trigger Info
0229   //-------------------------------
0230   // Did it pass certain HLT path?
0231   bool passed_electron_HLT = true;
0232   bool passed_muon_HLT = true;
0233 
0234   //-------------------------------
0235   //--- Vertex Info
0236   //-------------------------------
0237   Handle<VertexCollection> vertexHandle;
0238   e.getByToken(vertexToken_, vertexHandle);
0239   if (vertexHandle.isValid()) {
0240     VertexCollection vertexCollection = *(vertexHandle.product());
0241     int vertex_number = vertexCollection.size();
0242     VertexCollection::const_iterator v = vertexCollection.begin();
0243     double vertex_chi2 = v->normalizedChi2();  // v->chi2();
0244     double vertex_d0 = sqrt(v->x() * v->x() + v->y() * v->y());
0245     // double vertex_ndof    = v->ndof();cout << "ndof="<<vertex_ndof<<endl;
0246     double vertex_numTrks = v->tracksSize();
0247     double vertex_sumTrks = 0.0;
0248     for (Vertex::trackRef_iterator vertex_curTrack = v->tracks_begin(); vertex_curTrack != v->tracks_end();
0249          vertex_curTrack++) {
0250       vertex_sumTrks += (*vertex_curTrack)->pt();
0251     }
0252     h_vertex_number->Fill(vertex_number);
0253     h_vertex_chi2->Fill(vertex_chi2);
0254     h_vertex_d0->Fill(vertex_d0);
0255     h_vertex_numTrks->Fill(vertex_numTrks);
0256     h_vertex_sumTrks->Fill(vertex_sumTrks);
0257   }
0258 
0259   //-------------------------------
0260   //--- Electrons
0261   //-------------------------------
0262   float nEle = 0;
0263   Handle<GsfElectronCollection> electronCollection;
0264   e.getByToken(theElectronCollectionToken_, electronCollection);
0265   if (electronCollection.isValid()) {
0266     int posEle = 0, negEle = 0;
0267     // If it passed electron HLT and the collection was found, find electrons
0268     // near Z mass
0269     if (passed_electron_HLT) {
0270       for (reco::GsfElectronCollection::const_iterator recoElectron = electronCollection->begin();
0271            recoElectron != electronCollection->end();
0272            recoElectron++) {
0273         //      cout << "Electron with pt= " <<  recoElectron->pt() << " and
0274         // eta" << recoElectron->eta() << " p=" <<  recoElectron->p() << endl;
0275         h_ePt->Fill(recoElectron->pt());
0276         h_eEta->Fill(recoElectron->eta());
0277         h_ePhi->Fill(recoElectron->phi());
0278         if (recoElectron->charge() == 1) {
0279           posEle++;
0280         } else if (recoElectron->charge() == -1) {
0281           negEle++;
0282         }
0283         // Require electron to pass some basic cuts
0284         // if ( recoElectron->et() < 20 || fabs(recoElectron->eta())>2.5 )
0285         // continue;
0286         // Tighter electron cuts
0287         // if ( recoElectron->deltaPhiSuperClusterTrackAtVtx() > 0.58 ||
0288         //     recoElectron->deltaEtaSuperClusterTrackAtVtx() > 0.01 ||
0289         //     recoElectron->sigmaIetaIeta() > 0.027 ) continue;
0290       }  // end of loop over electrons
0291     }    // end if passed HLT
0292     nEle = posEle + negEle;
0293     if (nEle > 9.)
0294       nEle = 9.;
0295     h_eMultiplicity->Fill(nEle);
0296 
0297     // Z->ee:
0298     unsigned int eleCollectionSize = electronCollection->size();
0299     for (unsigned int i = 0; i < eleCollectionSize; i++) {
0300       const GsfElectron& ele = electronCollection->at(i);
0301       double pt = ele.pt();
0302       if (pt > ptThrMu1_) {
0303         for (unsigned int j = i + 1; j < eleCollectionSize; j++) {
0304           const GsfElectron& ele2 = electronCollection->at(j);
0305           double pt2 = ele2.pt();
0306           if (pt2 > ptThrMu2_) {
0307             const math::XYZTLorentzVector ZRecoEE(
0308                 ele.px() + ele2.px(), ele.py() + ele2.py(), ele.pz() + ele2.pz(), ele.p() + ele2.p());
0309             h_dielemass->Fill(ZRecoEE.mass());
0310           }
0311         }
0312       }
0313     }
0314   }
0315 
0316   //-------------------------------
0317   //--- Muons
0318   //-------------------------------
0319   float nMu = 0;
0320   Handle<MuonCollection> muonCollection;
0321   e.getByToken(theMuonCollectionToken_, muonCollection);
0322   if (muonCollection.isValid()) {
0323     // Find the highest pt muons
0324     int posMu = 0, negMu = 0;
0325     TLorentzVector m1, m2;
0326     if (passed_muon_HLT) {
0327       for (reco::MuonCollection::const_iterator recoMuon = muonCollection->begin(); recoMuon != muonCollection->end();
0328            recoMuon++) {
0329         // cout << "Muon with pt= " <<  muIter->pt() << " and eta" <<
0330         // muIter->eta() << " p=" <<  muIter->p() << endl;
0331         if (recoMuon->isGlobalMuon() && recoMuon->isTrackerMuon()) {
0332           h_mPt_GMTM->Fill(recoMuon->pt());
0333           h_mEta_GMTM->Fill(recoMuon->eta());
0334           h_mPhi_GMTM->Fill(recoMuon->phi());
0335         } else if (recoMuon->isGlobalMuon() && (muon::isGoodMuon((*recoMuon), muon::GlobalMuonPromptTight))) {
0336           h_mPt_GMPT->Fill(recoMuon->pt());
0337           h_mEta_GMPT->Fill(recoMuon->eta());
0338           h_mPhi_GMPT->Fill(recoMuon->phi());
0339         } else if (recoMuon->isGlobalMuon()) {
0340           h_mPt_GM->Fill(recoMuon->pt());
0341           h_mEta_GM->Fill(recoMuon->eta());
0342           h_mPhi_GM->Fill(recoMuon->phi());
0343         } else if (recoMuon->isTrackerMuon() &&
0344                    (muon::segmentCompatibility((*recoMuon), reco::Muon::SegmentAndTrackArbitration))) {
0345           h_mPt_TM->Fill(recoMuon->pt());
0346           h_mEta_TM->Fill(recoMuon->eta());
0347           h_mPhi_TM->Fill(recoMuon->phi());
0348         } else if (recoMuon->isStandAloneMuon()) {
0349           h_mPt_STAM->Fill(recoMuon->pt());
0350           h_mEta_STAM->Fill(recoMuon->eta());
0351           h_mPhi_STAM->Fill(recoMuon->phi());
0352         }
0353         if (recoMuon->charge() == 1) {
0354           posMu++;
0355         } else if (recoMuon->charge() == -1) {
0356           negMu++;
0357         }
0358       }
0359       nMu = posMu + negMu;
0360       if (nMu > 9.)
0361         nMu = 9.;
0362       h_mMultiplicity->Fill(nMu);
0363     }
0364 
0365     // Z->mumu:
0366     unsigned int muonCollectionSize = muonCollection->size();
0367     for (unsigned int i = 0; i < muonCollectionSize; i++) {
0368       const Muon& mu = muonCollection->at(i);
0369       // if (!mu.isGlobalMuon()) continue;
0370       double pt = mu.pt();
0371       if (pt > ptThrMu1_) {
0372         for (unsigned int j = i + 1; j < muonCollectionSize; j++) {
0373           const Muon& mu2 = muonCollection->at(j);
0374           double pt2 = mu2.pt();
0375           if (pt2 > ptThrMu2_) {
0376             // Glb + Glb
0377             if (mu.isGlobalMuon() && mu2.isGlobalMuon()) {
0378               const math::XYZTLorentzVector ZRecoGMGM(
0379                   mu.px() + mu2.px(), mu.py() + mu2.py(), mu.pz() + mu2.pz(), mu.p() + mu2.p());
0380               h_dimumass_GMGM->Fill(ZRecoGMGM.mass());
0381             }
0382             // Glb + TM
0383             else if (mu.isGlobalMuon() && mu2.isTrackerMuon()) {
0384               const math::XYZTLorentzVector ZRecoGMTM(
0385                   mu.px() + mu2.px(), mu.py() + mu2.py(), mu.pz() + mu2.pz(), mu.p() + mu2.p());
0386               h_dimumass_GMTM->Fill(ZRecoGMTM.mass());
0387             }
0388             // TM + TM
0389             else if (mu.isTrackerMuon() && mu2.isTrackerMuon()) {
0390               const math::XYZTLorentzVector ZRecoTMTM(
0391                   mu.px() + mu2.px(), mu.py() + mu2.py(), mu.pz() + mu2.pz(), mu.p() + mu2.p());
0392               h_dimumass_TMTM->Fill(ZRecoTMTM.mass());
0393             }
0394           }
0395         }
0396       }
0397     }
0398   }
0399 
0400   //-------------------------------
0401   //--- Jets
0402   //-------------------------------
0403   Handle<CaloJetCollection> caloJetCollection;
0404   e.getByToken(theCaloJetCollectionToken_, caloJetCollection);
0405   if (caloJetCollection.isValid()) {
0406     float jet_et = -8.0;
0407     //    float jet_eta   = -8.0; // UNUSED
0408     //    float jet_phi   = -8.0; // UNUSED
0409     int jet_count = 0;
0410     float jet2_et = -9.0;
0411     //    float jet2_eta  = -9.0; // UNUSED
0412     //    float jet2_phi  = -9.0; // UNUSED
0413     for (CaloJetCollection::const_iterator i_calojet = caloJetCollection->begin();
0414          i_calojet != caloJetCollection->end();
0415          i_calojet++) {
0416       float jet_current_et = i_calojet->et();
0417       // if it overlaps with electron, it is not a jet
0418       // if ( electron_et>0.0 && fabs(i_calojet->eta()-electron_eta ) < 0.2 &&
0419       // calcDeltaPhi(i_calojet->phi(), electron_phi ) < 0.2) continue;
0420       // if ( electron2_et>0.0&& fabs(i_calojet->eta()-electron2_eta) < 0.2 &&
0421       // calcDeltaPhi(i_calojet->phi(), electron2_phi) < 0.2) continue;
0422       // if it has too low Et, throw away
0423       if (jet_current_et < 15)
0424         continue;
0425       jet_count++;
0426       if (jet_current_et > jet_et) {
0427         jet2_et = jet_et;          // 2nd highest jet get's et from current highest
0428                                    //        jet2_eta = jet_eta; // UNUSED
0429                                    //        jet2_phi = jet_phi; // UNUSED
0430         jet_et = i_calojet->et();  // current highest jet gets et from the new
0431                                    // highest
0432         //        jet_eta  = i_calojet->eta(); // UNUSED
0433         //        jet_phi  = i_calojet->phi(); // UNUSED
0434       } else if (jet_current_et > jet2_et) {
0435         jet2_et = i_calojet->et();
0436         //        jet2_eta = i_calojet->eta(); // UNUSED
0437         //        jet2_phi = i_calojet->phi(); // UNUSED
0438       }
0439     }
0440     if (jet_et > 0.0) {
0441       h_jet_et->Fill(jet_et);
0442       h_jet_count->Fill(jet_count);
0443     }
0444   }
0445 
0446   //-------------------------------
0447   //--- MET
0448   //-------------------------------
0449   Handle<CaloMETCollection> caloMETCollection;
0450   e.getByToken(theCaloMETCollectionToken_, caloMETCollection);
0451   if (caloMETCollection.isValid()) {
0452     float caloMet = caloMETCollection->begin()->et();
0453     float caloMet_phi = caloMETCollection->begin()->phi();
0454     h_caloMet->Fill(caloMet);
0455     h_caloMet_phi->Fill(caloMet_phi);
0456   }
0457   Handle<PFMETCollection> pfMETCollection;
0458   e.getByToken(thePfMETCollectionToken_, pfMETCollection);
0459   if (pfMETCollection.isValid()) {
0460     float pfMet = pfMETCollection->begin()->et();
0461     float pfMet_phi = pfMETCollection->begin()->phi();
0462     h_pfMet->Fill(pfMet);
0463     h_pfMet_phi->Fill(pfMet_phi);
0464   }
0465 
0466   //-------------------------------------
0467   //--- Events with more than 2 leptons:
0468   //-------------------------------------
0469   if (nMu + nEle > 2 && nMu + nEle < 10) {
0470     if (nMu == 0 && nEle == 3)
0471       h_lepcounts->Fill(0);
0472     if (nMu == 0 && nEle == 4)
0473       h_lepcounts->Fill(1);
0474     if (nMu == 0 && nEle == 5)
0475       h_lepcounts->Fill(2);
0476     if (nMu == 0 && nEle == 6)
0477       h_lepcounts->Fill(3);
0478     if (nMu == 0 && nEle == 7)
0479       h_lepcounts->Fill(4);
0480     if (nMu == 0 && nEle == 8)
0481       h_lepcounts->Fill(5);
0482     if (nMu == 0 && nEle == 9)
0483       h_lepcounts->Fill(6);
0484     if (nMu == 1 && nEle == 2)
0485       h_lepcounts->Fill(7);
0486     if (nMu == 1 && nEle == 3)
0487       h_lepcounts->Fill(8);
0488     if (nMu == 1 && nEle == 4)
0489       h_lepcounts->Fill(9);
0490     if (nMu == 1 && nEle == 5)
0491       h_lepcounts->Fill(10);
0492     if (nMu == 1 && nEle == 6)
0493       h_lepcounts->Fill(11);
0494     if (nMu == 1 && nEle == 7)
0495       h_lepcounts->Fill(12);
0496     if (nMu == 1 && nEle == 8)
0497       h_lepcounts->Fill(13);
0498     if (nMu == 2 && nEle == 1)
0499       h_lepcounts->Fill(14);
0500     if (nMu == 2 && nEle == 2)
0501       h_lepcounts->Fill(15);
0502     if (nMu == 2 && nEle == 3)
0503       h_lepcounts->Fill(16);
0504     if (nMu == 2 && nEle == 4)
0505       h_lepcounts->Fill(17);
0506     if (nMu == 2 && nEle == 5)
0507       h_lepcounts->Fill(18);
0508     if (nMu == 2 && nEle == 6)
0509       h_lepcounts->Fill(19);
0510     if (nMu == 2 && nEle == 7)
0511       h_lepcounts->Fill(20);
0512     if (nMu == 3 && nEle == 0)
0513       h_lepcounts->Fill(21);
0514     if (nMu == 3 && nEle == 1)
0515       h_lepcounts->Fill(22);
0516     if (nMu == 3 && nEle == 2)
0517       h_lepcounts->Fill(23);
0518     if (nMu == 3 && nEle == 3)
0519       h_lepcounts->Fill(24);
0520     if (nMu == 3 && nEle == 4)
0521       h_lepcounts->Fill(25);
0522     if (nMu == 3 && nEle == 5)
0523       h_lepcounts->Fill(26);
0524     if (nMu == 3 && nEle == 6)
0525       h_lepcounts->Fill(27);
0526     if (nMu == 4 && nEle == 0)
0527       h_lepcounts->Fill(28);
0528     if (nMu == 4 && nEle == 1)
0529       h_lepcounts->Fill(29);
0530     if (nMu == 4 && nEle == 2)
0531       h_lepcounts->Fill(30);
0532     if (nMu == 4 && nEle == 3)
0533       h_lepcounts->Fill(31);
0534     if (nMu == 4 && nEle == 4)
0535       h_lepcounts->Fill(32);
0536     if (nMu == 4 && nEle == 5)
0537       h_lepcounts->Fill(33);
0538     if (nMu == 5 && nEle == 0)
0539       h_lepcounts->Fill(34);
0540     if (nMu == 5 && nEle == 1)
0541       h_lepcounts->Fill(35);
0542     if (nMu == 5 && nEle == 2)
0543       h_lepcounts->Fill(36);
0544     if (nMu == 5 && nEle == 3)
0545       h_lepcounts->Fill(37);
0546     if (nMu == 5 && nEle == 4)
0547       h_lepcounts->Fill(38);
0548     if (nMu == 6 && nEle == 0)
0549       h_lepcounts->Fill(39);
0550     if (nMu == 6 && nEle == 1)
0551       h_lepcounts->Fill(40);
0552     if (nMu == 6 && nEle == 2)
0553       h_lepcounts->Fill(41);
0554     if (nMu == 6 && nEle == 3)
0555       h_lepcounts->Fill(42);
0556     if (nMu == 7 && nEle == 0)
0557       h_lepcounts->Fill(43);
0558     if (nMu == 7 && nEle == 1)
0559       h_lepcounts->Fill(44);
0560     if (nMu == 7 && nEle == 2)
0561       h_lepcounts->Fill(45);
0562     if (nMu == 8 && nEle == 0)
0563       h_lepcounts->Fill(46);
0564     if (nMu == 8 && nEle == 1)
0565       h_lepcounts->Fill(47);
0566     if (nMu == 9 && nEle == 0)
0567       h_lepcounts->Fill(48);
0568   }
0569   if ((nMu + nEle) >= 10)
0570     LogDebug("HiggsDQM") << "WARNING: " << nMu + nEle << " leptons in this event: run=" << e.id().run()
0571                          << ", event=" << e.id().event() << "\n";
0572 }
0573 
0574 // Local Variables:
0575 // show-trailing-whitespace: t
0576 // truncate-lines: t
0577 // End: