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
MuonTrackResidualsTest Class Reference

#include <MuonTrackResidualsTest.h>

Inheritance diagram for MuonTrackResidualsTest:
edm::EDAnalyzer

Public Member Functions

 MuonTrackResidualsTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~MuonTrackResidualsTest ()
 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

std::map< std::string,
std::vector< std::string > > 
histoNames
 
std::map< std::string,
MonitorElement * > 
MeanHistos
 
std::string metname
 
int nevents
 
unsigned int nLumiSegs
 
edm::ParameterSet parameters
 
int prescaleFactor
 
int run
 
std::map< std::string,MonitorElement * > SigmaHistos
 
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)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 39 of file MuonTrackResidualsTest.h.

Constructor & Destructor Documentation

MuonTrackResidualsTest::MuonTrackResidualsTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 37 of file MuonTrackResidualsTest.cc.

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

37  {
38  parameters = ps;
39 
41 
42  prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 1);
43 
44 }
T getUntrackedParameter(std::string const &, T const &) const
MuonTrackResidualsTest::~MuonTrackResidualsTest ( )
virtual

Destructor.

Definition at line 47 of file MuonTrackResidualsTest.cc.

References LogTrace, metname, and nevents.

47  {
48 
49  LogTrace(metname) << "DTResolutionTest: analyzed " << nevents << " events";
50 
51 }
#define LogTrace(id)

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 119 of file MuonTrackResidualsTest.cc.

References LogTrace, metname, and nevents.

119  {
120 
121  nevents++;
122  LogTrace(metname)<< "[MuonTrackResidualsTest]: "<<nevents<<" events";
123 
124 }
#define LogTrace(id)
void MuonTrackResidualsTest::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 54 of file MuonTrackResidualsTest.cc.

References trackerHits::c, LogTrace, metname, and nevents.

54  {
55 
56  metname = "trackResidualsTest";
57  theDbe->setCurrentFolder("Muons/Tests/trackResidualsTest");
58 
59  LogTrace(metname) << "[MuonTrackResidualsTest] beginJob: Parameters initialization"<<endl;
60 
61 
62  string histName, MeanHistoName, SigmaHistoName, MeanHistoTitle, SigmaHistoTitle;
63  vector<string> type;
64  type.push_back("eta");
65  type.push_back("theta");
66  type.push_back("phi");
67 
68 
69  for(unsigned int c=0; c<type.size(); c++){
70 
71  MeanHistoName = "MeanTest_" + type[c];
72  SigmaHistoName = "SigmaTest_" + type[c];
73 
74  MeanHistoTitle = "Mean of the #" + type[c] + " residuals distribution";
75  SigmaHistoTitle = "Sigma of the #" + type[c] + " residuals distribution";
76 
77  histName = "Res_GlbSta_"+type[c];
78  histoNames[type[c]].push_back(histName);
79  histName = "Res_TkGlb_"+type[c];
80  histoNames[type[c]].push_back(histName);
81  histName = "Res_TkSta_"+type[c];
82  histoNames[type[c]].push_back(histName);
83 
84 
85  MeanHistos[type[c]] = theDbe->book1D(MeanHistoName.c_str(),MeanHistoTitle.c_str(),3,0.5,3.5);
86  (MeanHistos[type[c]])->setBinLabel(1,"Res_StaGlb",1);
87  (MeanHistos[type[c]])->setBinLabel(2,"Res_TkGlb",1);
88  (MeanHistos[type[c]])->setBinLabel(3,"Res_TkSta",1);
89 
90 
91  SigmaHistos[type[c]] = theDbe->book1D(SigmaHistoName.c_str(),SigmaHistoTitle.c_str(),3,0.5,3.5);
92  (SigmaHistos[type[c]])->setBinLabel(1,"Res_StaGlb",1);
93  (SigmaHistos[type[c]])->setBinLabel(2,"Res_TkGlb",1);
94  (SigmaHistos[type[c]])->setBinLabel(3,"Res_TkSta",1);
95 
96  }
97 
98  nevents = 0;
99 
100 }
type
Definition: HCALResponse.h:22
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
#define LogTrace(id)
std::map< std::string, MonitorElement * > MeanHistos
std::map< std::string, std::vector< std::string > > histoNames
std::map< std::string,MonitorElement * > SigmaHistos
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void MuonTrackResidualsTest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 109 of file MuonTrackResidualsTest.cc.

109  {
110 
111  // LogTrace(metname)<<"[MuonTrackResidualsTest]: beginLuminosityBlock";
112 
113  // Get the run number
114  // run = lumiSeg.run();
115 
116 }
void MuonTrackResidualsTest::beginRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 103 of file MuonTrackResidualsTest.cc.

References LogTrace, and metname.

103  {
104 
105  LogTrace(metname)<<"[MuonTrackResidualsTest]: beginRun";
106 
107 }
#define LogTrace(id)
void MuonTrackResidualsTest::endJob ( void  )
protectedvirtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 207 of file MuonTrackResidualsTest.cc.

References LogTrace, and metname.

