CMS 3D CMS Logo

Public Member Functions | Protected Attributes

DiMuonHistograms Class Reference

#include <DiMuonHistograms.h>

Inheritance diagram for DiMuonHistograms:
MuonAnalyzerBase

List of all members.

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
void beginJob (DQMStore *dbe)
 Inizialize parameters for histo binning.
 DiMuonHistograms (const edm::ParameterSet &pset, MuonServiceProxy *theService)
virtual ~DiMuonHistograms ()

Protected Attributes

edm::InputTag bsTag
int etaBBin
int etaBin
double etaBMax
double etaBMin
double EtaCutMax
double EtaCutMin
int etaEBin
double etaECMax
double etaECMin
std::string EtaName
int etaOvlpBin
std::vector< MonitorElement * > GlbGlbMuon_HM
std::vector< MonitorElement * > GlbGlbMuon_LM
double HighMassMax
double HighMassMin
double LowMassMax
double LowMassMin
std::string metname
edm::ParameterSet parameters
std::vector< MonitorElement * > SoftSoftMuon
std::vector< MonitorElement * > StaTrkMuon_HM
std::vector< MonitorElement * > StaTrkMuon_LM
edm::InputTag theMuonCollectionLabel
edm::InputTag theSTACollectionLabel
std::vector< MonitorElement * > TightTightMuon
std::vector< MonitorElement * > TrkTrkMuon_HM
std::vector< MonitorElement * > TrkTrkMuon_LM
edm::InputTag vertexTag

Detailed Description

Class DiMuonHistograms

DQM monitoring for dimuon mass

Author: S.Folgueras, U. Oviedo

Definition at line 27 of file DiMuonHistograms.h.


Constructor & Destructor Documentation

DiMuonHistograms::DiMuonHistograms ( const edm::ParameterSet pset,
MuonServiceProxy *  theService 
)

Definition at line 42 of file DiMuonHistograms.cc.

References parameters.

DiMuonHistograms::~DiMuonHistograms ( ) [virtual]

Definition at line 46 of file DiMuonHistograms.cc.

{ }

Member Function Documentation

void DiMuonHistograms::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)

