5 void BadDriftRegions(
const Char_t *macro =
6 "/afs/rhic.bnl.gov/star/packages/.DEV2/StarDb/Calibrations/svt/svtHybridDriftVelocity.20070321.000207.C",
7 const Char_t *badF =
"/star/data07/calib/fisyak/SvtSsdAlignment/FF.Bad.Drift",
8 Int_t date = 20070321, Int_t time = 209) {
9 gSystem->Load(
"libStDb_Tables.so");
10 gROOT->LoadMacro(macro);
11 St_svtHybridDriftVelocity *svtHybridDriftVelocity = (St_svtHybridDriftVelocity *) CreateTable();
12 Int_t NN = svtHybridDriftVelocity->GetNRows();
13 FILE *fp = fopen(badF,
"r");
15 Int_t Barrel, Ladder, Wafer, Hybrid;
18 while (fgets(&line[0],120,fp)) {
22 if (T.Contains(
"BAD")) iok = 1;
23 else if (T.Contains(
"DEAD")) iok = 2;
24 else if (T.Contains(
"GOOD")) iok = 3;
27 sscanf(&line[0],
"| B%1dL%02dW%1dH%1d| [%f,%f]",&Barrel,&Ladder,&Wafer,&Hybrid,&xmin,&xmax);
31 Float_t temp = - xmin;
38 Int_t K = 100*(xmin + 0.005);
40 K = 100*(xmax + 0.005);
43 sscanf(&line[0],
"| B%1dL%02dW%1dH%1d|",&Barrel,&Ladder,&Wafer,&Hybrid);
45 cout <<
"B"<< Barrel <<
"L" << Ladder <<
"W" << Wafer <<
"H" << Hybrid;
46 cout <<
" xmin " << xmin <<
" xmax " << xmax;
47 if (! iok ) cout <<
" O.K";
48 if ( iok == 1) cout <<
" BAD";
49 if ( iok == 2) cout <<
" DEAD";
51 svtHybridDriftVelocity_st *row = svtHybridDriftVelocity->GetTable();
52 for (Int_t i = 0; i < NN; i++) {
53 if (row[i].barrel == Barrel &&
54 row[i].ladder == Ladder &&
55 row[i].wafer == Wafer &&
56 row[i].hybrid == Hybrid) {
57 svtHybridDriftVelocity->Print(i,1);
58 if (iok == 1) row[i].npar = -1;
59 if (iok == 2) row[i].npar = -2;
73 svtHybridDriftVelocity->Print(i,1);
84 sprintf(Out,
"%s.%8i.%06i.C",svtHybridDriftVelocity->GetName(),date,time);
87 cout <<
"Create " << Out << endl;
88 out <<
"TDataSet *CreateTable() {" << endl;
89 out <<
" if (!gROOT->GetClass(\"St_svtHybridDriftVelocity\")) return 0;" << endl;
90 out <<
" svtHybridDriftVelocity_st row[" << NN <<
"] = {//Clean up" << endl;
91 for (Int_t i = 0; i < NN; i++) {
92 out << Form(
"{%2i,%1i,%4i,%4i,%3i,%7i",row[i].type,row[i].status,row[i].idx,row[i].nrows,row[i].npar,row[i].Id);
93 out << Form(
",%1i,%2i,%1i,%1i",row[i].barrel,row[i].ladder,row[i].wafer,row[i].hybrid);
94 out << Form(
",%6.3f,%5.3f,%7.3f,%6.3f",row[i].tmin,row[i].dtmin,row[i].tmax,row[i].dtmax);
95 Double_t *v = &row[i].v0;
96 for (Int_t j = 0; j < 10; j++) {
97 if (v[j]) out << Form(
",%8.5f",v[j]);
98 else out <<
", 0.00000";
100 if (i < NN - 1) out <<
"},";
102 out << Form(
"// B%iL%02iW%iH%i",row[i].barrel,row[i].ladder,row[i].wafer,row[i].hybrid) << endl;
104 out <<
" };" << endl;
105 out <<
" St_svtHybridDriftVelocity *tableSet = new St_svtHybridDriftVelocity(\"" << svtHybridDriftVelocity->GetName() <<
"\"," << NN <<
");" << endl;
106 out <<
" for (Int_t i = 0; i < " << NN <<
"; i++) tableSet->AddAt(&row[i].type, i);" << endl;
107 out <<
" return (TDataSet *)tableSet;" << endl;