CMS 3D CMS Logo

Functions
listbadmodule.cc File Reference
#include <iostream>
#include <cstdio>
#include <TDirectory.h>
#include <TFile.h>
#include <TKey.h>
#include <TH1.h>
#include <Riostream.h>
#include <string>
#include <vector>
#include <set>
#include <fstream>
#include <sstream>
#include <cstdint>
#include <cstdlib>
#include "listbadmodule.h"

Go to the source code of this file.

Functions

void listbadmodule (std::string filename, std::string pclfilename)
 
int main (int argc, char *argv[])
 

Function Documentation

◆ listbadmodule()

void listbadmodule ( std::string  filename,
std::string  pclfilename 
)

Definition at line 38 of file listbadmodule.cc.

References gather_cfg::cout, debug, corrVsCorr::filename, RemoveAddSevLevel::flag, mps_fire::i, crabWrapper::key, mps_splice::line, GetRecoTauVFromDQM_MC_cff::next, timingPdfMaker::outfile, AlCaHLTBitMon_QueryRunRegistry::string, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by main().

38  {
39  int debug = 1;
40 
41  // extract fully bad modules from PCLBadComponents txt file
42 
43  std::set<unsigned int> pclbadmods;
44 
45  std::ifstream pclfile(pclfilename);
46 
47  char line[400];
48  unsigned int pcldetid;
49  char sixapvs[] = "1 1 1 1 1 1";
50  char fourapvs[] = "1 1 x x 1 1";
51 
52  while (pclfile.getline(line, 400)) {
53  if (strstr(line, sixapvs) || strstr(line, fourapvs)) {
54  std::stringstream linestream;
55  linestream << line;
56  linestream >> pcldetid;
57  // std::cout << pcldetid << std::endl;
58  pclbadmods.insert(pcldetid);
59  }
60  }
61 
62  std::vector<std::string> subdet;
63  subdet.push_back("TIB");
64  subdet.push_back("TID/MINUS");
65  subdet.push_back("TID/PLUS");
66  subdet.push_back("TOB");
67  subdet.push_back("TEC/MINUS");
68  subdet.push_back("TEC/PLUS");
69 
70  std::string nrun = filename.substr(filename.find("_R000") + 5, 6);
71  int fileNum = atoi(nrun.c_str());
72  std::cout << " ------ Run " << fileNum << std::endl;
73 
74  std::ofstream outfile;
75  std::string namefile;
76  namefile = "QualityTestOBSOLETE_run" + nrun + ".txt";
77  outfile.open(namefile.c_str());
78 
79  TFile *myfile = TFile::Open(filename.c_str());
80  if (debug == 1) {
81  std::cout << " Opened " << filename << std::endl;
82  }
83  std::string topdir = "DQMData/Run " + nrun + "/SiStrip/Run summary/MechanicalView";
84  gDirectory->cd(topdir.c_str());
85  TDirectory *mec1 = gDirectory;
86 
87  //get the summary first
88  std::vector<int> nbadmod;
89  for (unsigned int i = 0; i < subdet.size(); i++) {
90  int nbad = 0;
91  std::string badmodule_dir = subdet[i] + "/BadModuleList";
92  if (gDirectory->cd(badmodule_dir.c_str())) {
93  TIter next(gDirectory->GetListOfKeys());
94  TKey *key;
95  while ((key = dynamic_cast<TKey *>(next()))) {
96  std::string sflag = key->GetName();
97  if (sflag.empty())
98  continue;
99  nbad++;
100  }
101  }
102  nbadmod.push_back(nbad);
103  mec1->cd();
104  }
105 
106  outfile << "Number of bad modules in total excluding PCL-only bad modules:" << std::endl;
107  outfile << "--------------------------------------------------------------" << std::endl;
108  outfile << subdet.at(0) << ": " << nbadmod.at(0) << std::endl;
109  outfile << subdet.at(1) << ": " << nbadmod.at(1) << std::endl;
110  outfile << subdet.at(2) << ": " << nbadmod.at(2) << std::endl;
111  outfile << subdet.at(3) << ": " << nbadmod.at(3) << std::endl;
112  outfile << subdet.at(4) << ": " << nbadmod.at(4) << std::endl;
113  outfile << subdet.at(5) << ": " << nbadmod.at(5) << std::endl;
114  outfile << "-------------------------------" << std::endl;
115 
116  outfile << std::endl << "List of bad modules per partition:" << std::endl;
117  outfile << "----------------------------------" << std::endl;
118 
119  std::set<unsigned int>::const_iterator pclbadmod = pclbadmods.begin();
120 
121  for (unsigned int i = 0; i < subdet.size(); i++) {
122  std::string badmodule_dir = subdet[i] + "/BadModuleList";
123  outfile << " " << std::endl;
124  outfile << "SubDetector " << subdet[i] << std::endl;
125  outfile << " " << std::endl;
126  std::cout << badmodule_dir.c_str() << std::endl;
127  if (gDirectory->cd(badmodule_dir.c_str())) {
128  //
129  // Loop to find bad module for each partition
130  //
131  TIter next(gDirectory->GetListOfKeys());
132  TKey *key;
133 
134  while ((key = dynamic_cast<TKey *>(next()))) {
135  std::string sflag = key->GetName();
136  if (sflag.empty())
137  continue;
138  std::string detid = sflag.substr(sflag.find('<') + 1, 9);
139  size_t pos1 = sflag.find('/');
140  sflag = sflag.substr(sflag.find('<') + 13, pos1 - 2);
141  int flag = atoi(sflag.c_str());
142  sscanf(detid.c_str(), "%u", &pcldetid);
143  // the following loop add modules which are bad only for the PCL to the list.
144  // It requires that the bad modules from QT are sorted as the one of the PCL
145  while (pclbadmod != pclbadmods.end() && pcldetid > *pclbadmod) {
146  outfile << "Module " << *pclbadmod << " PCLBadModule " << std::endl;
147  pclbadmod++;
148  }
149  std::string message;
150  message = "Module " + detid;
151  if (((flag >> 0) & 0x1) > 0)
152  message += " Fed BadChannel : ";
153  if (((flag >> 1) & 0x1) > 0)
154  message += " # of Digi : ";
155  if (((flag >> 2) & 0x1) > 0)
156  message += " # of Clusters :";
157  if (((flag >> 3) & 0x1) > 0)
158  message += " Excluded FED Channel ";
159  if (((flag >> 4) & 0x1) > 0)
160  message += " DCSError ";
161  if (pclbadmods.find(pcldetid) != pclbadmods.end()) {
162  message += " PCLBadModule ";
163  pclbadmod = pclbadmods.find(pcldetid);
164  pclbadmod++;
165  }
166  outfile << message.c_str() << std::endl;
167  }
168  }
169  mec1->cd();
170  }
171  myfile->Close();
172  outfile.close();
173 }
#define debug
Definition: HDRShower.cc:19

