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 edm::EDConsumerBase

Public Member Functions

 MuonRecoTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~MuonRecoTest ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 37 of file MuonRecoTest.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 35 of file MuonRecoTest.cc.

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

35  {
36 
37  parameters = ps;
38 
40 
41  prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 1);
42 
43 }
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet parameters
Definition: MuonRecoTest.h:77
int prescaleFactor
Definition: MuonRecoTest.h:71
DQMStore * theDbe
Definition: MuonRecoTest.h:76
MuonRecoTest::~MuonRecoTest ( )
virtual

Destructor.

Definition at line 46 of file MuonRecoTest.cc.

References LogTrace, metname, and nevents.

46  {
47 
48  LogTrace(metname) << "MuonRecoTest: analyzed " << nevents << " events";
49 
50 }
std::string metname
Definition: MuonRecoTest.h:74
#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 95 of file MuonRecoTest.cc.

References LogTrace, metname, and nevents.

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 53 of file MuonRecoTest.cc.

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

53  {
54 
55  metname = "muonRecoTest";
56  theDbe->setCurrentFolder("Muons/Tests/muonRecoTest");
57 
58  LogTrace(metname)<<"[MuonRecoTest] beginJob: Parameters initialization";
59 
60  // efficiency plot
61 
62  etaBin = parameters.getParameter<int>("etaBin");
63  etaMin = parameters.getParameter<double>("etaMin");
64  etaMax = parameters.getParameter<double>("etaMax");
65  etaEfficiency = theDbe->book1D("etaEfficiency_staMuon", "#eta_{STA} efficiency", etaBin, etaMin, etaMax);
66 
67  phiBin = parameters.getParameter<int>("phiBin");
68  phiMin = parameters.getParameter<double>("phiMin");
69  phiMax = parameters.getParameter<double>("phiMax");
70  phiEfficiency = theDbe->book1D("phiEfficiency_staMuon", "#phi_{STA} efficiency", phiBin, phiMin, phiMax);
71 
72  // alignment plots
73  globalRotation.push_back(theDbe->book1D("muVStkSytemRotation_posMu_profile", "pT_{TK} / pT_{GLB} vs pT_{GLB} profile for #mu^{+}",50,0,200));
74  globalRotation.push_back(theDbe->book1D("muVStkSytemRotation_negMu_profile", "pT_{TK} / pT_{GLB} vs pT_{GLB} profile for #mu^{-}",50,0,200));
75  globalRotation.push_back(theDbe->book1D("muVStkSytemRotation_profile", "pT_{TK} / pT_{GLB} vs pT_{GLB} profile for #mu^{+}-#mu^{-}",50,0,200));
76 
77 }
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:872
double etaMin
Definition: MuonRecoTest.h:81
std::vector< MonitorElement * > globalRotation
Definition: MuonRecoTest.h:92
std::string metname
Definition: MuonRecoTest.h:74
#define LogTrace(id)
double etaMax
Definition: MuonRecoTest.h:82
MonitorElement * phiEfficiency
Definition: MuonRecoTest.h:90
double phiMax
Definition: MuonRecoTest.h:86
edm::ParameterSet parameters
Definition: MuonRecoTest.h:77
double phiMin
Definition: MuonRecoTest.h:85
MonitorElement * etaEfficiency
Definition: MuonRecoTest.h:89
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
DQMStore * theDbe
Definition: MuonRecoTest.h:76
void MuonRecoTest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 85 of file MuonRecoTest.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 79 of file MuonRecoTest.cc.

References LogTrace, and metname.

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

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 219 of file MuonRecoTest.cc.

References LogTrace, and metname.

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

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 104 of file MuonRecoTest.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 116 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, getHLTPrescaleColumns::path, jptDQMConfig_cff::phiMax, jptDQMConfig_cff::phiMin, mathSSE::sqrt(), and x.