Definition at line 93 of file DiMuonHistograms.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, reco::BeamSpot::BeamWidthX(), reco::BeamSpot::BeamWidthY(), bsTag, DeDxDiscriminatorTools::charge(), error, etaBMax, etaBMin, EtaCutMax, EtaCutMin, etaECMax, etaECMin, edm::Event::getByLabel(), GlbGlbMuon_HM, GlbGlbMuon_LM, HighMassMin, muon::isSoftMuon(), muon::isTightMuon(), edm::HandleBase::isValid(), LogTrace, LowMassMax, metname, patZpeak::muons, position, reco::BeamSpot::position(), reco::BeamSpot::sigmaZ(), SoftSoftMuon, StaTrkMuon_HM, StaTrkMuon_LM, theMuonCollectionLabel, TightTightMuon, TrkTrkMuon_HM, TrkTrkMuon_LM, and vertexTag.

                                                                                  {


  // ==========================================================
  // Look for the Primary Vertex (and use the BeamSpot instead, if you can't find it):

  reco::Vertex::Point posVtx;
  reco::Vertex::Error errVtx;
 
  unsigned int theIndexOfThePrimaryVertex = 999.;
 
  edm::Handle<reco::VertexCollection> vertex;
  iEvent.getByLabel(vertexTag, vertex);

 if ( vertex.isValid() ){
  for (unsigned int ind=0; ind<vertex->size(); ++ind) {
    if ( (*vertex)[ind].isValid() && !((*vertex)[ind].isFake()) ) {
      theIndexOfThePrimaryVertex = ind;
      break;
    }
  }
 }
  if (theIndexOfThePrimaryVertex<100) {
    posVtx = ((*vertex)[theIndexOfThePrimaryVertex]).position();
    errVtx = ((*vertex)[theIndexOfThePrimaryVertex]).error();
  }   else {
    LogInfo("RecoMuonValidator") << "reco::PrimaryVertex not found, use BeamSpot position instead\n";
  
    edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
    iEvent.getByLabel(bsTag,recoBeamSpotHandle);
    
    reco::BeamSpot bs = *recoBeamSpotHandle;
    
    posVtx = bs.position();
    errVtx(0,0) = bs.BeamWidthX();
    errVtx(1,1) = bs.BeamWidthY();
    errVtx(2,2) = bs.sigmaZ();
  }
  const reco::Vertex thePrimaryVertex(posVtx,errVtx);
  // ==========================================================




  LogTrace(metname)<<"[DiMuonHistograms] Analyze the mu in different eta regions";
  edm::Handle<reco::MuonCollection> muons;
  iEvent.getByLabel(theMuonCollectionLabel, muons);

  reco::BeamSpot beamSpot;
  Handle<reco::BeamSpot> beamSpotHandle;
  iEvent.getByLabel("offlineBeamSpot", beamSpotHandle);
  beamSpot = *beamSpotHandle;

  if(!muons.isValid()) return;

  // Loop on muon collection
  TLorentzVector Mu1, Mu2;
  float charge = 99.;
  float InvMass = -99.;

  for (reco::MuonCollection::const_iterator recoMu1 = muons->begin(); recoMu1!=muons->end(); ++recoMu1) {
    LogTrace(metname)<<"[DiMuonHistograms] loop over 1st muon"<<endl;

    // Loop on second muons to fill invariant mass plots
    for (reco::MuonCollection::const_iterator recoMu2 = recoMu1; recoMu2!=muons->end(); ++recoMu2){ 
      LogTrace(metname)<<"[DiMuonHistograms] loop over 2nd muon"<<endl;
      if (recoMu1==recoMu2) continue;
      
      // Global-Global Muon
      if (recoMu1->isGlobalMuon() && recoMu2->isGlobalMuon()) {
        LogTrace(metname)<<"[DiMuonHistograms] Glb-Glb pair"<<endl;
        reco::TrackRef recoCombinedGlbTrack1 = recoMu1->combinedMuon();
        reco::TrackRef recoCombinedGlbTrack2 = recoMu2->combinedMuon();
        Mu1.SetPxPyPzE(recoCombinedGlbTrack1->px(), recoCombinedGlbTrack1->py(),recoCombinedGlbTrack1->pz(), recoCombinedGlbTrack1->p());
        Mu2.SetPxPyPzE(recoCombinedGlbTrack2->px(), recoCombinedGlbTrack2->py(),recoCombinedGlbTrack2->pz(), recoCombinedGlbTrack2->p());
        
        charge  = recoCombinedGlbTrack1->charge()*recoCombinedGlbTrack2->charge();
        if (charge < 0) {
          InvMass = (Mu1+Mu2).M();
          for (unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
            if (iEtaRegion==0) {EtaCutMin= 0.;         EtaCutMax=2.4;       }
            if (iEtaRegion==1) {EtaCutMin= etaBMin;    EtaCutMax=etaBMax;   } 
            if (iEtaRegion==2) {EtaCutMin= etaECMin;   EtaCutMax=etaECMax;  }
            
            if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax && 
               fabs(recoCombinedGlbTrack2->eta())>EtaCutMin && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax){
              if (InvMass < LowMassMax)  GlbGlbMuon_LM[iEtaRegion]->Fill(InvMass);
              if (InvMass > HighMassMin) GlbGlbMuon_HM[iEtaRegion]->Fill(InvMass);
            }
          }
        }
        // Also Tight-Tight Muon Selection

        if ( muon::isTightMuon(*recoMu1, thePrimaryVertex)  && 
             muon::isTightMuon(*recoMu2, thePrimaryVertex) ) { 
          
          LogTrace(metname)<<"[DiMuonHistograms] Tight-Tight pair"<<endl;
          for (unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
            if (iEtaRegion==0) {EtaCutMin= 0.;         EtaCutMax=2.4;       }
            if (iEtaRegion==1) {EtaCutMin= etaBMin;    EtaCutMax=etaBMax;   } 
            if (iEtaRegion==2) {EtaCutMin= etaECMin;   EtaCutMax=etaECMax;  }

            if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax && 
               fabs(recoCombinedGlbTrack2->eta())>EtaCutMin && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax){
              if (InvMass > 55. && InvMass < 125.) TightTightMuon[iEtaRegion]->Fill(InvMass);
            }
          }
        }
      }
    
      // Now check for STA-TRK 
      if (recoMu2->isStandAloneMuon() && recoMu1->isTrackerMuon()) {
        LogTrace(metname)<<"[DiMuonHistograms] STA-Trk pair"<<endl;
        reco::TrackRef recoStaTrack = recoMu2->standAloneMuon();
        reco::TrackRef recoTrack    = recoMu1->track();
        Mu2.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(),recoStaTrack->pz(), recoStaTrack->p());
        Mu1.SetPxPyPzE(recoTrack->px(), recoTrack->py(),recoTrack->pz(), recoTrack->p());

        charge  = recoStaTrack->charge()*recoTrack->charge();
        if (charge < 0) {
          InvMass = (Mu1+Mu2).M();
          for (unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
            if (iEtaRegion==0) {EtaCutMin= 0.;         EtaCutMax=2.4;       }
            if (iEtaRegion==1) {EtaCutMin= etaBMin;    EtaCutMax=etaBMax;   } 
            if (iEtaRegion==2) {EtaCutMin= etaECMin;   EtaCutMax=etaECMax;  }
            
            if(fabs(recoStaTrack->eta())>EtaCutMin && fabs(recoStaTrack->eta())<EtaCutMax &&
               fabs(recoTrack->eta())>EtaCutMin && fabs(recoTrack->eta())<EtaCutMax){
              if (InvMass < LowMassMax)  StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
              if (InvMass > HighMassMin) StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
            }
          }
        }
      }
      if (recoMu1->isStandAloneMuon() && recoMu2->isTrackerMuon()) {
        LogTrace(metname)<<"[DiMuonHistograms] STA-Trk pair"<<endl;
        reco::TrackRef recoStaTrack = recoMu1->standAloneMuon();
        reco::TrackRef recoTrack    = recoMu2->track();
        Mu1.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(),recoStaTrack->pz(), recoStaTrack->p());
        Mu2.SetPxPyPzE(recoTrack->px(), recoTrack->py(),recoTrack->pz(), recoTrack->p());

        charge  = recoStaTrack->charge()*recoTrack->charge();
        if (charge < 0) {
          InvMass = (Mu1+Mu2).M();
          for (unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
            if (iEtaRegion==0) {EtaCutMin= 0.;         EtaCutMax=2.4;       }
            if (iEtaRegion==1) {EtaCutMin= etaBMin;    EtaCutMax=etaBMax;   } 
            if (iEtaRegion==2) {EtaCutMin= etaECMin;   EtaCutMax=etaECMax;  }
            
            if(fabs(recoStaTrack->eta())>EtaCutMin && fabs(recoStaTrack->eta())<EtaCutMax &&
               fabs(recoTrack->eta())>EtaCutMin && fabs(recoTrack->eta())<EtaCutMax){
              if (InvMass < LowMassMax)  StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
              if (InvMass > HighMassMin) StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
            }
          }
        }
      }

      // TRK-TRK dimuon 
      if (recoMu1->isTrackerMuon() && recoMu2->isTrackerMuon()) {
        LogTrace(metname)<<"[DiMuonHistograms] Trk-Trk dimuon pair"<<endl;
        reco::TrackRef recoTrack2 = recoMu2->track();
        reco::TrackRef recoTrack1 = recoMu1->track();
        Mu2.SetPxPyPzE(recoTrack2->px(), recoTrack2->py(),recoTrack2->pz(), recoTrack2->p());
        Mu1.SetPxPyPzE(recoTrack1->px(), recoTrack1->py(),recoTrack1->pz(), recoTrack1->p());
        
        charge  = recoTrack1->charge()*recoTrack2->charge();
        if (charge < 0) {
          InvMass = (Mu1+Mu2).M();
          for (unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
            if (iEtaRegion==0) {EtaCutMin= 0.;         EtaCutMax=2.4;       }
            if (iEtaRegion==1) {EtaCutMin= etaBMin;    EtaCutMax=etaBMax;   } 
            if (iEtaRegion==2) {EtaCutMin= etaECMin;   EtaCutMax=etaECMax;  }
            
            if(fabs(recoTrack1->eta())>EtaCutMin && fabs(recoTrack1->eta())<EtaCutMax &&
               fabs(recoTrack2->eta())>EtaCutMin && fabs(recoTrack2->eta())<EtaCutMax){
              if (InvMass < LowMassMax)  TrkTrkMuon_LM[iEtaRegion]->Fill(InvMass);
              if (InvMass > HighMassMin) TrkTrkMuon_HM[iEtaRegion]->Fill(InvMass);
            }
          }
        }


        LogTrace(metname)<<"[DiMuonHistograms] Soft-Soft pair"<<endl;

        if (muon::isSoftMuon(*recoMu1, thePrimaryVertex)  && 
            muon::isSoftMuon(*recoMu2, thePrimaryVertex) ) { 
          
          if (charge < 0) {
            InvMass = (Mu1+Mu2).M();
            for (unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
              if (iEtaRegion==0) {EtaCutMin= 0.;         EtaCutMax=2.4; }
              if (iEtaRegion==1) {EtaCutMin= etaBMin;    EtaCutMax=etaBMax; }
              if (iEtaRegion==2) {EtaCutMin= etaECMin;   EtaCutMax=etaECMax; }
              
              if(fabs(recoTrack1->eta())>EtaCutMin && fabs(recoTrack1->eta())<EtaCutMax &&
                 fabs(recoTrack2->eta())>EtaCutMin && fabs(recoTrack2->eta())<EtaCutMax){
                SoftSoftMuon[iEtaRegion]->Fill(InvMass); 
              }
            }
          }
        } 
      }
    } //muon2
  } //Muon1
}
void DiMuonHistograms::beginJob ( DQMStore dbe) [virtual]

