changes in the MagF constructor
[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
ae8c1d56 73 cout << "SIMRUN:: Run " << gSystem->Getenv("DC_RUN") << " Event " << gSystem->Getenv("DC_EVENT")\r
2858736f 74 << endl;\r
75\r
76\r
77 // Background simulation\r
78 gSystem->Setenv("CONFIG_EMBEDDING","kBackground");\r
79\r
80 cout<<">>>>> BACKGROUND SIMULATION <<<<<"<<endl;\r
ae8c1d56 81 gSystem->Exec("mkdir BackgroundFull");\r
82 gSystem->Exec("cp Config.C BackgroundFull/");\r
83 gSystem->Exec("cp sim.C BackgroundFull/");\r
84 gSystem->Exec("cp rec.C BackgroundFull/");\r
85 gSystem->ChangeDirectory("BackgroundFull/");\r
2858736f 86 gSystem->Exec("aliroot -b -q 'sim.C(0)' > sim.log 2>&1");\r
87 cout<<">>>>> BACKGROUND RECONSTRUCTION <<<<<"<<endl;\r
88 gSystem->Exec("aliroot -b -q 'rec.C(0)' > rec.log 2>&1");\r
89 gSystem->ChangeDirectory("../");\r
90\r
ae8c1d56 91 // Convert Raw to SDigits\r
92 cout << ">>>>> CONVERTING RAW 2 SDIGITS <<<<<" << endl;\r
93 gSystem->Exec("mkdir Background");\r
94 gSystem->Exec("cp BackgroundFull/raw.root Background/");\r
95 gSystem->Exec("cp BackgroundFull/AliESDs.root Background/");\r
96 gSystem->Exec("cp -a BackgroundFull/GRP Background/");\r
97 gSystem->Exec("cp sim.C Background/");\r
8217c4eb 98 gSystem->Exec("cp Config.C Background/");\r
ae8c1d56 99 gSystem->ChangeDirectory("Background/");\r
100 gSystem->Exec("aliroot -b -q 'sim.C(4)' > sim.log 2>&1");\r
101 gSystem->ChangeDirectory("../");\r
102 gSystem->Exec("mkdir BackgroundSDigits");\r
103 gSystem->Exec("cp Background/*SDigits.root BackgroundSDigits");\r
104 gSystem->Exec("cp BackgroundFull/galice.root BackgroundSDigits/");\r
105 gSystem->Exec("cp BackgroundFull/AliESDs.root BackgroundSDigits/");\r
106\r
2858736f 107 // Merged simulation\r
108 gSystem->Setenv("CONFIG_EMBEDDING","kMerged");\r
109\r
110 cout<<">>>>> MERGED SIMULATION <<<<<<"<< endl;\r
111 gSystem->Exec("mkdir Merged");\r
112 gSystem->Exec("cp Config.C Merged/");\r
113 gSystem->Exec("cp sim.C Merged/");\r
114 gSystem->Exec("cp rec.C Merged/");\r
115 gSystem->ChangeDirectory("Merged/");\r
116 gSystem->Exec("aliroot -b -q 'sim.C(1)' > sim.log 2>&1");\r
117 cout<<">>>>> MERGED RECONSTRUCTION <<<<<"<<endl;\r
118 gSystem->Exec("aliroot -b -q 'rec.C(1)' > rec.log 2>&1");\r
119 gSystem->ChangeDirectory("../");\r
120\r
121 // Pure signal re-reconstruction\r
122 gSystem->Setenv("CONFIG_EMBEDDING","kSignal");\r
ae8c1d56 123 \r
2858736f 124 cout<<">>>>> SIGNAL SIMULATION <<<<<<"<< endl;\r
125 gSystem->Exec("mkdir Signal");\r
126 gSystem->Exec("cp Config.C Signal/");\r
127 gSystem->Exec("cp sim.C Signal/");\r
128 gSystem->Exec("cp rec.C Signal/");\r
129 gSystem->Exec("cp Merged/*SDigits*.root Signal/");\r
130 gSystem->Exec("cp Merged/galice.root Signal/");\r
131 gSystem->Exec("cp Merged/Kinematics.root Signal/");\r
8217c4eb 132 gSystem->Exec("cp -a Merged/GRP Signal/");\r
2858736f 133 gSystem->ChangeDirectory("Signal/");\r
134 gSystem->Exec("aliroot -b -q 'sim.C(2)' > sim.log 2>&1");\r
135 cout<<">>>>> SIGNAL RECONSTRUCTION <<<<<"<<endl;\r
136 gSystem->Exec("aliroot -b -q 'rec.C(2)' > rec.log 2>&1");\r
137 gSystem->ChangeDirectory("../");\r
ae8c1d56 138 \r
2858736f 139 // cout<<">>>>> TAG <<<<<"<<endl;\r
140 // gSystem->Exec("aliroot -b -q tag.C > tag.log 2>&1");\r
141 // cout<<">>>>> CHECK ESD <<<<<"<<endl;\r
142 // gSystem->Exec("aliroot -b -q CheckESD.C > check.log 2>&1");\r
143 // cout<<">>>>> AOD <<<<<"<<endl;\r
144 // gSystem->Exec("aliroot -b -q CreateAODfromESD.C > aod.log 2>&1");\r
145}\r