116  {
117 
118  LogTrace(metname)<<"[MuonRecoTest]: endRun, performing the DQM end of run client operation";
119 
120  string path = "Muons/MuonRecoAnalyzer/StaEta_ifCombinedAlso";
121  MonitorElement * staEtaIfComb_histo = theDbe->get(path);
122  path = "Muons/MuonRecoAnalyzer/StaEta";
123  MonitorElement * staEta_histo = theDbe->get(path);
124 
125  if(staEtaIfComb_histo && staEta_histo){
126  TH1F * staEtaIfComb_root = staEtaIfComb_histo->getTH1F();
127  TH1F * staEta_root = staEta_histo->getTH1F();
128 
129  if(staEtaIfComb_root->GetXaxis()->GetNbins()!=etaBin
130  || staEtaIfComb_root->GetXaxis()->GetXmax()!=etaMax
131  || staEtaIfComb_root->GetXaxis()->GetXmin()!=etaMin){
132  LogTrace(metname)<<"[MuonRecoTest] wrong histo binning on eta histograms";
133  return;
134  }
135 
136  for(int i=1; i<=etaBin; i++){
137  if(staEta_root->GetBinContent(i)!=0){
138  double efficiency = double(staEtaIfComb_root->GetBinContent(i))/double(staEta_root->GetBinContent(i));
139  etaEfficiency->setBinContent(i,efficiency);
140  }
141  }
142  }
143 
144  path = "Muons/MuonRecoAnalyzer/StaPhi_ifCombinedAlso";
145  MonitorElement * staPhiIfComb_histo = theDbe->get(path);
146  path = "Muons/MuonRecoAnalyzer/StaPhi";
147  MonitorElement * staPhi_histo = theDbe->get(path);
148 
149  if(staPhiIfComb_histo && staPhi_histo){
150 
151  TH1F * staPhiIfComb_root = staPhiIfComb_histo->getTH1F();
152  TH1F * staPhi_root = staPhi_histo->getTH1F();
153 
154  if(staPhiIfComb_root->GetXaxis()->GetNbins()!=phiBin
155  || staPhiIfComb_root->GetXaxis()->GetXmax()!=phiMax
156  || staPhiIfComb_root->GetXaxis()->GetXmin()!=phiMin){
157  LogTrace(metname)<<"[MuonRecoTest] wrong histo binning on phi histograms";
158  return;
159  }
160 
161  for(int i=1; i<=etaBin; i++){
162  if(staPhi_root->GetBinContent(i)!=0){
163  double efficiency = double(staPhiIfComb_root->GetBinContent(i))/double(staPhi_root->GetBinContent(i));
164  phiEfficiency->setBinContent(i,efficiency);
165  }
166  }
167  }
168 
169 
170  // efficiency test
171  string EfficiencyCriterionName = parameters.getUntrackedParameter<string>("efficiencyTestName","EfficiencyInRange");
172 
173  // eta efficiency
174  const QReport * theEtaQReport = etaEfficiency->getQReport(EfficiencyCriterionName);
175  if(theEtaQReport) {
176  vector<dqm::me_util::Channel> badChannels = theEtaQReport->getBadChannels();
177  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
178  channel != badChannels.end(); channel++) {
179  LogTrace(metname)<<"[etaEfficiency test] bad ranges: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents()<<endl;
180  }
181  LogTrace(metname)<< "-------- type: [etaEfficiency] "<<theEtaQReport->getMessage()<<" ------- "<<theEtaQReport->getStatus()<<endl;
182  }
183  // phi efficiency
184  const QReport * thePhiQReport = phiEfficiency->getQReport(EfficiencyCriterionName);
185  if(thePhiQReport) {
186  vector<dqm::me_util::Channel> badChannels = thePhiQReport->getBadChannels();
187  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
188  channel != badChannels.end(); channel++) {
189  LogTrace(metname)<< "[phiEfficiency test] bad ranges: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents()<<endl;
190  }
191  LogTrace(metname)<<"-------- type: [phiEfficiency] "<<thePhiQReport->getMessage()<<" ------- "<<thePhiQReport->getStatus()<<endl;
192  }
193 
194  //alignment plot
195  string pathPos = "Muons/MuonRecoAnalyzer/muVStkSytemRotation_posMu";
196  MonitorElement * muVStkSytemRotation_posMu_histo = theDbe->get(pathPos);
197  string pathNeg = "Muons/MuonRecoAnalyzer/muVStkSytemRotation_negMu";
198  MonitorElement * muVStkSytemRotation_negMu_histo = theDbe->get(pathNeg);
199  if(muVStkSytemRotation_posMu_histo && muVStkSytemRotation_negMu_histo){
200 
201  TH2F * muVStkSytemRotation_posMu_root = muVStkSytemRotation_posMu_histo->getTH2F();
202  TProfile * muVStkSytemRotation_posMu_profile = muVStkSytemRotation_posMu_root->ProfileX("",1,100);
203  TH2F * muVStkSytemRotation_negMu_root = muVStkSytemRotation_negMu_histo->getTH2F();
204  TProfile * muVStkSytemRotation_negMu_profile = muVStkSytemRotation_negMu_root->ProfileX("",1,100);
205 
206  for(int x=1; x<50; x++){
207  globalRotation[0]->Fill((x*4)-1,muVStkSytemRotation_posMu_profile->GetBinContent(x));
208  globalRotation[0]->setBinError(x,muVStkSytemRotation_posMu_profile->GetBinError(x));
209  globalRotation[1]->Fill((x*4)-1,muVStkSytemRotation_negMu_profile->GetBinContent(x));
210  globalRotation[1]->setBinError(x,muVStkSytemRotation_negMu_profile->GetBinError(x));
211  globalRotation[2]->Fill((x*4)-1,muVStkSytemRotation_posMu_profile->GetBinContent(x)-muVStkSytemRotation_negMu_profile->GetBinContent(x));
212  globalRotation[2]->setBinError(x,sqrt((muVStkSytemRotation_posMu_profile->GetBinError(x)*muVStkSytemRotation_posMu_profile->GetBinError(x))
213  + (muVStkSytemRotation_negMu_profile->GetBinError(x)*muVStkSytemRotation_negMu_profile->GetBinError(x))));
214  }
215  }
216 
217 }
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
double etaMin
Definition: MuonRecoTest.h:81
std::vector< MonitorElement * > globalRotation
Definition: MuonRecoTest.h:92
T sqrt(T t)
Definition: SSEVec.h:48
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:1623
std::string metname
Definition: MuonRecoTest.h:74
const std::vector< DQMChannel > & getBadChannels(void) const
Definition: QReport.h:33
#define LogTrace(id)
double etaMax
Definition: MuonRecoTest.h:82
MonitorElement * phiEfficiency
Definition: MuonRecoTest.h:90
double phiMax
Definition: MuonRecoTest.h:86
TH1F * getTH1F(void) const
edm::ParameterSet parameters
Definition: MuonRecoTest.h:77
Definition: DDAxes.h:10
TH2F * getTH2F(void) const
double phiMin
Definition: MuonRecoTest.h:85
MonitorElement * etaEfficiency
Definition: MuonRecoTest.h:89
DQMStore * theDbe
Definition: MuonRecoTest.h:76

