StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
selectAllM9.C
1 void selectAllM9(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","below4","below3","below2","below1","above1","above2","above3","above4","one","onetwo","onethree","two","twothree","three","soft","hard"};
29 
30  const int _map[17][21]={
31  0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,
32  0, 1, 2, 3, 4, 6, 7, 8, 9,11,12,13,15,16,18, 0, 0, 0, 0, 0, 0,
33  0, 1, 2, 3, 6, 7, 8,11,12,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
34  0, 1, 2, 6, 7,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
35  0, 1, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
36  2, 3, 4, 5, 8, 9,10,13,14,17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
37  3, 4, 5, 9,10,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
38  4, 5,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
39  5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
40  2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
41  2, 3, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
42  2, 3, 4, 8, 9,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
43  3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
44  3, 4, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
45  4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
46  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
47  1, 2, 3, 4, 5, 7, 8, 9,10,12,13,14,16,17,19, 0, 0, 0, 0, 0 0};
48 
49  int num[17]={21,15,10,6,3,10,6,3,1,1,3,6,1,3,1,1,15};
50 
51 
52  int nParentSum[2];
53  int parentSum[6][2] = { 0,0, 1,1, 2,2, 3,3, 4,4, 5,5 };
54  for(int k=0;k<17;k++){
55  int nin = num[k];
56  int * ndata=_map[k];
57  for(int i=0;i<21;i++) cout<<ndata[i]<<",";
58  cout<<" = "<<nin<<endl;
59 
60  TString fname(dirName);
61  fname+="/";
62  fname+=fileBase;
63  fname+=oname[k];
64  fname+=".root";
65  switch (k) {
66  case 0 : {
67  nParentSum[0] = 6;
68  nParentSum[1] = 6;
69  break;
70  } case 1 : {
71  nParentSum[0] = 5;
72  nParentSum[1] = 5;
73  break;
74  } case 2 : {
75  nParentSum[0] = 4;
76  nParentSum[1] = 4;
77  break;
78  } case 3 : {
79  nParentSum[0] = 3;
80  nParentSum[1] = 3;
81  break;
82  } case 4 : {
83  nParentSum[0] = 2;
84  nParentSum[1] = 2;
85  break;
86  } case 5 : {
87  nParentSum[0] = 4;
88  nParentSum[1] = 4;
89  parentSum[0][0] = 2;
90  parentSum[0][1] = 2;
91  parentSum[1][0] = 3;
92  parentSum[1][1] = 3;
93  parentSum[2][0] = 4;
94  parentSum[2][1] = 4;
95  parentSum[3][0] = 5;
96  parentSum[3][1] = 5;
97  break;
98  } case 6 : {
99  nParentSum[0] = 3;
100  nParentSum[1] = 3;
101  parentSum[0][0] = 3;
102  parentSum[0][1] = 3;
103  parentSum[1][0] = 4;
104  parentSum[1][1] = 4;
105  parentSum[2][0] = 5;
106  parentSum[2][1] = 5;
107  break;
108  } case 7 : {
109  nParentSum[0] = 2;
110  nParentSum[1] = 2;
111  parentSum[0][0] = 4;
112  parentSum[0][1] = 4;
113  parentSum[1][0] = 5;
114  parentSum[1][1] = 5;
115  break;
116  } case 8 : {
117  nParentSum[0] = 1;
118  nParentSum[1] = 1;
119  parentSum[0][0] = 5;
120  parentSum[0][1] = 5;
121  break;
122  } case 9 : {
123  nParentSum[0] = 1;
124  nParentSum[1] = 1;
125  parentSum[0][0] = 2;
126  parentSum[0][1] = 2;
127  break;
128  } case 10 : {
129  nParentSum[0] = 2;
130  nParentSum[1] = 2;
131  parentSum[0][0] = 2;
132  parentSum[0][1] = 2;
133  parentSum[1][0] = 3;
134  parentSum[1][1] = 3;
135  break;
136  } case 11 : {
137  nParentSum[0] = 3;
138  nParentSum[1] = 3;
139  parentSum[0][0] = 2;
140  parentSum[0][1] = 2;
141  parentSum[1][0] = 3;
142  parentSum[1][1] = 3;
143  parentSum[2][0] = 4;
144  parentSum[2][1] = 4;
145  break;
146  } case 12 : {
147  nParentSum[0] = 1;
148  nParentSum[1] = 1;
149  parentSum[0][0] = 3;
150  parentSum[0][1] = 3;
151  break;
152  } case 13 : {
153  nParentSum[0] = 2;
154  nParentSum[1] = 2;
155  parentSum[0][0] = 3;
156  parentSum[0][1] = 3;
157  parentSum[1][0] = 4;
158  parentSum[1][1] = 4;
159  break;
160  } case 14 : {
161  nParentSum[0] = 1;
162  nParentSum[1] = 1;
163  parentSum[0][0] = 4;
164  parentSum[0][1] = 4;
165  break;
166  } case 15 : {
167  nParentSum[0] = 1;
168  nParentSum[1] = 1;
169  parentSum[0][0] = 0;
170  parentSum[0][1] = 0;
171  break;
172  } case 16 : {
173  nParentSum[0] = 5;
174  nParentSum[1] = 5;
175  parentSum[0][0] = 1;
176  parentSum[0][1] = 1;
177  parentSum[1][0] = 2;
178  parentSum[1][1] = 2;
179  parentSum[2][0] = 3;
180  parentSum[2][1] = 3;
181  parentSum[3][0] = 4;
182  parentSum[3][1] = 4;
183  parentSum[4][0] = 5;
184  parentSum[4][1] = 5;
185  break;
186  }
187  }
188  adder.addCuts(fname.Data(),tf,ndata,nin,parentSum,nParentSum,1);
189  }
190 
191  TString fname(dirName);
192  fname+="/";
193  fname+=fileBase;
194  fname+="_pairDensities.root";
195  adder.addDensities(fname.Data(),tf);
196 };
197 
198