CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
SiPixelHistoricInfoDQMClient Class Reference

#include <SiPixelHistoricInfoDQMClient.h>

Inheritance diagram for SiPixelHistoricInfoDQMClient:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 SiPixelHistoricInfoDQMClient (const edm::ParameterSet &)
 
 ~SiPixelHistoricInfoDQMClient ()
 
- 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 ()
 

Private Types

typedef std::vector< std::string > vstring
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
 
void beginJob ()
 
void beginRun (const edm::Run &, const edm::EventSetup &)
 
void endJob ()
 
void endRun (const edm::Run &, const edm::EventSetup &)
 
void fillPerformanceSummary () const
 
void getSummaryMEmeanRMSnBins (std::vector< MonitorElement * >::const_iterator, float &, float &, float &) const
 
uint32_t getSummaryRegionID (std::string) const
 
void retrieveMEs ()
 
void saveFile (std::string filename) const
 
void writeDB () const
 

Private Attributes

DQMStoredbe_
 
SiPixelHistogramId histogramManager
 
std::vector< std::string > inputFiles_
 
std::map< uint32_t,
std::vector< MonitorElement * > > 
mapOfdetIDtoMEs
 
std::string outputDir_
 
edm::ParameterSet parameterSet_
 
SiPixelPerformanceSummaryperformanceSummary
 
bool printDebug_
 
bool useSummary_
 
bool writeHisto_
 

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 &)
 
- 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)
 

Detailed Description

Definition at line 17 of file SiPixelHistoricInfoDQMClient.h.

Member Typedef Documentation

typedef std::vector<std::string> SiPixelHistoricInfoDQMClient::vstring
private

Definition at line 18 of file SiPixelHistoricInfoDQMClient.h.

Constructor & Destructor Documentation

SiPixelHistoricInfoDQMClient::SiPixelHistoricInfoDQMClient ( const edm::ParameterSet parameterSet)
explicit

Definition at line 16 of file SiPixelHistoricInfoDQMClient.cc.

References edm::ParameterSet::getUntrackedParameter(), and edm::parameterSet().

16  {
18 
19  useSummary_ = parameterSet_.getUntrackedParameter<bool>("useSummary", true);
20  printDebug_ = parameterSet_.getUntrackedParameter<bool>("printDebug",false);
21  writeHisto_ = parameterSet_.getUntrackedParameter<bool>("writeHisto",false);
22 
24  outputDir_ = parameterSet_.getUntrackedParameter<string>("outputDir",".");
25 }
T getUntrackedParameter(std::string const &, T const &) const
vector< string > vstring
Definition: ExoticaDQM.cc:75
std::vector< std::string > inputFiles_
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
SiPixelHistoricInfoDQMClient::~SiPixelHistoricInfoDQMClient ( )
inline

Definition at line 22 of file SiPixelHistoricInfoDQMClient.h.

22 {};

Member Function Documentation

void SiPixelHistoricInfoDQMClient::analyze ( const edm::Event ,
const edm::EventSetup  
)
inlineprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 27 of file SiPixelHistoricInfoDQMClient.h.

27 {};
void SiPixelHistoricInfoDQMClient::beginJob ( void  )
privatevirtual
void SiPixelHistoricInfoDQMClient::beginRun ( const edm::Run ,
const edm::EventSetup  
)
inlineprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 26 of file SiPixelHistoricInfoDQMClient.h.

26 {};
void SiPixelHistoricInfoDQMClient::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 60 of file SiPixelHistoricInfoDQMClient.cc.

References dbe_, and DQMStore::save().

