CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SiPixelDetectorStatus Class Reference

#include <SiPixelDetectorStatus.h>

Public Member Functions

void addModule (int detid, int nrocs)
 
void addModule (int detid, SiPixelModuleStatus a)
 
std::map< int, SiPixelModuleStatus >::iterator begin ()
 
unsigned long int digiOccDET ()
 
void dumpToFile (std::string filename)
 
std::map< int, SiPixelModuleStatus >::iterator end ()
 
void fillDIGI (int detid, int roc)
 
void fillFEDerror25 (int detid, PixelFEDChannel ch)
 
bool findModule (int detid)
 
std::map< int, SiPixelModuleStatusgetDetectorStatus ()
 
std::map< int, std::vector< int > > getFEDerror25Rocs ()
 
std::pair< int, int > getLSRange ()
 
SiPixelModuleStatusgetModule (int detid)
 
unsigned long int getNevents ()
 
std::pair< int, int > getRunRange ()
 
std::map< int, SiPixelModuleStatus >::iterator next ()
 
int nmodules ()
 
double perRocDigiOcc ()
 
double perRocDigiOccVar ()
 
void readFromFile (std::string filename)
 
void resetDetectorStatus ()
 
void setLSRange (int ls0, int ls1)
 
void setNevents (unsigned long int N)
 
void setRunRange (int run0, int run1)
 
 SiPixelDetectorStatus ()
 
void updateDetectorStatus (SiPixelDetectorStatus newData)
 
 ~SiPixelDetectorStatus ()
 

Private Attributes

unsigned long int fDetHits
 
int fLS0
 
int fLS1
 
std::map< int, SiPixelModuleStatusfModules
 
unsigned long int fNevents
 
int fRun0
 
int fRun1
 

Detailed Description

Definition at line 11 of file SiPixelDetectorStatus.h.

Constructor & Destructor Documentation

◆ SiPixelDetectorStatus()

SiPixelDetectorStatus::SiPixelDetectorStatus ( )

Definition at line 14 of file SiPixelDetectorStatus.cc.

14  : fLS0(99999999), fLS1(0), fRun0(99999999), fRun1(0) {
15  fDetHits = 0;
16  fNevents = 0;
17 }

References fDetHits, and fNevents.

◆ ~SiPixelDetectorStatus()

SiPixelDetectorStatus::~SiPixelDetectorStatus ( )

Definition at line 20 of file SiPixelDetectorStatus.cc.

20 {}

Member Function Documentation

◆ addModule() [1/2]

void SiPixelDetectorStatus::addModule ( int  detid,
int  nrocs 
)

Definition at line 105 of file SiPixelDetectorStatus.cc.

105  {
106  SiPixelModuleStatus a(detid, nrocs);
107  fModules.insert(std::make_pair(detid, a));
108 }

References a, fModules, and DeadROCCounter::nrocs.

Referenced by SiPixelStatusProducer::beginLuminosityBlock(), and readFromFile().

◆ addModule() [2/2]

void SiPixelDetectorStatus::addModule ( int  detid,
SiPixelModuleStatus  a 
)

Definition at line 111 of file SiPixelDetectorStatus.cc.

111 { fModules.insert(std::make_pair(detid, a)); }

References a, and fModules.

◆ begin()

std::map< int, SiPixelModuleStatus >::iterator SiPixelDetectorStatus::begin ( )

Definition at line 150 of file SiPixelDetectorStatus.cc.

150 { return fModules.begin(); }

References fModules.

Referenced by dumpToFile(), getFEDerror25Rocs(), perRocDigiOcc(), perRocDigiOccVar(), and updateDetectorStatus().

◆ digiOccDET()

unsigned long int SiPixelDetectorStatus::digiOccDET ( )
inline

Definition at line 36 of file SiPixelDetectorStatus.h.

36 { return fDetHits; }

References fDetHits.

Referenced by SiPixelStatusManager::readLumi(), and updateDetectorStatus().

◆ dumpToFile()

void SiPixelDetectorStatus::dumpToFile ( std::string  filename)

