StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
selectAllM3.C
1 void selectAllM3(const char* dirName, const char *fileBase ){
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  gROOT->LoadMacro("load2ptLibs.C");
9  load2ptLibs();
10  TString inFile(dirName);
11  inFile+="/";
12  inFile+=fileBase;
13  inFile+=".root";
14  gSystem->Load("StEStructPoolSupport.so");
15 
16  StEStructHAdd adder;
17 
18  TFile * tf=new TFile(inFile.Data());
19 
20  if(!tf){
21  cout<<"error opening file "<<endl;
22  return ;
23  };
24  StEStructCutBin* cb = StEStructCutBin::Instance();
25  cb->setMode(3);
26 
27  //--> do all of the following
28  const char* oname[]={"all","awayside","nearside","soft","softAS","softNS","neck","neckAS","neckNS","hard","hardAS","hardNS","softHard","softHardAS","softHardNS"};
29 
30  const int _map[15][16]={
31  0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,
32  0, 1, 4, 5, 8, 9,12,13, 0, 0, 0, 0, 0, 0, 0, 0,
33  2, 3, 6, 7,10,11,14,15, 0, 0, 0, 0, 0, 0, 0, 0,
34  0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
35  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
36  2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
37  4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
38  4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
39  6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
40  8, 9,10,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
41  8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
42  10,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
43  12,13,14,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
44  12,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
45  14,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
46 
47  int num[15]={16,8,8,4,2,2,4,2,2,4,2,2,4,2,2};
48 
49 
50  int nParentSum[2];
51  int parentSum[3][2] = { 0,0, 1,1, 2,2 };
52  for(int k=0;k<15;k++){
53  int nin = num[k];
54  int * ndata=_map[k];
55  for(int i=0;i<16;i++) cout<<ndata[i]<<",";
56  cout<<" = "<<nin<<endl;
57 
58  TString fname(dirName);
59  fname+="/";
60  fname+=fileBase;
61  fname+=oname[k];
62  fname+=".root";
63  if (k < 3) {
64  nParentSum[0] = 3;
65  nParentSum[1] = 3;
66  } else if (k < 12) {
67  nParentSum[0] = 1;
68  nParentSum[1] = 1;
69  parentSum[0][0] = k/3 - 1;
70  parentSum[0][1] = k/3 - 1;
71  } else {
72  nParentSum[0] = 1;
73  nParentSum[1] = 2;
74  parentSum[0][0] = 2;
75  parentSum[0][1] = 0;
76  parentSum[1][1] = 1;
77  }
78  adder.addCuts(fname.Data(),tf,ndata,nin,parentSum,nParentSum,1);
79  }
80 
81  TString fname(dirName);
82  fname+="/";
83  fname+=fileBase;
84  fname+="_pairDensities.root";
85  adder.addDensities(fname.Data(),tf);
86 };
87 
88