warning removal
[u/mrichter/AliRoot.git] / prod / LHC09a10 / simrun.C
1 // #define VERBOSEARGS\r
2 // simrun.C\r
3 {\r
4   // extract the run and event variables given with \r
5   // --run <x> --event <y> --type <t>\r
6   // where "type" can be "ppMBias" or "pptrg2mu"\r
7   int nrun = 0;\r
8   int nevent = 0;\r
9   int seed = 0;\r
10   char sseed[1024];\r
11   char srun[1024];\r
12   char sevent[1024];\r
13   char type[1024];\r
14   sprintf(srun,"");\r
15   sprintf(sevent,"");\r
16   for (int i=0; i< gApplication->Argc();i++){\r
17 #ifdef VERBOSEARGS\r
18     printf("Arg %d:  %s\n",i,gApplication->Argv(i));\r
19 #endif\r
20     if (!(strcmp(gApplication->Argv(i),"--run")))\r
21       nrun = atoi(gApplication->Argv(i+1));\r
22     sprintf(srun,"%d",nrun);\r
23     if (!(strcmp(gApplication->Argv(i),"--event")))\r
24       nevent = atoi(gApplication->Argv(i+1));\r
25     sprintf(sevent,"%d",nevent);\r
26     if (!(strcmp(gApplication->Argv(i),"--type")))\r
27       strcpy(type,gApplication->Argv(i+1));\r
28   }\r
29   \r
30   seed = nrun * 100000 + nevent;\r
31   sprintf(sseed,"%d",seed);\r
32   \r
33   if (seed==0) {\r
34     fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
35     fprintf(stderr,"!!!!  WARNING! Seeding variable for MC is 0          !!!!\n");\r
36     fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
37   } else {\r
38     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
39     fprintf(stdout,"!!!  MC Seed is %d \n",seed);\r
40     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");\r
41   }\r
42   \r
43   gSystem->Setenv("CONFIG_SEED",sseed);\r
44   gSystem->Setenv("CONFIG_RUN_TYPE",type);\r
45   gSystem->Setenv("DC_RUN",srun);\r
46 \r
47   gSystem->Setenv("ALIMDC_RAWDB1","./mdc1");\r
48   gSystem->Setenv("ALIMDC_RAWDB2","./mdc2");\r
49   gSystem->Setenv("ALIMDC_TAGDB","./mdc1/tag");\r
50   gSystem->Setenv("ALIMDC_RUNDB","./mdc1/meta");\r
51   \r
52   gSystem->Exec("cp $ALICE_ROOT/.rootrc .rootrc");\r
53   gSystem->Exec("aliroot -b -q sim.C 2>&1 | tee sim.log");\r
54   gSystem->Exec("mkdir generated");\r
55   gSystem->Exec("mv *.root generated");\r
56   gSystem->Exec("ln -s generated/geometry.root");\r
57   gSystem->Exec("ln -s generated/raw.root");\r
58   gSystem->Exec("aliroot -b -q rec.C 2>&1 | tee rec.log");\r
59   gSystem->Exec("mv galice.root galice_rec.root");\r
60   gSystem->Exec("mv generated/*.root .");\r
61   gSystem->Exec("aliroot -b -q tag.C 2>&1 | tee tag.log");\r
62   gSystem->Exec("aliroot -b -q CheckESD.C 2>&1 | tee check.log");\r
63 \r
64 }\r