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 Member Functions | Private Attributes
DTDataIntegrityTest Class Reference

#include <DTDataIntegrityTest.h>

Inheritance diagram for DTDataIntegrityTest:
edm::EDAnalyzer

Public Member Functions

 DTDataIntegrityTest (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~DTDataIntegrityTest ()
 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 ()
 BeginJob. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 
void beginRun (const edm::Run &run, const edm::EventSetup &c)
 BeginRun. More...
 
void bookHistos (std::string histoType, int dduId)
 Book the MEs. More...
 
void endJob ()
 Endjob. More...
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 DQM Client Diagnostic. More...
 
std::string getMEName (std::string histoType, int FEDId)
 Get the ME name. More...
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Member Functions

int readOutToGeometry (int dduId, int rosNumber, int &wheel, int &sector)
 

Private Attributes

int counter
 
DQMStoredbe
 
std::map< std::string,
std::map< int, MonitorElement * > > 
dduHistos
 
std::map< std::string,
std::map< int, std::vector
< MonitorElement * > > > 
dduVectorHistos
 
MonitorElementglbSummaryHisto
 
edm::ESHandle< DTReadOutMappingmapping
 
int nevents
 
unsigned int nLumiSegs
 
int nupdates
 
int prescaleFactor
 
int run
 
MonitorElementsummaryHisto
 
MonitorElementsummaryTDCHisto
 

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 24 of file DTDataIntegrityTest.h.

Constructor & Destructor Documentation

DTDataIntegrityTest::DTDataIntegrityTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 30 of file DTDataIntegrityTest.cc.

References edm::ParameterSet::getUntrackedParameter(), LogTrace, and prescaleFactor.

30  : nevents(0) {
31 
32  LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") << "[DTDataIntegrityTest]: Constructor";
33 
34  // prescale on the # of LS to update the test
35  prescaleFactor = ps.getUntrackedParameter<int>("diagnosticPrescale", 1);
36 
37 
38 }
T getUntrackedParameter(std::string const &, T const &) const
#define LogTrace(id)
DTDataIntegrityTest::~DTDataIntegrityTest ( )

Destructor.

Definition at line 41 of file DTDataIntegrityTest.cc.

References LogTrace, and nupdates.

41  {
42 
43  LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") << "DataIntegrityTest: analyzed " << nupdates << " updates";
44 
45 }
#define LogTrace(id)

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 95 of file DTDataIntegrityTest.cc.

References LogTrace, and nevents.

95  {
96  // count the analyzed events
97  nevents++;
98  if(nevents%1000 == 0)
99  LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest")
100  << "[DTDataIntegrityTest]: "<<nevents<<" events";
101 }
#define LogTrace(id)
void DTDataIntegrityTest::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 48 of file DTDataIntegrityTest.cc.

References DQMStore::book2D(), dbe, glbSummaryHisto, LogTrace, nupdates, cppFunctionSkipper::operator, run, MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), summaryHisto, and summaryTDCHisto.

48  {
49 
50  LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") << "[DTDataIntegrityTest]: BeginJob";
51 
52  //nSTAEvents = 0;
53  nupdates = 0;
54  run=0;
55 
57 
58  // book the summary histogram
59  dbe->setCurrentFolder("DT/00-DataIntegrity");
60  summaryHisto = dbe->book2D("DataIntegritySummary","Summary Data Integrity",12,1,13,5,-2,3);
61  summaryHisto->setAxisTitle("Sector",1);
62  summaryHisto->setAxisTitle("Wheel",2);
63 
64  dbe->setCurrentFolder("DT/00-DataIntegrity");
65  summaryTDCHisto = dbe->book2D("DataIntegrityTDCSummary","TDC Summary Data Integrity",12,1,13,5,-2,3);
66  summaryTDCHisto->setAxisTitle("Sector",1);
67  summaryTDCHisto->setAxisTitle("Wheel",2);
68 
69  dbe->setCurrentFolder("DT/00-DataIntegrity");
70  glbSummaryHisto = dbe->book2D("DataIntegrityGlbSummary","Summary Data Integrity",12,1,13,5,-2,3);
71  glbSummaryHisto->setAxisTitle("Sector",1);
72  glbSummaryHisto->setAxisTitle("Wheel",2);
73 
74 }
MonitorElement * summaryTDCHisto
MonitorElement * glbSummaryHisto
MonitorElement * summaryHisto
#define LogTrace(id)
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void DTDataIntegrityTest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 84 of file DTDataIntegrityTest.cc.

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

