StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
selectAllM2.C
1 void selectAllM2(const char* infile, const char* outfile=""){
2  // extracts files for cutbin mode 2 (soft/hard SS/AS)
3  // creates directories soft, hard, SS, AS, other
4  // MUST BE RUN FROM DATA DIR
5 
6  cout << " selectAllM2, input: " << infile << endl;
7 
8  gSystem->Load("StEStructPoolSupport.so");
9  StEStructHAdd adder;
10  TFile * tf=new TFile(infile);
11 
12  if(tf->IsZombie()){
13  cout<<"error opening file "<<endl;
14  return ;
15  };
16 
17  //cout << "Creating directories soft hard SS AS other" << endl;
18  gSystem->Exec("mkdir -p all soft hard SS AS other");
19 
20  /*
21  TString fname = infile;
22  cout << fname << endl;
23  TObjArray* toa = fname.Tokenize("/");
24  tos = (TObjString*) toa->Last();
25  fname = tos->String();
26  cout << fname << endl;
27  */
28 
29  TString fname = infile;
30  if(outfile[0]) fname = outfile;
31 
32  cout << "Writing to " << fname << endl;
33 
34  // OLD 0 = soft SS; 1 = hard SS; 2 = soft AS; 3 = hard AS
35 
36  // 0 = soft SS; 1 = hard SS; 2 = other SS; 3 = soft AS; 4 = hard AS; 5 = other AS;
37 
38  int num;
39  TString ts;
40 
41  num = 2;
42  int ns[2] = {0,3};
43  ts = "soft/"; ts+=fname;
44  cout << " writing " << ts << endl;
45  adder.addCuts(ts,tf,ns,num);
46 
47  num = 2;
48  int nh[2] = {1,4};
49  ts = "hard/"; ts+=fname;
50  cout << " writing " << ts << endl;
51  adder.addCuts(ts,tf,nh,num);
52 
53  num = 2;
54  int nh[2] = {2,5};
55  ts = "other/"; ts+=fname;
56  cout << " writing " << ts << endl;
57  adder.addCuts(ts,tf,nh,num);
58 
59  num = 3;
60  int nss[3] = {0,1,2};
61  ts = "SS/"; ts+=fname;
62  cout << " writing " << ts << endl;
63  adder.addCuts(ts,tf,nss,num);
64 
65  num = 3;
66  int nas[3] = {3,4,5};
67  ts = "AS/"; ts+=fname;
68  cout << " writing " << ts << endl;
69  adder.addCuts(ts,tf,nas,num);
70 
71  num = 6;
72  int nall[6] = {0,1,2,3,4,5};
73  ts = "all/"; ts+=fname;
74  cout << " writing " << ts << endl;
75  adder.addCuts(ts,tf,nall,num);
76 
77 
78 
79 }
80 
81