CMS 3D CMS Logo

Public Member Functions | Private Attributes

MuonRecoOneHLT Class Reference

#include <MuonRecoOneHLT.h>

Inheritance diagram for MuonRecoOneHLT:
MuonAnalyzerBase

List of all members.

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &, const edm::TriggerResults &)
 Get the analysis.
void beginJob (DQMStore *dbe)
 Inizialize parameters for histo binning.
void beginRun (const edm::Run &iRun, const edm::EventSetup &iSetup)
 MuonRecoOneHLT (const edm::ParameterSet &, MuonServiceProxy *theService)
 Constructor.
virtual ~MuonRecoOneHLT ()
 Destructor.

Private Attributes

GenericTriggerEventFlag_DoubleMuonEventFlag
GenericTriggerEventFlag_SingleMuonEventFlag
int chi2Bin
float chi2Max
float chi2Min
std::vector< MonitorElement * > chi2OvDFGlbTrack
MonitorElementchi2OvDFStaTrack
MonitorElementchi2OvDFTight
MonitorElementchi2OvDFTrack
std::vector< std::string > doublemuonExpr_
int etaBin
std::vector< MonitorElement * > etaGlbTrack
float etaMax
float etaMin
MonitorElementetaStaTrack
MonitorElementetaTight
MonitorElementetaTrack
std::string metname
MonitorElementmuReco
edm::ParameterSet parameters
int phiBin
std::vector< MonitorElement * > phiGlbTrack
float phiMax
float phiMin
MonitorElementphiStaTrack
MonitorElementphiTight
MonitorElementphiTrack
int ptBin
std::vector< MonitorElement * > ptGlbTrack
float ptMax
float ptMin
MonitorElementptStaTrack
MonitorElementptTight
MonitorElementptTrack
std::vector< std::string > singlemuonExpr_
edm::InputTag theMuonCollectionLabel
edm::InputTag theSTACollectionLabel

Detailed Description

Definition at line 25 of file MuonRecoOneHLT.h.


Constructor & Destructor Documentation

MuonRecoOneHLT::MuonRecoOneHLT ( const edm::ParameterSet pSet,
MuonServiceProxy *  theService 
)

Constructor.

Definition at line 24 of file MuonRecoOneHLT.cc.

References _DoubleMuonEventFlag, _SingleMuonEventFlag, doublemuonExpr_, edm::ParameterSet::getParameter(), parameters, and singlemuonExpr_.

                                                                                       :MuonAnalyzerBase(theService) {
  parameters = pSet;
  
  ParameterSet muonparms   = parameters.getParameter<edm::ParameterSet>("SingleMuonTrigger");
  ParameterSet dimuonparms = parameters.getParameter<edm::ParameterSet>("DoubleMuonTrigger");
  _SingleMuonEventFlag     = new GenericTriggerEventFlag( muonparms );
  _DoubleMuonEventFlag     = new GenericTriggerEventFlag( dimuonparms );
  
  // Trigger Expresions in case de connection to the DB fails
  singlemuonExpr_          = muonparms.getParameter<std::vector<std::string> >("hltPaths");
  doublemuonExpr_          = dimuonparms.getParameter<std::vector<std::string> >("hltPaths");
}
MuonRecoOneHLT::~MuonRecoOneHLT ( ) [virtual]

Destructor.

Definition at line 38 of file MuonRecoOneHLT.cc.

References _DoubleMuonEventFlag, and _SingleMuonEventFlag.


Member Function Documentation

void MuonRecoOneHLT::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const edm::TriggerResults triggerResults 
)

Get the analysis.

Definition at line 129 of file MuonRecoOneHLT.cc.

