2 #include <TDirectory.h>
12 #include <TPaveStats.h>
34 char* crun2 =
argv[1];
35 char* repro_run2 =
argv[2];
38 sscanf(crun2,
"%d", &
run2);
40 std::cout <<
"ready to run modulediff " <<
run2 <<
" repro run " << repro_run2 << std::endl;
52 vector<int> badmodlist_run1;
53 vector<int> badmodlist_run2;
54 vector<int> modules_recovered;
55 vector<int> modules_malformed;
62 repro_run1 = repro_run2;
64 printf(
"closest run not found, exiting.\n");
71 if (flag1 < 0 || flag2 < 0) {
72 cout <<
"Error: file not found." << endl;
76 get_difference(badmodlist_run1, badmodlist_run2, modules_recovered);
77 get_difference(badmodlist_run2, badmodlist_run1, modules_malformed);
81 string namefile =
"modulediff_emailbody.txt";
84 outfile <<
"Recovered modules in run " << run_2 <<
": " << (
int)modules_recovered.size() << endl;
85 outfile <<
"New bad modules in run " << run_2 <<
": " << (
int)modules_malformed.size() << endl;
86 outfile <<
"Using reference run " << run_1 << endl << endl;
88 outfile <<
"Recovered modules in run " << run_2 <<
":" << endl;
89 if (modules_recovered.empty())
91 for (
unsigned int i = 0;
i < modules_recovered.size();
i++)
92 outfile <<
" " << modules_recovered[
i] << endl;
94 outfile <<
"New bad modules that appeared in run " << run_2 <<
":" << endl;
95 if (modules_malformed.empty())
97 for (
unsigned int i = 0;
i < modules_malformed.size();
i++)
98 outfile <<
" " << modules_malformed[
i] << endl;
104 if (!modules_recovered.empty()) {
105 std::ofstream outfile_good;
106 outfile_good.open(
"modulediff_good.txt");
107 for (
unsigned int i = 0;
i < modules_recovered.size();
i++)
108 outfile_good <<
" " << modules_recovered[
i] << endl;
109 outfile_good.close();
112 if (!modules_malformed.empty()) {
113 std::ofstream outfile_bad;
114 outfile_bad.open(
"modulediff_bad.txt");
115 for (
unsigned int i = 0;
i < modules_malformed.size();
i++)
116 outfile_bad <<
" " << modules_malformed[
i] << endl;
121 void get_difference(vector<int> badlist1, vector<int> badlist2, vector<int>& difflist) {
123 for (
unsigned int i1 = 0;
i1 < badlist1.size();
i1++) {
124 bool thisrecovered =
true;
125 for (
unsigned int i2 = 0;
i2 < badlist2.size();
i2++)
126 if (badlist1[
i1] == badlist2[
i2]) {
127 thisrecovered =
false;
131 difflist.push_back(badlist1[
i1]);
140 cout <<
"reading problem" << endl;
144 vector<string> subdet;
145 subdet.push_back(
"TIB");
146 subdet.push_back(
"TID/MINUS");
147 subdet.push_back(
"TID/PLUS");
148 subdet.push_back(
"TOB");
149 subdet.push_back(
"TEC/MINUS");
150 subdet.push_back(
"TEC/PLUS");
155 string topdir =
"DQMData/Run " + nrun +
"/SiStrip/Run summary/MechanicalView";
156 gDirectory->cd(topdir.c_str());
157 TDirectory* mec1 = gDirectory;
159 for (
unsigned int i = 0;
i < subdet.size();
i++) {
160 string badmodule_dir = subdet[
i] +
"/BadModuleList";
161 if (gDirectory->cd(badmodule_dir.c_str())) {
162 TIter
next(gDirectory->GetListOfKeys());
165 while ((
key = dynamic_cast<TKey*>(
next()))) {
166 string sflag =
key->GetName();
170 string detid = sflag.substr(sflag.find(
'<') + 1, 9);
171 badlist.push_back(atoi(detid.c_str()));
186 stringstream rundirprefix;
187 rundirprefix <<
"000" <<
run / 100 <<
"xx/";
189 stringstream thisdir;
191 thisdir <<
"/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/data/OfflineData/HIRun2011/" << repro_type.c_str() <<
"/"
192 << rundirprefix.str();
194 string thisdir2 = thisdir.str();
197 if ((
dp = opendir(thisdir2.c_str())) ==
nullptr) {
198 cout <<
"dir " << thisdir2.c_str() <<
" not found" << endl;
206 while ((dirp = readdir(
dp)) !=
nullptr) {
207 string dirfile =
string(dirp->d_name);
208 if (dirfile.find(
"__DQM") != string::npos && dirfile.find(
runstr.str()) != string::npos) {
229 for (
int test_run = thisrun - 1; test_run > thisrun - 1000; test_run--) {