Inizialize parameters for histo binning.

Implements MuonAnalyzerBase.

Definition at line 48 of file DiMuonHistograms.cc.

References DQMStore::book1D(), bsTag, etaBBin, etaBin, etaBMax, etaBMin, etaEBin, etaECMax, etaECMin, EtaName, edm::ParameterSet::getParameter(), GlbGlbMuon_HM, GlbGlbMuon_LM, HighMassMax, HighMassMin, LogTrace, LowMassMax, LowMassMin, metname, parameters, DQMStore::setCurrentFolder(), SoftSoftMuon, StaTrkMuon_HM, StaTrkMuon_LM, theMuonCollectionLabel, TightTightMuon, TrkTrkMuon_HM, TrkTrkMuon_LM, and vertexTag.

                                              {
  
  metname = "DiMuonhistograms";
  LogTrace(metname)<<"[DiMuonHistograms] Parameters initialization";
  dbe->setCurrentFolder("Muons/DiMuonHistograms");  

  theMuonCollectionLabel = parameters.getParameter<edm::InputTag>("MuonCollection");
  bsTag  = parameters.getParameter<edm::InputTag>("bsLabel");
  vertexTag  = parameters.getParameter<edm::InputTag>("vertexLabel");

  etaBin = parameters.getParameter<int>("etaBin");
  etaBBin = parameters.getParameter<int>("etaBBin");
  etaEBin = parameters.getParameter<int>("etaEBin");
  
  etaBMin = parameters.getParameter<double>("etaBMin");
  etaBMax = parameters.getParameter<double>("etaBMax");
  etaECMin = parameters.getParameter<double>("etaECMin");
  etaECMax = parameters.getParameter<double>("etaECMax");
  
  LowMassMin = parameters.getParameter<double>("LowMassMin");  
  LowMassMax = parameters.getParameter<double>("LowMassMax");
  HighMassMin = parameters.getParameter<double>("HighMassMin");
  HighMassMax = parameters.getParameter<double>("HighMassMax");

  int nBin = 0;
  for (unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
    if (iEtaRegion==0) { EtaName = "";         nBin = etaBin;} 
    if (iEtaRegion==1) { EtaName = "_Barrel";  nBin = etaBBin;}
    if (iEtaRegion==2) { EtaName = "_EndCap";  nBin = etaEBin;}
    
    GlbGlbMuon_LM.push_back(dbe->book1D("GlbGlbMuon_LM"+EtaName,"InvMass_{GLB,GLB}"+EtaName,nBin, LowMassMin, LowMassMax));
    TrkTrkMuon_LM.push_back(dbe->book1D("TrkTrkMuon_LM"+EtaName,"InvMass_{TRK,TRK}"+EtaName,nBin, LowMassMin, LowMassMax));
    StaTrkMuon_LM.push_back(dbe->book1D("StaTrkMuon_LM"+EtaName,"InvMass_{STA,TRK}"+EtaName,nBin, LowMassMin, LowMassMax));
    
    GlbGlbMuon_HM.push_back(dbe->book1D("GlbGlbMuon_HM"+EtaName,"InvMass_{GLB,GLB}"+EtaName,nBin, HighMassMin, HighMassMax));
    TrkTrkMuon_HM.push_back(dbe->book1D("TrkTrkMuon_HM"+EtaName,"InvMass_{TRK,TRK}"+EtaName,nBin, HighMassMin, HighMassMax));
    StaTrkMuon_HM.push_back(dbe->book1D("StaTrkMuon_HM"+EtaName,"InvMass_{STA,TRK}"+EtaName,nBin, HighMassMin, HighMassMax));
    
    // arround the Z peak
    TightTightMuon.push_back(dbe->book1D("TightTightMuon"+EtaName,"InvMass_{Tight,Tight}"+EtaName,nBin, 55.0, 125.0));

    // low-mass resonances
    SoftSoftMuon.push_back(dbe->book1D("SoftSoftMuon"+EtaName,"InvMass_{Soft,Soft}"+EtaName,nBin, 5.0, 55.0));
  }
}

