2 #include <TDirectory.h> 12 #include <TPaveStats.h> 60 float limit_x = 0.002;
61 float limit_y = 0.002;
63 float limit_dx = 0.002;
64 float limit_dy = 0.002;
66 float limit_errdx = 0.002;
67 float limit_errdy = 0.002;
68 float limit_errdz = 0.5;
75 vector<int> ls_xsc_bad;
76 vector<int> ls_ysc_bad;
77 vector<int> ls_zsc_bad;
79 vector<int> ls_dx_bad;
80 vector<int> ls_dy_bad;
81 vector<int> ls_dz_bad;
83 vector<int> ls_dxsc_bad;
84 vector<int> ls_dysc_bad;
85 vector<int> ls_dzsc_bad;
87 vector<int> ls_errdx_bad;
88 vector<int> ls_errdy_bad;
89 vector<int> ls_errdz_bad;
91 vector<int> ls_errdxsc_bad;
92 vector<int> ls_errdysc_bad;
93 vector<int> ls_errdzsc_bad;
99 check_offset(
filename,
"Validation",
"hxLumibased PrimaryVertex-DataBase", -limit_x, limit_x, ls_x_bad);
100 check_offset(
filename,
"Validation",
"hyLumibased PrimaryVertex-DataBase", -limit_y, limit_y, ls_y_bad);
101 check_offset(
filename,
"Validation",
"hzLumibased PrimaryVertex-DataBase", -limit_z, limit_z, ls_z_bad);
104 check_offset(
filename,
"Validation",
"hxLumibased Scalers-DataBase fit", -limit_x, limit_x, ls_xsc_bad);
105 check_offset(
filename,
"Validation",
"hyLumibased Scalers-DataBase fit", -limit_y, limit_y, ls_ysc_bad);
106 check_offset(
filename,
"Validation",
"hzLumibased Scalers-DataBase fit", -limit_z, limit_z, ls_zsc_bad);
108 check_offset(
filename,
"Debug",
"hsigmaXLumibased PrimaryVertex-DataBase fit", -limit_dx, limit_dx, ls_dx_bad);
109 check_offset(
filename,
"Debug",
"hsigmaYLumibased PrimaryVertex-DataBase fit", -limit_dy, limit_dy, ls_dy_bad);
110 check_offset(
filename,
"Debug",
"hsigmaZLumibased PrimaryVertex-DataBase fit", -limit_dz, limit_dz, ls_dz_bad);
112 check_offset(
filename,
"Validation",
"hsigmaXLumibased Scalers-DataBase fit", -limit_dx, limit_dx, ls_dxsc_bad);
113 check_offset(
filename,
"Validation",
"hsigmaYLumibased Scalers-DataBase fit", -limit_dy, limit_dy, ls_dysc_bad);
114 check_offset(
filename,
"Validation",
"hsigmaZLumibased Scalers-DataBase fit", -limit_dz, limit_dz, ls_dzsc_bad);
116 check_sigma(
filename,
"Debug",
"hsigmaXLumibased PrimaryVertex-DataBase fit", limit_errdx, ls_errdx_bad);
117 check_sigma(
filename,
"Debug",
"hsigmaYLumibased PrimaryVertex-DataBase fit", limit_errdy, ls_errdy_bad);
118 check_sigma(
filename,
"Debug",
"hsigmaZLumibased PrimaryVertex-DataBase fit", limit_errdz, ls_errdz_bad);
120 check_sigma(
filename,
"Validation",
"hsigmaXLumibased Scalers-DataBase fit", limit_errdx, ls_errdxsc_bad);
121 check_sigma(
filename,
"Validation",
"hsigmaYLumibased Scalers-DataBase fit", limit_errdy, ls_errdysc_bad);
122 check_sigma(
filename,
"Validation",
"hsigmaZLumibased Scalers-DataBase fit", limit_errdz, ls_errdzsc_bad);
167 ls_good.push_back(
i);
172 outfile.open(namefile.c_str());
176 sprintf(
line,
" GOOD Lumisections (values within limits): %s",
ListOut(ls_good).c_str());
179 if (!ls_bad.empty()) {
180 sprintf(
line,
" BAD Lumisections (values outside limits): %s",
ListOut(ls_bad).c_str());
183 sprintf(
line,
" --- histogram name --- --- bad lumisection list(*) ---");
185 sprintf(
line,
" hxLumibased PrimaryVertex-DataBase (mean): %s",
ListOut(ls_x_bad).c_str());
186 if (!ls_x_bad.empty())
188 sprintf(
line,
" hyLumibased PrimaryVertex-DataBase (mean): %s",
ListOut(ls_y_bad).c_str());
189 if (!ls_y_bad.empty())
191 sprintf(
line,
" hzLumibased PrimaryVertex-DataBase (mean): %s",
ListOut(ls_z_bad).c_str());
192 if (!ls_z_bad.empty())
195 sprintf(
line,
" hsigmaXLumibased PrimaryVertex-DataBase fit (mean): %s",
ListOut(ls_dx_bad).c_str());
196 if (!ls_dx_bad.empty())
198 sprintf(
line,
" hsigmaYLumibased PrimaryVertex-DataBase fit (mean): %s",
ListOut(ls_dy_bad).c_str());
199 if (!ls_dy_bad.empty())
201 sprintf(
line,
" hsigmaZLumibased PrimaryVertex-DataBase fit (mean): %s",
ListOut(ls_dz_bad).c_str());
202 if (!ls_dz_bad.empty())
205 sprintf(
line,
" hsigmaXLumibased PrimaryVertex-DataBase fit (error): %s",
ListOut(ls_errdx_bad).c_str());
206 if (!ls_errdx_bad.empty())
208 sprintf(
line,
" hsigmaYLumibased PrimaryVertex-DataBase fit (error): %s",
ListOut(ls_errdy_bad).c_str());
209 if (!ls_errdy_bad.empty())
211 sprintf(
line,
" hsigmaZLumibased PrimaryVertex-DataBase fit (error): %s",
ListOut(ls_errdz_bad).c_str());
212 if (!ls_errdz_bad.empty())
215 sprintf(
line,
" (*) also bad in the corresponding 'Scalers-Database fit' histograms");
220 std::cout <<
"Lumibased BeamSpot Calibration Certification summary saved in " << namefile << endl;
229 for (
int i = 1;
i <= checkPlot.GetNbinsX();
i++) {
230 float value = checkPlot.GetBinContent(
i);
231 if (value < limit_min || value > limit_max) {
232 badLS.push_back((
int)checkPlot.GetBinCenter(
i));
243 for (
int i = 1;
i <= checkPlot.GetNbinsX();
i++) {
244 float value = checkPlot.GetBinError(
i);
245 if (
value > limit_err) {
246 badLS.push_back((
int)checkPlot.GetBinCenter(
i));
253 for (
unsigned int i = 0;
i < ls_badlist.size();
i++) {
254 if (
ls == ls_badlist[
i])
265 if (!
file->IsOpen()) {
271 string EventInfoDir =
"DQMData/Run " +
run +
"/SiStrip/Run summary/EventInfo";
272 TDirectory* rsEventInfoDir =
dynamic_cast<TDirectory*
>(
file->Get(EventInfoDir.c_str()));
273 rsEventInfoDir->cd();
274 TIter eiKeys(rsEventInfoDir->GetListOfKeys());
276 while ((eiKey = dynamic_cast<TKey*>(eiKeys()))) {
279 string sflag = eiKey->GetName();
280 string tempname = sflag.substr(sflag.find(
"i=") + 2);
281 size_t pos1 = tempname.find(
'<');
282 size_t pos2 = sflag.find_first_of(
'>');
283 string detvalue = tempname.substr(0, pos1);
284 string numlumisec = sflag.substr(1, pos2 - 1);
285 if (numlumisec == (
string)
"iLumiSection") {
303 if (!
file->IsOpen()) {
308 string dir =
"DQMData/Run " +
run +
"/AlcaBeamMonitor/Run summary/" + iDir;
312 string theplot = strplot +
";1";
314 gDirectory->GetObject(theplot.c_str(), thisplot);
317 std::cout <<
"Error: plot " <<
dir <<
"/" << theplot.c_str() <<
" not found!" << endl;
333 int refLS = LSlist[0];
334 for (
unsigned int at = 1; at < LSlist.size() - 1; at++) {
336 if (refLS + 1 == LSlist[at] && LSlist[at] + 1 == LSlist[at + 1]) {
349 bool rangeset =
false;
350 for (
unsigned int at = 0; at < LSlist.size(); at++) {
351 if (LSlist[at] != -1) {
352 if (at > 0 && LSlist[at - 1] != -1)
356 strout += lsnum.str();
359 if (LSlist[at] == -1 && !rangeset) {
371 int def_size = bad_def.size();
372 for (
int i = 0;
i < def_size;
i++)
373 for (
unsigned int j = 0;
j < bad_sc.size();
j++)
374 if (bad_def[
i] == bad_sc[
j]) {
375 temp.push_back(bad_def[
i]);
void lsbs_cert(string filename)
void vector_AND(vector< int > &, vector< int >)
int nlumis(string filename)
int getplot(string filename, string iDir, string strplot, TH1F &plot)
void Cleaning(vector< int > &)
string runnum_str(string filename)
string ListOut(vector< int > &)
int main(int argc, char *argv[])
bool check_isgood(vector< int > &ls_badlist, int ls)
void check_offset(string filename, string iDir, string plot, float limit_min, float limit_max, vector< int > &badLS)
void check_sigma(string filename, string iDir, string plot, float limit_err, vector< int > &badLS)