1 void SplitSvtWafer(
const Char_t *name =
"StarDb/Geometry/svt/svtWafersPosition.20050101.000100.C") {
3 Top.ReplaceAll(
"$STAR/",
"");
4 Top = gSystem->DirName(Top.Data());
5 static const Char_t *Barrels[4] = {
"InnerBarrel",
"MiddleBarrel",
"OuterBarrel",
"Ssd"};
6 static const Char_t *Ladder =
"Ladder_";
7 static const Char_t *Wafer =
"Wafer_";
9 gSystem->ExpandPathName(Name);
10 gSystem->Load(
"libStDb_Tables.so");
13 gInterpreter->ProcessLine(cmd);
14 St_svtWafersPosition *table = CreateTable();
15 cmd.ReplaceAll(
".L ",
".U ");
16 gInterpreter->ProcessLine(cmd);
18 TString tname = gSystem->BaseName(Name);
19 Int_t N = table->GetNRows();
20 svtWafersPosition_st *row = table->GetTable();
21 TString separator(
"/");
22 for (Int_t i = 0; i < N; i++, row++) {
25 Int_t layer = Id/1000;
if (layer > 7) layer = 7;
28 Int_t ladder = Id%100;
29 Int_t barrel = (layer-1)/2;
31 dir += Form(
"/%s/%s%02i/%s%02i",Barrels[barrel],Ladder,ladder,Wafer,wafer);
32 if (gSystem->AccessPathName(dir)) {
33 Int_t iok = gSystem->mkdir(dir,kTRUE);
34 if (iok > -1) cout <<
"Make directory " << dir <<
" done " << endl;
35 else {cout <<
"Make directory " << dir <<
" failed with " << iok << endl;}
41 St_svtWafersPosition *newtable =
new St_svtWafersPosition(table->GetName(),1);
43 out.open(ts.Data()); cout <<
"Create " << ts << endl;
44 newtable->SavePrimitive(out,
"");