Definition at line 84 of file SiPixelDetectorStatus.cc.

84  {
85  std::ofstream OD(filename.c_str());
86  OD << "# SiPixelDetectorStatus START" << std::endl;
87  OD << "# SiPixelDetectorStatus for LS " << fLS0 << " .. " << fLS1 << std::endl;
88  OD << "# SiPixelDetectorStatus for run " << fRun0 << " .. " << fRun1 << std::endl;
89  OD << "# SiPixelDetectorStatus total hits = " << fDetHits << std::endl;
90 
91  for (std::map<int, SiPixelModuleStatus>::iterator it = SiPixelDetectorStatus::begin();
93  ++it) {
94  for (int iroc = 0; iroc < it->second.nrocs(); ++iroc) {
95  for (int idc = 0; idc < 26; ++idc) {
96  OD << Form("%10d %2d %3d", it->first, iroc, int(it->second.getRoc(iroc)->digiOccROC())) << std::endl;
97  }
98  }
99  }
100  OD << "# SiPixelDetectorStatus END" << std::endl;
101  OD.close();
102 }

References begin(), end(), fDetHits, corrVsCorr::filename, fLS0, fLS1, fRun0, and fRun1.

◆ end()

std::map< int, SiPixelModuleStatus >::iterator SiPixelDetectorStatus::end ( )

◆ fillDIGI()

void SiPixelDetectorStatus::fillDIGI ( int  detid,
int  roc 
)

Definition at line 114 of file SiPixelDetectorStatus.cc.

114  {
115  ++fDetHits;
116  fModules[detid].fillDIGI(roc);
117 }

References fDetHits, fModules, and PixelMapPlotter::roc.

Referenced by SiPixelStatusProducer::accumulate().

◆ fillFEDerror25()

void SiPixelDetectorStatus::fillFEDerror25 ( int  detid,
PixelFEDChannel  ch 
)

Definition at line 120 of file SiPixelDetectorStatus.cc.

120  {
121  if (fModules.find(detid) != fModules.end()) {
122  fModules[detid].fillFEDerror25(ch);
123  }
124 }

References fModules.

Referenced by SiPixelStatusProducer::endLuminosityBlockProduce().

◆ findModule()

bool SiPixelDetectorStatus::findModule ( int  detid)

Definition at line 171 of file SiPixelDetectorStatus.cc.

171  {
172  if (fModules.find(detid) == fModules.end())
173  return false;
174  else
175  return true;
176 }

References fModules.

◆ getDetectorStatus()

std::map<int, SiPixelModuleStatus> SiPixelDetectorStatus::getDetectorStatus ( )
inline

Definition at line 80 of file SiPixelDetectorStatus.h.

80 { return fModules; }

References fModules.

Referenced by SiPixelStatusHarvester::dqmEndRun(), and SiPixelStatusHarvester::perLayerRingAverage().

◆ getFEDerror25Rocs()

std::map< int, std::vector< int > > SiPixelDetectorStatus::getFEDerror25Rocs ( )

Definition at line 127 of file SiPixelDetectorStatus.cc.

127  {
128  std::map<int, std::vector<int>> badRocLists_;
129 
130  for (std::map<int, SiPixelModuleStatus>::iterator itMod = SiPixelDetectorStatus::begin();
131  itMod != SiPixelDetectorStatus::end();
132  ++itMod) {
133  int detid = itMod->first;
134  // FEDerror25 effected ROCs in a given module
135  std::vector<int> list;
136  SiPixelModuleStatus modStatus = itMod->second;
137  for (int iroc = 0; iroc < modStatus.nrocs(); ++iroc) {
138  SiPixelRocStatus* roc = modStatus.getRoc(iroc);
139  if (roc->isFEDerror25()) {
140  list.push_back(iroc);
141  }
142  badRocLists_[detid] = list;
143  }
144  }
145 
146  return badRocLists_;
147 }

References begin(), end(), SiPixelModuleStatus::getRoc(), list(), SiPixelModuleStatus::nrocs(), and PixelMapPlotter::roc.

