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