StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Ast2Root.C
1 #define OLD_GEANT_VMC
2 void Ast2Root(const Char_t *vers="y2005x") {
3  gROOT->LoadMacro("bfc.C");
4  TString cmd("bfc(0,\"gstar,nodefault,");
5  cmd += vers;
6  cmd += "\")";
7  gInterpreter->ProcessLine(cmd.Data());
8  geant = (St_geant_Maker *) chain->Maker("geant");
9  if (! geant) return;
10 #ifndef OLD_GEANT_VMC
11  geant->DetSetIndex();
12 #endif
13  TString rzFile(vers);
14  rzFile += ".rz";
15  TString cmd("grfile ");
16  cmd += rzFile;
17  geant->Do(cmd.Data());
18 #ifdef OLD_GEANT_VMC
19  Char_t *sets[2] = {"geom","Detectors"};
20  for (Int_t i = 0; i < 2; i++) {
21  TString setN(".const/");
22  setN += sets[i];
23  TDataSet *set = geant->Find(setN.Data());
24  if (set) {
25  TString file(sets[i]);
26  file += ".";
27  file += vers;
28  file += ".root";
29  TFile *f = new TFile(file.Data(),"RECREATE");
30  set->Write();
31  delete f;
32  }
33  }
34 #endif
35  cmd = "g2Root ";
36  rzFile.ReplaceAll("grfile ","");
37  cmd += rzFile;
38  cmd += " "; cmd += vers; cmd += ".h";
39  gSystem->Exec(cmd);
40 }
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Definition: TDataSet.cxx:893
virtual void Do(const Char_t *option="dcut cave x 0.1 10 10 0.03 0.03")
Executes a KUIP command.
virtual TDataSet * Find(const char *path) const
Definition: TDataSet.cxx:362