26 INS.open(filename.c_str());
29 int detid(0),
roc(0), hits(0), nroc(0);
32 while (std::getline(INS, sline)) {
33 if (std::string::npos != sline.find(
"# SiPixelDetectorStatus START")) {
40 if (std::string::npos != sline.find(
"# SiPixelDetectorStatus END")) {
45 if (sline.find(
"# SiPixelDetectorStatus for LS") != std::string::npos) {
46 std::sscanf(sline.c_str(),
"# SiPixelDetectorStatus for LS %d .. %d", &
fLS0_, &
fLS1_);
49 if (sline.find(
"# SiPixelDetectorStatus for run") != std::string::npos) {
50 std::sscanf(sline.c_str(),
"# SiPixelDetectorStatus for run %d .. %d", &
fRun0_, &
fRun1_);
53 if (sline.find(
"# SiPixelDetectorStatus total hits = ") != std::string::npos) {
54 std::sscanf(sline.c_str(),
"# SiPixelDetectorStatus total hits = %ld", &
fDetHits_);
58 std::sscanf(sline.c_str(),
"%d %d %d", &detid, &
roc, &hits);
61 if (detid != oldDetId) {
75 if (pMod !=
nullptr) {
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;
94 for (
int iroc = 0; iroc < it->second.nrocs(); ++iroc) {
95 OD << Form(
"%10d %2d %3d", it->first, iroc,
int(it->second.getRoc(iroc)->digiOccROC())) << std::endl;
98 OD <<
"# SiPixelDetectorStatus END" << std::endl;
106 fModules_.insert(std::make_pair(detid, a));
128 std::map<int, std::vector<int>> badRocLists;
133 int detid = itMod->first;
135 std::vector<int> list;
137 for (
int iroc = 0; iroc < modStatus.
nrocs(); ++iroc) {
140 list.push_back(iroc);
142 badRocLists[detid] = list;
175 unsigned long int ave(0);
180 unsigned long int inc = it->second.digiOccMOD();
182 nrocs += it->second.nrocs();
184 return (1.0 * ave) / nrocs;
195 unsigned long int inc = it->second.digiOccMOD();
196 sig += (fDetAverage - inc) * (fDetAverage - inc);
197 nrocs += it->second.nrocs();
200 double fDetSigma = sig / (nrocs - 1);
201 return TMath::Sqrt(fDetSigma);
209 for (std::map<int, SiPixelModuleStatus>::iterator it = newData.
begin(); it != newData.
end(); ++it) {
210 int detid = it->first;
void addModule(int detid, int nrocs)
void updateDetectorStatus(SiPixelDetectorStatus newData)
void updateModuleDIGI(int roc, unsigned int nhits)
combine new data to update(topup) module status
void resetDetectorStatus()
void dumpToFile(std::ofstream &outFile)
unsigned long int digiOccDET()
void fillFEDerror25(int detid, PixelFEDChannel ch)
double perRocDigiOccVar()
std::map< int, std::vector< int > > getFEDerror25Rocs()
void fillDIGI(int detid, int roc)
unsigned long int fDetHits_
unsigned long int ftotalevents_
void readFromFile(std::string filename)
std::map< int, SiPixelModuleStatus >::iterator end()
std::map< int, SiPixelModuleStatus >::iterator begin()
std::map< int, SiPixelModuleStatus > fModules_
unsigned long int getNevents()
SiPixelRocStatus * getRoc(int i)
get a ROC
SiPixelModuleStatus * getModule(int detid)
bool findModule(int detid)