45 std::set<unsigned int> pclbadmods;
47 ifstream pclfile(pclfilename);
50 unsigned int pcldetid;
51 char sixapvs[]=
"1 1 1 1 1 1";
52 char fourapvs[]=
"1 1 x x 1 1";
54 while(pclfile.getline(line,400)) {
55 if(strstr(line,sixapvs) || strstr(line,fourapvs)) {
56 stringstream linestream;
58 linestream >> pcldetid;
60 pclbadmods.insert(pcldetid);
64 std::vector<std::string> subdet;
65 subdet.push_back(
"TIB");
66 subdet.push_back(
"TID/side_1");
67 subdet.push_back(
"TID/side_2");
68 subdet.push_back(
"TOB");
69 subdet.push_back(
"TEC/side_1");
70 subdet.push_back(
"TEC/side_2");
73 int fileNum = atoi(nrun.c_str());
74 cout <<
" ------ Run " << fileNum << endl;
78 namefile =
"QualityTestOBSOLETE_run" + nrun +
".txt";
79 outfile.open(namefile.c_str());
81 TFile *myfile = TFile::Open(
filename.c_str());
85 std::string topdir =
"DQMData/Run " + nrun +
"/SiStrip/Run summary/MechanicalView";
86 gDirectory->cd(topdir.c_str());
87 TDirectory* mec1 = gDirectory;
91 for (
unsigned int i=0;
i < subdet.size();
i++){
93 string badmodule_dir = subdet[
i] +
"/BadModuleList";
94 if (gDirectory->cd(badmodule_dir.c_str())){
95 TIter
next(gDirectory->GetListOfKeys());
97 while ( (key = dynamic_cast<TKey*>(
next())) ) {
98 string sflag = key->GetName();
99 if (sflag.size() == 0)
continue;
103 nbadmod.push_back(nbad);
107 outfile <<
"Number of bad modules in total excluding PCL-only bad modules:" << std::endl;
108 outfile <<
"--------------------------------------------------------------" << std::endl;
109 outfile << subdet.at(0) <<
": " << nbadmod.at(0) << std::endl;
110 outfile << subdet.at(1) <<
": " << nbadmod.at(1) << std::endl;
111 outfile << subdet.at(2) <<
": " << nbadmod.at(2) << std::endl;
112 outfile << subdet.at(3) <<
": " << nbadmod.at(3) << std::endl;
113 outfile << subdet.at(4) <<
": " << nbadmod.at(4) << std::endl;
114 outfile << subdet.at(5) <<
": " << nbadmod.at(5) << std::endl;
115 outfile <<
"-------------------------------" << std::endl;
118 <<
"List of bad modules per partition:" << std::endl;
119 outfile <<
"----------------------------------" << std::endl;
121 std::set<unsigned int>::const_iterator pclbadmod = pclbadmods.begin();
123 for (
unsigned int i=0;
i < subdet.size();
i++){
124 std::string badmodule_dir = subdet[
i] +
"/BadModuleList";
125 outfile <<
" " << endl;
126 outfile <<
"SubDetector " << subdet[
i] << endl;
127 outfile <<
" " << endl;
128 cout << badmodule_dir.c_str() << endl;
129 if (gDirectory->cd(badmodule_dir.c_str())){
133 TIter
next(gDirectory->GetListOfKeys());
136 while ( (key = dynamic_cast<TKey*>(
next())) ) {
137 std::string sflag = key->GetName();
138 if (sflag.size() == 0)
continue;
139 std::string
detid = sflag.substr(sflag.find(
"<")+1,9);
140 size_t pos1 = sflag.find(
"/");
141 sflag = sflag.substr(sflag.find(
"<")+13,pos1-2);
142 int flag = atoi(sflag.c_str());
143 sscanf(detid.c_str(),
"%u",&pcldetid);
146 while(pclbadmod!= pclbadmods.end() && pcldetid > *pclbadmod) {
147 outfile <<
"Module " << *pclbadmod <<
" PCLBadModule " << std::endl;
151 message =
"Module " +
detid;
152 if (((flag >> 0) & 0x1) > 0) message +=
" Fed BadChannel : ";
153 if (((flag >> 1) & 0x1) > 0) message +=
" # of Digi : ";
154 if (((flag >> 2) & 0x1) > 0) message +=
" # of Clusters :";
155 if (((flag >> 3) & 0x1) > 0) message +=
" Excluded FED Channel ";
156 if (((flag >> 4) & 0x1) > 0) message +=
" DCSError ";
157 if (pclbadmods.find(pcldetid) != pclbadmods.end()) {
158 message +=
" PCLBadModule ";
159 pclbadmod = pclbadmods.find(pcldetid);
162 outfile << message.c_str() << std::endl;