References edm::HLTGlobalStatus::accept(), SiPixelRawToDigiRegional_cfi::beamSpot, chi2OvDFGlbTrack, chi2OvDFStaTrack, chi2OvDFTight, chi2OvDFTrack, gather_cfg::cout, doublemuonExpr_, etaGlbTrack, etaStaTrack, etaTight, etaTrack, MonitorElement::Fill(), edm::Event::getByLabel(), i, LogTrace, metname, patZpeak::muons, muReco, phiGlbTrack, phiStaTrack, phiTight, phiTrack, reco::BeamSpot::position(), ptGlbTrack, ptStaTrack, ptTight, ptTrack, singlemuonExpr_, edm::TriggerNames::size(), theMuonCollectionLabel, edm::TriggerNames::triggerName(), and edm::Event::triggerNames().

                                                                      {
#ifdef DEBUG
  cout << "[MuonRecoOneHLT]  analyze "<< endl;
#endif
  
  //  TEST FOR ONLY TAKE HIGHEST PT MUON
  edm::Handle<reco::MuonCollection> muons;
  iEvent.getByLabel(theMuonCollectionLabel,muons);


  std::map<float,reco::Muon> muonMap;
  for (reco::MuonCollection::const_iterator recoMu = muons->begin(); recoMu!=muons->end(); ++recoMu){
    muonMap[recoMu->pt()] = *recoMu;
  }
  std::vector<reco::Muon> LeadingMuon;
  for( std::map<float,reco::Muon>::reverse_iterator rit=muonMap.rbegin(); rit!=muonMap.rend(); ++rit){
    LeadingMuon.push_back( (*rit).second );
  }

  reco::BeamSpot beamSpot;
  Handle<reco::BeamSpot> beamSpotHandle;
  iEvent.getByLabel("offlineBeamSpot", beamSpotHandle);
  beamSpot = *beamSpotHandle;
  
  const edm::TriggerNames& triggerNames = iEvent.triggerNames(triggerResults);
  const unsigned int nTrig(triggerNames.size());
  bool _trig_SingleMu = false;
  bool _trig_DoubleMu = false;
  for (unsigned int i=0;i<nTrig;++i){
    if (triggerNames.triggerName(i).find(singlemuonExpr_[0].substr(0,singlemuonExpr_[0].rfind("_v")+2))!=std::string::npos && triggerResults.accept(i))
      _trig_SingleMu = true;
    if (triggerNames.triggerName(i).find(doublemuonExpr_[0].substr(0,doublemuonExpr_[0].rfind("_v")+2))!=std::string::npos && triggerResults.accept(i))
      _trig_DoubleMu = true;
  }
#ifdef DEBUG
  cout << "[MuonRecoOneHLT]  Trigger Fired ? "<< _trig_SingleMu << endl;
#endif

  if (!_trig_SingleMu && !_trig_DoubleMu) return;
  if (LeadingMuon.size() == 0)            return; 
  //  if (_MuonEventFlag->on() && !(_MuonEventFlag->accept(iEvent,iSetup))) return;

  // Check if Muon is Global
  if(LeadingMuon[0].isGlobalMuon()) {
    LogTrace(metname)<<"[MuonRecoOneHLT] The mu is global - filling the histos";
    if(LeadingMuon[0].isTrackerMuon() && LeadingMuon[0].isStandAloneMuon())          muReco->Fill(1);
    if(!(LeadingMuon[0].isTrackerMuon()) && LeadingMuon[0].isStandAloneMuon())       muReco->Fill(2);
    if(!LeadingMuon[0].isStandAloneMuon())   
      LogTrace(metname)<<"[MuonRecoOneHLT] ERROR: the mu is global but not standalone!";

    // get the track combinig the information from both the Tracker and the Spectrometer
    reco::TrackRef recoCombinedGlbTrack = LeadingMuon[0].combinedMuon();
    // get the track using only the tracker data
    reco::TrackRef recoTkGlbTrack = LeadingMuon[0].track();
    // get the track using only the mu spectrometer data
    reco::TrackRef recoStaGlbTrack = LeadingMuon[0].standAloneMuon();

    etaGlbTrack[0]->Fill(recoCombinedGlbTrack->eta());
    etaGlbTrack[1]->Fill(recoTkGlbTrack->eta());
    etaGlbTrack[2]->Fill(recoStaGlbTrack->eta());
    
    phiGlbTrack[0]->Fill(recoCombinedGlbTrack->phi());
    phiGlbTrack[1]->Fill(recoTkGlbTrack->phi());
    phiGlbTrack[2]->Fill(recoStaGlbTrack->phi());
    
    chi2OvDFGlbTrack[0]->Fill(recoCombinedGlbTrack->normalizedChi2());
    chi2OvDFGlbTrack[1]->Fill(recoTkGlbTrack->normalizedChi2());
    chi2OvDFGlbTrack[2]->Fill(recoStaGlbTrack->normalizedChi2());

    ptGlbTrack[0]->Fill(recoCombinedGlbTrack->pt());
    ptGlbTrack[1]->Fill(recoTkGlbTrack->pt());
    ptGlbTrack[2]->Fill(recoStaGlbTrack->pt());
  }
  // Check if Muon is Tight
  if (LeadingMuon[0].isGlobalMuon()  && 
      LeadingMuon[0].isTrackerMuon() && 
      LeadingMuon[0].combinedMuon()->normalizedChi2()<10.  && 
      LeadingMuon[0].combinedMuon()->hitPattern().numberOfValidMuonHits()>0 && 
      fabs(LeadingMuon[0].combinedMuon()->dxy(beamSpot.position()))<0.2  && 
      LeadingMuon[0].combinedMuon()->hitPattern().numberOfValidPixelHits()>0 && 
      LeadingMuon[0].numberOfMatches() > 1){
    
    LogTrace(metname)<<"[MuonRecoOneHLT] The mu is tracker only - filling the histos";
    
    reco::TrackRef recoCombinedGlbTrack = LeadingMuon[0].combinedMuon();

    etaTight->Fill(recoCombinedGlbTrack->eta());
    phiTight->Fill(recoCombinedGlbTrack->phi());
    chi2OvDFTight->Fill(recoCombinedGlbTrack->normalizedChi2());
    ptTight->Fill(recoCombinedGlbTrack->pt());
  }
  
  // Check if Muon is Tracker but NOT Global
  if(LeadingMuon[0].isTrackerMuon() && !(LeadingMuon[0].isGlobalMuon())) {
    LogTrace(metname)<<"[MuonRecoOneHLT] The mu is tracker only - filling the histos";
    if(LeadingMuon[0].isStandAloneMuon())          muReco->Fill(3);
    if(!(LeadingMuon[0].isStandAloneMuon()))        muReco->Fill(4);
    
    // get the track using only the tracker data
    reco::TrackRef recoTrack = LeadingMuon[0].track();

    etaTrack->Fill(recoTrack->eta());
    phiTrack->Fill(recoTrack->phi());
    chi2OvDFTrack->Fill(recoTrack->normalizedChi2());
    ptTrack->Fill(recoTrack->pt());
  }
    
  // Check if Muon is STA but NOT Global
  if(LeadingMuon[0].isStandAloneMuon() && !(LeadingMuon[0].isGlobalMuon())) {
    LogTrace(metname)<<"[MuonRecoOneHLT] The mu is STA only - filling the histos";
    if(!(LeadingMuon[0].isTrackerMuon()))         muReco->Fill(5);
     
    // get the track using only the mu spectrometer data
    reco::TrackRef recoStaTrack = LeadingMuon[0].standAloneMuon();

    etaStaTrack->Fill(recoStaTrack->eta());
    phiStaTrack->Fill(recoStaTrack->phi());
    chi2OvDFStaTrack->Fill(recoStaTrack->normalizedChi2());
    ptStaTrack->Fill(recoStaTrack->pt());
  }
  // Check if Muon is Only CaloMuon
  if(LeadingMuon[0].isCaloMuon() && !(LeadingMuon[0].isGlobalMuon()) && !(LeadingMuon[0].isTrackerMuon()) && !(LeadingMuon[0].isStandAloneMuon()))
    muReco->Fill(6);
}
void MuonRecoOneHLT::beginJob ( DQMStore dbe) [virtual]