Member Data Documentation

int MuonRecoTest::etaBin
private

Definition at line 80 of file MuonRecoTest.h.

MonitorElement* MuonRecoTest::etaEfficiency
private

Definition at line 89 of file MuonRecoTest.h.

double MuonRecoTest::etaMax
private

Definition at line 82 of file MuonRecoTest.h.

double MuonRecoTest::etaMin
private

Definition at line 81 of file MuonRecoTest.h.

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

Definition at line 92 of file MuonRecoTest.h.

std::string MuonRecoTest::metname
private

Definition at line 74 of file MuonRecoTest.h.

int MuonRecoTest::nevents
private

Definition at line 69 of file MuonRecoTest.h.

unsigned int MuonRecoTest::nLumiSegs
private

Definition at line 70 of file MuonRecoTest.h.

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

Definition at line 84 of file MuonRecoTest.h.

MonitorElement* MuonRecoTest::phiEfficiency
private

Definition at line 90 of file MuonRecoTest.h.

double MuonRecoTest::phiMax
private

Definition at line 86 of file MuonRecoTest.h.

double MuonRecoTest::phiMin
private

Definition at line 85 of file MuonRecoTest.h.

int MuonRecoTest::prescaleFactor
private

Definition at line 71 of file MuonRecoTest.h.

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

Definition at line 76 of file MuonRecoTest.h.