StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SavePrimitive.C
1 // $Id: SavePrimitive.C,v 1.5 2006/08/15 21:43:00 jeromel Exp $
2 // $Log: SavePrimitive.C,v $
3 // Revision 1.5 2006/08/15 21:43:00 jeromel
4 // Fix rhic -> rhic.bnl.gov
5 //
6 // Revision 1.4 1999/05/21 15:33:53 kathy
7 // made sure Log & Id are in each file and also put in standard comment line with name of owner
8 //
9 // Revision 1.3 1998/12/27 03:17:43 fine
10 // STAR_shapes to test two brand new classes: St_Node St_NodePosition
11 //
12 // Revision 1.2 1998/12/21 19:45:49 fisyak
13 // Move ROOT includes to non system
14 //
15 // Revision 1.1 1998/12/12 02:38:42 fisyak
16 // Clean up
17 //
18 // Revision 1.25 1998/11/25 21:58:36 fisyak
19 // Cleanup
20 //
21 // Revision 1.24 1998/11/07 02:45:05 fisyak
22 // cleanup analysis
23 //
24 // Revision 1.23 1998/11/06 01:42:18 fisyak
25 // Add ana.C
26 //
27 // Revision 1.22 1998/11/01 16:42:28 fisyak
28 // dst analysis
29 //
30 // Revision 1.21 1998/10/31 00:26:26 fisyak
31 // Makers take care about branches
32 //
33 // Revision 1.20 1998/10/21 20:30:56 fine
34 // makedoc macro creates "gif" directories and fill it up
35 //
36 // Revision 1.19 1998/10/18 21:20:49 fisyak
37 // typo
38 //
39 // Revision 1.18 1998/10/12 00:53:02 fisyak
40 // Add parameters for bfc
41 //
42 // Revision 1.17 1998/09/27 01:24:22 fisyak
43 // bfc.C for whole file
44 //
45 // Revision 1.16 1998/09/26 00:35:31 fisyak
46 // Add real files
47 //
48 // Revision 1.15 1998/09/26 00:17:27 fisyak
49 // Add SetWrite
50 //
51 // Revision 1.13 1998/09/23 20:23:23 fisyak
52 // Prerelease SL98h
53 //
54 // Revision 1.12 1998/09/18 14:35:33 fisyak
55 // Fix makers
56 //
57 // Revision 1.11 1998/09/15 20:55:35 fisyak
58 // Split St_DataSet -> St_DataSet + St_DataSetIter
59 //
60 // Revision 1.10 1998/08/26 12:15:15 fisyak
61 // Remove asu & dsl libraries
62 //
63 // Revision 1.9 1998/08/20 12:33:32 fisyak
64 // Splitted base libraries
65 //
66 // Revision 1.8 1998/08/18 14:05:08 fisyak
67 // Add to bfc dst
68 //
69 // Revision 1.7 1998/08/10 02:35:13 fisyak
70 // add laser
71 //
72 //=======================================================================
73 // owner: Valery Fine
74 // what it does:
75 //=======================================================================
76 {
77  gSystem->Load("St_base");
78  gSystem->Load("StChain");
79  gSystem->Load("xdf2root");
80  gSystem->Load("St_Tables");
81  gSystem->Load("St_params_Maker");
82  // StChain chain("bfc");
83  const Char_t *Path="/afs/rhic.bnl.gov/star/packages/dev/StDb/";
84  StChain chain("bfc");
85 
86 // Create the makers to be called by the current chain
87  St_params_Maker params("params","run/params");
88 // Init the mai chain and all its makers
89  int iInit = chain.Init();
90  if (iInit) chain.Fatal(iInit,"on init");
91  St_DataSet *set=chain.DataSet("params");
92  St_DataSetIter param(set,0);
93  param.Cd("params");
94  St_DataSet *t = 0;
95  // St_tss_tsspar *tsspar = (St_tss_tsspar *) param("params/tpc/tsspars/tsspar");
96  // tsspar->Print(0);
97  TString path = Path;
98  TString dirname=0;
99  Bool_t go = kFALSE;
100  while (t = param()){
101  path = Path;
102  path += t->Path()->ReplaceAll("params/","");
103  cout << "path = " << path.Data() << endl;
104  if (t->HasData()){ // Table
105  path += ".C";
106  dirname = gSystem->DirName(path.Data());
107  // if (strcmp("/afs/rhic.bnl.gov/star/packages/dev/StDb/svt/stkpars",dirname.Data()) == 0) {go = kTRUE;}
108  // if (! go) continue;
109  if (!gSystem->OpenDirectory(dirname.Data())) {
110  if (gSystem->mkdir(dirname.Data())) {
111  cout << "Directoty " << dirname << " creation failed" << endl;
112  }
113  }
114  ofstream *out = new ofstream(path.Data());
115  cout << "Open " << path.Data() << endl;
116  t->SavePrimitive(*out,"");
117  delete out;
118  }
119  }
120 }
virtual TString Path() const
return the full path of this data set
Definition: TDataSet.cxx:626