207  {
208 
209  LogTrace(metname)<< "[MuonTrackResidualsTest] endJob called!";
210  theDbe->rmdir("Muons/Tests/trackResidualsTest");
211 
212 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
#define LogTrace(id)
void MuonTrackResidualsTest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
protectedvirtual

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 128 of file MuonTrackResidualsTest.cc.

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

128  {
129 
130  // LogTrace(metname)<<"[MuonTrackResidualsTest]: endLuminosityBlock, performing the DQM LS client operation"<<endl;
131 
132  // counts number of lumiSegs
133  nLumiSegs = lumiSeg.id().luminosityBlock();
134 
135  // prescale factor
136  if ( nLumiSegs%prescaleFactor != 0 ) return;
137 
138 
139 }
void MuonTrackResidualsTest::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 142 of file MuonTrackResidualsTest.cc.

References QReport::getBadChannels(), QReport::getMessage(), MonitorElement::getQReport(), QReport::getStatus(), interpolateCardsSimple::histo, LogTrace, python.multivaluedict::map(), timingPdfMaker::mean, metname, Parameters::parameters, and scaleCards::path.

142  {
143 
144  LogTrace(metname)<<"[MuonTrackResidualsTest]: endRun, performing the DQM end of run client operation";
145 
146  for(map<string, vector<string> > ::const_iterator histo = histoNames.begin();
147  histo != histoNames.end();
148  histo++) {
149 
150  for (unsigned int type=0; type< (*histo).second.size(); type++){
151 
152  string path = "Muons/MuonRecoAnalyzer/" + (*histo).second[type];
153  MonitorElement * res_histo = theDbe->get(path);
154  if (res_histo) {
155 
156  // gaussian test
157  string GaussianCriterionName =
158  parameters.getUntrackedParameter<string>("resDistributionTestName",
159  "ResidualsDistributionGaussianTest");
160  const QReport * GaussianReport = res_histo->getQReport(GaussianCriterionName);
161  if(GaussianReport){
162  LogTrace(metname) << "-------- histo : "<<(*histo).second[type]<<" "<<GaussianReport->getMessage()<<" ------- "<<GaussianReport->getStatus();
163  }
164  int BinNumber = type+1;
165  float mean = (*res_histo).getMean(1);
166  float sigma = (*res_histo).getRMS(1);
167  MeanHistos.find((*histo).first)->second->setBinContent(BinNumber, mean);
168  SigmaHistos.find((*histo).first)->second->setBinContent(BinNumber, sigma);
169  }
170  }
171  }
172 
173 
174  // Mean test
175  string MeanCriterionName = parameters.getUntrackedParameter<string>("meanTestName","ResidualsMeanInRange");
176  for(map<string, MonitorElement*>::const_iterator hMean = MeanHistos.begin();
177  hMean != MeanHistos.end();
178  hMean++) {
179  const QReport * theMeanQReport = (*hMean).second->getQReport(MeanCriterionName);
180  if(theMeanQReport) {
181  vector<dqm::me_util::Channel> badChannels = theMeanQReport->getBadChannels();
182  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
183  channel != badChannels.end(); channel++) {
184  LogTrace(metname)<< "type:"<<(*hMean).first<<" Bad mean channels: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents()<<endl;
185  }
186  LogTrace(metname)<< "-------- type: "<<(*hMean).first<<" "<<theMeanQReport->getMessage()<<" ------- "<<theMeanQReport->getStatus()<<endl;
187  }
188  }
189 
190  // Sigma test
191  string SigmaCriterionName = parameters.getUntrackedParameter<string>("sigmaTestName","ResidualsSigmaInRange");
192  for(map<string, MonitorElement*>::const_iterator hSigma = SigmaHistos.begin();
193  hSigma != SigmaHistos.end();
194  hSigma++) {
195  const QReport * theSigmaQReport = (*hSigma).second->getQReport(SigmaCriterionName);
196  if(theSigmaQReport) {
197  vector<dqm::me_util::Channel> badChannels = theSigmaQReport->getBadChannels();
198  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
199  channel != badChannels.end(); channel++) {
200  LogTrace(metname)<< "type:"<<(*hSigma).first<<" Bad sigma channels: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents()<<endl;
201  }
202  LogTrace(metname) << "-------- type: "<<(*hSigma).first<<" "<<theSigmaQReport->getMessage()<<" ------- "<<theSigmaQReport->getStatus()<<endl;
203  }
204  }
205 }
type
Definition: HCALResponse.h:22
T getUntrackedParameter(std::string const &, T const &) const
const QReport * getQReport(const std::string &qtname) const
get QReport corresponding to &lt;qtname&gt; (null pointer if QReport does not exist)
const std::string & getMessage(void) const
get message attached to test
Definition: QReport.h:24
list path
Definition: scaleCards.py:51
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:1468
const std::vector< DQMChannel > & getBadChannels(void) const
Definition: QReport.h:33
#define LogTrace(id)
std::map< std::string, MonitorElement * > MeanHistos
std::map< std::string, std::vector< std::string > > histoNames
std::map< std::string,MonitorElement * > SigmaHistos

Member Data Documentation

std::map< std::string, std::vector<std::string> > MuonTrackResidualsTest::histoNames
private

Definition at line 82 of file MuonTrackResidualsTest.h.

std::map< std::string, MonitorElement* > MuonTrackResidualsTest::MeanHistos
private

Definition at line 85 of file MuonTrackResidualsTest.h.

std::string MuonTrackResidualsTest::metname
private

Definition at line 76 of file MuonTrackResidualsTest.h.

int MuonTrackResidualsTest::nevents
private

Definition at line 71 of file MuonTrackResidualsTest.h.

unsigned int MuonTrackResidualsTest::nLumiSegs
private

Definition at line 72 of file MuonTrackResidualsTest.h.

edm::ParameterSet MuonTrackResidualsTest::parameters
private
int MuonTrackResidualsTest::prescaleFactor
private

Definition at line 73 of file MuonTrackResidualsTest.h.

int MuonTrackResidualsTest::run
private
std::map< std::string ,MonitorElement* > MuonTrackResidualsTest::SigmaHistos
private

Definition at line 86 of file MuonTrackResidualsTest.h.

DQMStore* MuonTrackResidualsTest::theDbe
private

Definition at line 78 of file MuonTrackResidualsTest.h.