CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

MuonRecoTest Class Reference

#include <MuonRecoTest.h>

Inheritance diagram for MuonRecoTest:
edm::EDAnalyzer

List of all members.

Public Member Functions

 MuonRecoTest (const edm::ParameterSet &ps)
 Constructor.
virtual ~MuonRecoTest ()
 Destructor.

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze.
void beginJob (void)
 BeginJob.
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
void beginRun (edm::Run const &run, edm::EventSetup const &eSetup)
void endJob ()
 Endjob.
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 DQM Client Diagnostic.
void endRun (edm::Run const &run, edm::EventSetup const &eSetup)

Private Attributes

int etaBin
MonitorElementetaEfficiency
double etaMax
double etaMin
std::vector< MonitorElement * > globalRotation
std::string metname
int nevents
unsigned int nLumiSegs
edm::ParameterSet parameters
int phiBin
MonitorElementphiEfficiency
double phiMax
double phiMin
int prescaleFactor
int run
DQMStoretheDbe

Detailed Description

* DQMOffline Test Client check the recostruction efficiency of Sta/Glb on eta, phi parameters

Date:
2009/12/22 17:42:47
Revision:
1.5
Author:
G. Mila - INFN Torino

Definition at line 39 of file MuonRecoTest.h.


Constructor & Destructor Documentation

MuonRecoTest::MuonRecoTest ( const edm::ParameterSet ps)
MuonRecoTest::~MuonRecoTest ( ) [virtual]

Destructor.

Definition at line 48 of file MuonRecoTest.cc.

References LogTrace, metname, and nevents.

                           {

  LogTrace(metname) << "MuonRecoTest: analyzed " << nevents << " events";

}

Member Function Documentation

void MuonRecoTest::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

Analyze.

Implements edm::EDAnalyzer.

Definition at line 97 of file MuonRecoTest.cc.

References LogTrace, metname, and nevents.

                                                                         {

  nevents++;
  LogTrace(metname)<< "[MuonRecoTest]: "<<nevents<<" events";

}
void MuonRecoTest::beginJob ( void  ) [protected, virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file MuonRecoTest.cc.

References ExpressReco_HICollisions_FallBack::etaBin, ExpressReco_HICollisions_FallBack::etaMax, ExpressReco_HICollisions_FallBack::etaMin, LogTrace, metname, ExpressReco_HICollisions_FallBack::parameters, ExpressReco_HICollisions_FallBack::phiBin, ExpressReco_HICollisions_FallBack::phiMax, and ExpressReco_HICollisions_FallBack::phiMin.

                               {

  metname = "muonRecoTest";
  theDbe->setCurrentFolder("Muons/Tests/muonRecoTest");

  LogTrace(metname)<<"[MuonRecoTest] beginJob: Parameters initialization";
 
  // efficiency plot

  etaBin = parameters.getParameter<int>("etaBin");
  etaMin = parameters.getParameter<double>("etaMin");
  etaMax = parameters.getParameter<double>("etaMax");
  etaEfficiency = theDbe->book1D("etaEfficiency_staMuon", "#eta_{STA} efficiency", etaBin, etaMin, etaMax);

  phiBin = parameters.getParameter<int>("phiBin");
  phiMin = parameters.getParameter<double>("phiMin");
  phiMax = parameters.getParameter<double>("phiMax");
  phiEfficiency = theDbe->book1D("phiEfficiency_staMuon", "#phi_{STA} efficiency", phiBin, phiMin, phiMax);

  // alignment plots
  globalRotation.push_back(theDbe->book1D("muVStkSytemRotation_posMu_profile", "pT_{TK} / pT_{GLB} vs pT_{GLB} profile for #mu^{+}",50,0,200));
  globalRotation.push_back(theDbe->book1D("muVStkSytemRotation_negMu_profile", "pT_{TK} / pT_{GLB} vs pT_{GLB} profile for #mu^{-}",50,0,200));
  globalRotation.push_back(theDbe->book1D("muVStkSytemRotation_profile", "pT_{TK} / pT_{GLB} vs pT_{GLB} profile for #mu^{+}-#mu^{-}",50,0,200));

}
void MuonRecoTest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 87 of file MuonRecoTest.cc.

References CrabTask::run, and edm::LuminosityBlockBase::run().

                                                                                                 {

  //  LogTrace(metname)<<"[MuonRecoTest]: beginLuminosityBlock";

  // Get the run number
  run = lumiSeg.run();

}
void MuonRecoTest::beginRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 81 of file MuonRecoTest.cc.

References LogTrace, and metname.

                                                                    {

  LogTrace(metname)<<"[MuonRecoTest]: beginRun";

}
void MuonRecoTest::endJob ( void  ) [protected, virtual]

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 221 of file MuonRecoTest.cc.

References LogTrace, and metname.

                         {
  
  LogTrace(metname)<< "[MuonRecoTest] endJob called!";
  theDbe->rmdir("Muons/Tests/muonRecoTest");
  
}
void MuonRecoTest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
) [protected, virtual]

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 106 of file MuonRecoTest.cc.

References edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), and ExpressReco_HICollisions_FallBack::prescaleFactor.

                                                                                               {

  //  LogTrace(metname)<<"[MuonRecoTest]: endLuminosityBlock, performing the DQM LS client operation";
  
  // counts number of lumiSegs 
  nLumiSegs = lumiSeg.id().luminosityBlock();
  
  // prescale factor
  if ( nLumiSegs%prescaleFactor != 0 ) return;

}
void MuonRecoTest::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 118 of file MuonRecoTest.cc.

References ExpressReco_HICollisions_FallBack::etaBin, ExpressReco_HICollisions_FallBack::etaMax, ExpressReco_HICollisions_FallBack::etaMin, QReport::getBadChannels(), QReport::getMessage(), QReport::getStatus(), MonitorElement::getTH1F(), MonitorElement::getTH2F(), i, LogTrace, metname, ExpressReco_HICollisions_FallBack::parameters, path(), ExpressReco_HICollisions_FallBack::phiBin, ExpressReco_HICollisions_FallBack::phiMax, ExpressReco_HICollisions_FallBack::phiMin, mathSSE::sqrt(), and ExpressReco_HICollisions_FallBack::x.

                                                                  {

  LogTrace(metname)<<"[MuonRecoTest]: endRun, performing the DQM end of run client operation";

  string path = "Muons/MuonRecoAnalyzer/StaEta_ifCombinedAlso";
  MonitorElement * staEtaIfComb_histo = theDbe->get(path);
  path = "Muons/MuonRecoAnalyzer/StaEta";
  MonitorElement * staEta_histo = theDbe->get(path);

  if(staEtaIfComb_histo && staEta_histo){
    TH1F * staEtaIfComb_root = staEtaIfComb_histo->getTH1F();
    TH1F * staEta_root = staEta_histo->getTH1F();

    if(staEtaIfComb_root->GetXaxis()->GetNbins()!=etaBin
       || staEtaIfComb_root->GetXaxis()->GetXmax()!=etaMax
       || staEtaIfComb_root->GetXaxis()->GetXmin()!=etaMin){
      LogTrace(metname)<<"[MuonRecoTest] wrong histo binning on eta histograms";
      return;
    }

    for(int i=1; i<=etaBin; i++){
      if(staEta_root->GetBinContent(i)!=0){
        double efficiency = double(staEtaIfComb_root->GetBinContent(i))/double(staEta_root->GetBinContent(i));
        etaEfficiency->setBinContent(i,efficiency);
      }
    }
  }

  path = "Muons/MuonRecoAnalyzer/StaPhi_ifCombinedAlso";
  MonitorElement * staPhiIfComb_histo = theDbe->get(path);
  path = "Muons/MuonRecoAnalyzer/StaPhi";
  MonitorElement * staPhi_histo = theDbe->get(path);

  if(staPhiIfComb_histo && staPhi_histo){
 
    TH1F * staPhiIfComb_root = staPhiIfComb_histo->getTH1F();
    TH1F * staPhi_root = staPhi_histo->getTH1F();

    if(staPhiIfComb_root->GetXaxis()->GetNbins()!=phiBin
       || staPhiIfComb_root->GetXaxis()->GetXmax()!=phiMax
       || staPhiIfComb_root->GetXaxis()->GetXmin()!=phiMin){
      LogTrace(metname)<<"[MuonRecoTest] wrong histo binning on phi histograms";
      return;
    }

    for(int i=1; i<=etaBin; i++){
      if(staPhi_root->GetBinContent(i)!=0){
        double efficiency = double(staPhiIfComb_root->GetBinContent(i))/double(staPhi_root->GetBinContent(i));
        phiEfficiency->setBinContent(i,efficiency);
      }
    }
  }


  // efficiency test 
  string EfficiencyCriterionName = parameters.getUntrackedParameter<string>("efficiencyTestName","EfficiencyInRange"); 

  // eta efficiency
  const QReport * theEtaQReport = etaEfficiency->getQReport(EfficiencyCriterionName);
  if(theEtaQReport) {
    vector<dqm::me_util::Channel> badChannels = theEtaQReport->getBadChannels();
    for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); 
         channel != badChannels.end(); channel++) {
      LogTrace(metname)<<"[etaEfficiency test] bad ranges: "<<(*channel).getBin()<<"  Contents : "<<(*channel).getContents()<<endl;
    }
    LogTrace(metname)<< "-------- type: [etaEfficiency]  "<<theEtaQReport->getMessage()<<" ------- "<<theEtaQReport->getStatus()<<endl;
  }
  // phi efficiency
  const QReport * thePhiQReport = phiEfficiency->getQReport(EfficiencyCriterionName);
  if(thePhiQReport) {
    vector<dqm::me_util::Channel> badChannels = thePhiQReport->getBadChannels();
    for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); 
         channel != badChannels.end(); channel++) {
      LogTrace(metname)<< "[phiEfficiency test] bad ranges: "<<(*channel).getBin()<<"  Contents : "<<(*channel).getContents()<<endl;
    }
    LogTrace(metname)<<"-------- type: [phiEfficiency]  "<<thePhiQReport->getMessage()<<" ------- "<<thePhiQReport->getStatus()<<endl;
  }

  //alignment plot
  string pathPos = "Muons/MuonRecoAnalyzer/muVStkSytemRotation_posMu";
  MonitorElement * muVStkSytemRotation_posMu_histo = theDbe->get(pathPos);
  string pathNeg = "Muons/MuonRecoAnalyzer/muVStkSytemRotation_negMu";
  MonitorElement * muVStkSytemRotation_negMu_histo = theDbe->get(pathNeg);
  if(muVStkSytemRotation_posMu_histo && muVStkSytemRotation_negMu_histo){

    TH2F * muVStkSytemRotation_posMu_root = muVStkSytemRotation_posMu_histo->getTH2F();
    TProfile * muVStkSytemRotation_posMu_profile = muVStkSytemRotation_posMu_root->ProfileX("",1,100);
    TH2F * muVStkSytemRotation_negMu_root = muVStkSytemRotation_negMu_histo->getTH2F();
    TProfile * muVStkSytemRotation_negMu_profile = muVStkSytemRotation_negMu_root->ProfileX("",1,100);

    for(int x=1; x<50; x++){
      globalRotation[0]->Fill((x*4)-1,muVStkSytemRotation_posMu_profile->GetBinContent(x));
      globalRotation[0]->setBinError(x,muVStkSytemRotation_posMu_profile->GetBinError(x));
      globalRotation[1]->Fill((x*4)-1,muVStkSytemRotation_negMu_profile->GetBinContent(x));
      globalRotation[1]->setBinError(x,muVStkSytemRotation_negMu_profile->GetBinError(x));
      globalRotation[2]->Fill((x*4)-1,muVStkSytemRotation_posMu_profile->GetBinContent(x)-muVStkSytemRotation_negMu_profile->GetBinContent(x));
      globalRotation[2]->setBinError(x,sqrt((muVStkSytemRotation_posMu_profile->GetBinError(x)*muVStkSytemRotation_posMu_profile->GetBinError(x))
                                            + (muVStkSytemRotation_negMu_profile->GetBinError(x)*muVStkSytemRotation_negMu_profile->GetBinError(x))));
    }
  }

}

