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

Public Member Functions

 DTDataIntegrityTest (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~DTDataIntegrityTest ()
 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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 ()
 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::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 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
 
- 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 22 of file DTDataIntegrityTest.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 28 of file DTDataIntegrityTest.cc.

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

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

Destructor.

Definition at line 39 of file DTDataIntegrityTest.cc.

References LogTrace, and nupdates.

39  {
40 
41  LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") << "DataIntegrityTest: analyzed " << nupdates << " updates";
42 
43 }
#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 93 of file DTDataIntegrityTest.cc.

References LogTrace, and nevents.

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 46 of file DTDataIntegrityTest.cc.

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

46  {
47 
48  LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") << "[DTDataIntegrityTest]: BeginJob";
49 
50  //nSTAEvents = 0;
51  nupdates = 0;
52  run=0;
53 
55 
56  // book the summary histogram
57  dbe->setCurrentFolder("DT/00-DataIntegrity");
58  summaryHisto = dbe->book2D("DataIntegritySummary","Summary Data Integrity",12,1,13,5,-2,3);
59  summaryHisto->setAxisTitle("Sector",1);
60  summaryHisto->setAxisTitle("Wheel",2);
61 
62  dbe->setCurrentFolder("DT/00-DataIntegrity");
63  summaryTDCHisto = dbe->book2D("DataIntegrityTDCSummary","TDC Summary Data Integrity",12,1,13,5,-2,3);
64  summaryTDCHisto->setAxisTitle("Sector",1);
65  summaryTDCHisto->setAxisTitle("Wheel",2);
66 
67  dbe->setCurrentFolder("DT/00-DataIntegrity");
68  glbSummaryHisto = dbe->book2D("DataIntegrityGlbSummary","Summary Data Integrity",12,1,13,5,-2,3);
69  glbSummaryHisto->setAxisTitle("Sector",1);
70  glbSummaryHisto->setAxisTitle("Wheel",2);
71 
72 }
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:1070
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:655
void DTDataIntegrityTest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 82 of file DTDataIntegrityTest.cc.

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

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 74 of file DTDataIntegrityTest.cc.

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

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

Book the MEs.

Definition at line 235 of file DTDataIntegrityTest.cc.

References dbe, and DQMStore::setCurrentFolder().

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

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 214 of file DTDataIntegrityTest.cc.

References LogTrace.

214  {
215 
216  LogTrace ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest] endjob called!";
217 
218 // dbe->rmdir("DT/DTDataIntegrity");
219 }
#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 103 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().

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

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

Definition at line 243 of file DTDataIntegrityTest.cc.

References mapping.

Referenced by endLuminosityBlock().

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

Member Data Documentation

int DTDataIntegrityTest::counter
private

Definition at line 69 of file DTDataIntegrityTest.h.

Referenced by endLuminosityBlock().

DQMStore* DTDataIntegrityTest::dbe
private

Definition at line 77 of file DTDataIntegrityTest.h.

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

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

Definition at line 83 of file DTDataIntegrityTest.h.

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

Definition at line 85 of file DTDataIntegrityTest.h.

MonitorElement* DTDataIntegrityTest::glbSummaryHisto
private

Definition at line 89 of file DTDataIntegrityTest.h.

Referenced by beginJob(), and endLuminosityBlock().

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

Definition at line 78 of file DTDataIntegrityTest.h.

Referenced by beginRun(), and readOutToGeometry().

int DTDataIntegrityTest::nevents
private

Definition at line 71 of file DTDataIntegrityTest.h.

Referenced by analyze().

unsigned int DTDataIntegrityTest::nLumiSegs
private

Definition at line 72 of file DTDataIntegrityTest.h.

Referenced by endLuminosityBlock().

int DTDataIntegrityTest::nupdates
private

Definition at line 62 of file DTDataIntegrityTest.h.

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

int DTDataIntegrityTest::prescaleFactor
private

Definition at line 65 of file DTDataIntegrityTest.h.

Referenced by DTDataIntegrityTest(), and endLuminosityBlock().

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

Definition at line 87 of file DTDataIntegrityTest.h.

Referenced by beginJob(), and endLuminosityBlock().

MonitorElement* DTDataIntegrityTest::summaryTDCHisto
private

Definition at line 88 of file DTDataIntegrityTest.h.

Referenced by beginJob(), and endLuminosityBlock().