Inizialize parameters for histo binning.

Implements MuonAnalyzerBase.

Definition at line 42 of file MuonRecoOneHLT.cc.

References DQMStore::book1D(), chi2Bin, chi2Max, chi2Min, chi2OvDFGlbTrack, chi2OvDFStaTrack, chi2OvDFTight, chi2OvDFTrack, gather_cfg::cout, etaBin, etaGlbTrack, etaMax, etaMin, etaStaTrack, etaTight, etaTrack, edm::ParameterSet::getParameter(), muReco, parameters, phiBin, phiGlbTrack, phiMax, phiMin, phiStaTrack, phiTight, phiTrack, ptBin, ptGlbTrack, ptMax, ptMin, ptStaTrack, ptTight, ptTrack, MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), and theMuonCollectionLabel.

                                            {
#ifdef DEBUG
  cout << "[MuonRecoOneHLT]  beginJob " << endl;
#endif
  dbe->setCurrentFolder("Muons/MuonRecoOneHLT");
  
  theMuonCollectionLabel = parameters.getParameter<edm::InputTag>("MuonCollection");
  
  muReco = dbe->book1D("Muon_Reco", "Muon Reconstructed Tracks", 6, 1, 7);
  muReco->setBinLabel(1,"glb+tk+sta"); 
  muReco->setBinLabel(2,"glb+sta");
  muReco->setBinLabel(3,"tk+sta");
  muReco->setBinLabel(4,"tk");
  muReco->setBinLabel(5,"sta");
  muReco->setBinLabel(6,"calo");

  // monitoring of eta parameter
  etaBin = parameters.getParameter<int>("etaBin");
  etaMin = parameters.getParameter<double>("etaMin");
  etaMax = parameters.getParameter<double>("etaMax");
  
  std::string histname = "GlbMuon_";
  etaGlbTrack.push_back(dbe->book1D(histname+"Glb_eta", "#eta_{GLB}", etaBin, etaMin, etaMax));
  etaGlbTrack.push_back(dbe->book1D(histname+"Tk_eta", "#eta_{TKfromGLB}", etaBin, etaMin, etaMax));
  etaGlbTrack.push_back(dbe->book1D(histname+"Sta_eta", "#eta_{STAfromGLB}", etaBin, etaMin, etaMax));
  etaTight = dbe->book1D("TightMuon_eta", "#eta_{GLB}", etaBin, etaMin, etaMax);
  etaTrack = dbe->book1D("TkMuon_eta", "#eta_{TK}", etaBin, etaMin, etaMax);
  etaStaTrack = dbe->book1D("StaMuon_eta", "#eta_{STA}", etaBin, etaMin, etaMax);

  // monitoring of phi paramater
  phiBin = parameters.getParameter<int>("phiBin");
  phiMin = parameters.getParameter<double>("phiMin");
  phiMax = parameters.getParameter<double>("phiMax");
  phiGlbTrack.push_back(dbe->book1D(histname+"Glb_phi", "#phi_{GLB}", phiBin, phiMin, phiMax));
  phiGlbTrack[0]->setAxisTitle("rad");
  phiGlbTrack.push_back(dbe->book1D(histname+"Tk_phi", "#phi_{TKfromGLB}", phiBin, phiMin, phiMax));
  phiGlbTrack[1]->setAxisTitle("rad");
  phiGlbTrack.push_back(dbe->book1D(histname+"Sta_phi", "#phi_{STAfromGLB}", phiBin, phiMin, phiMax));
  phiGlbTrack[2]->setAxisTitle("rad");
  phiTight = dbe->book1D("TightMuon_phi", "#phi_{GLB}", phiBin, phiMin, phiMax);
  phiTrack = dbe->book1D("TkMuon_phi", "#phi_{TK}", phiBin, phiMin, phiMax);
  phiTrack->setAxisTitle("rad"); 
  phiStaTrack = dbe->book1D("StaMuon_phi", "#phi_{STA}", phiBin, phiMin, phiMax);
  phiStaTrack->setAxisTitle("rad"); 
  
  // monitoring of the chi2 parameter
  chi2Bin = parameters.getParameter<int>("chi2Bin");
  chi2Min = parameters.getParameter<double>("chi2Min");
  chi2Max = parameters.getParameter<double>("chi2Max");
  chi2OvDFGlbTrack.push_back(dbe->book1D(histname+"Glb_chi2OverDf", "#chi_{2}OverDF_{GLB}", chi2Bin, chi2Min, chi2Max));
  chi2OvDFGlbTrack.push_back(dbe->book1D(histname+"Tk_chi2OverDf",  "#chi_{2}OverDF_{TKfromGLB}", phiBin, chi2Min, chi2Max));
  chi2OvDFGlbTrack.push_back(dbe->book1D(histname+"Sta_chi2OverDf", "#chi_{2}OverDF_{STAfromGLB}", chi2Bin, chi2Min, chi2Max));
  chi2OvDFTight    = dbe->book1D("TightMuon_chi2OverDf", "#chi_{2}OverDF_{GLB}", chi2Bin, chi2Min, chi2Max);
  chi2OvDFTrack    = dbe->book1D("TkMuon_chi2OverDf",    "#chi_{2}OverDF_{TK}", chi2Bin, chi2Min, chi2Max);
  chi2OvDFStaTrack = dbe->book1D("StaMuon_chi2OverDf",   "#chi_{2}OverDF_{STA}", chi2Bin, chi2Min, chi2Max);

  // monitoring of the transverse momentum
  ptBin = parameters.getParameter<int>("ptBin");
  ptMin = parameters.getParameter<double>("ptMin");
  ptMax = parameters.getParameter<double>("ptMax");
  ptGlbTrack.push_back(dbe->book1D(histname+"Glb_pt", "pt_{GLB}", ptBin, ptMin, ptMax));
  ptGlbTrack[0]->setAxisTitle("GeV"); 
  ptGlbTrack.push_back(dbe->book1D(histname+"Tk_pt", "pt_{TKfromGLB}", ptBin, ptMin, ptMax));
  ptGlbTrack[1]->setAxisTitle("GeV"); 
  ptGlbTrack.push_back(dbe->book1D(histname+"Sta_pt", "pt_{STAfromGLB}", ptBin, ptMin, ptMax));
  ptGlbTrack[2]->setAxisTitle("GeV"); 
  ptTight = dbe->book1D("TightMuon_pt", "pt_{GLB}", ptBin, ptMin, ptMax);
  ptTight->setAxisTitle("GeV"); 
  ptTrack = dbe->book1D("TkMuon_pt", "pt_{TK}", ptBin, ptMin, ptMax);
  ptTrack->setAxisTitle("GeV"); 
  ptStaTrack = dbe->book1D("StaMuon_pt", "pt_{STA}", ptBin, ptMin, ptMax);
  ptStaTrack->setAxisTitle("GeV"); 
}
void MuonRecoOneHLT::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)

