double for 4-momentum in Generate()
[u/mrichter/AliRoot.git] / prod / LHC09c1 / simrun.C
1 // #define VERBOSEARGS
2 // simrun.C
3 {
4 // set job and simulation variables as :
5 // root.exe -b -q simrun.C  --run <x> --event <y> --process <kPythia6/kPhojet> --field <kNoField/k5kG> --energy <900/10000>
6
7   int nrun = 0;
8   int nevent = 0;
9   int seed = 0;
10
11   char sseed[1024];
12   char srun[1024];
13   char sevent[1024];
14   char sprocess[1024];
15   char sfield[1024];
16   char senergy[1024];
17
18   sprintf(srun,"");
19   sprintf(sevent,"");
20   sprintf(sprocess,"");
21   sprintf(sfield,"");
22   sprintf(senergy,"");
23
24   for (int i=0; i< gApplication->Argc();i++){
25 #ifdef VERBOSEARGS
26     printf("Arg  %d:  %s\n",i,gApplication->Argv(i));
27 #endif
28     if (!(strcmp(gApplication->Argv(i),"--run")))
29       nrun = atoi(gApplication->Argv(i+1));
30     sprintf(srun,"%d",nrun);
31
32     if (!(strcmp(gApplication->Argv(i),"--event")))
33       nevent = atoi(gApplication->Argv(i+1));
34     sprintf(sevent,"%d",nevent);
35
36     if (!(strcmp(gApplication->Argv(i),"--process")))
37       sprintf(sprocess, gApplication->Argv(i+1));
38
39     if (!(strcmp(gApplication->Argv(i),"--field")))
40       sprintf(sfield,gApplication->Argv(i+1));
41
42     if (!(strcmp(gApplication->Argv(i),"--energy")))
43       sprintf(senergy,gApplication->Argv(i+1));
44
45   }
46
47   seed = nrun * 100000 + nevent;
48   sprintf(sseed,"%d",seed);
49
50   if (seed==0) {
51     fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
52     fprintf(stderr,"!!!!  WARNING! Seeding variable for MC is 0          !!!!\n");
53     fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
54   } else {
55     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
56     fprintf(stdout,"!!!  MC Seed is %d \n",seed);
57     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
58   }
59   
60 // set the seed environment variable
61   gSystem->Setenv("CONFIG_SEED",sseed);
62   gSystem->Setenv("CONFIG_RUN_TYPE",sprocess); // kPythia6 or kPhojet
63   gSystem->Setenv("CONFIG_FIELD",sfield);      // kNoField or k5kG
64   gSystem->Setenv("CONFIG_ENERGY",senergy);    // 900 or 10000 (GeV)
65   gSystem->Setenv("DC_RUN",srun); // Not used in Config.C
66   gSystem->Setenv("DC_EVENT",sevent); // Not used in Config.C
67   
68 // Needed to produce simulated RAW data
69   gSystem->Setenv("ALIMDC_RAWDB1","./mdc1");
70   gSystem->Setenv("ALIMDC_RAWDB2","./mdc2");
71   gSystem->Setenv("ALIMDC_TAGDB","./mdc1/tag");
72   gSystem->Setenv("ALIMDC_RUNDB","./mdc1/meta");
73   cout<< "SIMRUN:: Run " << gSystem->Getenv("DC_RUN") << " Event " << gSystem->Getenv("DC_EVENT")
74           << " Generator "    << gSystem->Getenv("CONFIG_RUN_TYPE")
75           << " Field " << gSystem->Getenv("CONFIG_FIELD")
76           << " Energy " << gSystem->Getenv("CONFIG_ENERGY")
77           << endl;
78
79   cout<<">>>>> SIMULATION <<<<<"<<endl;
80   gSystem->Exec("aliroot -b -q sim.C > sim.log 2>&1");
81   cout<<">>>>> RECONSTRUCTION <<<<<"<<endl;
82   gSystem->Exec("aliroot -b -q rec.C > rec.log 2>&1");
83   cout<<">>>>> TAG <<<<<"<<endl;
84   gSystem->Exec("aliroot -b -q tag.C > tag.log 2>&1");
85   cout<<">>>>> CHECK ESD <<<<<"<<endl;
86   gSystem->Exec("aliroot -b -q CheckESD.C > check.log 2>&1");
87   cout<<">>>>> AOD <<<<<"<<endl;
88   gSystem->Exec("aliroot -b -q CreateAODfromESD.C > aod.log 2>&1");
89
90 }