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