Referenced by SiPixelStatusManager::createFEDerror25().

◆ getLSRange()

std::pair<int, int> SiPixelDetectorStatus::getLSRange ( )
inline

Definition at line 60 of file SiPixelDetectorStatus.h.

60 { return std::make_pair(fLS0, fLS1); }

References fLS0, and fLS1.

Referenced by SiPixelStatusManager::rankByLumi().

◆ getModule()

SiPixelModuleStatus * SiPixelDetectorStatus::getModule ( int  detid)

Definition at line 164 of file SiPixelDetectorStatus.cc.

164  {
165  if (fModules.find(detid) == fModules.end()) {
166  return nullptr;
167  }
168  return &(fModules[detid]);
169 }

References fModules.

Referenced by readFromFile(), and updateDetectorStatus().

◆ getNevents()

unsigned long int SiPixelDetectorStatus::getNevents ( )
inline

Definition at line 64 of file SiPixelDetectorStatus.h.

64 { return fNevents; }

References fNevents.

Referenced by updateDetectorStatus().

◆ getRunRange()

std::pair<int, int> SiPixelDetectorStatus::getRunRange ( )
inline

Definition at line 55 of file SiPixelDetectorStatus.h.

55 { return std::make_pair(fRun0, fRun1); }

References fRun0, and fRun1.

◆ next()

std::map<int, SiPixelModuleStatus>::iterator SiPixelDetectorStatus::next ( )

◆ nmodules()

int SiPixelDetectorStatus::nmodules ( )

Definition at line 161 of file SiPixelDetectorStatus.cc.

161 { return static_cast<int>(fModules.size()); }

References fModules.

◆ perRocDigiOcc()

double SiPixelDetectorStatus::perRocDigiOcc ( )

Definition at line 179 of file SiPixelDetectorStatus.cc.

179  {
180  unsigned long int ave(0);
181  int nrocs(0);
182  for (std::map<int, SiPixelModuleStatus>::iterator it = SiPixelDetectorStatus::begin();
184  ++it) {
185  unsigned long int inc = it->second.digiOccMOD();
186  ave += inc;
187  nrocs += it->second.nrocs();
188  }
189  return (1.0 * ave) / nrocs;
190 }

References begin(), end(), and DeadROCCounter::nrocs.

Referenced by SiPixelStatusManager::createBadComponents(), SiPixelStatusHarvester::dqmEndRun(), and perRocDigiOccVar().

◆ perRocDigiOccVar()

double SiPixelDetectorStatus::perRocDigiOccVar ( )

Definition at line 192 of file SiPixelDetectorStatus.cc.

192  {
193  double fDetAverage = SiPixelDetectorStatus::perRocDigiOcc();
194 
195  double sig = 0.0;
196  int nrocs(0);
197  for (std::map<int, SiPixelModuleStatus>::iterator it = SiPixelDetectorStatus::begin();
199  ++it) {
200  unsigned long int inc = it->second.digiOccMOD();
201  sig += (fDetAverage - inc) * (fDetAverage - inc);
202  nrocs += it->second.nrocs();
203  }
204 
205  double fDetSigma = sig / (nrocs - 1);
206  return TMath::Sqrt(fDetSigma);
207 }

References begin(), end(), DeadROCCounter::nrocs, and perRocDigiOcc().

◆ readFromFile()

void SiPixelDetectorStatus::readFromFile ( std::string  filename)

Definition at line 23 of file SiPixelDetectorStatus.cc.

