CMS 3D CMS Logo

MuonRecoAnalyzer.cc

Go to the documentation of this file.
00001 
00002 /*
00003  *  See header file for a description of this class.
00004  *
00005  *  $Date: 2008/11/25 11:16:09 $
00006  *  $Revision: 1.18 $
00007  *  \author G. Mila - INFN Torino
00008  */
00009 
00010 #include "DQMOffline/Muon/src/MuonRecoAnalyzer.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 MuonRecoAnalyzer::MuonRecoAnalyzer(const edm::ParameterSet& pSet, MuonServiceProxy *theService):MuonAnalyzerBase(theService) {
00029   parameters = pSet;
00030 }
00031 
00032 
00033 MuonRecoAnalyzer::~MuonRecoAnalyzer() { }
00034 
00035 
00036 void MuonRecoAnalyzer::beginJob(edm::EventSetup const& iSetup,DQMStore * dbe) {
00037 
00038   metname = "muRecoAnalyzer";
00039 
00040   LogTrace(metname)<<"[MuonRecoAnalyzer] Parameters initialization";
00041   dbe->setCurrentFolder("Muons/MuonRecoAnalyzer");
00042 
00043   muReco = dbe->book1D("muReco", "muon reconstructed tracks", 6, 1, 7);
00044   muReco->setBinLabel(1,"glb+tk+sta");
00045   muReco->setBinLabel(2,"glb+sta");
00046   muReco->setBinLabel(3,"tk+sta");
00047   muReco->setBinLabel(4,"tk");
00048   muReco->setBinLabel(5,"sta");
00049   muReco->setBinLabel(6,"calo");
00050 
00051   int binFactor = 4;
00052 
00053   // monitoring of eta parameter
00054   etaBin = parameters.getParameter<int>("etaBin");
00055   etaMin = parameters.getParameter<double>("etaMin");
00056   etaMax = parameters.getParameter<double>("etaMax");
00057   std::string histname = "GlbMuon_";
00058   etaGlbTrack.push_back(dbe->book1D(histname+"Glb_eta", "#eta_{GLB}", etaBin, etaMin, etaMax));
00059   etaGlbTrack.push_back(dbe->book1D(histname+"Tk_eta", "#eta_{TKfromGLB}", etaBin, etaMin, etaMax));
00060   etaGlbTrack.push_back(dbe->book1D(histname+"Sta_eta", "#eta_{STAfromGLB}", etaBin, etaMin, etaMax));
00061   etaResolution.push_back(dbe->book1D("Res_TkGlb_eta", "#eta_{TKfromGLB} - #eta_{GLB}", etaBin*binFactor, etaMin/3000, etaMax/3000));
00062   etaResolution.push_back(dbe->book1D("Res_GlbSta_eta", "#eta_{GLB} - #eta_{STAfromGLB}", etaBin*binFactor, etaMin/100, etaMax/100));
00063   etaResolution.push_back(dbe->book1D("Res_TkSta_eta", "#eta_{TKfromGLB} - #eta_{STAfromGLB}", etaBin*binFactor, etaMin/100, etaMax/100));
00064   etaResolution.push_back(dbe->book2D("ResVsEta_TkGlb_eta", "(#eta_{TKfromGLB} - #eta_{GLB}) vs #eta_{GLB}", etaBin, etaMin, etaMax, etaBin*binFactor, etaMin/3000, etaMax/3000));
00065   etaResolution.push_back(dbe->book2D("ResVsEta_GlbSta_eta", "(#eta_{GLB} - #eta_{STAfromGLB}) vs #eta_{GLB}", etaBin, etaMin, etaMax, etaBin*binFactor, etaMin/100, etaMax/100));
00066   etaResolution.push_back(dbe->book2D("ResVsEta_TkSta_eta", "(#eta_{TKfromGLB} - #eta_{STAfromGLB}) vs #eta_{TKfromGLB}", etaBin, etaMin, etaMax, etaBin*binFactor, etaMin/100, etaMax/100));
00067   etaTrack = dbe->book1D("TkMuon_eta", "#eta_{TK}", etaBin, etaMin, etaMax);
00068   etaStaTrack = dbe->book1D("StaMuon_eta", "#eta_{STA}", etaBin, etaMin, etaMax);
00069   etaEfficiency.push_back(dbe->book1D("StaEta", "#eta_{STAfromGLB}", etaBin, etaMin, etaMax));
00070   etaEfficiency.push_back(dbe->book1D("StaEta_ifCombinedAlso", "#eta_{STAfromGLB} if isGlb=true", etaBin, etaMin, etaMax));
00071 
00072   // monitoring of theta parameter
00073   thetaBin = parameters.getParameter<int>("thetaBin");
00074   thetaMin = parameters.getParameter<double>("thetaMin");
00075   thetaMax = parameters.getParameter<double>("thetaMax");
00076   thetaGlbTrack.push_back(dbe->book1D(histname+"Glb_theta", "#theta_{GLB}", thetaBin, thetaMin, thetaMax));
00077   thetaGlbTrack[0]->setAxisTitle("rad");
00078   thetaGlbTrack.push_back(dbe->book1D(histname+"Tk_theta", "#theta_{TKfromGLB}", thetaBin, thetaMin, thetaMax));
00079   thetaGlbTrack[1]->setAxisTitle("rad");
00080   thetaGlbTrack.push_back(dbe->book1D(histname+"Sta_theta", "#theta_{STAfromGLB}", thetaBin, thetaMin, thetaMax));
00081   thetaGlbTrack[2]->setAxisTitle("rad");
00082   thetaResolution.push_back(dbe->book1D("Res_TkGlb_theta", "#theta_{TKfromGLB} - #theta_{GLB}", thetaBin*binFactor, -(thetaMax/3000), thetaMax/3000));
00083   thetaResolution[0]->setAxisTitle("rad");
00084   thetaResolution.push_back(dbe->book1D("Res_GlbSta_theta", "#theta_{GLB} - #theta_{STAfromGLB}", thetaBin*binFactor,-(thetaMax/100), thetaMax/100));
00085   thetaResolution[1]->setAxisTitle("rad");
00086   thetaResolution.push_back(dbe->book1D("Res_TkSta_theta", "#theta_{TKfromGLB} - #theta_{STAfromGLB}", thetaBin*binFactor, -(thetaMax/100), thetaMax/100));
00087   thetaResolution[2]->setAxisTitle("rad");
00088   thetaResolution.push_back(dbe->book2D("ResVsTheta_TkGlb_theta", "(#theta_{TKfromGLB} - #theta_{GLB}) vs #theta_{GLB}", thetaBin, thetaMin, thetaMax, thetaBin*binFactor, -(thetaMax/3000), thetaMax/3000));
00089   thetaResolution[3]->setAxisTitle("rad",1);
00090   thetaResolution[3]->setAxisTitle("rad",2);
00091   thetaResolution.push_back(dbe->book2D("ResVsTheta_GlbSta_theta", "(#theta_{GLB} - #theta_{STAfromGLB}) vs #theta_{GLB}", thetaBin, thetaMin, thetaMax, thetaBin*binFactor, -(thetaMax/100), thetaMax/100));
00092   thetaResolution[4]->setAxisTitle("rad",1);
00093   thetaResolution[4]->setAxisTitle("rad",2);
00094   thetaResolution.push_back(dbe->book2D("ResVsTheta_TkSta_theta", "(#theta_{TKfromGLB} - #theta_{STAfromGLB}) vs #theta_{TKfromGLB}", thetaBin, thetaMin, thetaMax, thetaBin*binFactor, -(thetaMax/100), thetaMax/100));
00095   thetaResolution[5]->setAxisTitle("rad",1);
00096   thetaResolution[5]->setAxisTitle("rad",2);
00097   thetaTrack = dbe->book1D("TkMuon_theta", "#theta_{TK}", thetaBin, thetaMin, thetaMax);
00098   thetaTrack->setAxisTitle("rad");
00099   thetaStaTrack = dbe->book1D("StaMuon_theta", "#theta_{STA}", thetaBin, thetaMin, thetaMax);
00100   thetaStaTrack->setAxisTitle("rad");
00101 
00102   // monitoring of phi paramater
00103   phiBin = parameters.getParameter<int>("phiBin");
00104   phiMin = parameters.getParameter<double>("phiMin");
00105   phiMax = parameters.getParameter<double>("phiMax");
00106   phiGlbTrack.push_back(dbe->book1D(histname+"Glb_phi", "#phi_{GLB}", phiBin, phiMin, phiMax));
00107   phiGlbTrack[0]->setAxisTitle("rad");
00108   phiGlbTrack.push_back(dbe->book1D(histname+"Tk_phi", "#phi_{TKfromGLB}", phiBin, phiMin, phiMax));
00109   phiGlbTrack[1]->setAxisTitle("rad");
00110   phiGlbTrack.push_back(dbe->book1D(histname+"Sta_phi", "#phi_{STAfromGLB}", phiBin, phiMin, phiMax));
00111   phiGlbTrack[2]->setAxisTitle("rad");
00112   phiResolution.push_back(dbe->book1D("Res_TkGlb_phi", "#phi_{TKfromGLB} - #phi_{GLB}", phiBin*binFactor, phiMin/3000, phiMax/3000));
00113   phiResolution[0]->setAxisTitle("rad");
00114   phiResolution.push_back(dbe->book1D("Res_GlbSta_phi", "#phi_{GLB} - #phi_{STAfromGLB}", phiBin*binFactor, phiMin/100, phiMax/100));
00115   phiResolution[1]->setAxisTitle("rad");
00116   phiResolution.push_back(dbe->book1D("Res_TkSta_phi", "#phi_{TKfromGLB} - #phi_{STAfromGLB}", phiBin*binFactor, phiMin/100, phiMax/100));
00117   phiResolution[2]->setAxisTitle("rad");
00118   phiResolution.push_back(dbe->book2D("ResVsPhi_TkGlb_phi", "(#phi_{TKfromGLB} - #phi_{GLB}) vs #phi_GLB", phiBin, phiMin, phiMax, phiBin*binFactor, phiMin/3000, phiMax/3000));
00119   phiResolution[3]->setAxisTitle("rad",1);
00120   phiResolution[3]->setAxisTitle("rad",2);
00121   phiResolution.push_back(dbe->book2D("ResVsPhi_GlbSta_phi", "(#phi_{GLB} - #phi_{STAfromGLB}) vs #phi_{GLB}", phiBin, phiMin, phiMax, phiBin*binFactor, phiMin/100, phiMax/100));
00122   phiResolution[4]->setAxisTitle("rad",1);
00123   phiResolution[4]->setAxisTitle("rad",2);
00124   phiResolution.push_back(dbe->book2D("ResVsPhi_TkSta_phi", "(#phi_{TKfromGLB} - #phi_{STAfromGLB}) vs #phi_{TKfromGLB}", phiBin, phiMin, phiMax, phiBin*binFactor, phiMin/100, phiMax/100));
00125   phiResolution[5]->setAxisTitle("rad",1);
00126   phiResolution[5]->setAxisTitle("rad",2);
00127   phiTrack = dbe->book1D("TkMuon_phi", "#phi_{TK}", phiBin, phiMin, phiMax);
00128   phiTrack->setAxisTitle("rad"); 
00129   phiStaTrack = dbe->book1D("StaMuon_phi", "#phi_{STA}", phiBin, phiMin, phiMax);
00130   phiStaTrack->setAxisTitle("rad"); 
00131   phiEfficiency.push_back(dbe->book1D("StaPhi", "#phi_{STAfromGLB}", phiBin, phiMin, phiMax));
00132   phiEfficiency[0]->setAxisTitle("rad"); 
00133   phiEfficiency.push_back(dbe->book1D("StaPhi_ifCombinedAlso", "#phi_{STAfromGLB} if the isGlb=true", phiBin, phiMin, phiMax));
00134   phiEfficiency[1]->setAxisTitle("rad"); 
00135 
00136   // monitoring of the chi2 parameter
00137   chi2Bin = parameters.getParameter<int>("chi2Bin");
00138   chi2Min = parameters.getParameter<double>("chi2Min");
00139   chi2Max = parameters.getParameter<double>("chi2Max");
00140   chi2OvDFGlbTrack.push_back(dbe->book1D(histname+"Glb_chi2OverDf", "#chi_{2}OverDF_{GLB}", chi2Bin, chi2Min, chi2Max));
00141   chi2OvDFGlbTrack.push_back(dbe->book1D(histname+"Tk_chi2OverDf", "#chi_{2}OverDF_{TKfromGLB}", phiBin, chi2Min, chi2Max));
00142   chi2OvDFGlbTrack.push_back(dbe->book1D(histname+"Sta_chi2OverDf", "#chi_{2}OverDF_{STAfromGLB}", chi2Bin, chi2Min, chi2Max));
00143   chi2OvDFTrack = dbe->book1D("TkMuon_chi2OverDf", "#chi_{2}OverDF_{TK}", chi2Bin, chi2Min, chi2Max);
00144   chi2OvDFStaTrack = dbe->book1D("StaMuon_chi2OverDf", "#chi_{2}OverDF_{STA}", chi2Bin, chi2Min, chi2Max);
00145 
00146   // monitoring of the momentum
00147   pBin = parameters.getParameter<int>("pBin");
00148   pMin = parameters.getParameter<double>("pMin");
00149   pMax = parameters.getParameter<double>("pMax");
00150   pGlbTrack.push_back(dbe->book1D(histname+"Glb_p", "p_{GLB}", pBin, pMin, pMax));
00151   pGlbTrack[0]->setAxisTitle("GeV"); 
00152   pGlbTrack.push_back(dbe->book1D(histname+"Tk_p", "p_{TKfromGLB}", pBin, pMin, pMax));
00153   pGlbTrack[1]->setAxisTitle("GeV");
00154   pGlbTrack.push_back(dbe->book1D(histname+"Sta_p", "p_{STAfromGLB}", pBin, pMin, pMax));
00155   pGlbTrack[2]->setAxisTitle("GeV");
00156   pTrack = dbe->book1D("TkMuon_p", "p_{TK}", pBin, pMin, pMax);
00157   pTrack->setAxisTitle("GeV"); 
00158   pStaTrack = dbe->book1D("StaMuon_p", "p_{STA}", pBin, pMin, pMax);
00159   pStaTrack->setAxisTitle("GeV"); 
00160 
00161   // monitoring of the transverse momentum
00162   ptBin = parameters.getParameter<int>("ptBin");
00163   ptMin = parameters.getParameter<double>("ptMin");
00164   ptMax = parameters.getParameter<double>("ptMax");
00165   ptGlbTrack.push_back(dbe->book1D(histname+"Glb_pt", "pt_{GLB}", ptBin, ptMin, ptMax));
00166   ptGlbTrack[0]->setAxisTitle("GeV"); 
00167   ptGlbTrack.push_back(dbe->book1D(histname+"Tk_pt", "pt_{TKfromGLB}", ptBin, ptMin, ptMax));
00168   ptGlbTrack[1]->setAxisTitle("GeV"); 
00169   ptGlbTrack.push_back(dbe->book1D(histname+"Sta_pt", "pt_{STAfromGLB}", ptBin, ptMin, ptMax));
00170   ptGlbTrack[2]->setAxisTitle("GeV"); 
00171   ptTrack = dbe->book1D("TkMuon_pt", "pt_{TK}", ptBin, ptMin, ptMax);
00172   ptTrack->setAxisTitle("GeV"); 
00173   ptStaTrack = dbe->book1D("StaMuon_pt", "pt_{STA}", ptBin, ptMin, pMax);
00174   ptStaTrack->setAxisTitle("GeV"); 
00175 
00176   // monitoring of the muon charge
00177   qGlbTrack.push_back(dbe->book1D(histname+"Glb_q", "q_{GLB}", 5, -2.5, 2.5));
00178   qGlbTrack.push_back(dbe->book1D(histname+"Tk_q", "q_{TKfromGLB}", 5, -2.5, 2.5));
00179   qGlbTrack.push_back(dbe->book1D(histname+"Sta_q", "q_{STAformGLB}", 5, -2.5, 2.5));
00180   qGlbTrack.push_back(dbe->book1D(histname+"qComparison", "comparison between q_{GLB} and q_{TKfromGLB}, q_{STAfromGLB}", 8, 0.5, 8.5));
00181   qGlbTrack[3]->setBinLabel(1,"qGlb=qSta");
00182   qGlbTrack[3]->setBinLabel(2,"qGlb!=qSta");
00183   qGlbTrack[3]->setBinLabel(3,"qGlb=qTk");
00184   qGlbTrack[3]->setBinLabel(4,"qGlb!=qTk");
00185   qGlbTrack[3]->setBinLabel(5,"qSta=qTk");
00186   qGlbTrack[3]->setBinLabel(6,"qSta!=qTk");
00187   qGlbTrack[3]->setBinLabel(7,"qGlb!=qSta,qGlb!=Tk");
00188   qGlbTrack[3]->setBinLabel(8,"qGlb=qSta,qGlb=Tk");
00189   qTrack = dbe->book1D("TkMuon_q", "q_{TK}", 5, -2.5, 2.5);
00190   qStaTrack = dbe->book1D("StaMuon_q", "q_{STA}", 5, -2.5, 2.5);
00191 
00192   // monitoring of the momentum resolution
00193   pResBin = parameters.getParameter<int>("pResBin");
00194   pResMin = parameters.getParameter<double>("pResMin");
00195   pResMax = parameters.getParameter<double>("pResMax");
00196   qOverpResolution.push_back(dbe->book1D("Res_TkGlb_qOverp", "(q/p)_{TKfromGLB} - (q/p)_{GLB}", pResBin*binFactor*2, pResMin/10, pResMax/10));
00197   qOverpResolution[0]->setAxisTitle("GeV^{-1}"); 
00198   qOverpResolution.push_back(dbe->book1D("Res_GlbSta_qOverp", "(q/p)_{GLB} - (q/p)_{STAfromGLB}", pResBin*binFactor, pResMin, pResMax));
00199   qOverpResolution[1]->setAxisTitle("GeV^{-1}"); 
00200   qOverpResolution.push_back(dbe->book1D("Res_TkSta_qOverp", "(q/p)_{TKfromGLB} - (q/p)_{STAfromGLB}", pResBin*binFactor, pResMin, pResMax));
00201   qOverpResolution[2]->setAxisTitle("GeV^{-1}"); 
00202   oneOverpResolution.push_back(dbe->book1D("Res_TkGlb_oneOverp", "(1/p)_{TKfromGLB} - (1/p)_{GLB}", pResBin*binFactor*2, pResMin/10, pResMax/10));
00203   oneOverpResolution[0]->setAxisTitle("GeV^{-1}"); 
00204   oneOverpResolution.push_back(dbe->book1D("Res_GlbSta_oneOverp", "(1/p)_{GLB} - (1/p)_{STAfromGLB}", pResBin*binFactor, pResMin, pResMax));
00205   oneOverpResolution[1]->setAxisTitle("GeV^{-1}");
00206   oneOverpResolution.push_back(dbe->book1D("Res_TkSta_oneOverp", "(q/p)_{TKfromGLB} - (q/p)_{STAfromGLB}", pResBin*binFactor, pResMin, pResMax));
00207   oneOverpResolution[2]->setAxisTitle("GeV^{-1}");
00208   qOverptResolution.push_back(dbe->book1D("Res_TkGlb_qOverpt", "(q/p_{t})_{TKfromGLB} - (q/p_{t})_{GLB}", pResBin*binFactor*2, pResMin/10, pResMax/10));
00209   qOverptResolution[0]->setAxisTitle("GeV^{-1}");  
00210   qOverptResolution.push_back(dbe->book1D("Res_GlbSta_qOverpt", "(q/p_{t})_{GLB} - (q/p_{t})_{STAfromGLB}", pResBin*binFactor, pResMin, pResMax));
00211   qOverptResolution[1]->setAxisTitle("GeV^{-1}"); 
00212   qOverptResolution.push_back(dbe->book1D("Res_TkSta_qOverpt", "(q/p_{t})_{TKfromGLB} - (q/p_{t})_{STAfromGLB}", pResBin*binFactor, pResMin, pResMax));
00213   qOverptResolution[1]->setAxisTitle("GeV^{-1}"); 
00214   oneOverptResolution.push_back(dbe->book1D("Res_TkGlb_oneOverpt", "(1/p_{t})_{TKfromGLB} - (1/p_{t})_{GLB}", pResBin*binFactor*2, pResMin/10, pResMax/10));
00215   oneOverptResolution[0]->setAxisTitle("GeV^{-1}");  
00216   oneOverptResolution.push_back(dbe->book1D("Res_GlbSta_oneOverpt", "(1/p_{t})_{GLB} - (1/p_{t})_{STAfromGLB}", pResBin*binFactor, pResMin, pResMax));
00217   oneOverptResolution[1]->setAxisTitle("GeV^{-1}");
00218   oneOverptResolution.push_back(dbe->book1D("Res_TkSta_oneOverpt", "(1/p_{t})_{TKfromGLB} - (1/p_{t})_{STAfromGLB}", pResBin*binFactor, pResMin, pResMax));
00219   oneOverptResolution[2]->setAxisTitle("GeV^{-1}");
00220   oneOverptResolution.push_back(dbe->book2D("ResVsEta_TkGlb_oneOverpt", "(#eta_{TKfromGLB} - #eta_{GLB}) vs (1/p_{t})_{GLB}", etaBin, etaMin, etaMax, pResBin*binFactor*2, pResMin/10, pResMax/10));
00221   oneOverptResolution[3]->setAxisTitle("GeV^{-1}",2);
00222   oneOverptResolution.push_back(dbe->book2D("ResVsEta_GlbSta_oneOverpt", "(#eta_{GLB} - #eta_{STAfromGLB} vs (1/p_{t})_{GLB}", etaBin, etaMin, etaMax, pResBin*binFactor, pResMin, pResMax));
00223   oneOverptResolution[4]->setAxisTitle("GeV^{-1}",2);
00224   oneOverptResolution.push_back(dbe->book2D("ResVsEta_TkSta_oneOverpt", "(#eta_{TKfromGLB} - #eta_{STAfromGLB}) vs (1/p_{t})_{TKfromGLB}", etaBin, etaMin, etaMax, pResBin*binFactor, pResMin, pResMax));
00225   oneOverptResolution[5]->setAxisTitle("GeV^{-1}",2);
00226   oneOverptResolution.push_back(dbe->book2D("ResVsPhi_TkGlb_oneOverpt", "(#phi_{TKfromGLB} - #phi_{GLB}) vs (1/p_{t})_{GLB}", phiBin, phiMin, phiMax, pResBin*binFactor*2, pResMin/10, pResMax/10));
00227   oneOverptResolution[6]->setAxisTitle("rad",1);
00228   oneOverptResolution[6]->setAxisTitle("GeV^{-1}",2);
00229   oneOverptResolution.push_back(dbe->book2D("ResVsPhi_GlbSta_oneOverpt", "(#phi_{GLB} - #phi_{STAfromGLB} vs (1/p_{t})_{GLB}", phiBin, phiMin, phiMax, pResBin*binFactor, pResMin, pResMax));
00230   oneOverptResolution[7]->setAxisTitle("rad",1);
00231   oneOverptResolution[7]->setAxisTitle("GeV^{-1}",2);
00232   oneOverptResolution.push_back(dbe->book2D("ResVsPhi_TkSta_oneOverpt", "(#phi_{TKfromGLB} - #phi_{STAfromGLB}) vs (1/p_{t})_{TKfromGLB}", phiBin, phiMin, phiMax, pResBin*binFactor, pResMin, pResMax));
00233   oneOverptResolution[8]->setAxisTitle("rad",1);
00234   oneOverptResolution[8]->setAxisTitle("GeV^{-1}",2);
00235   oneOverptResolution.push_back(dbe->book2D("ResVsPt_TkGlb_oneOverpt", "((1/p_{t})_{TKfromGLB} - (1/p_{t})_{GLB}) vs (1/p_{t})_{GLB}", ptBin/5, ptMin, ptMax/100, pResBin*binFactor*2, pResMin/10, pResMax/10));
00236   oneOverptResolution[9]->setAxisTitle("GeV^{-1}",1);
00237   oneOverptResolution[9]->setAxisTitle("GeV^{-1}",2);
00238   oneOverptResolution.push_back(dbe->book2D("ResVsPt_GlbSta_oneOverpt", "((1/p_{t})_{GLB} - (1/p_{t})_{STAfromGLB} vs (1/p_{t})_{GLB}", ptBin/5, ptMin, ptMax/100, pResBin*binFactor, pResMin, pResMax));
00239   oneOverptResolution[10]->setAxisTitle("GeV^{-1}",1);
00240   oneOverptResolution[10]->setAxisTitle("GeV^{-1}",2);
00241   oneOverptResolution.push_back(dbe->book2D("ResVsPt_TkSta_oneOverpt", "((1/p_{t})_{TKfromGLB} - (1/p_{t})_{STAfromGLB}) vs (1/p_{t})_{TKfromGLB}", ptBin/5, ptMin, ptMax/100, pResBin*binFactor, pResMin, pResMax));
00242   oneOverptResolution[11]->setAxisTitle("GeV^{-1}",1);
00243   oneOverptResolution[11]->setAxisTitle("GeV^{-1}",2);
00244 
00245   // monitoring of the recHits provenance
00246   rhBin=parameters.getParameter<int>("rhBin");
00247   rhMin=parameters.getParameter<double>("rhMin");
00248   rhMax=parameters.getParameter<double>("rhMax");
00249   rhAnalysis.push_back(dbe->book1D("StaRh_Frac_inGlb", "recHits_{STAinGLB} / recHits_{GLB}", rhBin, rhMin, rhMax));
00250   rhAnalysis.push_back(dbe->book1D("TkRh_Frac_inGlb", "recHits_{TKinGLB} / recHits_{GLB}", rhBin, rhMin, rhMax));
00251   rhAnalysis.push_back(dbe->book1D("StaRh_inGlb_Div_RhAssoSta", "recHits_{STAinGLB} / recHits_{STAfromGLB}", rhBin, rhMin, rhMax));
00252   rhAnalysis.push_back(dbe->book1D("TkRh_inGlb_Div_RhAssoTk", "recHits_{TKinGLB} / recHits_{TKfromGLB}", rhBin, rhMin, rhMax));
00253   rhAnalysis.push_back(dbe->book1D("GlbRh_Div_RhAssoStaTk", "recHits_{GLB} / (recHits_{TKfromGLB}+recHits_{STAfromGLB})", rhBin, rhMin, rhMax));
00254   rhAnalysis.push_back(dbe->book1D("invalidRh_Frac_inTk", "Invalid recHits / rechits_{GLB}", rhBin, rhMin, rhMax));
00255 
00256 }
00257 
00258 
00259 void MuonRecoAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Muon& recoMu) {
00260 
00261   LogTrace(metname)<<"[MuonRecoAnalyzer] Analyze the mu";
00262 
00263   if(recoMu.isGlobalMuon()) {
00264 
00265     LogTrace(metname)<<"[MuonRecoAnalyzer] The mu is global - filling the histos";
00266     if(recoMu.isTrackerMuon() && recoMu.isStandAloneMuon())
00267       muReco->Fill(1);
00268     if(!(recoMu.isTrackerMuon()) && recoMu.isStandAloneMuon())
00269       muReco->Fill(2);
00270     if(!recoMu.isStandAloneMuon())
00271       LogTrace(metname)<<"[MuonRecoAnalyzer] ERROR: the mu is global but not standalone!";
00272 
00273     // get the track combinig the information from both the Tracker and the Spectrometer
00274     reco::TrackRef recoCombinedGlbTrack = recoMu.combinedMuon();
00275     // get the track using only the tracker data
00276     reco::TrackRef recoTkGlbTrack = recoMu.track();
00277     // get the track using only the mu spectrometer data
00278     reco::TrackRef recoStaGlbTrack = recoMu.standAloneMuon();
00279   
00280     etaGlbTrack[0]->Fill(recoCombinedGlbTrack->eta());
00281     etaGlbTrack[1]->Fill(recoTkGlbTrack->eta());
00282     etaGlbTrack[2]->Fill(recoStaGlbTrack->eta());
00283     etaResolution[0]->Fill(recoTkGlbTrack->eta()-recoCombinedGlbTrack->eta());
00284     etaResolution[1]->Fill(-recoStaGlbTrack->eta()+recoCombinedGlbTrack->eta());
00285     etaResolution[2]->Fill(recoTkGlbTrack->eta()-recoStaGlbTrack->eta());
00286     etaResolution[3]->Fill(recoCombinedGlbTrack->eta(), recoTkGlbTrack->eta()-recoCombinedGlbTrack->eta());
00287     etaResolution[4]->Fill(recoCombinedGlbTrack->eta(), -recoStaGlbTrack->eta()+recoCombinedGlbTrack->eta());
00288     etaResolution[5]->Fill(recoCombinedGlbTrack->eta(), recoTkGlbTrack->eta()-recoStaGlbTrack->eta());
00289 
00290     thetaGlbTrack[0]->Fill(recoCombinedGlbTrack->theta());
00291     thetaGlbTrack[1]->Fill(recoTkGlbTrack->theta());
00292     thetaGlbTrack[2]->Fill(recoStaGlbTrack->theta());
00293     thetaResolution[0]->Fill(recoTkGlbTrack->theta()-recoCombinedGlbTrack->theta());
00294     thetaResolution[1]->Fill(-recoStaGlbTrack->theta()+recoCombinedGlbTrack->theta());
00295     thetaResolution[2]->Fill(recoTkGlbTrack->theta()-recoStaGlbTrack->theta());
00296     thetaResolution[3]->Fill(recoCombinedGlbTrack->theta(), recoTkGlbTrack->theta()-recoCombinedGlbTrack->theta());
00297     thetaResolution[4]->Fill(recoCombinedGlbTrack->theta(), -recoStaGlbTrack->theta()+recoCombinedGlbTrack->theta());
00298     thetaResolution[5]->Fill(recoCombinedGlbTrack->theta(), recoTkGlbTrack->theta()-recoStaGlbTrack->theta());
00299      
00300     phiGlbTrack[0]->Fill(recoCombinedGlbTrack->phi());
00301     phiGlbTrack[1]->Fill(recoTkGlbTrack->phi());
00302     phiGlbTrack[2]->Fill(recoStaGlbTrack->phi());
00303     phiResolution[0]->Fill(recoTkGlbTrack->phi()-recoCombinedGlbTrack->phi());
00304     phiResolution[1]->Fill(-recoStaGlbTrack->phi()+recoCombinedGlbTrack->phi());
00305     phiResolution[2]->Fill(recoTkGlbTrack->phi()-recoStaGlbTrack->phi());
00306     phiResolution[3]->Fill(recoCombinedGlbTrack->phi(), recoTkGlbTrack->phi()-recoCombinedGlbTrack->phi());
00307     phiResolution[4]->Fill(recoCombinedGlbTrack->phi(), -recoStaGlbTrack->phi()+recoCombinedGlbTrack->phi());
00308     phiResolution[5]->Fill(recoCombinedGlbTrack->phi(), recoTkGlbTrack->phi()-recoStaGlbTrack->phi());
00309     
00310     chi2OvDFGlbTrack[0]->Fill(recoCombinedGlbTrack->normalizedChi2());
00311     chi2OvDFGlbTrack[1]->Fill(recoTkGlbTrack->normalizedChi2());
00312     chi2OvDFGlbTrack[2]->Fill(recoStaGlbTrack->normalizedChi2());
00313 
00314     pGlbTrack[0]->Fill(recoCombinedGlbTrack->p());
00315     pGlbTrack[1]->Fill(recoTkGlbTrack->p());
00316     pGlbTrack[2]->Fill(recoStaGlbTrack->p());
00317 
00318     ptGlbTrack[0]->Fill(recoCombinedGlbTrack->pt());
00319     ptGlbTrack[1]->Fill(recoTkGlbTrack->pt());
00320     ptGlbTrack[2]->Fill(recoStaGlbTrack->pt());
00321 
00322     qGlbTrack[0]->Fill(recoCombinedGlbTrack->charge());
00323     qGlbTrack[1]->Fill(recoTkGlbTrack->charge());
00324     qGlbTrack[2]->Fill(recoStaGlbTrack->charge());
00325     if(recoCombinedGlbTrack->charge()==recoStaGlbTrack->charge()) qGlbTrack[3]->Fill(1);
00326     else qGlbTrack[3]->Fill(2);
00327     if(recoCombinedGlbTrack->charge()==recoTkGlbTrack->charge()) qGlbTrack[3]->Fill(3);
00328     else qGlbTrack[3]->Fill(4);
00329     if(recoStaGlbTrack->charge()==recoTkGlbTrack->charge()) qGlbTrack[3]->Fill(5);
00330     else qGlbTrack[3]->Fill(6);
00331     if(recoCombinedGlbTrack->charge()!=recoStaGlbTrack->charge() && recoCombinedGlbTrack->charge()!=recoTkGlbTrack->charge()) qGlbTrack[3]->Fill(7);
00332     if(recoCombinedGlbTrack->charge()==recoStaGlbTrack->charge() && recoCombinedGlbTrack->charge()==recoTkGlbTrack->charge()) qGlbTrack[3]->Fill(8);
00333     
00334     qOverpResolution[0]->Fill((recoTkGlbTrack->charge()/recoTkGlbTrack->p())-(recoCombinedGlbTrack->charge()/recoCombinedGlbTrack->p()));
00335     qOverpResolution[1]->Fill(-(recoStaGlbTrack->charge()/recoStaGlbTrack->p())+(recoCombinedGlbTrack->charge()/recoCombinedGlbTrack->p()));
00336     qOverpResolution[2]->Fill((recoTkGlbTrack->charge()/recoTkGlbTrack->p())-(recoStaGlbTrack->charge()/recoStaGlbTrack->p()));
00337     oneOverpResolution[0]->Fill((1/recoTkGlbTrack->p())-(1/recoCombinedGlbTrack->p()));
00338     oneOverpResolution[1]->Fill(-(1/recoStaGlbTrack->p())+(1/recoCombinedGlbTrack->p()));
00339     oneOverpResolution[2]->Fill((1/recoTkGlbTrack->p())-(1/recoStaGlbTrack->p()));
00340     qOverptResolution[0]->Fill((recoTkGlbTrack->charge()/recoTkGlbTrack->pt())-(recoCombinedGlbTrack->charge()/recoCombinedGlbTrack->pt()));
00341     qOverptResolution[1]->Fill(-(recoStaGlbTrack->charge()/recoStaGlbTrack->pt())+(recoCombinedGlbTrack->charge()/recoCombinedGlbTrack->pt()));
00342     qOverptResolution[2]->Fill((recoTkGlbTrack->charge()/recoTkGlbTrack->pt())-(recoStaGlbTrack->charge()/recoStaGlbTrack->pt()));
00343     oneOverptResolution[0]->Fill((1/recoTkGlbTrack->pt())-(1/recoCombinedGlbTrack->pt()));
00344     oneOverptResolution[1]->Fill(-(1/recoStaGlbTrack->pt())+(1/recoCombinedGlbTrack->pt()));
00345     oneOverptResolution[2]->Fill((1/recoTkGlbTrack->pt())-(1/recoStaGlbTrack->pt()));
00346     oneOverptResolution[3]->Fill(recoCombinedGlbTrack->eta(),(1/recoTkGlbTrack->pt())-(1/recoCombinedGlbTrack->pt()));
00347     oneOverptResolution[4]->Fill(recoCombinedGlbTrack->eta(),-(1/recoStaGlbTrack->pt())+(1/recoCombinedGlbTrack->pt()));
00348     oneOverptResolution[5]->Fill(recoCombinedGlbTrack->eta(),(1/recoTkGlbTrack->pt())-(1/recoStaGlbTrack->pt()));
00349     oneOverptResolution[6]->Fill(recoCombinedGlbTrack->phi(),(1/recoTkGlbTrack->pt())-(1/recoCombinedGlbTrack->pt()));
00350     oneOverptResolution[7]->Fill(recoCombinedGlbTrack->phi(),-(1/recoStaGlbTrack->pt())+(1/recoCombinedGlbTrack->pt()));
00351     oneOverptResolution[8]->Fill(recoCombinedGlbTrack->phi(),(1/recoTkGlbTrack->pt())-(1/recoStaGlbTrack->pt()));
00352     oneOverptResolution[9]->Fill(recoCombinedGlbTrack->pt(),(1/recoTkGlbTrack->pt())-(1/recoCombinedGlbTrack->pt()));
00353     oneOverptResolution[10]->Fill(recoCombinedGlbTrack->pt(),-(1/recoStaGlbTrack->pt())+(1/recoCombinedGlbTrack->pt()));
00354     oneOverptResolution[11]->Fill(recoCombinedGlbTrack->pt(),(1/recoTkGlbTrack->pt())-(1/recoStaGlbTrack->pt()));
00355     
00356     // valid hits Glb track
00357     double rhGlb = recoCombinedGlbTrack->found();
00358     // valid hits Glb track from Tracker
00359     double rhGlb_StaProvenance=0;
00360     // valid hits Glb track from Sta system
00361     double rhGlb_TkProvenance=0;
00362     for (trackingRecHit_iterator recHit = recoCombinedGlbTrack->recHitsBegin();
00363          recHit!=recoCombinedGlbTrack->recHitsEnd(); ++recHit){
00364       if((*recHit)->isValid()){
00365         DetId id = (*recHit)->geographicalId();
00366         if (id.det() == DetId::Muon)
00367           rhGlb_StaProvenance++;
00368         if (id.det() == DetId::Tracker)
00369           rhGlb_TkProvenance++;
00370       }
00371     }
00372     // valid hits Sta track associated to Glb track
00373     double rhStaGlb = recoStaGlbTrack->recHitsSize();
00374     // valid hits Traker track associated to Glb track
00375     double rhTkGlb = recoTkGlbTrack->found();
00376     // invalid hits Traker track associated to Glb track
00377     double rhTkGlb_notValid = recoTkGlbTrack->lost();
00378    
00379     // fill the histos
00380     rhAnalysis[0]->Fill(rhGlb_StaProvenance/rhGlb);
00381     rhAnalysis[1]->Fill(rhGlb_TkProvenance/rhGlb);
00382     rhAnalysis[2]->Fill(rhGlb_StaProvenance/rhStaGlb);
00383     rhAnalysis[3]->Fill(rhGlb_TkProvenance/rhTkGlb);
00384     rhAnalysis[4]->Fill(rhGlb/(rhStaGlb+rhTkGlb));
00385     rhAnalysis[5]->Fill(rhTkGlb_notValid/rhGlb);
00386     
00387   }
00388 
00389 
00390   if(recoMu.isTrackerMuon() && !(recoMu.isGlobalMuon())) {
00391     LogTrace(metname)<<"[MuonRecoAnalyzer] The mu is tracker only - filling the histos";
00392      if(recoMu.isStandAloneMuon())
00393       muReco->Fill(3);
00394     if(!(recoMu.isStandAloneMuon()))
00395       muReco->Fill(4);
00396 
00397     // get the track using only the tracker data
00398     reco::TrackRef recoTrack = recoMu.track();
00399 
00400     etaTrack->Fill(recoTrack->eta());
00401     thetaTrack->Fill(recoTrack->theta());
00402     phiTrack->Fill(recoTrack->phi());
00403     chi2OvDFTrack->Fill(recoTrack->normalizedChi2());
00404     pTrack->Fill(recoTrack->p());
00405     ptTrack->Fill(recoTrack->pt());
00406     qTrack->Fill(recoTrack->charge());
00407     
00408   }
00409 
00410   if(recoMu.isStandAloneMuon() && !(recoMu.isGlobalMuon())) {
00411     LogTrace(metname)<<"[MuonRecoAnalyzer] The mu is STA only - filling the histos";
00412     if(!(recoMu.isTrackerMuon()))
00413       muReco->Fill(5);
00414      
00415     // get the track using only the mu spectrometer data
00416     reco::TrackRef recoStaTrack = recoMu.standAloneMuon();
00417 
00418     etaStaTrack->Fill(recoStaTrack->eta());
00419     thetaStaTrack->Fill(recoStaTrack->theta());
00420     phiStaTrack->Fill(recoStaTrack->phi());
00421     chi2OvDFStaTrack->Fill(recoStaTrack->normalizedChi2());
00422     pStaTrack->Fill(recoStaTrack->p());
00423     ptStaTrack->Fill(recoStaTrack->pt());
00424     qStaTrack->Fill(recoStaTrack->charge());
00425 
00426   }
00427     
00428   if(recoMu.isCaloMuon() && !(recoMu.isGlobalMuon()) && !(recoMu.isTrackerMuon()) && !(recoMu.isStandAloneMuon()))
00429     muReco->Fill(6);
00430   
00431   //efficiency plots
00432   
00433   // get the track using only the mu spectrometer data
00434   reco::TrackRef recoStaGlbTrack = recoMu.standAloneMuon();
00435   
00436   if(recoMu.isStandAloneMuon()){
00437     etaEfficiency[0]->Fill(recoStaGlbTrack->eta());
00438     phiEfficiency[0]->Fill(recoStaGlbTrack->phi());
00439   }
00440   if(recoMu.isStandAloneMuon() && recoMu.isGlobalMuon()){
00441     etaEfficiency[1]->Fill(recoStaGlbTrack->eta());
00442     phiEfficiency[1]->Fill(recoStaGlbTrack->phi());
00443   }
00444 
00445 
00446 
00447 
00448 }

Generated on Tue Jun 9 17:33:50 2009 for CMSSW by  doxygen 1.5.4