StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
selectAllM4.C
1 void selectAllM4(const char* dirname){
2 
3  // -- example for recombining histograms by selection in new root file
4  //
5  // root.exe -q -b selectASNS.C'("dirContainingFinal.rootFile")
6  //
7 
8  TString dir(dirname);
9  dir+="/final.root";
10  gSystem->Load("StEStructPoolSupport.so");
11 
12  StEStructHAdd adder;
13 
14  TFile * tf=new TFile(dir.Data());
15 
16  if(!tf){
17  cout<<"error opening file "<<endl;
18  return ;
19  };
20 
21  int nas[32];//={0,12,4,5,8,9,12,13};
22  int numas=32;
23  for(int i=0;i<numas;i++)nas[i]=i;
24  TString fname(dirname); fname+="/all";
25  fname+=".root";
26  cout<<"Will write "<<fname.Data()<<endl;
27  adder.addCuts(fname.Data(),tf,nas,numas);
28 
29  TString fname_ns(dirname); fname_ns+="/nearside.root";
30  cout<<"Will write "<<fname_ns.Data()<<endl;
31  adder.addCuts(fname_ns.Data(),tf,nas,16);
32 
33  int *ns=&nas[16];
34  TString fname_as(dirname); fname_as+="/awayside.root";
35  cout<<"Will write "<<fname_as.Data()<<endl;
36  adder.addCuts(fname_as.Data(),tf,ns,16);
37 
38  int nsoft[2]={0,16};
39  TString fname_soft(dirname); fname_soft+="/soft.root";
40  cout<<"Will write "<<fname_soft.Data()<<endl;
41  adder.addCuts(fname_soft.Data(),tf,nsoft,2);
42 
43  int nhard[26]={1,2,3,4,5,6,7,8,9,10,11,12,13,17,18,19,20,21,22,23,24,25,26,27,28,29};
44  TString fname_hard(dirname); fname_hard+="/hard.root";
45  cout<<"Will write "<<fname_hard.Data()<<endl;
46  adder.addCuts(fname_hard.Data(),tf,nhard,26);
47 
48 
49 
50 
51 };
52 
53