60  {
61  if (writeHisto_) {
62  ostringstream endJobOutputFile;
63  endJobOutputFile << outputDir_ << "/SiPixelHistoricInfoDQMClient_endJob.root";
64  dbe_->save(endJobOutputFile.str());
65  }
66 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2540
void SiPixelHistoricInfoDQMClient::endRun ( const edm::Run run,
const edm::EventSetup eventSetup 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 33 of file SiPixelHistoricInfoDQMClient.cc.

References gather_cfg::cout, data, dbe_, DQMStore::open(), edm::RunBase::run(), convertSQLiteXML::runNumber, and DQMStore::save().

33  {
34  for (vector<string>::const_iterator iFile = inputFiles_.begin(); iFile!=inputFiles_.end(); ++iFile) {
35  unsigned int runNumber=0;
36  if (iFile->find("R0000",0)!=string::npos) runNumber = atoi(iFile->substr(iFile->find("R0000",0)+5,5).data());
37  else if (iFile->find("Run",0)!=string::npos) runNumber = atoi(iFile->substr(iFile->find("Run",0)+3,5).data());
38  else cout << "run number cannot be extracted from file name" << endl;
39 
40  if (runNumber==run.run()) {
41  dbe_->open(iFile->data(), true);
42 
44  performanceSummary->setRunNumber(runNumber);
45 
46  retrieveMEs();
48  writeDB();
49 
50  if (writeHisto_) {
51  ostringstream endRunOutputFile;
52  endRunOutputFile << outputDir_<<"/SiPixelHistoricInfoDQMClient_"<< runNumber <<".root";
53  dbe_->save(endRunOutputFile.str());
54  }
55  }
56  }
57 }
SiPixelPerformanceSummary * performanceSummary
RunNumber_t run() const
Definition: RunBase.h:42
std::vector< std::string > inputFiles_
void setRunNumber(unsigned int runNumber)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2540
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:2895
tuple cout
Definition: gather_cfg.py:121
void SiPixelHistoricInfoDQMClient::fillPerformanceSummary ( ) const
private

Definition at line 316 of file SiPixelHistoricInfoDQMClient.cc.

References b, gather_cfg::cout, python.multivaluedict::map(), mathSSE::sqrt(), findQualityFiles::v, and cuy::yBin.

316  {
317  for (map< uint32_t, vector<MonitorElement*> >::const_iterator iMEvec = mapOfdetIDtoMEs.begin();
318  iMEvec!=mapOfdetIDtoMEs.end(); iMEvec++) {
319  uint32_t theMEdetID = iMEvec->first;
320  vector<MonitorElement*> theMEvector = iMEvec->second;
321 
322  if (printDebug_) {
323  cout << theMEdetID << ":"; for (vector<MonitorElement*>::const_iterator iME = theMEvector.begin();
324  iME!=theMEvector.end(); iME++) cout << (*iME)->getName() << ","; cout << endl;
325  }
326  for (vector<MonitorElement*>::const_iterator iME = theMEvector.begin(); iME!=theMEvector.end(); iME++) {
327  string theMEname = (*iME)->getName();
328 
329  if (theMEdetID<50) {
330  // from SiPixelMonitorRawData
331  if (theMEname.find("errorType_siPixelDigis")!=string::npos) {
332  for (int v=25; v<40; v++) {
333  int b = (*iME)->getTH1()->GetXaxis()->FindBin(v);
334  performanceSummary->setRawDataErrorType(theMEdetID, v-25, (*iME)->getBinContent(b));
335  }
336  }
337  }
338  // from SiPixelMonitorTrack
339  else if (theMEdetID==77) {
340  if (theMEname.find("ntracks")!=string::npos && theMEname.find("InPixVol")==string::npos) {
341  float trkMean=0.0, trkRMS=0.0;
342  if ((*iME)->getBinContent(1)>0.0) {
343  trkMean = float((*iME)->getBinContent(3))/(*iME)->getBinContent(1); // Barrel regionID: 80
344  trkRMS = sqrt(trkMean*(trkMean+1.0)/(*iME)->getBinContent(1));
345  performanceSummary->setFractionOfTracks(80, trkMean, trkRMS);
346 
347  trkMean = float((*iME)->getBinContent(4))/(*iME)->getBinContent(1); // Endcap regionID: 81
348  trkRMS = sqrt(trkMean*(trkMean+1.0)/(*iME)->getBinContent(1));
349  performanceSummary->setFractionOfTracks(81, trkMean, trkRMS);
350  }
351  }
352  }
353  else if (theMEdetID==78) { // OnTrack
354  if (theMEname.find("nclusters_siPixelClusters")!=string::npos) {
355  performanceSummary->setNumberOfOnTrackClusters(80, (*iME)->getBinContent(2));
356  performanceSummary->setNumberOfOnTrackClusters(81, (*iME)->getBinContent(3));
357  }
358  if (theMEname.find("charge_siPixelClusters_Barrel")!=string::npos) {
359  performanceSummary->setClusterChargeOnTrack(80, (*iME)->getMean(), (*iME)->getRMS());
360  }
361  if (theMEname.find("charge_siPixelClusters_Endcap")!=string::npos) {
362  performanceSummary->setClusterChargeOnTrack(81, (*iME)->getMean(), (*iME)->getRMS());
363  }
364  if (theMEname.find("size_siPixelClusters_Barrel")!=string::npos) {
365  performanceSummary->setClusterSizeOnTrack(80, (*iME)->getMean(), (*iME)->getRMS());
366  }
367  if (theMEname.find("size_siPixelClusters_Endcap")!=string::npos) {
368  performanceSummary->setClusterSizeOnTrack(81, (*iME)->getMean(), (*iME)->getRMS());
369  }
370  }
371  else if (theMEdetID==79) { // OffTrack
372  if (theMEname.find("nclusters_siPixelClusters")!=string::npos) {
373  performanceSummary->setNumberOfOffTrackClusters(80, (*iME)->getBinContent(2));
374  performanceSummary->setNumberOfOffTrackClusters(81, (*iME)->getBinContent(3));
375  }
376  if (theMEname.find("charge_siPixelClusters_Barrel")!=string::npos) {
377  performanceSummary->setClusterChargeOffTrack(80, (*iME)->getMean(), (*iME)->getRMS());
378  }
379  if (theMEname.find("charge_siPixelClusters_Endcap")!=string::npos) {
380  performanceSummary->setClusterChargeOffTrack(81, (*iME)->getMean(), (*iME)->getRMS());
381  }
382  if (theMEname.find("size_siPixelClusters_Barrel")!=string::npos) {
383  performanceSummary->setClusterSizeOffTrack(80, (*iME)->getMean(), (*iME)->getRMS());
384  }
385  if (theMEname.find("size_siPixelClusters_Endcap")!=string::npos) {
386  performanceSummary->setClusterSizeOffTrack(81, (*iME)->getMean(), (*iME)->getRMS());
387  }
388  }
389  else {
390  if (useSummary_) {
391  if (theMEname.find("SUM")!=string::npos) {
392  // from SiPixelMonitorDigi
393  if (theMEname.find("ndigis")!=string::npos && theMEname.find("FREQ")==string::npos) {
394  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
395  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
396  performanceSummary->setNumberOfDigis(theMEdetID, avgMean, avgRMS, emPtn);
397  }
398  if (theMEname.find("adc")!=string::npos) {
399  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
400  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
401  performanceSummary->setADC(theMEdetID, avgMean, avgRMS, emPtn);
402  }
403  // from SiPixelMonitorCluster
404  if (theMEname.find("nclusters")!=string::npos) {
405  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
406  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
407  performanceSummary->setNumberOfClusters(theMEdetID, avgMean, avgRMS, emPtn);
408  }
409  if (theMEname.find("charge")!=string::npos) {
410  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
411  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
412  performanceSummary->setClusterCharge(theMEdetID, avgMean, avgRMS, emPtn);
413  }
414  if (theMEname.find("size")!=string::npos) {
415  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
416  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
417  performanceSummary->setClusterSize(theMEdetID, avgMean, avgRMS, emPtn);
418  }
419  if (theMEname.find("sizeX")!=string::npos) {
420  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
421  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
422  performanceSummary->setClusterSizeX(theMEdetID, avgMean, avgRMS, emPtn);
423  }
424  if (theMEname.find("sizeY")!=string::npos) {
425  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
426  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
427  performanceSummary->setClusterSizeY(theMEdetID, avgMean, avgRMS, emPtn);
428  }
429  // from SiPixelMonitorRecHit
430  if (theMEname.find("nRecHits")!=string::npos) {
431  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
432  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
433  performanceSummary->setNumberOfRecHits(theMEdetID, avgMean, avgRMS, emPtn);
434  }
435  // from SiPixelMonitorTrack
436  if (theMEname.find("residualX")!=string::npos) {
437  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
438  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
439  performanceSummary->setResidualX(theMEdetID, avgMean, avgRMS, emPtn);
440  }
441  if (theMEname.find("residualY")!=string::npos) {
442  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
443  performanceSummary->setResidualY(theMEdetID, avgMean, avgRMS, emPtn);
444  }
445  // temporary solutions
446  if (theMEname.find("OccupancyMap")!=std::string::npos) { // entire barrel and entire endcap only
447  int nNoisyCells=0, nEmptyCells=0;
448  for (int xBin=0; xBin<(*iME)->getNbinsX(); xBin++) { // 1 pixel per bin
449  for (int yBin=0; yBin<(*iME)->getNbinsY(); yBin++) {
450  if ((*iME)->getBinContent(xBin+1, yBin+1)>0.01*(*iME)->getEntries()) nNoisyCells++;
451  if ((*iME)->getBinContent(xBin+1, yBin+1)==.0 && (*iME)->getBinError(xBin+1, yBin+1)==0.0) nEmptyCells++;
452  }
453  }
454  performanceSummary->setNumberOfNoisCells(theMEdetID, float(nNoisyCells));
455  performanceSummary->setNumberOfDeadCells(theMEdetID, float(nEmptyCells));
456  }
457  // performanceSummary->setNumberOfPixelHitsInTrackFit(theMEdetId, float(nPixelHits));
458  }
459  else {
460  // from SiPixelMonitorDigi
461  if (theMEname.find("ndigis_siPixelDigis")!=string::npos && theMEname.find("FREQ")==string::npos) {
462  performanceSummary->setNumberOfDigis(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
463  }
464  if (theMEname.find("adc_siPixelDigis")!=string::npos) {
465  performanceSummary->setADC(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
466  }
467  // from SiPixelMonitorCluster
468  if (theMEname.find("nclusters_siPixelClusters")!=string::npos) {
469  performanceSummary->setNumberOfClusters(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
470  }
471  if (theMEname.find("charge_siPixelClusters")!=string::npos) {
472  performanceSummary->setClusterCharge(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
473  }
474  if (theMEname.find("size_siPixelClusters")!=string::npos) {
475  performanceSummary->setClusterSize(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
476  }
477  if (theMEname.find("sizeX_siPixelClusters")!=string::npos) {
478  performanceSummary->setClusterSizeX(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
479  }
480  if (theMEname.find("sizeY_siPixelClusters")!=string::npos) {
481  performanceSummary->setClusterSizeY(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
482  }
483  // from SiPixelMonitorRecHit
484  if (theMEname.find("nRecHits_siPixelRecHits")!=string::npos) {
485  performanceSummary->setNumberOfRecHits(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
486  }
487  // from SiPixelMonitorTrack
488  if (theMEname.find("residualX_siPixelTrackResiduals")!=string::npos) {
489  performanceSummary->setResidualX(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
490  }
491  if (theMEname.find("residualY_siPixelTrackResiduals")!=string::npos) {
492  performanceSummary->setResidualY(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
493  }
494  }
495  }
496  else {
497  // from SiPixelMonitorDigi
498  if (theMEname.find("ndigis_siPixelDigis")!=string::npos && theMEname.find("FREQ")==string::npos) {
499  performanceSummary->setNumberOfDigis(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
500  }
501  if (theMEname.find("adc_siPixelDigis")!=string::npos) {
502  performanceSummary->setADC(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
503  }
504  // from SiPixelMonitorCluster
505  if (theMEname.find("nclusters_siPixelClusters")!=string::npos) {
506  performanceSummary->setNumberOfClusters(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
507  }
508  if (theMEname.find("charge_siPixelClusters")!=string::npos) {
509  performanceSummary->setClusterCharge(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
510  }
511  if (theMEname.find("size_siPixelClusters")!=string::npos) {
512  performanceSummary->setClusterSize(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
513  }
514  if (theMEname.find("sizeX_siPixelClusters")!=string::npos) {
515  performanceSummary->setClusterSizeX(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
516  }
517  if (theMEname.find("sizeY_siPixelClusters")!=string::npos) {
518  performanceSummary->setClusterSizeY(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
519  }
520  // from SiPixelMonitorRecHit
521  if (theMEname.find("nRecHits_siPixelRecHits")!=string::npos) {
522  performanceSummary->setNumberOfRecHits(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
523  }
524  // from SiPixelMonitorTrack
525  if (theMEname.find("residualX_siPixelTrackResiduals")!=string::npos) {
526  performanceSummary->setResidualX(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
527  }
528  if (theMEname.find("residualY_siPixelTrackResiduals")!=string::npos) {
529  performanceSummary->setResidualY(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
530  }
531  // temporary solutions
532  if (theMEname.find("hitmap_siPixelClusters")!=std::string::npos ||
533  theMEname.find("hitmap_siPixelDigis")!=std::string::npos) { // if digi map exists, use it; else use cluster map
534  int nNoisyCells=0, nEmptyCells=0; // not use xypos_siPixelRecHits
535  for (int xBin=0; xBin<(*iME)->getNbinsX(); xBin++) { // 4-1 pixel per bin
536  for (int yBin=0; yBin<(*iME)->getNbinsY(); yBin++) {
537  if ((*iME)->getBinContent(xBin+1, yBin+1)>0.01*(*iME)->getEntries()) nNoisyCells++;
538  if ((*iME)->getBinContent(xBin+1, yBin+1)==.0 && (*iME)->getBinError(xBin+1, yBin+1)==0.0) nEmptyCells++;
539  }
540  }
541  performanceSummary->setNumberOfNoisCells(theMEdetID, float(nNoisyCells));
542  performanceSummary->setNumberOfDeadCells(theMEdetID, float(nEmptyCells));
543  }
544  // performanceSummary->setNumberOfPixelHitsInTrackFit(theMEdetId, float(nPixelHits));
545  }
546  }
547  }
548  }
549 }
SiPixelPerformanceSummary * performanceSummary
bool setRawDataErrorType(uint32_t detId, int bin, float nErrors)
tuple yBin
Definition: cuy.py:891
bool setADC(uint32_t detId, float mean, float rms, float emPtn)
bool setNumberOfOnTrackClusters(uint32_t detId, float nClusters)
bool setClusterSizeY(uint32_t detId, float mean, float rms, float emPtn)
bool setNumberOfDigis(uint32_t detId, float mean, float rms, float emPtn)
bool setNumberOfDeadCells(uint32_t detId, float nNpixCells)
T sqrt(T t)
Definition: SSEVec.h:48
bool setResidualY(uint32_t detId, float mean, float rms, float emPtn)
void getSummaryMEmeanRMSnBins(std::vector< MonitorElement * >::const_iterator, float &, float &, float &) const
bool setClusterSize(uint32_t detId, float mean, float rms, float emPtn)
bool setNumberOfOffTrackClusters(uint32_t detId, float nClusters)
bool setResidualX(uint32_t detId, float mean, float rms, float emPtn)
bool setClusterSizeX(uint32_t detId, float mean, float rms, float emPtn)
bool setNumberOfRecHits(uint32_t detId, float mean, float rms, float emPtn)
bool setClusterCharge(uint32_t detId, float mean, float rms, float emPtn)
bool setClusterSizeOffTrack(uint32_t detId, float mean, float rms)
bool setClusterChargeOffTrack(uint32_t detId, float mean, float rms)
double b
Definition: hdecay.h:120
bool setNumberOfNoisCells(uint32_t detId, float nNpixCells)
bool setClusterChargeOnTrack(uint32_t detId, float mean, float rms)
tuple cout
Definition: gather_cfg.py:121
bool setClusterSizeOnTrack(uint32_t detId, float mean, float rms)
bool setNumberOfClusters(uint32_t detId, float mean, float rms, float emPtn)
bool setFractionOfTracks(uint32_t detId, float mean, float rms)
std::map< uint32_t, std::vector< MonitorElement * > > mapOfdetIDtoMEs
void SiPixelHistoricInfoDQMClient::getSummaryMEmeanRMSnBins ( std::vector< MonitorElement * >::const_iterator  iME,
float &  mean,
float &  RMS,
float &  emPtn 
) const
private

Definition at line 301 of file SiPixelHistoricInfoDQMClient.cc.

References b, funct::pow(), and mathSSE::sqrt().

302  {
303  int nBins=0; for (int b=0; b<(*iME)->getNbinsX(); b++) {
304  float binMean = (*iME)->getBinContent(b+1);
305  float binRMS = (*iME)->getBinError(b+1);
306  if (binMean!=0.0 || binRMS!=0.0) { nBins++; mean += binMean; RMS += pow(binRMS,2); }
307  }
308  if (nBins>0) {
309  mean = mean/float(nBins);
310  RMS = sqrt(RMS/float(nBins)); // emPtn = proportion of empty modules in a summary ME
311  }
312  if ((*iME)->getNbinsX()>0) emPtn = 1.0 - float(nBins)/float((*iME)->getNbinsX());
313 }
T sqrt(T t)
Definition: SSEVec.h:48
double b
Definition: hdecay.h:120
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
uint32_t SiPixelHistoricInfoDQMClient::getSummaryRegionID ( std::string  ) const
private

Definition at line 239 of file SiPixelHistoricInfoDQMClient.cc.

References gather_cfg::cout.

239  {
240  uint32_t regionID = 666;
241  if (thePath.find("Ladder",0)==string::npos && thePath.find("Blade",0)==string::npos) {
242  regionID = 100;
243  if (thePath.find("Barrel",0)!=string::npos) {
244  regionID += 0;
245  string shell = thePath.substr(thePath.find("Shell",0)+6,2);
246  if (shell.compare("mI")==0) regionID += 0;
247  else if (shell.compare("mO")==0) regionID += 3;
248  else if (shell.compare("pI")==0) regionID += 6;
249  else if (shell.compare("pO")==0) regionID += 9;
250  else cout << "Shell_" << shell.data() << "?!" << endl;
251  string layer = thePath.substr(thePath.find("Layer",0)+6,1);
252  regionID += (atoi(layer.data())-1);
253  }
254  else if (thePath.find("Endcap",0)!=string::npos) {
255  regionID += 12;
256  string halfCylinder = thePath.substr(thePath.find("HalfCylinder",0)+13,2);
257  if (halfCylinder.compare("mI")==0) regionID += 0;
258  else if (halfCylinder.compare("mO")==0) regionID += 2;
259  else if (halfCylinder.compare("pI")==0) regionID += 4;
260  else if (halfCylinder.compare("pO")==0) regionID += 6;
261  else cout << "HalfCylinder_" << halfCylinder.data() << "?!" << endl;
262  string disk = thePath.substr(thePath.find("Disk",0)+5,1);
263  regionID += (atoi(disk.data())-1);
264  }
265  }
266  else if (thePath.find("Ladder",0)!=string::npos || thePath.find("Blade",0)!=string::npos) {
267  regionID = 1000;
268  if (thePath.find("Barrel",0)!=string::npos) {
269  regionID += 0;
270  string shell = thePath.substr(thePath.find("Shell",0)+6,2);
271  if (shell.compare("mI")==0) regionID += 0;
272  else if (shell.compare("mO")==0) regionID += 48;
273  else if (shell.compare("pI")==0) regionID += 96;
274  else if (shell.compare("pO")==0) regionID += 144;
275  else cout << "Shell_" << shell.data() << "?!" << endl;
276  string layer = thePath.substr(thePath.find("Layer",0)+6,1);
277  if (layer.compare("1")==0) regionID += 0;
278  else if (layer.compare("2")==0) regionID += 10;
279  else if (layer.compare("3")==0) regionID += 26;
280  else cout << "Layer_" << layer.data() << "?!" << endl;
281  string ladder = thePath.substr(thePath.find("Ladder",0)+7,2);
282  regionID += (atoi(ladder.data())-1);
283  }
284  else if (thePath.find("Endcap",0)!=string::npos) {
285  regionID += 192;
286  string halfCylinder = thePath.substr(thePath.find("HalfCylinder",0)+13,2);
287  if (halfCylinder.compare("mI")==0) regionID += 0;
288  else if (halfCylinder.compare("mO")==0) regionID += 24;
289  else if (halfCylinder.compare("pI")==0) regionID += 48;
290  else if (halfCylinder.compare("pO")==0) regionID += 72;
291  else cout << "HalfCylinder_" << halfCylinder.data() << "?!" << endl;
292  string disk = thePath.substr(thePath.find("Disk",0)+5,1);
293  string blade = thePath.substr(thePath.find("Blade",0)+6,2);
294  regionID += (12*(atoi(disk.data())-1) + atoi(blade.data())-1);
295  }
296  }
297  return regionID;
298 }
tuple cout
Definition: gather_cfg.py:121
void SiPixelHistoricInfoDQMClient::retrieveMEs ( )
private

Definition at line 69 of file SiPixelHistoricInfoDQMClient.cc.

References gather_cfg::cout, dbe_, DQMStore::get(), DQMStore::getContents(), MonitorElement::getFloatValue(), MonitorElement::getIntValue(), and MonitorElement::getName().

69  {
70  mapOfdetIDtoMEs.clear();
71  bool noModules = true, noSummary = true;
72 
73  vector<string> listOfMEswithFullPath;
74  dbe_->getContents(listOfMEswithFullPath);
75 
76  for (vector<string>::const_iterator iMEstr = listOfMEswithFullPath.begin();
77  iMEstr!=listOfMEswithFullPath.end(); iMEstr++) {
78  if (printDebug_) cout << iMEstr->data() << endl;
79 
80  size_t pathLength = iMEstr->find(":",0);
81  string thePath = iMEstr->substr(0, pathLength);
82  string allHists = iMEstr->substr(pathLength+1);
83 
84  if (thePath.find("Pixel",0)!=string::npos) {
85  if (thePath.find("FED_",0)!=string::npos) {
86  size_t histnameLength;
87  do {
88  histnameLength = allHists.find(",",0);
89  string theHist;
90  if (histnameLength!=string::npos) {
91  theHist = allHists.substr(0, histnameLength);
92  allHists.erase(0, histnameLength+1);
93  }
94  else theHist = allHists;
95 
96  string fullPathHist = thePath + "/" + theHist;
97  MonitorElement* newME = dbe_->get(fullPathHist);
98  if (newME) {
99  uint32_t newMEdetID = histogramManager.getRawId(newME->getName());
100 
101  if (mapOfdetIDtoMEs.find(newMEdetID)==mapOfdetIDtoMEs.end()) {
102  vector<MonitorElement*> newMEvector;
103  newMEvector.push_back(newME);
104  mapOfdetIDtoMEs.insert(make_pair(newMEdetID, newMEvector));
105  }
106  else (mapOfdetIDtoMEs.find(newMEdetID)->second).push_back(newME);
107  }
108  }
109  while (histnameLength!=string::npos);
110  }
111  if (thePath.find("Module_",0)!=string::npos) {
112  if (!useSummary_) {
113  size_t histnameLength;
114  do {
115  histnameLength = allHists.find(",",0);
116  string theHist;
117  if (histnameLength!=string::npos) {
118  theHist = allHists.substr(0, histnameLength);
119  allHists.erase(0, histnameLength+1);
120  }
121  else theHist = allHists;
122 
123  string fullPathHist = thePath + "/" + theHist;
124  MonitorElement* newME = dbe_->get(fullPathHist);
125  if (newME) {
126  uint32_t newMEdetID = histogramManager.getRawId(newME->getName());
127 
128  if (mapOfdetIDtoMEs.find(newMEdetID)==mapOfdetIDtoMEs.end()) {
129  vector<MonitorElement*> newMEvector;
130  newMEvector.push_back(newME);
131  mapOfdetIDtoMEs.insert(make_pair(newMEdetID, newMEvector));
132  }
133  else (mapOfdetIDtoMEs.find(newMEdetID)->second).push_back(newME);
134  }
135  }
136  while(histnameLength!=string::npos);
137  }
138  if (noModules) noModules = false;
139  }
140  else if( (thePath.find("Layer_",0)!=string::npos ||
141  (thePath.find("Disk_",0)!=string::npos && thePath.find("Panel_",0)==string::npos)) ) {
142  if (useSummary_) {
143  uint32_t newMEdetID = getSummaryRegionID(thePath);
144  if (printDebug_) cout << thePath.data() <<" in region "<< newMEdetID << endl;
145  size_t histnameLength;
146  do {
147  histnameLength = allHists.find(",",0);
148  string theHist;
149  if (histnameLength!=string::npos) {
150  theHist = allHists.substr(0, histnameLength);
151  allHists.erase(0, histnameLength+1);
152  }
153  else theHist = allHists;
154 
155  string fullPathHist = thePath + "/" + theHist;
156  MonitorElement* newME = dbe_->get(fullPathHist);
157  if (newME) {
158  if (mapOfdetIDtoMEs.find(newMEdetID)==mapOfdetIDtoMEs.end()) {
159  vector<MonitorElement*> newMEvector;
160  newMEvector.push_back(newME);
161  mapOfdetIDtoMEs.insert(make_pair(newMEdetID, newMEvector));
162  }
163  else (mapOfdetIDtoMEs.find(newMEdetID)->second).push_back(newME);
164  }
165  }
166  while (histnameLength!=string::npos);
167  }
168  if (noSummary) noSummary = false;
169  }
170  if (thePath.find("Track",0)!=string::npos) { // for Pixel/Tracks, Pixel/Clusters/OnTrack, Pixel/Clusters/OffTrack
171  uint32_t newMEdetID = 77;
172  if (thePath.find("On", 0)!=string::npos) newMEdetID = 78;
173  if (thePath.find("Off",0)!=string::npos) newMEdetID = 79;
174 
175  size_t histnameLength;
176  do {
177  histnameLength = allHists.find(",",0);
178  string theHist;
179  if (histnameLength!=string::npos) {
180  theHist = allHists.substr(0, histnameLength);
181  allHists.erase(0, histnameLength+1);
182  }
183  else theHist = allHists;
184 
185  string fullPathHist = thePath + "/" + theHist;
186  MonitorElement* newME = dbe_->get(fullPathHist);
187  if (newME) {
188  if (mapOfdetIDtoMEs.find(newMEdetID)==mapOfdetIDtoMEs.end()) {
189  vector<MonitorElement*> newMEvector;
190  newMEvector.push_back(newME);
191  mapOfdetIDtoMEs.insert(make_pair(newMEdetID, newMEvector));
192  }
193  else (mapOfdetIDtoMEs.find(newMEdetID)->second).push_back(newME);
194  }
195  }
196  while (histnameLength!=string::npos);
197  }
198  if (thePath.find("EventInfo",0)!=string::npos) {
199  size_t histnameLength;
200  do {
201  histnameLength = allHists.find(",",0);
202  string theHist;
203  if (histnameLength!=string::npos) {
204  theHist = allHists.substr(0, histnameLength);
205  allHists.erase(0, histnameLength+1);
206  }
207  else theHist = allHists;
208 
209  if (theHist.find("iRun",0)!=string::npos) {
210  string fullPathHist = thePath + "/" + theHist;
211  MonitorElement* strME = dbe_->get(fullPathHist);
212  if (strME) performanceSummary->setRunNumber(strME->getIntValue());
213  }
214  if (theHist.find("iLumiSection",0)!=string::npos) {
215  string fullPathHist = thePath + "/" + theHist;
216  MonitorElement* strME = dbe_->get(fullPathHist);
217  if (strME) performanceSummary->setLuminosityBlock(strME->getIntValue());
218  }
219  if (theHist.find("processedEvents",0)!=string::npos) {
220  string fullPathHist = thePath + "/" + theHist;
221  MonitorElement* strME = dbe_->get(fullPathHist);
222  if (strME) performanceSummary->setNumberOfEvents(strME->getIntValue());
223  }
224  if (theHist.find("eventTimeStamp",0)!=string::npos) {
225  string fullPathHist = thePath + "/" + theHist;
226  MonitorElement* strME = dbe_->get(fullPathHist);
227  if (strME) performanceSummary->setTimeStamp((unsigned long long)strME->getFloatValue());
228  }
229  }
230  while (histnameLength!=string::npos);
231  }
232  }
233  }
234  if ( useSummary_ && noSummary) cout << endl << "use "<<"summary MEs but NO "<<"summary MEs in the input file" << endl << endl;
235  if (!useSummary_ && noModules) cout << endl << "use "<< "module MEs but NO "<< "module MEs in the input file" << endl << endl;
236 }
SiPixelPerformanceSummary * performanceSummary
const std::string & getName(void) const
get name of ME
void setTimeStamp(unsigned long long timeStamp)
uint32_t getSummaryRegionID(std::string) const
double getFloatValue(void) const
void setRunNumber(unsigned int runNumber)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1737
int64_t getIntValue(void) const
void setLuminosityBlock(unsigned int lumBlock)
tuple cout
Definition: gather_cfg.py:121
uint32_t getRawId(std::string histogramId)
Get Detector Raw Id.
void setNumberOfEvents(unsigned int numberOfEvents)
std::map< uint32_t, std::vector< MonitorElement * > > mapOfdetIDtoMEs
void SiPixelHistoricInfoDQMClient::saveFile ( std::string  filename) const
inlineprivate

Definition at line 37 of file SiPixelHistoricInfoDQMClient.h.

37 { dbe_->save(filename); };
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2540
tuple filename
Definition: lut2db_cfg.py:20
void SiPixelHistoricInfoDQMClient::writeDB ( ) const
private

Definition at line 552 of file SiPixelHistoricInfoDQMClient.cc.

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), gather_cfg::cout, cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::currentTime(), cond::service::PoolDBOutputService::endOfTime(), edm::Service< T >::isAvailable(), and cond::service::PoolDBOutputService::isNewTagRequest().

552  {
554  else performanceSummary->print();
555  cout << "SiPixelHistoricInfoDQMClient::writeDB()" << endl;
556 
558  if (mydbservice.isAvailable()) {
559  if (mydbservice->isNewTagRequest("SiPixelPerformanceSummaryRcd")) {
561  mydbservice->beginOfTime(),
562  mydbservice->endOfTime(),
563  "SiPixelPerformanceSummaryRcd");
564  }
565  else {
567  mydbservice->currentTime(),
568  "SiPixelPerformanceSummaryRcd");
569  }
570  }
571  else LogError("writeDB") << "service unavailable" << endl;
572 }
SiPixelPerformanceSummary * performanceSummary
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:46
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

DQMStore* SiPixelHistoricInfoDQMClient::dbe_
private

Definition at line 47 of file SiPixelHistoricInfoDQMClient.h.

SiPixelHistogramId SiPixelHistoricInfoDQMClient::histogramManager
private

Definition at line 49 of file SiPixelHistoricInfoDQMClient.h.

std::vector<std::string> SiPixelHistoricInfoDQMClient::inputFiles_
private

Definition at line 43 of file SiPixelHistoricInfoDQMClient.h.

std::map< uint32_t, std::vector<MonitorElement*> > SiPixelHistoricInfoDQMClient::mapOfdetIDtoMEs
private

Definition at line 50 of file SiPixelHistoricInfoDQMClient.h.

std::string SiPixelHistoricInfoDQMClient::outputDir_
private

Definition at line 44 of file SiPixelHistoricInfoDQMClient.h.

Referenced by valtools.webpage::readCaptions().

edm::ParameterSet SiPixelHistoricInfoDQMClient::parameterSet_
private

Definition at line 46 of file SiPixelHistoricInfoDQMClient.h.

SiPixelPerformanceSummary* SiPixelHistoricInfoDQMClient::performanceSummary
private

Definition at line 51 of file SiPixelHistoricInfoDQMClient.h.

bool SiPixelHistoricInfoDQMClient::printDebug_
private

Definition at line 41 of file SiPixelHistoricInfoDQMClient.h.

bool SiPixelHistoricInfoDQMClient::useSummary_
private

Definition at line 37 of file SiPixelHistoricInfoDQMClient.h.

bool SiPixelHistoricInfoDQMClient::writeHisto_
private

Definition at line 42 of file SiPixelHistoricInfoDQMClient.h.