CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
MuonRecoTest Class Reference

#include <MuonRecoTest.h>

Inheritance diagram for MuonRecoTest:
edm::EDAnalyzer

Public Member Functions

 MuonRecoTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~MuonRecoTest ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginJob (void)
 BeginJob. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 
void beginRun (edm::Run const &run, edm::EventSetup const &eSetup)
 
void endJob ()
 Endjob. More...
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 DQM Client Diagnostic. More...
 
void endRun (edm::Run const &run, edm::EventSetup const &eSetup)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 39 of file MuonRecoTest.h.

Constructor & Destructor Documentation

MuonRecoTest::MuonRecoTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 37 of file MuonRecoTest.cc.

References cmsCodeRules.cppFunctionSkipper::operator, Parameters::parameters, and dtDQMClient_cfg::prescaleFactor.

37  {
38 
39  parameters = ps;
40 
42 
43  prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 1);
44 
45 }
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet parameters
Definition: MuonRecoTest.h:79
int prescaleFactor
Definition: MuonRecoTest.h:73
DQMStore * theDbe
Definition: MuonRecoTest.h:78
MuonRecoTest::~MuonRecoTest ( )
virtual

Destructor.

Definition at line 48 of file MuonRecoTest.cc.

References LogTrace, metname, and nevents.

48  {
49 
50  LogTrace(metname) << "MuonRecoTest: analyzed " << nevents << " events";
51 
52 }
std::string metname
Definition: MuonRecoTest.h:76
#define LogTrace(id)

Member Function Documentation

void MuonRecoTest::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 97 of file MuonRecoTest.cc.

References LogTrace, metname, and nevents.

97  {
98 
99  nevents++;
100  LogTrace(metname)<< "[MuonRecoTest]: "<<nevents<<" events";
101 
102 }
std::string metname
Definition: MuonRecoTest.h:76
#define LogTrace(id)
void MuonRecoTest::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file MuonRecoTest.cc.

References jptDQMConfig_cff::etaMax, jptDQMConfig_cff::etaMin, LogTrace, metname, Parameters::parameters, jptDQMConfig_cff::phiMax, and jptDQMConfig_cff::phiMin.