84  {
85 
86  LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]: Begin of LS transition";
87 
88  // Get the run number
89  run = lumiSeg.run();
90 
91 }
#define LogTrace(id)
void DTDataIntegrityTest::beginRun ( const edm::Run run,
const edm::EventSetup c 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 76 of file DTDataIntegrityTest.cc.

References edm::EventSetup::get(), and mapping.

76  {
77 
78  context.get<DTReadOutMappingRcd>().get(mapping);
79 
80 }
edm::ESHandle< DTReadOutMapping > mapping
void DTDataIntegrityTest::bookHistos ( std::string  histoType,
int  dduId 
)
protected

Book the MEs.

Definition at line 237 of file DTDataIntegrityTest.cc.

References dbe, and DQMStore::setCurrentFolder().

237  {
238  stringstream dduId_s; dduId_s << dduId;
239  dbe->setCurrentFolder("DT/00-DataIntegrity/FED" + dduId_s.str());
240  string histoName;
241 
242 }
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void DTDataIntegrityTest::endJob ( void  )
protectedvirtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 216 of file DTDataIntegrityTest.cc.

References LogTrace.

216  {
217 
218  LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest] endjob called!";
219 
220 // dbe->rmdir("DT/DTDataIntegrity");
221 }
#define LogTrace(id)
void DTDataIntegrityTest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
protectedvirtual

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 105 of file DTDataIntegrityTest.cc.

References counter, dbe, DQMStore::get(), MonitorElement::getBinContent(), MonitorElement::getTH1F(), MonitorElement::getTH2F(), glbSummaryHisto, edm::LuminosityBlockBase::id(), LogTrace, edm::LuminosityBlockID::luminosityBlock(), max(), FEDNumbering::MAXDTFEDID, FEDNumbering::MINDTFEDID, nLumiSegs, nupdates, prescaleFactor, readOutToGeometry(), query::result, MonitorElement::setBinContent(), summaryHisto, summaryTDCHisto, and plotscripts::wheelNumber().