23  {
24  std::ifstream INS;
25  std::string sline;
26  INS.open(filename.c_str());
27 
28  int oldDetId(-1);
29  int detid(0), roc(0), hits(0), nroc(0);
30  SiPixelModuleStatus* pMod(nullptr);
31  bool readOK(false);
32  while (std::getline(INS, sline)) {
33  if (std::string::npos != sline.find("# SiPixelDetectorStatus START")) {
34  readOK = true;
35  continue;
36  }
37  if (!readOK)
38  continue;
39 
40  if (std::string::npos != sline.find("# SiPixelDetectorStatus END")) {
41  pMod->setNrocs(nroc + 1);
42  break;
43  }
44 
45  if (sline.find("# SiPixelDetectorStatus for LS") != std::string::npos) {
46  std::sscanf(sline.c_str(), "# SiPixelDetectorStatus for LS %d .. %d", &fLS0, &fLS1);
47  continue;
48  }
49  if (sline.find("# SiPixelDetectorStatus for run") != std::string::npos) {
50  std::sscanf(sline.c_str(), "# SiPixelDetectorStatus for run %d .. %d", &fRun0, &fRun1);
51  continue;
52  }
53  if (sline.find("# SiPixelDetectorStatus total hits = ") != std::string::npos) {
54  std::sscanf(sline.c_str(), "# SiPixelDetectorStatus total hits = %ld", &fDetHits);
55  continue;
56  }
57 
58  std::sscanf(sline.c_str(), "%d %d %d", &detid, &roc, &hits);
59  if (roc > nroc)
60  nroc = roc;
61  if (detid != oldDetId) {
62  if (pMod) {
63  pMod->setNrocs(nroc + 1);
64  }
65 
66  oldDetId = detid;
67  if (getModule(detid) == nullptr) {
68  addModule(detid, nroc + 1);
69  }
70 
71  pMod = getModule(detid);
72  nroc = 0;
73  }
74  if (pMod) {
75  fDetHits += hits;
76  pMod->updateModuleDIGI(roc, hits);
77  }
78  }
79 
80  INS.close();
81 }

References addModule(), fDetHits, corrVsCorr::filename, fLS0, fLS1, fRun0, fRun1, getModule(), hfClusterShapes_cfi::hits, PixelMapPlotter::roc, SiPixelModuleStatus::setNrocs(), AlCaHLTBitMon_QueryRunRegistry::string, and SiPixelModuleStatus::updateModuleDIGI().

◆ resetDetectorStatus()

void SiPixelDetectorStatus::resetDetectorStatus ( )
inline

Definition at line 66 of file SiPixelDetectorStatus.h.

66  {
67  fModules.clear();
68  fDetHits = 0;
69  fNevents = 0;
70  fRun0 = 99999999;
71  fRun1 = 0;
72  fLS0 = 99999999;
73  fLS1 = 0;
74  }

References fDetHits, fLS0, fLS1, fModules, fNevents, fRun0, and fRun1.

Referenced by SiPixelStatusProducer::endLuminosityBlockProduce().

◆ setLSRange()

void SiPixelDetectorStatus::setLSRange ( int  ls0,
int  ls1 
)
inline

Definition at line 56 of file SiPixelDetectorStatus.h.

56  {
57  fLS0 = ls0;
58  fLS1 = ls1;
59  }

References fLS0, and fLS1.

Referenced by SiPixelStatusManager::createBadComponents(), and SiPixelStatusProducer::endLuminosityBlockProduce().

◆ setNevents()

void SiPixelDetectorStatus::setNevents ( unsigned long int  N)
inline

Definition at line 63 of file SiPixelDetectorStatus.h.

63 { fNevents = N; }

References fNevents, and N.

Referenced by SiPixelStatusProducer::endLuminosityBlockProduce().

◆ setRunRange()

void SiPixelDetectorStatus::setRunRange ( int  run0,
int  run1 
)
inline

Definition at line 51 of file SiPixelDetectorStatus.h.

51  {
52  fRun0 = run0;
53  fRun1 = run1;
54  }

References fRun0, fRun1, ntuplemaker::run0, and ntuplemaker::run1.

Referenced by SiPixelStatusProducer::endLuminosityBlockProduce().

◆ updateDetectorStatus()

void SiPixelDetectorStatus::updateDetectorStatus ( SiPixelDetectorStatus  newData)

Definition at line 210 of file SiPixelDetectorStatus.cc.