55  {
56 
57  metname = "muonRecoTest";
58  theDbe->setCurrentFolder("Muons/Tests/muonRecoTest");
59 
60  LogTrace(metname)<<"[MuonRecoTest] beginJob: Parameters initialization";
61 
62  // efficiency plot
63 
64  etaBin = parameters.getParameter<int>("etaBin");
65  etaMin = parameters.getParameter<double>("etaMin");
66  etaMax = parameters.getParameter<double>("etaMax");
67  etaEfficiency = theDbe->book1D("etaEfficiency_staMuon", "#eta_{STA} efficiency", etaBin, etaMin, etaMax);
68 
69  phiBin = parameters.getParameter<int>("phiBin");
70  phiMin = parameters.getParameter<double>("phiMin");
71  phiMax = parameters.getParameter<double>("phiMax");
72  phiEfficiency = theDbe->book1D("phiEfficiency_staMuon", "#phi_{STA} efficiency", phiBin, phiMin, phiMax);
73 
74  // alignment plots
75  globalRotation.push_back(theDbe->book1D("muVStkSytemRotation_posMu_profile", "pT_{TK} / pT_{GLB} vs pT_{GLB} profile for #mu^{+}",50,0,200));
76  globalRotation.push_back(theDbe->book1D("muVStkSytemRotation_negMu_profile", "pT_{TK} / pT_{GLB} vs pT_{GLB} profile for #mu^{-}",50,0,200));
77  globalRotation.push_back(theDbe->book1D("muVStkSytemRotation_profile", "pT_{TK} / pT_{GLB} vs pT_{GLB} profile for #mu^{+}-#mu^{-}",50,0,200));
78 
79 }
T getParameter(std::string const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:514
double etaMin
Definition: MuonRecoTest.h:83
std::vector< MonitorElement * > globalRotation
Definition: MuonRecoTest.h:94
std::string metname
Definition: MuonRecoTest.h:76
#define LogTrace(id)
double etaMax
Definition: MuonRecoTest.h:84
MonitorElement * phiEfficiency
Definition: MuonRecoTest.h:92
double phiMax
Definition: MuonRecoTest.h:88
edm::ParameterSet parameters
Definition: MuonRecoTest.h:79
double phiMin
Definition: MuonRecoTest.h:87
MonitorElement * etaEfficiency
Definition: MuonRecoTest.h:91
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232
DQMStore * theDbe
Definition: MuonRecoTest.h:78
void MuonRecoTest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 87 of file MuonRecoTest.cc.

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

87  {
88 
89  // LogTrace(metname)<<"[MuonRecoTest]: beginLuminosityBlock";
90 
91  // Get the run number
92  run = lumiSeg.run();
93 
94 }
void MuonRecoTest::beginRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 81 of file MuonRecoTest.cc.

References LogTrace, and metname.

81  {
82 
83  LogTrace(metname)<<"[MuonRecoTest]: beginRun";
84 
85 }
std::string metname
Definition: MuonRecoTest.h:76
#define LogTrace(id)
void MuonRecoTest::endJob ( void  )
protectedvirtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 221 of file MuonRecoTest.cc.

References LogTrace, and metname.

221  {
222 
223  LogTrace(metname)<< "[MuonRecoTest] endJob called!";
224  theDbe->rmdir("Muons/Tests/muonRecoTest");
225 
226 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2311
std::string metname
Definition: MuonRecoTest.h:76
#define LogTrace(id)
DQMStore * theDbe
Definition: MuonRecoTest.h:78
void MuonRecoTest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
protectedvirtual

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 106 of file MuonRecoTest.cc.

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

106  {
107 
108  // LogTrace(metname)<<"[MuonRecoTest]: endLuminosityBlock, performing the DQM LS client operation";
109 
110  // counts number of lumiSegs
111  nLumiSegs = lumiSeg.id().luminosityBlock();
112 
113  // prescale factor
114  if ( nLumiSegs%prescaleFactor != 0 ) return;
115 
116 }
unsigned int nLumiSegs
Definition: MuonRecoTest.h:72
int prescaleFactor
Definition: MuonRecoTest.h:73
void MuonRecoTest::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 118 of file MuonRecoTest.cc.

References postValidation_cfi::efficiency, jptDQMConfig_cff::etaMax, jptDQMConfig_cff::etaMin, QReport::getBadChannels(), QReport::getMessage(), QReport::getStatus(), MonitorElement::getTH1F(), MonitorElement::getTH2F(), i, LogTrace, metname, Parameters::parameters, path(), jptDQMConfig_cff::phiMax, jptDQMConfig_cff::phiMin, mathSSE::sqrt(), and x.

118  {
119 
120  LogTrace(metname)<<"[MuonRecoTest]: endRun, performing the DQM end of run client operation";
121 
122  string path = "Muons/MuonRecoAnalyzer/StaEta_ifCombinedAlso";
123  MonitorElement * staEtaIfComb_histo = theDbe->get(path);
124  path = "Muons/MuonRecoAnalyzer/StaEta";
125  MonitorElement * staEta_histo = theDbe->get(path);
126 
127  if(staEtaIfComb_histo && staEta_histo){
128  TH1F * staEtaIfComb_root = staEtaIfComb_histo->getTH1F();
129  TH1F * staEta_root = staEta_histo->getTH1F();
130 
131  if(staEtaIfComb_root->GetXaxis()->GetNbins()!=etaBin
132  || staEtaIfComb_root->GetXaxis()->GetXmax()!=etaMax
133  || staEtaIfComb_root->GetXaxis()->GetXmin()!=etaMin){
134  LogTrace(metname)<<"[MuonRecoTest] wrong histo binning on eta histograms";
135  return;
136  }
137 
138  for(int i=1; i<=etaBin; i++){
139  if(staEta_root->GetBinContent(i)!=0){
140  double efficiency = double(staEtaIfComb_root->GetBinContent(i))/double(staEta_root->GetBinContent(i));
141  etaEfficiency->setBinContent(i,efficiency);
142  }
143  }
144  }
145 
146  path = "Muons/MuonRecoAnalyzer/StaPhi_ifCombinedAlso";
147  MonitorElement * staPhiIfComb_histo = theDbe->get(path);
148  path = "Muons/MuonRecoAnalyzer/StaPhi";
149  MonitorElement * staPhi_histo = theDbe->get(path);
150 
151  if(staPhiIfComb_histo && staPhi_histo){
152 
153  TH1F * staPhiIfComb_root = staPhiIfComb_histo->getTH1F();
154  TH1F * staPhi_root = staPhi_histo->getTH1F();
155 
156  if(staPhiIfComb_root->GetXaxis()->GetNbins()!=phiBin
157  || staPhiIfComb_root->GetXaxis()->GetXmax()!=phiMax
158  || staPhiIfComb_root->GetXaxis()->GetXmin()!=phiMin){
159  LogTrace(metname)<<"[MuonRecoTest] wrong histo binning on phi histograms";
160  return;
161  }
162 
163  for(int i=1; i<=etaBin; i++){
164  if(staPhi_root->GetBinContent(i)!=0){
165  double efficiency = double(staPhiIfComb_root->GetBinContent(i))/double(staPhi_root->GetBinContent(i));
166  phiEfficiency->setBinContent(i,efficiency);
167  }
168  }
169  }
170 
171 
172  // efficiency test
173  string EfficiencyCriterionName = parameters.getUntrackedParameter<string>("efficiencyTestName","EfficiencyInRange");
174 
175  // eta efficiency
176  const QReport * theEtaQReport = etaEfficiency->getQReport(EfficiencyCriterionName);
177  if(theEtaQReport) {
178  vector<dqm::me_util::Channel> badChannels = theEtaQReport->getBadChannels();
179  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
180  channel != badChannels.end(); channel++) {
181  LogTrace(metname)<<"[etaEfficiency test] bad ranges: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents()<<endl;
182  }
183  LogTrace(metname)<< "-------- type: [etaEfficiency] "<<theEtaQReport->getMessage()<<" ------- "<<theEtaQReport->getStatus()<<endl;
184  }
185  // phi efficiency
186  const QReport * thePhiQReport = phiEfficiency->getQReport(EfficiencyCriterionName);
187  if(thePhiQReport) {
188  vector<dqm::me_util::Channel> badChannels = thePhiQReport->getBadChannels();
189  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
190  channel != badChannels.end(); channel++) {
191  LogTrace(metname)<< "[phiEfficiency test] bad ranges: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents()<<endl;
192  }
193  LogTrace(metname)<<"-------- type: [phiEfficiency] "<<thePhiQReport->getMessage()<<" ------- "<<thePhiQReport->getStatus()<<endl;
194  }
195 
196  //alignment plot
197  string pathPos = "Muons/MuonRecoAnalyzer/muVStkSytemRotation_posMu";
198  MonitorElement * muVStkSytemRotation_posMu_histo = theDbe->get(pathPos);
199  string pathNeg = "Muons/MuonRecoAnalyzer/muVStkSytemRotation_negMu";
200  MonitorElement * muVStkSytemRotation_negMu_histo = theDbe->get(pathNeg);
201  if(muVStkSytemRotation_posMu_histo && muVStkSytemRotation_negMu_histo){
202 
203  TH2F * muVStkSytemRotation_posMu_root = muVStkSytemRotation_posMu_histo->getTH2F();
204  TProfile * muVStkSytemRotation_posMu_profile = muVStkSytemRotation_posMu_root->ProfileX("",1,100);
205  TH2F * muVStkSytemRotation_negMu_root = muVStkSytemRotation_negMu_histo->getTH2F();
206  TProfile * muVStkSytemRotation_negMu_profile = muVStkSytemRotation_negMu_root->ProfileX("",1,100);
207 
208  for(int x=1; x<50; x++){
209  globalRotation[0]->Fill((x*4)-1,muVStkSytemRotation_posMu_profile->GetBinContent(x));
210  globalRotation[0]->setBinError(x,muVStkSytemRotation_posMu_profile->GetBinError(x));
211  globalRotation[1]->Fill((x*4)-1,muVStkSytemRotation_negMu_profile->GetBinContent(x));
212  globalRotation[1]->setBinError(x,muVStkSytemRotation_negMu_profile->GetBinError(x));
213  globalRotation[2]->Fill((x*4)-1,muVStkSytemRotation_posMu_profile->GetBinContent(x)-muVStkSytemRotation_negMu_profile->GetBinContent(x));
214  globalRotation[2]->setBinError(x,sqrt((muVStkSytemRotation_posMu_profile->GetBinError(x)*muVStkSytemRotation_posMu_profile->GetBinError(x))
215  + (muVStkSytemRotation_negMu_profile->GetBinError(x)*muVStkSytemRotation_negMu_profile->GetBinError(x))));
216  }
217  }
218 
219 }
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
const QReport * getQReport(const std::string &qtname) const
get QReport corresponding to &lt;qtname&gt; (null pointer if QReport does not exist)
void setBinContent(int binx, double content)
set content of bin (1-D)
const std::string & getMessage(void) const
get message attached to test
Definition: QReport.h:24
int path() const
Definition: HLTadd.h:3
double etaMin
Definition: MuonRecoTest.h:83
std::vector< MonitorElement * > globalRotation
Definition: MuonRecoTest.h:94
T sqrt(T t)
Definition: SSEVec.h:28
int getStatus(void) const
get test status (see Core/interface/QTestStatus.h)
Definition: QReport.h:16
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1265
std::string metname
Definition: MuonRecoTest.h:76
const std::vector< DQMChannel > & getBadChannels(void) const
Definition: QReport.h:33
#define LogTrace(id)
double etaMax
Definition: MuonRecoTest.h:84
MonitorElement * phiEfficiency
Definition: MuonRecoTest.h:92
double phiMax
Definition: MuonRecoTest.h:88
TH1F * getTH1F(void) const
edm::ParameterSet parameters
Definition: MuonRecoTest.h:79
Definition: DDAxes.h:10
TH2F * getTH2F(void) const
double phiMin
Definition: MuonRecoTest.h:87
MonitorElement * etaEfficiency
Definition: MuonRecoTest.h:91
DQMStore * theDbe
Definition: MuonRecoTest.h:78

Member Data Documentation

int MuonRecoTest::etaBin
private

Definition at line 82 of file MuonRecoTest.h.

MonitorElement* MuonRecoTest::etaEfficiency
private

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.

std::vector<MonitorElement*> MuonRecoTest::globalRotation
private

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.

edm::ParameterSet MuonRecoTest::parameters
private
int MuonRecoTest::phiBin
private

Definition at line 86 of file MuonRecoTest.h.

MonitorElement* MuonRecoTest::phiEfficiency
private

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.

int MuonRecoTest::prescaleFactor
private

Definition at line 73 of file MuonRecoTest.h.

int MuonRecoTest::run
private
DQMStore* MuonRecoTest::theDbe
private

Definition at line 78 of file MuonRecoTest.h.