11 Int_t date = 20070321;
12 const Char_t *
Pass =
"Pass217 FFK";
14 #include "Drift_ALL.h"
15 static const Int_t N =
sizeof(Data)/
sizeof(
data_t);
19 void MakeSvtDriftVelocities(){
20 cout <<
"Date " << date <<
"\t Time " << time << endl;
21 gROOT->LoadMacro(
"bfc.C");
22 bfc(0,
"mysql,db,nodefault");
23 StMaker *dbMk = chain->Maker(
"db");
27 header->SetRunNumber(1);
28 dbMk->SetDateTime(date,time);
29 header->SetDateTime(date,time);
31 St_svtHybridDriftVelocity *svtHybridDriftVelocity = (St_svtHybridDriftVelocity *) dbMk->GetDataBase(
"Calibrations/svt/svtHybridDriftVelocity");
32 if (! (svtHybridDriftVelocity))
return;
33 Int_t NN = svtHybridDriftVelocity->GetNRows();
35 cout <<
"NN row from svtHybridDriftVelocity " << NN <<
" N corrections " << N << endl;
37 svtHybridDriftVelocity_st *row = svtHybridDriftVelocity->GetTable();
40 for (Int_t i = 0; i < NN; i++) {
41 for (Int_t j = 0; j < N; j++) {
42 if (Data[j].barrel == row[i].barrel &&
43 Data[j].ladder == row[i].ladder &&
44 Data[j].wafer == row[i].wafer &&
45 Data[j].hybrid == row[i].hybrid) {
46 Double_t *par = &row[i].v0;
47 Double_t *cor = &Data[j].v0;
48 Int_t nu = row[i].npar%10;
49 Int_t nv = (row[i].npar/10)%10;
50 Int_t I = (row[i].npar/100)%10;
52 cout <<
"Found Match" << endl;
53 svtHybridDriftVelocity->Print(i,1);
54 cout << Data[j].type <<
",\t" << Data[j].idx <<
",\t" << Data[j].nrows<<
",\t"
55 << Data[j].barrel <<
",\t" << Data[j].layer <<
",\t" << Data[j].ladder<<
",\t"
56 << Data[j].wafer <<
",\t" << Data[j].hybrid<<
",\t"
57 << Data[j].Npar <<
",\t";
58 cout <<
"\tnu = " << nu <<
"\tnv = " << nv <<
"\tNpar = " << Data[j].Npar;
59 for (Int_t l = 0; l <= Data[j].Npar; l++) cout <<
",\t" << cor[l];
60 cout <<
"\t" << Data[j].Comment << endl;
62 if (row[i].type == 0 && row[i].npar == 0) {
63 row[i].type = 2; row[i].v0 = 0;
65 if (row[i].type == 2) {
69 memset(drift, 0, 10*
sizeof(Double_t));
70 memset(anode, 0, 10*
sizeof(Double_t));
71 if (nu) memcpy (drift, &par[0], nu*
sizeof(Double_t));
72 if (nv) memcpy (anode, &par[nu], nv*
sizeof(Double_t));
74 for (Int_t k = 0; k <= Data[j].Npar; k++) {
77 if (nu <= Data[j].Npar) nu = Data[j].Npar+1;
79 for (Int_t k = 0; k <= Data[j].Npar; k++) {
82 if (nv <= Data[j].Npar) nv = Data[j].Npar+1;
86 for (Int_t k = 0; k < nu+nv; k++) {
87 if (k < nu) cout <<
"\td:" << par[k] <<
"\t" << drift[k];
88 else cout <<
"\ta:" << par[k] <<
"\t" << anode[k-nu];
92 row[i].npar = 100*I + 10*nv + nu;
93 memset(par, 0, 10*
sizeof(Double_t));
94 for (Int_t k = 0; k < nu + nv; k++) {
96 if (k < nu) par[k] = drift[k];
97 else par[k] = anode[k-nu];
101 svtHybridDriftVelocity->Print(i,1);
108 sprintf(Out,
"%s.%8i.%06i.C",svtHybridDriftVelocity->GetName(),date,time);
111 cout <<
"Create " << Out << endl;
112 out <<
"TDataSet *CreateTable() {" << endl;
113 out <<
" if (!gROOT->GetClass(\"St_svtHybridDriftVelocity\")) return 0;" << endl;
114 out <<
" svtHybridDriftVelocity_st row[" << NN <<
"] = {//" <<
Pass << endl;
115 for (Int_t i = 0; i < NN; i++) {
116 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);
117 out << Form(
",%1i,%2i,%1i,%1i",row[i].barrel,row[i].ladder,row[i].wafer,row[i].hybrid);
118 out << Form(
",%6.3f,%5.3f,%7.3f,%6.3f",row[i].tmin,row[i].dtmin,row[i].tmax,row[i].dtmax);
119 Double_t *v = &row[i].v0;
120 for (Int_t j = 0; j < 10; j++) {
121 if (v[j]) out << Form(
",%8.5f",v[j]);
122 else out <<
", 0.00000";
124 if (i < NN - 1) out <<
"},";
126 out << Form(
"// B%iL%02iW%iH%i",row[i].barrel,row[i].ladder,row[i].wafer,row[i].hybrid) << endl;
128 out <<
" };" << endl;
129 out <<
" St_svtHybridDriftVelocity *tableSet = new St_svtHybridDriftVelocity(\"" << svtHybridDriftVelocity->GetName() <<
"\"," << NN <<
");" << endl;
130 out <<
" for (Int_t i = 0; i < " << NN <<
"; i++) tableSet->AddAt(&row[i].type, i);" << endl;
131 out <<
" return (TDataSet *)tableSet;" << endl;
virtual EDataSetPass Pass(EDataSetPass(*callback)(TDataSet *), Int_t depth=0)