Updating the functionality of AliAnalysisHadEtCorrections to accomodate centrality...
[u/mrichter/AliRoot.git] / prod / LHC09a1 / simrun.C
CommitLineData
afea418a 1//#define VERBOSEARGS\r
2{\r
3 // set job and simulation variables as : alienoutner needed for seed\r
4 // root run.C --run <x> --event <y> --aliencounter <counter> --process <proc> --minhard <min> --maxhard <max> --minpt <minpt>\r
5\r
6\r
7 char* program = "aliroot";\r
8 // char* program = "alienaliroot";\r
9 \r
10 int nrun = 0;\r
11 int nevent = 0;\r
12 int seed = 0;\r
13 int naliencounter = 0;\r
14 \r
15 char sseed[1024];\r
16 char srun[1024];\r
17 char sevent[1024];\r
18 char saliencounter[1024];\r
19 char sprocess[1024];\r
20 char sminpthard[1024];\r
21 char smaxpthard[1024];\r
22 char sminptgammapi0[1024];\r
23 char squench[1024];\r
24 char sqhat[1024];\r
25\r
26 Int_t npthardbin = 0;\r
27 const Int_t nPtHardBins = 3;\r
28 const Int_t ptHardLo[nPtHardBins] = {15,50,100};\r
29 const Int_t ptHardHi[nPtHardBins] = {50,100,-1};\r
30\r
31\r
32\r
33\r
34 sprintf(srun,"");\r
35 sprintf(sevent,"");\r
36 sprintf(saliencounter,"");\r
37 sprintf(sprocess,"");\r
38 sprintf(sminpthard,"");\r
39 sprintf(smaxpthard,"");\r
40 sprintf(sminptgammapi0,"");\r
41 sprintf(squench,"");\r
42 sprintf(sqhat,"");\r
43\r
44 for (int i=0; i< gApplication->Argc();i++){\r
45#ifdef VERBOSEARGS\r
46 printf("Arg %d: %s\n",i,gApplication->Argv(i));\r
47#endif\r
48 if (!(strcmp(gApplication->Argv(i),"--run")))\r
49 nrun = atoi(gApplication->Argv(i+1));\r
50 sprintf(srun,"%d",nrun);\r
51 if (!(strcmp(gApplication->Argv(i),"--event")))\r
52 nevent = atoi(gApplication->Argv(i+1));\r
53 sprintf(sevent,"%d",nevent);\r
54 if (!(strcmp(gApplication->Argv(i),"--aliencounter")))\r
55 naliencounter = atoi(gApplication->Argv(i+1));\r
56 sprintf(saliencounter,"%d",naliencounter);\r
57\r
58 if (!(strcmp(gApplication->Argv(i),"--process")))\r
59 sprintf(sprocess, gApplication->Argv(i+1));\r
60\r
61 if (!(strcmp(gApplication->Argv(i),"--pthardbin")))\r
62 npthardbin = atoi(gApplication->Argv(i+1));\r
63\r
64 \r
65 if (!(strcmp(gApplication->Argv(i),"--minhard")))\r
66 sprintf(sminpthard,gApplication->Argv(i+1));\r
67 \r
68 if (!(strcmp(gApplication->Argv(i),"--maxhard")))\r
69 sprintf(smaxpthard,gApplication->Argv(i+1));\r
70\r
71\r
72 if (!(strcmp(gApplication->Argv(i),"--minpt")))\r
73 sprintf(sminptgammapi0,gApplication->Argv(i+1));\r
74\r
75 if (!(strcmp(gApplication->Argv(i),"--quench")))\r
76 sprintf(squench,gApplication->Argv(i+1));\r
77\r
78 if (!(strcmp(gApplication->Argv(i),"--qhat")))\r
79 sprintf(sqhat,gApplication->Argv(i+1));\r
80\r
81 }\r
82\r
83 if(!(strcmp(sminpthard,""))){\r
84 sprintf(sminpthard,"%d",ptHardLo[npthardbin%nPtHardBins]);\r
85 Printf(">>> MinPtHard %s %d",sminpthard,npthardbin%nPtHardBins);\r
86 }\r
87 if(!(strcmp(smaxpthard,""))){\r
88 sprintf(smaxpthard,"%d",ptHardHi[npthardbin%nPtHardBins]);\r
89 Printf(">>> MaxPtHard %s %d",smaxpthard,npthardbin%nPtHardBins);\r
90 }\r
91 \r
92\r
93 \r
94 /*\r
95 char cmd[200] ; \r
96 sprintf(cmd, ".! tar zxvf DBpp.tgz") ; \r
97 gROOT->ProcessLine(cmd) ; \r
98 sprintf(cmd, ".! tar zxvf TPCCalib_v4-16-Rev-01.tgz") ; \r
99 gROOT->ProcessLine(cmd) ; \r
100 */\r
101 gSystem->Exec("echo $PWD ");\r
102 gSystem->Exec("ls -l ");\r
103\r
104 seed = nrun * 100000 + naliencounter * 1000 + nevent;\r
105 sprintf(sseed,"%d",seed);\r
106\r
107 if (seed==0) {\r
108 fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
109 fprintf(stderr,"!!!! WARNING! Seeding variable for MC is 0 !!!!\n");\r
110 fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
111 } else {\r
112 fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
113 fprintf(stdout,"!!! MC Seed is %d \n",seed);\r
114 fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
115 }\r
116 \r
117 // set the seed environment variable\r
118 gSystem->Setenv("CONFIG_SEED",sseed);\r
119 gSystem->Setenv("DC_RUN",srun);\r
120 gSystem->Setenv("DC_EVENT",sevent);\r
121 gSystem->Setenv("DC_RUN_TYPE",sprocess);//"kPyGammaJetPHOS");\r
122 gSystem->Setenv("PTHARDMIN",sminpthard);//"20");\r
123 gSystem->Setenv("PTHARDMAX",smaxpthard);//"30");\r
124// gSystem->Setenv("DC_RUN_TYPE","kPyJetJet");\r
125// gSystem->Setenv("PTHARDMIN","40");\r
126// gSystem->Setenv("PTHARDMAX","-1");\r
127\r
128 gSystem->Setenv("PTGAMMAPI0MIN",sminptgammapi0);//"1");\r
129 gSystem->Setenv("QUENCHING",squench);\r
130 gSystem->Setenv("QHAT",sqhat);\r
131// gSystem->Setenv("QUENCHING","0");\r
132// gSystem->Setenv("QHAT","0");\r
133\r
134 gSystem->Setenv("ECMS","10000");\r
135// gSystem->Setenv("ECMS","14000");\r
136 gSystem->Setenv("ALIMDC_RAWDB1","./mdc1");\r
137 gSystem->Setenv("ALIMDC_RAWDB2","./mdc2");\r
138 gSystem->Setenv("ALIMDC_TAGDB","./mdc1/tag");\r
139 gSystem->Setenv("ALIMDC_RUNDB","./mdc1/meta");\r
140 cout<< "SIMRUN:: Run " << gSystem->Getenv("DC_RUN") << " Event " << gSystem->Getenv("DC_EVENT") \r
141 << " Process " << gSystem->Getenv("DC_RUN_TYPE") \r
142 << " minpthard " << gSystem->Getenv("PTHARDMIN") \r
143 << " maxpthard " << gSystem->Getenv("PTHARDMAX") \r
144 << " minpt " << gSystem->Getenv("PTGAMMAPI0MIN") \r
145 << endl;\r
146 //gSystem->Exec("cp $ROOTSYS/etc/system.rootrc .rootrc");\r
147 cout<<">>>>> SIMULATION <<<<<"<<endl;\r
148\r
149 gSystem->Exec("echo ALICE_ROOT $ALICE_ROOT");\r
150 gSystem->Exec("echo ROOTSYS $ROOTSYS");\r
151 gSystem->Exec("echo LD_LIB $LD_LIBRARY_PATH");\r
152 gSystem->Exec("echo PATH $PATH");\r
153 gSystem->Exec("ls -l $ALICE_ROOT/bin/");\r
154 gSystem->Exec("ls -l $ALICE_ROOT/bin/*");\r
155\r
156 gSystem->Exec(Form("%s -b -q \"sim.C(%d)\" > sim.log 2>&1",program,nevent));\r
157 \r
158\r
159 // residual\r
160\r
161\r
162 gSystem->MakeDirectory("residual");\r
163 gSystem->Exec("rm residual/*.root");\r
164 gSystem->Exec("ln -s ${PWD}/*.root residual/");\r
165\r
166 // residual_trd\r
167 gSystem->MakeDirectory("residual_trd");\r
168 gSystem->Exec("rm residual_trd/*.root");\r
169 gSystem->Exec("ln -s ${PWD}/*.root residual_trd/");\r
170\r
171 gSystem->ChangeDirectory("residual");\r
172 cout<<">>>>> RECONSTRUCTION <<<<<"<<endl;\r
173 Int_t iStatus = 0;\r
174 iStatus = gSystem->Exec(Form("%s -b -q ../rec.C > rec.log 2>&1",program));\r
175 Printf("%d",iStatus);\r
176 cout<<">>>>> TAG <<<<<"<<endl;\r
177 // iStatus = gSystem->Exec("aliroot -b -q ../tag.C 2>&1 tag.log");\r
178 iStatus = gSystem->Exec(Form("%s -b -q ../tag.C > tag.log 2>&1",program));\r
179 Printf("%d",iStatus);\r
180 cout<<">>>>> CHECK ESD <<<<<"<<endl;\r
181 iStatus = gSystem->Exec(Form("%s -b -q ../CheckESD.C > check.log 2>&1",program));\r
182 cout<<">>>>> CREATE AOD <<<<<"<<endl;\r
183 iStatus = gSystem->Exec(Form("%s -b -q ../runAODFilterJets.C > aod.log 2>&1",program));\r
184 Printf("%d",iStatus);\r
185\r
186 gSystem->Exec(Form("mv Run*tag.root ../"));\r
187 gSystem->Exec(Form("mv *RecPoints.root ../")); // for debugging\r
188 TString addString("");\r
189 // logs\r
190 gSystem->Exec(Form("mv rec.log ../rec%s.log",addString.Data()));\r
191 gSystem->Exec(Form("mv tag.log ../tag%s.log",addString.Data()));\r
192 gSystem->Exec(Form("mv check.log ../check%s.log",addString.Data()));\r
193 gSystem->Exec(Form("mv aod.log ../aod%s.log",addString.Data()));\r
194 // roots\r
195 gSystem->Exec(Form("mv AliESDs.root ../AliESDs%s.root",addString.Data()));\r
196 gSystem->Exec(Form("mv AliESDfriends.root ../AliESDfriends%s.root",addString.Data()));\r
197 gSystem->Exec(Form("mv AliAOD.root ../AliAOD%s.root",addString.Data()));\r
198 gSystem->ChangeDirectory("../");\r
199\r
200\r
201 \r
202\r
203 // residual_trd\r
204\r
205 gSystem->ChangeDirectory("residual_trd");\r
206 /*\r
207 sprintf(cmd, ".! tar zxvf ../DBpp.tgz") ; \r
208 gROOT->ProcessLine(cmd) ; \r
209 sprintf(cmd, ".! tar zxvf ../TPCCalib_v4-16-Rev-01.tgz") ; \r
210 gROOT->ProcessLine(cmd) ; \r
211 */\r
212 gSystem->Exec("ls -l");\r
213 cout<<">>>>> REC <<<<<"<<endl;\r
214 iStatus = gSystem->Exec(Form("%s -b -q ../rec2.C > rec.log 2>&1",program));\r
215 \r
216 Printf("%d",iStatus);\r
217 cout<<">>>>> CHECK ESD <<<<<"<<endl;\r
218 iStatus = gSystem->Exec(Form("%s -b -q ../CheckESD.C > check.log 2>&1",program));\r
219 Printf("%d",iStatus);\r
220 cout<<">>>>> CREATE AOD <<<<<"<<endl;\r
221 iStatus = gSystem->Exec(Form("%s -b -q ../runAODFilterJets.C > aod.log 2>&1",program));\r
222 Printf("%d",iStatus);\r
223 TString addString("TRD");\r
224 // logs\r
225 gSystem->Exec(Form("mv rec.log ../rec%s.log",addString.Data()));\r
226 gSystem->Exec(Form("mv check.log ../check%s.log",addString.Data()));\r
227 gSystem->Exec(Form("mv aod.log ../aod%s.log",addString.Data()));\r
228 // roots\r
229 gSystem->Exec(Form("mv AliESDs.root ../AliESDs%s.root",addString.Data()));\r
230 gSystem->Exec(Form("mv AliESDfriends.root ../AliESDfriends%s.root",addString.Data()));\r
231 gSystem->Exec(Form("mv AliAOD.root ../AliAOD%s.root",addString.Data()));\r
232 gSystem->ChangeDirectory("../");\r
233 gSystem->Exec("ls -l");\r
234}\r