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

Public Member Functions

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

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
 
- 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 MuonTrackResidualsTest.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 35 of file MuonTrackResidualsTest.cc.

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

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

Destructor.

Definition at line 45 of file MuonTrackResidualsTest.cc.

References LogTrace, metname, and nevents.

45  {
46 
47  LogTrace(metname) << "DTResolutionTest: analyzed " << nevents << " events";
48 
49 }
#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 117 of file MuonTrackResidualsTest.cc.

References LogTrace, metname, and nevents.

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 52 of file MuonTrackResidualsTest.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 107 of file MuonTrackResidualsTest.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 101 of file MuonTrackResidualsTest.cc.

References LogTrace, and metname.

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

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 205 of file MuonTrackResidualsTest.cc.

References LogTrace, and metname.

205  {
206 
207  LogTrace(metname)<< "[MuonTrackResidualsTest] endJob called!";
208  theDbe->rmdir("Muons/Tests/trackResidualsTest");
209 
210 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2730
#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 126 of file MuonTrackResidualsTest.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 140 of file MuonTrackResidualsTest.cc.

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

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

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

Definition at line 83 of file MuonTrackResidualsTest.h.

std::string MuonTrackResidualsTest::metname
private

Definition at line 74 of file MuonTrackResidualsTest.h.

int MuonTrackResidualsTest::nevents
private

Definition at line 69 of file MuonTrackResidualsTest.h.

unsigned int MuonTrackResidualsTest::nLumiSegs
private

Definition at line 70 of file MuonTrackResidualsTest.h.

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

Definition at line 71 of file MuonTrackResidualsTest.h.

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

Definition at line 84 of file MuonTrackResidualsTest.h.

DQMStore* MuonTrackResidualsTest::theDbe
private

Definition at line 76 of file MuonTrackResidualsTest.h.