Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-15 08:47:34

0001 /*

0002  *  $Date: 2012/01/11 13:53:29 $

0003  *  $Revision: 1.14 $

0004  *  \author M. Marienfeld - DESY Hamburg

0005  */
0006 
0007 #include "TLorentzVector.h"
0008 #include "DataFormats/Math/interface/deltaR.h"
0009 #include "DataFormats/Provenance/interface/RunLumiEventNumber.h"
0010 #include "DQM/Physics/src/TopDiLeptonDQM.h"
0011 #include "FWCore/Common/interface/TriggerNames.h"
0012 
0013 using namespace std;
0014 using namespace edm;
0015 
0016 TopDiLeptonDQM::TopDiLeptonDQM(const edm::ParameterSet& ps) {
0017   moduleName_ = ps.getUntrackedParameter<string>("moduleName");
0018   outputFile_ = ps.getUntrackedParameter<string>("outputFile");
0019   triggerResults_ = consumes<TriggerResults>(ps.getParameter<edm::InputTag>("TriggerResults"));
0020   hltPaths_ = ps.getParameter<vector<string> >("hltPaths");
0021   hltPaths_sig_ = ps.getParameter<vector<string> >("hltPaths_sig");
0022   hltPaths_trig_ = ps.getParameter<vector<string> >("hltPaths_trig");
0023 
0024   vertex_ = consumes<reco::VertexCollection>(ps.getParameter<edm::InputTag>("vertexCollection"));
0025   vertex_X_cut_ = ps.getParameter<double>("vertex_X_cut");
0026   vertex_Y_cut_ = ps.getParameter<double>("vertex_Y_cut");
0027   vertex_Z_cut_ = ps.getParameter<double>("vertex_Z_cut");
0028 
0029   muons_ = consumes<reco::MuonCollection>(ps.getParameter<edm::InputTag>("muonCollection"));
0030   muon_pT_cut_ = ps.getParameter<double>("muon_pT_cut");
0031   muon_eta_cut_ = ps.getParameter<double>("muon_eta_cut");
0032   muon_iso_cut_ = ps.getParameter<double>("muon_iso_cut");
0033 
0034   elecs_ = consumes<reco::GsfElectronCollection>(ps.getParameter<edm::InputTag>("elecCollection"));
0035   elec_pT_cut_ = ps.getParameter<double>("elec_pT_cut");
0036   elec_eta_cut_ = ps.getParameter<double>("elec_eta_cut");
0037   elec_iso_cut_ = ps.getParameter<double>("elec_iso_cut");
0038   elec_emf_cut_ = ps.getParameter<double>("elec_emf_cut");
0039 
0040   MassWindow_up_ = ps.getParameter<double>("MassWindow_up");
0041   MassWindow_down_ = ps.getParameter<double>("MassWindow_down");
0042 
0043   for (int i = 0; i < 100; ++i) {
0044     N_sig[i] = 0;
0045     N_trig[i] = 0;
0046     Eff[i] = 0.;
0047   }
0048 
0049   N_mumu = 0;
0050   N_muel = 0;
0051   N_elel = 0;
0052   Events_ = nullptr;
0053   Trigs_ = nullptr;
0054   TriggerEff_ = nullptr;
0055   Ntracks_ = nullptr;
0056   Nmuons_ = nullptr;
0057   Nmuons_iso_ = nullptr;
0058   Nmuons_charge_ = nullptr;
0059   VxVy_muons_ = nullptr;
0060   Vz_muons_ = nullptr;
0061   pT_muons_ = nullptr;
0062   eta_muons_ = nullptr;
0063   phi_muons_ = nullptr;
0064   Nelecs_ = nullptr;
0065   Nelecs_iso_ = nullptr;
0066   Nelecs_charge_ = nullptr;
0067   HoverE_elecs_ = nullptr;
0068   pT_elecs_ = nullptr;
0069   eta_elecs_ = nullptr;
0070   phi_elecs_ = nullptr;
0071   MuIso_emEt03_ = nullptr;
0072   MuIso_hadEt03_ = nullptr;
0073   MuIso_hoEt03_ = nullptr;
0074   MuIso_nJets03_ = nullptr;
0075   MuIso_nTracks03_ = nullptr;
0076   MuIso_sumPt03_ = nullptr;
0077   MuIso_CombRelIso03_ = nullptr;
0078   ElecIso_cal_ = nullptr;
0079   ElecIso_trk_ = nullptr;
0080   ElecIso_CombRelIso_ = nullptr;
0081   dimassRC_ = nullptr;
0082   dimassWC_ = nullptr;
0083   dimassRC_LOGX_ = nullptr;
0084   dimassWC_LOGX_ = nullptr;
0085   dimassRC_LOG10_ = nullptr;
0086   dimassWC_LOG10_ = nullptr;
0087   D_eta_muons_ = nullptr;
0088   D_phi_muons_ = nullptr;
0089   D_eta_elecs_ = nullptr;
0090   D_phi_elecs_ = nullptr;
0091   D_eta_lepts_ = nullptr;
0092   D_phi_lepts_ = nullptr;
0093 }
0094 
0095 TopDiLeptonDQM::~TopDiLeptonDQM() {}
0096 
0097 void TopDiLeptonDQM::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const&, edm::EventSetup const&) {
0098   iBooker.setCurrentFolder(moduleName_);
0099 
0100   Events_ = iBooker.book1D("00_Events", "Isolated dilepton events", 5, 0., 5.);
0101   Events_->setBinLabel(2, "#mu #mu", 1);
0102   Events_->setBinLabel(3, "#mu e", 1);
0103   Events_->setBinLabel(4, "e e", 1);
0104 
0105   Trigs_ = iBooker.book1D("01_Trigs", "Fired muon/electron triggers", 15, 0., 15.);
0106   TriggerEff_ = iBooker.book1D("02_TriggerEff", "HL Trigger Efficiencies", 10, 0., 10.);
0107   TriggerEff_->setTitle(
0108       "HL Trigger Efficiencies #epsilon_{signal} = #frac{[signal] && "
0109       "[control]}{[control]}");
0110   Ntracks_ = iBooker.book1D("Ntracks", "Number of tracks", 50, 0., 50.);
0111 
0112   Nmuons_ = iBooker.book1D("03_Nmuons", "Number of muons", 20, 0., 10.);
0113   Nmuons_iso_ = iBooker.book1D("04_Nmuons_iso", "Number of isolated muons", 20, 0., 10.);
0114   Nmuons_charge_ = iBooker.book1D("Nmuons_charge", "Number of muons * moun charge", 19, -10., 10.);
0115   VxVy_muons_ = iBooker.book2D("VxVy_muons", "Vertex x-y-positon (global)", 40, -1., 1., 40, -1., 1.);
0116   Vz_muons_ = iBooker.book1D("Vz_muons", "Vertex z-positon (global)", 40, -20., 20.);
0117   pT_muons_ = iBooker.book1D("pT_muons", "P_T of muons", 40, 0., 200.);
0118   eta_muons_ = iBooker.book1D("eta_muons", "Eta of muons", 50, -5., 5.);
0119   phi_muons_ = iBooker.book1D("phi_muons", "Phi of muons", 40, -4., 4.);
0120 
0121   Nelecs_ = iBooker.book1D("05_Nelecs", "Number of electrons", 20, 0., 10.);
0122   Nelecs_iso_ = iBooker.book1D("06_Nelecs_iso", "Number of isolated electrons", 20, 0., 10.);
0123   Nelecs_charge_ = iBooker.book1D("Nelecs_charge", "Number of elecs * elec charge", 19, -10., 10.);
0124   HoverE_elecs_ = iBooker.book1D("HoverE_elecs", "Hadronic over Ecal energy", 50, 0., 1.);
0125   pT_elecs_ = iBooker.book1D("pT_elecs", "P_T of electrons", 40, 0., 200.);
0126   eta_elecs_ = iBooker.book1D("eta_elecs", "Eta of electrons", 50, -5., 5.);
0127   phi_elecs_ = iBooker.book1D("phi_elecs", "Phi of electrons", 40, -4., 4.);
0128 
0129   MuIso_emEt03_ = iBooker.book1D("MuIso_emEt03", "Muon emEt03", 20, 0., 20.);
0130   MuIso_hadEt03_ = iBooker.book1D("MuIso_hadEt03", "Muon hadEt03", 20, 0., 20.);
0131   MuIso_hoEt03_ = iBooker.book1D("MuIso_hoEt03", "Muon hoEt03", 20, 0., 20.);
0132   MuIso_nJets03_ = iBooker.book1D("MuIso_nJets03", "Muon nJets03", 10, 0., 10.);
0133   MuIso_nTracks03_ = iBooker.book1D("MuIso_nTracks03", "Muon nTracks03", 20, 0., 20.);
0134   MuIso_sumPt03_ = iBooker.book1D("MuIso_sumPt03", "Muon sumPt03", 20, 0., 40.);
0135   MuIso_CombRelIso03_ = iBooker.book1D("07_MuIso_CombRelIso03", "Muon CombRelIso03", 20, 0., 1.);
0136 
0137   ElecIso_cal_ = iBooker.book1D("ElecIso_cal", "Electron Iso_cal", 21, -1., 20.);
0138   ElecIso_trk_ = iBooker.book1D("ElecIso_trk", "Electron Iso_trk", 21, -2., 40.);
0139   ElecIso_CombRelIso_ = iBooker.book1D("08_ElecIso_CombRelIso", "Electron CombRelIso", 20, 0., 1.);
0140 
0141   const int nbins = 200;
0142 
0143   double logmin = 0.;
0144   double logmax = 3.;  // 10^(3.)=1000

0145 
0146   float bins[nbins + 1];
0147 
0148   for (int i = 0; i <= nbins; i++) {
0149     double log = logmin + (logmax - logmin) * i / nbins;
0150     bins[i] = std::pow(10.0, log);
0151   }
0152 
0153   dimassRC_ = iBooker.book1D("09_dimassRC", "Dilepton mass RC", 50, 0., 200.);
0154   dimassWC_ = iBooker.book1D("11_dimassWC", "Dilepton mass WC", 50, 0., 200.);
0155   dimassRC_LOGX_ = iBooker.book1D("10_dimassRC_LOGX", "Dilepton mass RC LOG", nbins, &bins[0]);
0156   dimassWC_LOGX_ = iBooker.book1D("12_dimassWC_LOGX", "Dilepton mass WC LOG", nbins, &bins[0]);
0157   dimassRC_LOG10_ = iBooker.book1D("dimassRC_LOG10", "Dilepton mass RC LOG", 50, 0., 2.5);
0158   dimassWC_LOG10_ = iBooker.book1D("dimassWC_LOG10", "Dilepton mass WC LOG", 50, 0., 2.5);
0159 
0160   D_eta_muons_ = iBooker.book1D("13_D_eta_muons", "#Delta eta_muons", 20, -5., 5.);
0161   D_phi_muons_ = iBooker.book1D("14_D_phi_muons", "#Delta phi_muons", 20, -5., 5.);
0162   D_eta_elecs_ = iBooker.book1D("D_eta_elecs", "#Delta eta_elecs", 20, -5., 5.);
0163   D_phi_elecs_ = iBooker.book1D("D_phi_elecs", "#Delta phi_elecs", 20, -5., 5.);
0164   D_eta_lepts_ = iBooker.book1D("D_eta_lepts", "#Delta eta_lepts", 20, -5., 5.);
0165   D_phi_lepts_ = iBooker.book1D("D_phi_lepts", "#Delta phi_lepts", 20, -5., 5.);
0166 }
0167 
0168 void TopDiLeptonDQM::analyze(const edm::Event& evt, const edm::EventSetup& context) {
0169   // ------------------------

0170   //  Global Event Variables

0171   // ------------------------

0172 
0173   const int N_TriggerPaths = hltPaths_.size();
0174   const int N_SignalPaths = hltPaths_sig_.size();
0175   const int N_ControlPaths = hltPaths_trig_.size();
0176 
0177   bool Fired_Signal_Trigger[100] = {false};
0178   bool Fired_Control_Trigger[100] = {false};
0179 
0180   int N_leptons = 0;
0181   int N_iso_mu = 0;
0182   int N_iso_el = 0;
0183 
0184   double DilepMass = 0.;
0185 
0186   double vertex_X = 100.;
0187   double vertex_Y = 100.;
0188   double vertex_Z = 100.;
0189 
0190   // ------------------------

0191   //  Analyze Primary Vertex

0192   // ------------------------

0193 
0194   edm::Handle<reco::VertexCollection> vertexs;
0195   evt.getByToken(vertex_, vertexs);
0196 
0197   if (!vertexs.failedToGet()) {
0198     reco::Vertex primaryVertex = vertexs->front();
0199 
0200     int numberTracks = primaryVertex.tracksSize();
0201     //    double ndof      = primaryVertex.ndof();

0202     bool fake = primaryVertex.isFake();
0203 
0204     Ntracks_->Fill(numberTracks);
0205 
0206     if (!fake && numberTracks > 3) {
0207       vertex_X = primaryVertex.x();
0208       vertex_Y = primaryVertex.y();
0209       vertex_Z = primaryVertex.z();
0210     }
0211   }
0212 
0213   // -------------------------

0214   //  Analyze Trigger Results

0215   // -------------------------

0216 
0217   edm::Handle<TriggerResults> trigResults;
0218   evt.getByToken(triggerResults_, trigResults);
0219 
0220   if (!trigResults.failedToGet()) {
0221     int N_Triggers = trigResults->size();
0222 
0223     const edm::TriggerNames& trigName = evt.triggerNames(*trigResults);
0224 
0225     for (int i_Trig = 0; i_Trig < N_Triggers; ++i_Trig) {
0226       if (trigResults.product()->accept(i_Trig)) {
0227         // Check for all trigger paths

0228 
0229         for (int i = 0; i < N_TriggerPaths; i++) {
0230           if (trigName.triggerName(i_Trig) == hltPaths_[i]) {
0231             Trigs_->Fill(i);
0232             Trigs_->setBinLabel(i + 1, hltPaths_[i], 1);
0233           }
0234         }
0235 
0236         // Check for signal & control trigger paths

0237 
0238         for (int j = 0; j < N_SignalPaths; ++j) {
0239           if (trigName.triggerName(i_Trig) == hltPaths_sig_[j])
0240             Fired_Signal_Trigger[j] = true;
0241         }
0242 
0243         for (int k = 0; k < N_ControlPaths; ++k) {
0244           if (trigName.triggerName(i_Trig) == hltPaths_trig_[k])
0245             Fired_Control_Trigger[k] = true;
0246         }
0247       }
0248     }
0249   }
0250 
0251   // ------------------------

0252   //  Analyze Muon Isolation

0253   // ------------------------

0254 
0255   edm::Handle<reco::MuonCollection> muons;
0256   evt.getByToken(muons_, muons);
0257 
0258   reco::MuonCollection::const_iterator muon;
0259 
0260   if (!muons.failedToGet()) {
0261     Nmuons_->Fill(muons->size());
0262 
0263     N_leptons = N_leptons + muons->size();
0264 
0265     for (muon = muons->begin(); muon != muons->end(); ++muon) {
0266       float N_muons = muons->size();
0267       float Q_muon = muon->charge();
0268 
0269       Nmuons_charge_->Fill(N_muons * Q_muon);
0270 
0271       double track_X = 100.;
0272       double track_Y = 100.;
0273       double track_Z = 100.;
0274 
0275       if (muon->isGlobalMuon()) {
0276         reco::TrackRef track = muon->globalTrack();
0277 
0278         track_X = track->vx();
0279         track_Y = track->vy();
0280         track_Z = track->vz();
0281 
0282         VxVy_muons_->Fill(track_X, track_Y);
0283         Vz_muons_->Fill(track_Z);
0284       }
0285 
0286       // Vertex and kinematic cuts

0287 
0288       if (track_X > vertex_X_cut_)
0289         continue;
0290       if (track_Y > vertex_Y_cut_)
0291         continue;
0292       if (track_Z > vertex_Z_cut_)
0293         continue;
0294       if (muon->pt() < muon_pT_cut_)
0295         continue;
0296       if (abs(muon->eta()) > muon_eta_cut_)
0297         continue;
0298 
0299       reco::MuonIsolation muIso03 = muon->isolationR03();
0300 
0301       double muonCombRelIso = 1.;
0302 
0303       if (muon->pt() != 0.)
0304         muonCombRelIso = (muIso03.emEt + muIso03.hadEt + muIso03.hoEt + muIso03.sumPt) / muon->pt();
0305 
0306       MuIso_CombRelIso03_->Fill(muonCombRelIso);
0307 
0308       MuIso_emEt03_->Fill(muIso03.emEt);
0309       MuIso_hadEt03_->Fill(muIso03.hadEt);
0310       MuIso_hoEt03_->Fill(muIso03.hoEt);
0311       MuIso_nJets03_->Fill(muIso03.nJets);
0312       MuIso_nTracks03_->Fill(muIso03.nTracks);
0313       MuIso_sumPt03_->Fill(muIso03.sumPt);
0314 
0315       if (muonCombRelIso < muon_iso_cut_)
0316         ++N_iso_mu;
0317     }
0318 
0319     Nmuons_iso_->Fill(N_iso_mu);
0320   }
0321 
0322   // ----------------------------

0323   //  Analyze Electron Isolation

0324   // ----------------------------

0325 
0326   edm::Handle<reco::GsfElectronCollection> elecs;
0327   evt.getByToken(elecs_, elecs);
0328 
0329   reco::GsfElectronCollection::const_iterator elec;
0330 
0331   if (!elecs.failedToGet()) {
0332     Nelecs_->Fill(elecs->size());
0333 
0334     N_leptons = N_leptons + elecs->size();
0335 
0336     for (elec = elecs->begin(); elec != elecs->end(); ++elec) {
0337       float N_elecs = elecs->size();
0338       float Q_elec = elec->charge();
0339       float HoverE = elec->hcalOverEcal();
0340 
0341       HoverE_elecs_->Fill(HoverE);
0342 
0343       Nelecs_charge_->Fill(N_elecs * Q_elec);
0344 
0345       double track_X = 100.;
0346       double track_Y = 100.;
0347       double track_Z = 100.;
0348 
0349       reco::GsfTrackRef track = elec->gsfTrack();
0350 
0351       track_X = track->vx();
0352       track_Y = track->vy();
0353       track_Z = track->vz();
0354 
0355       // Vertex and kinematic cuts

0356 
0357       if (track_X > vertex_X_cut_)
0358         continue;
0359       if (track_Y > vertex_Y_cut_)
0360         continue;
0361       if (track_Z > vertex_Z_cut_)
0362         continue;
0363       if (elec->pt() < elec_pT_cut_)
0364         continue;
0365       if (abs(elec->eta()) > elec_eta_cut_)
0366         continue;
0367       if (HoverE > elec_emf_cut_)
0368         continue;
0369 
0370       reco::GsfElectron::IsolationVariables elecIso = elec->dr03IsolationVariables();
0371 
0372       double elecCombRelIso = 1.;
0373 
0374       if (elec->et() != 0.)
0375         elecCombRelIso = (elecIso.ecalRecHitSumEt + elecIso.hcalRecHitSumEt[0] + elecIso.tkSumPt) / elec->et();
0376 
0377       ElecIso_CombRelIso_->Fill(elecCombRelIso);
0378 
0379       ElecIso_cal_->Fill(elecIso.ecalRecHitSumEt);
0380       ElecIso_trk_->Fill(elecIso.tkSumPt);
0381 
0382       if (elecCombRelIso < elec_iso_cut_)
0383         ++N_iso_el;
0384     }
0385 
0386     Nelecs_iso_->Fill(N_iso_el);
0387   }
0388 
0389   // --------------------

0390   //  TWO Isolated MUONS

0391   // --------------------

0392 
0393   if (N_iso_mu > 1) {
0394     // Vertex cut

0395 
0396     if (vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ && vertex_Z < vertex_Z_cut_) {
0397       ++N_mumu;
0398 
0399       Events_->Fill(1.);
0400 
0401       reco::MuonCollection::const_reference mu1 = muons->at(0);
0402       reco::MuonCollection::const_reference mu2 = muons->at(1);
0403 
0404       DilepMass = sqrt((mu1.energy() + mu2.energy()) * (mu1.energy() + mu2.energy()) -
0405                        (mu1.px() + mu2.px()) * (mu1.px() + mu2.px()) - (mu1.py() + mu2.py()) * (mu1.py() + mu2.py()) -
0406                        (mu1.pz() + mu2.pz()) * (mu1.pz() + mu2.pz()));
0407 
0408       // Opposite muon charges -> Right Charge (RC)

0409 
0410       if (mu1.charge() * mu2.charge() < 0.) {
0411         dimassRC_LOG10_->Fill(log10(DilepMass));
0412         dimassRC_->Fill(DilepMass);
0413         dimassRC_LOGX_->Fill(DilepMass);
0414 
0415         if (DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_) {
0416           for (muon = muons->begin(); muon != muons->end(); ++muon) {
0417             pT_muons_->Fill(muon->pt());
0418             eta_muons_->Fill(muon->eta());
0419             phi_muons_->Fill(muon->phi());
0420           }
0421 
0422           D_eta_muons_->Fill(mu1.eta() - mu2.eta());
0423           D_phi_muons_->Fill(mu1.phi() - mu2.phi());
0424 
0425           // Determinating trigger efficiencies

0426 
0427           for (int k = 0; k < N_SignalPaths; ++k) {
0428             if (Fired_Signal_Trigger[k] && Fired_Control_Trigger[k])
0429               ++N_sig[k];
0430 
0431             if (Fired_Control_Trigger[k])
0432               ++N_trig[k];
0433 
0434             if (N_trig[k] != 0)
0435               Eff[k] = N_sig[k] / static_cast<float>(N_trig[k]);
0436 
0437             TriggerEff_->setBinContent(k + 1, Eff[k]);
0438             TriggerEff_->setBinLabel(k + 1, "#frac{[" + hltPaths_sig_[k] + "]}{vs. [" + hltPaths_trig_[k] + "]}", 1);
0439           }
0440         }
0441       }
0442 
0443       // Same muon charges -> Wrong Charge (WC)

0444 
0445       if (mu1.charge() * mu2.charge() > 0.) {
0446         dimassWC_LOG10_->Fill(log10(DilepMass));
0447         dimassWC_->Fill(DilepMass);
0448         dimassWC_LOGX_->Fill(DilepMass);
0449       }
0450     }
0451   }
0452 
0453   // -----------------------------

0454   //  TWO Isolated LEPTONS (mu/e)

0455   // -----------------------------

0456 
0457   if (N_iso_el > 0 && N_iso_mu > 0) {
0458     // Vertex cut

0459 
0460     if (vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ && vertex_Z < vertex_Z_cut_) {
0461       ++N_muel;
0462 
0463       Events_->Fill(2.);
0464 
0465       reco::MuonCollection::const_reference mu1 = muons->at(0);
0466       reco::GsfElectronCollection::const_reference el1 = elecs->at(0);
0467 
0468       DilepMass = sqrt((mu1.energy() + el1.energy()) * (mu1.energy() + el1.energy()) -
0469                        (mu1.px() + el1.px()) * (mu1.px() + el1.px()) - (mu1.py() + el1.py()) * (mu1.py() + el1.py()) -
0470                        (mu1.pz() + el1.pz()) * (mu1.pz() + el1.pz()));
0471 
0472       // Opposite lepton charges -> Right Charge (RC)

0473 
0474       if (mu1.charge() * el1.charge() < 0.) {
0475         dimassRC_LOG10_->Fill(log10(DilepMass));
0476         dimassRC_->Fill(DilepMass);
0477         dimassRC_LOGX_->Fill(DilepMass);
0478 
0479         if (DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_) {
0480           for (muon = muons->begin(); muon != muons->end(); ++muon) {
0481             pT_muons_->Fill(muon->pt());
0482             eta_muons_->Fill(muon->eta());
0483             phi_muons_->Fill(muon->phi());
0484           }
0485 
0486           for (elec = elecs->begin(); elec != elecs->end(); ++elec) {
0487             pT_elecs_->Fill(elec->pt());
0488             eta_elecs_->Fill(elec->eta());
0489             phi_elecs_->Fill(elec->phi());
0490           }
0491 
0492           D_eta_lepts_->Fill(mu1.eta() - el1.eta());
0493           D_phi_lepts_->Fill(mu1.phi() - el1.phi());
0494 
0495           // Determinating trigger efficiencies

0496 
0497           for (int k = 0; k < N_SignalPaths; ++k) {
0498             if (Fired_Signal_Trigger[k] && Fired_Control_Trigger[k])
0499               ++N_sig[k];
0500 
0501             if (Fired_Control_Trigger[k])
0502               ++N_trig[k];
0503 
0504             if (N_trig[k] != 0)
0505               Eff[k] = N_sig[k] / static_cast<float>(N_trig[k]);
0506 
0507             TriggerEff_->setBinContent(k + 1, Eff[k]);
0508             TriggerEff_->setBinLabel(k + 1, "#frac{[" + hltPaths_sig_[k] + "]}{vs. [" + hltPaths_trig_[k] + "]}", 1);
0509           }
0510         }
0511       }
0512 
0513       // Same muon charges -> Wrong Charge (WC)

0514 
0515       if (mu1.charge() * el1.charge() > 0.) {
0516         dimassWC_LOG10_->Fill(log10(DilepMass));
0517         dimassWC_->Fill(DilepMass);
0518         dimassWC_LOGX_->Fill(DilepMass);
0519       }
0520     }
0521   }
0522 
0523   // ------------------------

0524   //  TWO Isolated ELECTRONS

0525   // ------------------------

0526 
0527   if (N_iso_el > 1) {
0528     // Vertex cut

0529 
0530     if (vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ && vertex_Z < vertex_Z_cut_) {
0531       ++N_elel;
0532 
0533       Events_->Fill(3.);
0534 
0535       reco::GsfElectronCollection::const_reference el1 = elecs->at(0);
0536       reco::GsfElectronCollection::const_reference el2 = elecs->at(1);
0537 
0538       DilepMass = sqrt((el1.energy() + el2.energy()) * (el1.energy() + el2.energy()) -
0539                        (el1.px() + el2.px()) * (el1.px() + el2.px()) - (el1.py() + el2.py()) * (el1.py() + el2.py()) -
0540                        (el1.pz() + el2.pz()) * (el1.pz() + el2.pz()));
0541 
0542       // Opposite lepton charges -> Right Charge (RC)

0543 
0544       if (el1.charge() * el2.charge() < 0.) {
0545         dimassRC_LOG10_->Fill(log10(DilepMass));
0546         dimassRC_->Fill(DilepMass);
0547         dimassRC_LOGX_->Fill(DilepMass);
0548 
0549         if (DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_) {
0550           for (elec = elecs->begin(); elec != elecs->end(); ++elec) {
0551             pT_elecs_->Fill(elec->pt());
0552             eta_elecs_->Fill(elec->eta());
0553             phi_elecs_->Fill(elec->phi());
0554           }
0555 
0556           D_eta_elecs_->Fill(el1.eta() - el2.eta());
0557           D_phi_elecs_->Fill(el1.phi() - el2.phi());
0558 
0559           // Determinating trigger efficiencies

0560 
0561           for (int k = 0; k < N_SignalPaths; ++k) {
0562             if (Fired_Signal_Trigger[k] && Fired_Control_Trigger[k])
0563               ++N_sig[k];
0564 
0565             if (Fired_Control_Trigger[k])
0566               ++N_trig[k];
0567 
0568             if (N_trig[k] != 0)
0569               Eff[k] = N_sig[k] / static_cast<float>(N_trig[k]);
0570 
0571             TriggerEff_->setBinContent(k + 1, Eff[k]);
0572             TriggerEff_->setBinLabel(k + 1, "#frac{[" + hltPaths_sig_[k] + "]}{vs. [" + hltPaths_trig_[k] + "]}", 1);
0573           }
0574         }
0575       }
0576 
0577       // Same muon charges -> Wrong Charge (WC)

0578 
0579       if (el1.charge() * el2.charge() > 0.) {
0580         dimassWC_LOG10_->Fill(log10(DilepMass));
0581         dimassWC_->Fill(DilepMass);
0582         dimassWC_LOGX_->Fill(DilepMass);
0583       }
0584     }
0585   }
0586 }