Member Data Documentation

int MuonRecoTest::etaBin [private]

Definition at line 82 of file MuonRecoTest.h.

Definition at line 91 of file MuonRecoTest.h.

double MuonRecoTest::etaMax [private]

Definition at line 84 of file MuonRecoTest.h.

double MuonRecoTest::etaMin [private]

Definition at line 83 of file MuonRecoTest.h.

Definition at line 94 of file MuonRecoTest.h.

std::string MuonRecoTest::metname [private]

Definition at line 76 of file MuonRecoTest.h.

int MuonRecoTest::nevents [private]

Definition at line 71 of file MuonRecoTest.h.

unsigned int MuonRecoTest::nLumiSegs [private]

Definition at line 72 of file MuonRecoTest.h.

Definition at line 79 of file MuonRecoTest.h.

int MuonRecoTest::phiBin [private]

Definition at line 86 of file MuonRecoTest.h.

Definition at line 92 of file MuonRecoTest.h.

double MuonRecoTest::phiMax [private]

Definition at line 88 of file MuonRecoTest.h.

double MuonRecoTest::phiMin [private]

Definition at line 87 of file MuonRecoTest.h.

Definition at line 73 of file MuonRecoTest.h.

int MuonRecoTest::run [private]

Definition at line 74 of file MuonRecoTest.h.

Definition at line 78 of file MuonRecoTest.h.