Member Data Documentation

Definition at line 49 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

int DiMuonHistograms::etaBBin [protected]

Definition at line 54 of file DiMuonHistograms.h.

Referenced by beginJob().

int DiMuonHistograms::etaBin [protected]

Definition at line 53 of file DiMuonHistograms.h.

Referenced by beginJob().

double DiMuonHistograms::etaBMax [protected]

Definition at line 64 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

double DiMuonHistograms::etaBMin [protected]

Definition at line 63 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

double DiMuonHistograms::EtaCutMax [protected]

Definition at line 62 of file DiMuonHistograms.h.

Referenced by analyze().

double DiMuonHistograms::EtaCutMin [protected]

Definition at line 61 of file DiMuonHistograms.h.

Referenced by analyze().

int DiMuonHistograms::etaEBin [protected]

Definition at line 55 of file DiMuonHistograms.h.

Referenced by beginJob().

double DiMuonHistograms::etaECMax [protected]

Definition at line 66 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

double DiMuonHistograms::etaECMin [protected]

Definition at line 65 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

std::string DiMuonHistograms::EtaName [protected]

Definition at line 59 of file DiMuonHistograms.h.

Referenced by beginJob().

Definition at line 56 of file DiMuonHistograms.h.

Definition at line 75 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

Definition at line 74 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

double DiMuonHistograms::HighMassMax [protected]

Definition at line 72 of file DiMuonHistograms.h.

Referenced by beginJob().

double DiMuonHistograms::HighMassMin [protected]

Definition at line 71 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

double DiMuonHistograms::LowMassMax [protected]

Definition at line 70 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

double DiMuonHistograms::LowMassMin [protected]

Definition at line 69 of file DiMuonHistograms.h.

Referenced by beginJob().

std::string DiMuonHistograms::metname [protected]

Definition at line 44 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

Definition at line 41 of file DiMuonHistograms.h.

Referenced by beginJob(), and DiMuonHistograms().

Definition at line 82 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

Definition at line 77 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

Definition at line 76 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

Definition at line 48 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

Definition at line 47 of file DiMuonHistograms.h.

Definition at line 81 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

Definition at line 79 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

Definition at line 78 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().

Definition at line 50 of file DiMuonHistograms.h.

Referenced by analyze(), and beginJob().