105  {
106 
107  // counts number of lumiSegs
108  nLumiSegs = lumiSeg.id().luminosityBlock();
109  stringstream nLumiSegs_s; nLumiSegs_s << nLumiSegs;
110 
111  // prescale factor
112  if (nLumiSegs%prescaleFactor != 0) return;
113 
114  LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest")
115  <<"[DTDataIntegrityTest]: End of LS " << nLumiSegs << ", performing client operations";
116 
117 
118  // counts number of updats
119  nupdates++;
120 
121 
122  //Counter for x bin in the timing histos
123  counter++;
124 
125  //Loop on FED id
126  for (int dduId=FEDNumbering::MINDTFEDID; dduId<=FEDNumbering::MAXDTFEDID; ++dduId){
127  LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest")
128  <<"[DTDataIntegrityTest]:FED Id: "<<dduId;
129 
130  //Each nTimeBin onUpdate remove timing histos and book a new bunch of them
131  stringstream dduId_s; dduId_s << dduId;
132 
133  string histoType;
134 
135  //Check if the list of ROS is compatible with the channels enabled
136  string rosStatusName = "DT/00-DataIntegrity/FED" + dduId_s.str() + "/FED" + dduId_s.str() + "_ROSStatus";
137  MonitorElement * FED_ROSStatus = dbe->get(rosStatusName);
138 
139  // Get the error summary histo
140  string fedSummaryName = "DT/00-DataIntegrity/FED" + dduId_s.str() + "_ROSSummary";
141  MonitorElement * FED_ROSSummary = dbe->get(fedSummaryName);
142 
143  // Get the event lenght plot (used to counr # of processed evts)
144  string fedEvLenName = "DT/00-DataIntegrity/FED" + dduId_s.str() + "/FED" + dduId_s.str() + "_EventLenght";
145  MonitorElement * FED_EvLenght = dbe->get(fedEvLenName);
146 
147  // Get the histos for FED integrity
148  string fedIntegrityFolder = "DT/FEDIntegrity/";
149  MonitorElement * hFEDEntry = dbe->get(fedIntegrityFolder+"FEDEntries");
150  MonitorElement * hFEDFatal = dbe->get(fedIntegrityFolder+"FEDFatal");
151  MonitorElement * hFEDNonFatal = dbe->get(fedIntegrityFolder+"FEDNonFatal");
152 
153  if(hFEDEntry && hFEDFatal && hFEDNonFatal) {
154 
155  if(FED_ROSSummary && FED_ROSStatus && FED_EvLenght) {
156  TH2F * histoFEDSummary = FED_ROSSummary->getTH2F();
157  TH2F * histoROSStatus = FED_ROSStatus->getTH2F();
158  TH1F * histoEvLenght = FED_EvLenght->getTH1F();
159  // Check that the FED is in the ReadOut using the FEDIntegrity histos
160  bool fedNotReadout = (hFEDEntry->getBinContent(dduId-769) == 0 &&
161  hFEDFatal->getBinContent(dduId-769) == 0 &&
162  hFEDNonFatal->getBinContent(dduId-769) == 0);
163  int nFEDEvts = histoEvLenght->Integral();
164  for(int rosNumber = 1; rosNumber <= 12; ++rosNumber) { // loop on the ROS
165  int wheelNumber, sectorNumber;
166  if (!readOutToGeometry(dduId,rosNumber,wheelNumber,sectorNumber)) {
167  int result = -2;
168  float nErrors = histoFEDSummary->Integral(1,14,rosNumber,rosNumber);
169  nErrors += histoROSStatus->Integral(2,8,rosNumber,rosNumber);
170  if(nErrors == 0) { // no errors
171  result = 0;
172  } else { // there are errors
173  result = 2;
174  }
175  summaryHisto->setBinContent(sectorNumber,wheelNumber+3,result);
176  int tdcResult = -2;
177  float nTDCErrors = histoFEDSummary->Integral(15,15,rosNumber,rosNumber);
178  if(nTDCErrors == 0) { // no errors
179  tdcResult = 0;
180  } else { // there are errors
181  tdcResult = 2;
182  }
183  summaryTDCHisto->setBinContent(sectorNumber,wheelNumber+3,tdcResult);
184  // FIXME: different errors should have different weights
185  float sectPerc = max((float)0., ((float)nFEDEvts-nErrors)/(float)nFEDEvts);
186  glbSummaryHisto->setBinContent(sectorNumber,wheelNumber+3,sectPerc);
187 
188  if(fedNotReadout) {
189  // no data in this FED: it is off
190  summaryHisto->setBinContent(sectorNumber,wheelNumber+3,1);
191  summaryTDCHisto->setBinContent(sectorNumber,wheelNumber+3,1);
192  glbSummaryHisto->setBinContent(sectorNumber,wheelNumber+3,0);
193  }
194  }
195  }
196 
197  } else { // no data in this FED: it is off
198  for(int rosNumber = 1; rosNumber <= 12; ++rosNumber) {
199  int wheelNumber, sectorNumber;
200  if (!readOutToGeometry(dduId,rosNumber,wheelNumber,sectorNumber)) {
201  summaryHisto->setBinContent(sectorNumber,wheelNumber+3,1);
202  summaryTDCHisto->setBinContent(sectorNumber,wheelNumber+3,1);
203  glbSummaryHisto->setBinContent(sectorNumber,wheelNumber+3,0);
204  }
205  }
206  }
207 
208  }
209 
210  }
211 
212 }
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * summaryTDCHisto
MonitorElement * glbSummaryHisto
const T & max(const T &a, const T &b)
tuple result
Definition: query.py:137
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
MonitorElement * summaryHisto
#define LogTrace(id)
int readOutToGeometry(int dduId, int rosNumber, int &wheel, int &sector)
TH1F * getTH1F(void) const
double getBinContent(int binx) const
get content of bin (1-D)
TH2F * getTH2F(void) const
def wheelNumber
Definition: plotscripts.py:45
string DTDataIntegrityTest::getMEName ( std::string  histoType,
int  FEDId 
)
protected

