Working on the electron cut
[u/mrichter/AliRoot.git] / prod / LHC08d5 / simrun.C
1 // #define VERBOSEARGS
2 // simrun.C
3 {
4   // extract the run and event variables given with --run <x> --event <y>
5   int nrun = 0;
6   int nevent = 0;
7   int seed = 0;
8   char sseed[1024];
9   char srun[1024];
10   char sevent[1024];
11   sprintf(srun,"");
12   sprintf(sevent,"");
13   for (int i=0; i< gApplication->Argc();i++){
14 #ifdef VERBOSEARGS
15     printf("Arg %d:  %s\n",i,gApplication->Argv(i));
16 #endif
17     if (!(strcmp(gApplication->Argv(i),"--run")))
18       nrun = atoi(gApplication->Argv(i+1));
19       sprintf(srun,"%d",nrun);
20     if (!(strcmp(gApplication->Argv(i),"--event")))
21       nevent = atoi(gApplication->Argv(i+1));
22       sprintf(sevent,"%d",nevent);
23   }
24
25   seed = nrun * 100000 + nevent;
26   sprintf(sseed,"%d",seed);
27
28   if (seed==0) {
29     fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
30     fprintf(stderr,"!!!!  WARNING! Seeding variable for MC is 0          !!!!\n");
31     fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
32   } else {
33     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
34     fprintf(stdout,"!!!  MC Seed is %d \n",seed);
35     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
36   }
37
38   // set the seed environment variable
39   gSystem->Setenv("CONFIG_SEED",sseed);
40   gSystem->Setenv("DC_RUN",srun);
41   gSystem->Setenv("DC_EVENT",sevent);
42   gSystem->Setenv("ALIMDC_RAWDB1","./mdc1");
43   gSystem->Setenv("ALIMDC_RAWDB2","./mdc2");
44   gSystem->Setenv("ALIMDC_TAGDB","./mdc1/tag");
45   gSystem->Setenv("ALIMDC_RUNDB","./mdc1/meta");
46   gSystem->Exec("aliroot -b -q sim.C > sim.log 2>&1");
47   gSystem->Exec("mv syswatch.log simwatch.log");
48   gSystem->Exec("aliroot -b -q rec.C > rec.log 2>&1");
49   gSystem->Exec("mv syswatch.log recwatch.log");
50   gSystem->Exec("aliroot -b -q tag.C > tag.log 2>&1");
51   gSystem->Exec("aliroot -b -q $ALICE_ROOT/STEER/CheckESD.C > check.log 2>&1");
52   gSystem->Exec("aliroot -b -q $ALICE_ROOT/STEER/CreateAODfromESD.C  > aod.log 2>&1");
53 }