210  {
211  // loop over new data status
212  for (std::map<int, SiPixelModuleStatus>::iterator it = newData.begin(); it != newData.end(); ++it) {
213  int detid = it->first;
214  if (fModules.find(detid) != fModules.end()) { // if the detid is in the module lists
215  fModules[detid].updateModuleStatus(*(newData.getModule(detid)));
216  } else {
217  fModules.insert(std::make_pair(detid, *(newData.getModule(detid))));
218  }
219  }
220 
221  fDetHits = fDetHits + newData.digiOccDET();
222  fNevents = fNevents + newData.getNevents();
223 }

References begin(), digiOccDET(), end(), fDetHits, fModules, fNevents, getModule(), and getNevents().

Referenced by SiPixelStatusManager::createBadComponents().

Member Data Documentation

◆ fDetHits

unsigned long int SiPixelDetectorStatus::fDetHits
private

◆ fLS0

int SiPixelDetectorStatus::fLS0
private

◆ fLS1

int SiPixelDetectorStatus::fLS1
private

◆ fModules

std::map<int, SiPixelModuleStatus> SiPixelDetectorStatus::fModules
private

◆ fNevents

unsigned long int SiPixelDetectorStatus::fNevents
private

◆ fRun0

int SiPixelDetectorStatus::fRun0
private

◆ fRun1

int SiPixelDetectorStatus::fRun1
private
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
SiPixelDetectorStatus::fNevents
unsigned long int fNevents
Definition: SiPixelDetectorStatus.h:91
SiPixelDetectorStatus::fRun1
int fRun1
Definition: SiPixelDetectorStatus.h:88
SiPixelDetectorStatus::getModule
SiPixelModuleStatus * getModule(int detid)
Definition: SiPixelDetectorStatus.cc:164
SiPixelDetectorStatus::begin
std::map< int, SiPixelModuleStatus >::iterator begin()
Definition: SiPixelDetectorStatus.cc:150
SiPixelRocStatus
Definition: SiPixelRocStatus.h:5
SiPixelDetectorStatus::addModule
void addModule(int detid, int nrocs)
Definition: SiPixelDetectorStatus.cc:105
ntuplemaker.run1
run1
Definition: ntuplemaker.py:85
N
#define N
Definition: blowfish.cc:9
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
SiPixelModuleStatus
Definition: SiPixelModuleStatus.h:10
ntuplemaker.run0
run0
Definition: ntuplemaker.py:84
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiPixelDetectorStatus::getNevents
unsigned long int getNevents()
Definition: SiPixelDetectorStatus.h:64
SiPixelDetectorStatus::fDetHits
unsigned long int fDetHits
Definition: SiPixelDetectorStatus.h:94
a
double a
Definition: hdecay.h:119
SiPixelModuleStatus::getRoc
SiPixelRocStatus * getRoc(int i)
get a ROC
Definition: SiPixelModuleStatus.cc:91
SiPixelDetectorStatus::fModules
std::map< int, SiPixelModuleStatus > fModules
Definition: SiPixelDetectorStatus.h:83
SiPixelDetectorStatus::end
std::map< int, SiPixelModuleStatus >::iterator end()
Definition: SiPixelDetectorStatus.cc:158
DeadROCCounter.nrocs
nrocs
Definition: DeadROCCounter.py:57
PixelMapPlotter.roc
roc
Definition: PixelMapPlotter.py:498
SiPixelDetectorStatus::fLS1
int fLS1
Definition: SiPixelDetectorStatus.h:86
SiPixelDetectorStatus::perRocDigiOcc
double perRocDigiOcc()
Definition: SiPixelDetectorStatus.cc:179
list
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*", "!HLTx*" if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL. It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of "!*" before the partial wildcard feature was incorporated). Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
SiPixelModuleStatus::nrocs
int nrocs()
Definition: SiPixelModuleStatus.cc:61
SiPixelDetectorStatus::fRun0
int fRun0
Definition: SiPixelDetectorStatus.h:88
SiPixelDetectorStatus::digiOccDET
unsigned long int digiOccDET()
Definition: SiPixelDetectorStatus.h:36
SiPixelDetectorStatus::fLS0
int fLS0
Definition: SiPixelDetectorStatus.h:86