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