◆ main()

int main ( int  argc,
char *  argv[] 
)

===============================================================================================================================================================================================


variant2: for each run define phi-averaged A for normalization channel (Dref,16) and then, divide Rijk on it, i.e. get RRijk




















































































eta=27

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=19

eta=17

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=20

eta=19

eta=18

eta=27 L1=1

eta=25 L1=1

eta=23 L1=1

eta=22 L1=1

eta=21 L1=1

eta=29 L1=1

eta=26 L1=1

eta=24 L1=1

eta=20 L1=1

eta=19 L1=1

eta=18 L1=1

eta=17 L1=1

eta=28 L7=1

eta=27 L7=1

eta=25 L7=1

eta=23 L7=1

eta=22 L7=1

eta=21 L7=1

eta=26 L7=1

eta=24 L7=1

eta=20 L7=1

eta=19 L7=1

eta=18 L7=1

eta=17 L7=1

eta=27

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=19

eta=17

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=20

eta=19

eta=18

eta=27 L1=1

eta=25 L1=1

eta=23 L1=1

eta=22 L1=1

eta=21 L1=1

eta=26 L1=1

eta=24 L1=1

eta=20 L1=1

eta=19 L1=1

eta=18 L1=1

eta=17 L1=1

eta=28 L7=1

eta=27 L7=1

eta=25 L7=1

eta=23 L7=1

eta=22 L7=1

eta=21 L7=1

eta=26 L7=1

eta=24 L7=1

eta=20 L7=1

eta=19 L7=1

eta=18 L7=1

eta=17 L7=1

eta=27

eta=28

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:





Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:





Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:





Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

Prepare maps of good/bad channels:

Prepare maps of good/bad channels:

Prepare maps of good/bad channels:

Prepare maps of good/bad channels:

Definition at line 22 of file listbadmodule.cc.

References dir2webdir::argc, GCPpyPlots::argv, gather_cfg::cout, corrVsCorr::filename, and listbadmodule().

22  {
23  if (argc == 3) {
24  char *filename = argv[1];
25  char *pclfilename = argv[2];
26 
27  std::cout << "ready to prepare list of bad modules " << filename << std::endl;
28 
29  listbadmodule(filename, pclfilename);
30 
31  } else {
32  std::cout << "Too few arguments: " << argc << std::endl;
33  return -1;
34  }
35  return 0;
36 }
void listbadmodule(std::string filename, std::string pclfilename)