Modified file access mode
[u/mrichter/AliRoot.git] / test / embedding / simrun.C
CommitLineData
2858736f 1// #define VERBOSEARGS\r
2// simrun.C\r
3{\r
4// set job and simulation variables as :\r
5// root.exe -b -q simrun.C --run <x> --event <y> --process <kPythia6/kPhojet> --field <kNoField/k5kG> --energy <900/10000>\r
6\r
7 int nrun = 0;\r
8 int nevent = 0;\r
9 int seed = 0;\r
10\r
11 char sseed[1024];\r
12 char srun[1024];\r
13 char sevent[1024];\r
14 char sprocess[1024];\r
15 char sfield[1024];\r
16 char senergy[1024];\r
17\r
18 sprintf(srun,"");\r
19 sprintf(sevent,"");\r
20 sprintf(sprocess,"");\r
21 sprintf(sfield,"");\r
22 sprintf(senergy,"");\r
23\r
24 for (int i=0; i< gApplication->Argc();i++){\r
25#ifdef VERBOSEARGS\r
26 printf("Arg %d: %s\n",i,gApplication->Argv(i));\r
27#endif\r
28 if (!(strcmp(gApplication->Argv(i),"--run")))\r
29 nrun = atoi(gApplication->Argv(i+1));\r
30 sprintf(srun,"%d",nrun);\r
31\r
32 if (!(strcmp(gApplication->Argv(i),"--event")))\r
33 nevent = atoi(gApplication->Argv(i+1));\r
34 sprintf(sevent,"%d",nevent);\r
35\r
36 if (!(strcmp(gApplication->Argv(i),"--process")))\r
37 sprintf(sprocess, gApplication->Argv(i+1));\r
38\r
39 if (!(strcmp(gApplication->Argv(i),"--field")))\r
40 sprintf(sfield,gApplication->Argv(i+1));\r
41\r
42 if (!(strcmp(gApplication->Argv(i),"--energy")))\r
43 sprintf(senergy,gApplication->Argv(i+1));\r
44\r
45 }\r
46\r
47 seed = nrun * 100000 + nevent;\r
48 sprintf(sseed,"%d",seed);\r
49\r
50 if (seed==0) {\r
51 fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
52 fprintf(stderr,"!!!! WARNING! Seeding variable for MC is 0 !!!!\n");\r
53 fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
54 } else {\r
55 fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
56 fprintf(stdout,"!!! MC Seed is %d \n",seed);\r
57 fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
58 }\r
59 \r
60// set the seed environment variable\r
61 gSystem->Setenv("CONFIG_SEED",sseed);\r
62 gSystem->Setenv("CONFIG_RUN_TYPE",sprocess); // kPythia6 or kPhojet\r
63 gSystem->Setenv("CONFIG_FIELD",sfield); // kNoField or k5kG\r
64 gSystem->Setenv("CONFIG_ENERGY",senergy); // 900 or 10000 (GeV)\r
65 gSystem->Setenv("DC_RUN",srun); // Not used in Config.C\r
66 gSystem->Setenv("DC_EVENT",sevent); // Not used in Config.C\r
67 \r
68// Needed to produce simulated RAW data\r
69 gSystem->Setenv("ALIMDC_RAWDB1","./mdc1");\r
70 gSystem->Setenv("ALIMDC_RAWDB2","./mdc2");\r
71 gSystem->Setenv("ALIMDC_TAGDB","./mdc1/tag");\r
72 gSystem->Setenv("ALIMDC_RUNDB","./mdc1/meta");\r
73 cout<< "SIMRUN:: Run " << gSystem->Getenv("DC_RUN") << " Event " << gSystem->Getenv("DC_EVENT")\r
74 << " Process " << gSystem->Getenv("DC_RUN_TYPE")\r
75 << " minpthard " << gSystem->Getenv("PTHARDMIN")\r
76 << " maxpthard " << gSystem->Getenv("PTHARDMAX")\r
77 << " minpt " << gSystem->Getenv("PTGAMMAPI0MIN")\r
78 << endl;\r
79\r
80\r
81 // Background simulation\r
82 gSystem->Setenv("CONFIG_EMBEDDING","kBackground");\r
83\r
84 cout<<">>>>> BACKGROUND SIMULATION <<<<<"<<endl;\r
85 gSystem->Exec("mkdir Background");\r
86 gSystem->Exec("cp Config.C Background/");\r
87 gSystem->Exec("cp sim.C Background/");\r
88 gSystem->Exec("cp rec.C Background/");\r
89 gSystem->ChangeDirectory("Background/");\r
90 gSystem->Exec("aliroot -b -q 'sim.C(0)' > sim.log 2>&1");\r
91 cout<<">>>>> BACKGROUND RECONSTRUCTION <<<<<"<<endl;\r
92 gSystem->Exec("aliroot -b -q 'rec.C(0)' > rec.log 2>&1");\r
93 gSystem->ChangeDirectory("../");\r
94\r
95 // Merged simulation\r
96 gSystem->Setenv("CONFIG_EMBEDDING","kMerged");\r
97\r
98 cout<<">>>>> MERGED SIMULATION <<<<<<"<< endl;\r
99 gSystem->Exec("mkdir Merged");\r
100 gSystem->Exec("cp Config.C Merged/");\r
101 gSystem->Exec("cp sim.C Merged/");\r
102 gSystem->Exec("cp rec.C Merged/");\r
103 gSystem->ChangeDirectory("Merged/");\r
104 gSystem->Exec("aliroot -b -q 'sim.C(1)' > sim.log 2>&1");\r
105 cout<<">>>>> MERGED RECONSTRUCTION <<<<<"<<endl;\r
106 gSystem->Exec("aliroot -b -q 'rec.C(1)' > rec.log 2>&1");\r
107 gSystem->ChangeDirectory("../");\r
108\r
109 // Pure signal re-reconstruction\r
110 gSystem->Setenv("CONFIG_EMBEDDING","kSignal");\r
111\r
112 cout<<">>>>> SIGNAL SIMULATION <<<<<<"<< endl;\r
113 gSystem->Exec("mkdir Signal");\r
114 gSystem->Exec("cp Config.C Signal/");\r
115 gSystem->Exec("cp sim.C Signal/");\r
116 gSystem->Exec("cp rec.C Signal/");\r
117 gSystem->Exec("cp Merged/*SDigits*.root Signal/");\r
118 gSystem->Exec("cp Merged/galice.root Signal/");\r
119 gSystem->Exec("cp Merged/Kinematics.root Signal/");\r
120 gSystem->ChangeDirectory("Signal/");\r
121 gSystem->Exec("aliroot -b -q 'sim.C(2)' > sim.log 2>&1");\r
122 cout<<">>>>> SIGNAL RECONSTRUCTION <<<<<"<<endl;\r
123 gSystem->Exec("aliroot -b -q 'rec.C(2)' > rec.log 2>&1");\r
124 gSystem->ChangeDirectory("../");\r
125\r
126 // cout<<">>>>> TAG <<<<<"<<endl;\r
127 // gSystem->Exec("aliroot -b -q tag.C > tag.log 2>&1");\r
128 // cout<<">>>>> CHECK ESD <<<<<"<<endl;\r
129 // gSystem->Exec("aliroot -b -q CheckESD.C > check.log 2>&1");\r
130 // cout<<">>>>> AOD <<<<<"<<endl;\r
131 // gSystem->Exec("aliroot -b -q CreateAODfromESD.C > aod.log 2>&1");\r
132}\r