Member Data Documentation

Definition at line 54 of file MuonRecoOneHLT.h.

Referenced by beginRun(), MuonRecoOneHLT(), and ~MuonRecoOneHLT().

Definition at line 53 of file MuonRecoOneHLT.h.

Referenced by beginRun(), MuonRecoOneHLT(), and ~MuonRecoOneHLT().

int MuonRecoOneHLT::chi2Bin [private]

Definition at line 69 of file MuonRecoOneHLT.h.

Referenced by beginJob().

float MuonRecoOneHLT::chi2Max [private]

Definition at line 71 of file MuonRecoOneHLT.h.

Referenced by beginJob().

float MuonRecoOneHLT::chi2Min [private]

Definition at line 70 of file MuonRecoOneHLT.h.

Referenced by beginJob().

Definition at line 79 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

Definition at line 96 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

Definition at line 85 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

Definition at line 91 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

std::vector<std::string> MuonRecoOneHLT::doublemuonExpr_ [private]

Definition at line 52 of file MuonRecoOneHLT.h.

Referenced by analyze(), and MuonRecoOneHLT().

int MuonRecoOneHLT::etaBin [private]

Definition at line 61 of file MuonRecoOneHLT.h.

Referenced by beginJob().

Definition at line 77 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

float MuonRecoOneHLT::etaMax [private]