Get the ME name.

Definition at line 225 of file DTDataIntegrityTest.cc.

225  {
226  //Use the DDU name to find the ME
227  stringstream dduID_s; dduID_s << FEDId;
228 
229  string folderName = "DT/00-DataIntegrity/FED" + dduID_s.str();
230 
231  string histoName = folderName + "/FED" + dduID_s.str() + "_" + histoType;
232  return histoName;
233 }
int DTDataIntegrityTest::readOutToGeometry ( int  dduId,
int  rosNumber,
int &  wheel,
int &  sector 
)
private

Definition at line 245 of file DTDataIntegrityTest.cc.

References mapping.

Referenced by endLuminosityBlock().

245  {
246 
247  int dummy;
248  return mapping->readOutToGeometry(dduId,ros,2,2,2,wheel,dummy,sector,dummy,dummy,dummy);
249 
250 }
edm::ESHandle< DTReadOutMapping > mapping

Member Data Documentation

int DTDataIntegrityTest::counter
private

Definition at line 71 of file DTDataIntegrityTest.h.

Referenced by endLuminosityBlock().

DQMStore* DTDataIntegrityTest::dbe
private

Definition at line 79 of file DTDataIntegrityTest.h.

Referenced by beginJob(), bookHistos(), and endLuminosityBlock().

std::map<std::string, std::map<int, MonitorElement*> > DTDataIntegrityTest::dduHistos
private

Definition at line 85 of file DTDataIntegrityTest.h.

std::map<std::string, std::map<int, std::vector <MonitorElement*> > > DTDataIntegrityTest::dduVectorHistos
private

Definition at line 87 of file DTDataIntegrityTest.h.

MonitorElement* DTDataIntegrityTest::glbSummaryHisto
private

Definition at line 91 of file DTDataIntegrityTest.h.

Referenced by beginJob(), and endLuminosityBlock().

edm::ESHandle<DTReadOutMapping> DTDataIntegrityTest::mapping
private

Definition at line 80 of file DTDataIntegrityTest.h.

Referenced by beginRun(), and readOutToGeometry().

int DTDataIntegrityTest::nevents
private

Definition at line 73 of file DTDataIntegrityTest.h.

Referenced by analyze().

unsigned int DTDataIntegrityTest::nLumiSegs
private

Definition at line 74 of file DTDataIntegrityTest.h.

Referenced by endLuminosityBlock().

int DTDataIntegrityTest::nupdates
private

Definition at line 64 of file DTDataIntegrityTest.h.

Referenced by beginJob(), endLuminosityBlock(), and ~DTDataIntegrityTest().

int DTDataIntegrityTest::prescaleFactor
private

Definition at line 67 of file DTDataIntegrityTest.h.

Referenced by DTDataIntegrityTest(), and endLuminosityBlock().

int DTDataIntegrityTest::run
private
MonitorElement* DTDataIntegrityTest::summaryHisto
private

Definition at line 89 of file DTDataIntegrityTest.h.

Referenced by beginJob(), and endLuminosityBlock().

MonitorElement* DTDataIntegrityTest::summaryTDCHisto
private

Definition at line 90 of file DTDataIntegrityTest.h.

Referenced by beginJob(), and endLuminosityBlock().