00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "DQMOffline/Muon/src/MuonKinVsEtaAnalyzer.h"
00011
00012 #include "DataFormats/Common/interface/Handle.h"
00013 #include "DataFormats/MuonReco/interface/Muon.h"
00014 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00015 #include "DataFormats/MuonReco/interface/MuonEnergy.h"
00016
00017 #include "DataFormats/TrackReco/interface/Track.h"
00018 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00019
00020 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00021
00022 #include <string>
00023 using namespace std;
00024 using namespace edm;
00025
00026
00027
00028 MuonKinVsEtaAnalyzer::MuonKinVsEtaAnalyzer(const edm::ParameterSet& pSet, MuonServiceProxy *theService):MuonAnalyzerBase(theService){ parameters = pSet;
00029 }
00030
00031
00032 MuonKinVsEtaAnalyzer::~MuonKinVsEtaAnalyzer() { }
00033
00034
00035 void MuonKinVsEtaAnalyzer::beginJob(DQMStore * dbe) {
00036
00037 metname = "muonKinVsEta";
00038
00039 LogTrace(metname)<<"[MuonKinVsEtaAnalyzer] Parameters initialization";
00040 dbe->setCurrentFolder("Muons/MuonKinVsEtaAnalyzer");
00041
00042 etaBin = parameters.getParameter<int>("etaBin");
00043 etaMin = parameters.getParameter<double>("etaMin");
00044 etaMax = parameters.getParameter<double>("etaMax");
00045
00046 phiBin = parameters.getParameter<int>("phiBin");
00047 phiMin = parameters.getParameter<double>("phiMin");
00048 phiMax = parameters.getParameter<double>("phiMax");
00049
00050 pBin = parameters.getParameter<int>("pBin");
00051 pMin = parameters.getParameter<double>("pMin");
00052 pMax = parameters.getParameter<double>("pMax");
00053
00054 ptBin = parameters.getParameter<int>("ptBin");
00055 ptMin = parameters.getParameter<double>("ptMin");
00056 ptMax = parameters.getParameter<double>("ptMax");
00057
00058 etaBMin = parameters.getParameter<double>("etaBMin");
00059 etaBMax = parameters.getParameter<double>("etaBMax");
00060 etaECMin = parameters.getParameter<double>("etaECMin");
00061 etaECMax = parameters.getParameter<double>("etaECMax");
00062 etaOvlpMin = parameters.getParameter<double>("etaOvlpMin");
00063 etaOvlpMax = parameters.getParameter<double>("etaOvlpMax");
00064
00065
00066 std::string EtaName;
00067 for(unsigned int iEtaRegion=0;iEtaRegion<3;iEtaRegion++){
00068 if (iEtaRegion==0) EtaName = "Barrel_";
00069 if (iEtaRegion==1) EtaName = "EndCap_";
00070 if (iEtaRegion==2) EtaName = "Overlap_";
00071
00072
00073 etaGlbTrack.push_back(dbe->book1D("GlbMuon_"+EtaName+"Glb_eta", "#eta_{GLB}_"+EtaName, etaBin, etaMin, etaMax));
00074 etaTrack.push_back(dbe->book1D("TkMuon_eta_"+EtaName, "#eta_{TK}_"+EtaName, etaBin, etaMin, etaMax));
00075 etaStaTrack.push_back(dbe->book1D("StaMuon_eta_"+EtaName, "#eta_{STA}_"+EtaName, etaBin, etaMin, etaMax));
00076
00077
00078 phiGlbTrack.push_back(dbe->book1D("GlbMuon_"+EtaName+"Glb_phi", "#phi_{GLB}"+EtaName+ "(rad)", phiBin, phiMin, phiMax));
00079 phiTrack.push_back(dbe->book1D("TkMuon_phi"+EtaName, "#phi_{TK}" +EtaName +"(rad)", phiBin, phiMin, phiMax));
00080 phiStaTrack.push_back(dbe->book1D("StaMuon_phi"+EtaName, "#phi_{STA}"+EtaName+" (rad)", phiBin, phiMin, phiMax));
00081
00082
00083 pGlbTrack.push_back(dbe->book1D("GlbMuon_"+EtaName+"Glb_p", "p_{GLB}_"+EtaName, pBin, pMin, pMax));
00084 pTrack.push_back(dbe->book1D("TkMuon_p"+EtaName, "p_{TK}_"+EtaName, pBin, pMin, pMax));
00085 pStaTrack.push_back(dbe->book1D("StaMuon_p"+EtaName, "p_{STA}_"+EtaName, pBin, pMin, pMax));
00086
00087
00088 ptGlbTrack.push_back(dbe->book1D("GlbMuon_"+EtaName+"Glb_pt", "pt_{GLB}_"+EtaName, ptBin, ptMin, ptMax));
00089 ptTrack.push_back(dbe->book1D("TkMuon_pt"+EtaName, "pt_{TK}_"+EtaName, ptBin, ptMin, ptMax));
00090 ptStaTrack.push_back(dbe->book1D("StaMuon_pt"+EtaName, "pt_{STA}_"+EtaName, ptBin, ptMin, pMax));
00091 }
00092 }
00093
00094
00095
00096
00097 void MuonKinVsEtaAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Muon& recoMu) {
00098
00099 LogTrace(metname)<<"[MuonKinVsEtaAnalyzer] Analyze the mu in different eta regions";
00100
00101 for(unsigned int iEtaRegion=0;iEtaRegion<3;iEtaRegion++){
00102 if (iEtaRegion==0) {EtaCutMin= etaBMin; EtaCutMax=etaBMax;}
00103 if (iEtaRegion==1) {EtaCutMin= etaECMin; EtaCutMax=etaECMax;}
00104 if (iEtaRegion==2) {EtaCutMin= etaOvlpMin; EtaCutMax=etaOvlpMax;}
00105
00106 if(recoMu.isGlobalMuon()) {
00107 LogTrace(metname)<<"[MuonKinVsEtaAnalyzer] The mu is global - filling the histos";
00108 reco::TrackRef recoCombinedGlbTrack = recoMu.combinedMuon();
00109
00110 if(fabs(recoCombinedGlbTrack->eta())>EtaCutMin && fabs(recoCombinedGlbTrack->eta())<EtaCutMax){
00111 etaGlbTrack[iEtaRegion]->Fill(recoCombinedGlbTrack->eta());
00112 phiGlbTrack[iEtaRegion]->Fill(recoCombinedGlbTrack->phi());
00113 pGlbTrack[iEtaRegion]->Fill(recoCombinedGlbTrack->p());
00114 ptGlbTrack[iEtaRegion]->Fill(recoCombinedGlbTrack->pt());
00115 }
00116 }
00117
00118 if(recoMu.isTrackerMuon()) {
00119 LogTrace(metname)<<"[MuonKinVsEtaAnalyzer] The mu is tracker - filling the histos";
00120
00121 reco::TrackRef recoTrack = recoMu.track();
00122 if(fabs(recoTrack->eta())>EtaCutMin && fabs(recoTrack->eta())<EtaCutMax){
00123 etaTrack[iEtaRegion]->Fill(recoTrack->eta());
00124 phiTrack[iEtaRegion]->Fill(recoTrack->phi());
00125 pTrack[iEtaRegion]->Fill(recoTrack->p());
00126 ptTrack[iEtaRegion]->Fill(recoTrack->pt());
00127 }
00128 }
00129
00130 if(recoMu.isStandAloneMuon()) {
00131 LogTrace(metname)<<"[MuonKinVsEtaAnalyzer] The mu is standalone - filling the histos";
00132
00133 reco::TrackRef recoStaTrack = recoMu.standAloneMuon();
00134 if(fabs(recoStaTrack->eta())>EtaCutMin && fabs(recoStaTrack->eta())<EtaCutMax){
00135 etaStaTrack[iEtaRegion]->Fill(recoStaTrack->eta());
00136 phiStaTrack[iEtaRegion]->Fill(recoStaTrack->phi());
00137 pStaTrack[iEtaRegion]->Fill(recoStaTrack->p());
00138 ptStaTrack[iEtaRegion]->Fill(recoStaTrack->pt());
00139 }
00140 }
00141 }
00142
00143 }