Definition at line 63 of file MuonRecoOneHLT.h.

Referenced by beginJob().

float MuonRecoOneHLT::etaMin [private]

Definition at line 62 of file MuonRecoOneHLT.h.

Referenced by beginJob().

Definition at line 94 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

Definition at line 83 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

Definition at line 89 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

std::string MuonRecoOneHLT::metname [private]

Definition at line 46 of file MuonRecoOneHLT.h.

Referenced by analyze().

Definition at line 74 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

Definition at line 44 of file MuonRecoOneHLT.h.

Referenced by beginJob(), and MuonRecoOneHLT().

int MuonRecoOneHLT::phiBin [private]

Definition at line 65 of file MuonRecoOneHLT.h.

Referenced by beginJob().

Definition at line 78 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

float MuonRecoOneHLT::phiMax [private]

Definition at line 67 of file MuonRecoOneHLT.h.

Referenced by beginJob().

float MuonRecoOneHLT::phiMin [private]

Definition at line 66 of file MuonRecoOneHLT.h.

Referenced by beginJob().

Definition at line 95 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

Definition at line 84 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

Definition at line 90 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

int MuonRecoOneHLT::ptBin [private]

Definition at line 57 of file MuonRecoOneHLT.h.

Referenced by beginJob().

std::vector<MonitorElement*> MuonRecoOneHLT::ptGlbTrack [private]

Definition at line 80 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

float MuonRecoOneHLT::ptMax [private]

Definition at line 59 of file MuonRecoOneHLT.h.

Referenced by beginJob().

float MuonRecoOneHLT::ptMin [private]

Definition at line 58 of file MuonRecoOneHLT.h.

Referenced by beginJob().

Definition at line 97 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

Definition at line 86 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

Definition at line 92 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

std::vector<std::string> MuonRecoOneHLT::singlemuonExpr_ [private]

Definition at line 51 of file MuonRecoOneHLT.h.

Referenced by analyze(), beginRun(), and MuonRecoOneHLT().

Definition at line 48 of file MuonRecoOneHLT.h.

Referenced by analyze(), and beginJob().

Definition at line 49 of file MuonRecoOneHLT.h.