Adding directory with the production requests
[u/mrichter/AliRoot.git] / prod / LHC08d6 / simrun.C
1 //#define VERBOSEARGS
2
3 {
4   // set job and simulation variables as :
5   // --run <x> --event <y> --bmin <min> --bmax <max> --quench <quench> --qhat <shad> --etamin <etamin> --etamax <etamax> --phimin <phimin> --phimax <phimax>
6   // root simrun.C --run 1 --event 10 --bmin 0 --bmax 3 --quench 1 --qhat 1 --etamin -2 --etamax 2 --phimin 0 --phimax 6.283185
7
8   int nrun = 0;
9   int nevent = 0;
10   int seed = 0;
11
12 //   float minpthard = -1;
13 //   float maxpthard = -1;
14 //   float minptgammapi0 = 1;
15
16   char sseed[1024];
17   char srun[1024];
18   char sevent[1024];
19   char sbmin[1024];
20   char sbmax[1024];
21   char setamin[1024];
22   char setamax[1024];
23   char sphimin[1024];
24   char sphimax[1024];
25   char squench[1024];
26   char sqhat[1024];
27
28   sprintf(sseed,"");
29   sprintf(srun,"");
30   sprintf(sevent,"");
31   sprintf(sbmin,"");
32   sprintf(sbmax,"");
33   sprintf(setamin,"");
34   sprintf(setamax,"");
35   sprintf(sphimin,"");
36   sprintf(sphimax,"");
37   sprintf(squench,"");
38   sprintf(sqhat,"");
39
40   for (int i=0; i< gApplication->Argc();i++){
41 #ifdef VERBOSEARGS
42     printf("Arg  %d:  %s\n",i,gApplication->Argv(i));
43 #endif
44     if (!(strcmp(gApplication->Argv(i),"--run")))
45       nrun = atoi(gApplication->Argv(i+1));
46     sprintf(srun,"%d",nrun);
47     if (!(strcmp(gApplication->Argv(i),"--event")))
48       nevent = atoi(gApplication->Argv(i+1));
49     sprintf(sevent,"%d",nevent);
50
51     if (!(strcmp(gApplication->Argv(i),"--bmin")))
52       sprintf(sbmin,gApplication->Argv(i+1));
53
54     if (!(strcmp(gApplication->Argv(i),"--bmax")))
55       sprintf(sbmax,gApplication->Argv(i+1));
56
57     if (!(strcmp(gApplication->Argv(i),"--etamin")))
58       sprintf(setamin,gApplication->Argv(i+1));
59
60     if (!(strcmp(gApplication->Argv(i),"--etamax")))
61       sprintf(setamax,gApplication->Argv(i+1));
62
63     if (!(strcmp(gApplication->Argv(i),"--phimin")))
64       sprintf(sphimin,gApplication->Argv(i+1));
65
66     if (!(strcmp(gApplication->Argv(i),"--phimax")))
67       sprintf(sphimax,gApplication->Argv(i+1));
68
69     if (!(strcmp(gApplication->Argv(i),"--quench")))
70       sprintf(squench,gApplication->Argv(i+1));
71
72     if (!(strcmp(gApplication->Argv(i),"--qhat")))
73       sprintf(sqhat,gApplication->Argv(i+1));
74
75   }
76
77   seed = nrun * 100000 + nevent;
78   sprintf(sseed,"%d",seed);
79
80   if (seed==0) {
81     fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
82     fprintf(stderr,"!!!!  WARNING! Seeding variable for MC is 0          !!!!\n");
83     fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
84   } else {
85     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
86     fprintf(stdout,"!!!  MC Seed is %d \n",seed);
87     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
88   }
89
90     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
91     fprintf(stdout,"!!!  Run is %d \n",nrun);
92     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
93
94     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
95     fprintf(stdout,"!!!  Event is %d \n",nevent);
96     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
97
98     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
99     fprintf(stdout,"!!!  b min is %s \n",sbmin);
100     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
101
102     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
103     fprintf(stdout,"!!!  bmax is %s \n",sbmax);
104     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
105
106     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
107     fprintf(stdout,"!!!  eta min is %s \n",setamin);
108     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
109
110     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
111     fprintf(stdout,"!!!  eta max is %s \n",setamax);
112     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
113
114     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
115     fprintf(stdout,"!!!  phi min is %s \n",sphimin);
116     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
117
118     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
119     fprintf(stdout,"!!!  phi max is %s \n",sphimax);
120     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
121
122     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
123     fprintf(stdout,"!!!  Quenching is %s \n",squench);
124     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
125
126     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
127     fprintf(stdout,"!!!  Shadowing is %s \n",sqhat);
128     fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
129
130
131   // set the seed environment variable
132   gSystem->Setenv("CONFIG_SEED",sseed);
133   gSystem->Setenv("DC_RUN",srun);
134   gSystem->Setenv("DC_EVENT",sevent);
135   gSystem->Setenv("CONFIG_BMIN",sbmin);//"20");
136   gSystem->Setenv("CONFIG_BMAX",sbmax);//"30");
137   gSystem->Setenv("QUENCH",squench);
138   gSystem->Setenv("QHAT",sqhat);
139   gSystem->Setenv("CONFIG_ETAMIN",setamin);//"20");
140   gSystem->Setenv("CONFIG_ETAMAX",setamax);//"30");
141   gSystem->Setenv("CONFIG_PHIMIN",sphimin);//"20");
142   gSystem->Setenv("CONFIG_PHIMAX",sphimax);//"30");
143 //  gSystem->Exec("cp $ROOTSYS/etc/system.rootrc .rootrc");
144   cout << ">>>>>> SIMULATION <<<<<<" << endl;
145   gSystem->Exec("aliroot -b -q \"sim.C(2)\" > sim.log 2>&1");
146   cout << ">>>>>> RECONSTRUCTION <<<<<<" << endl;
147   gSystem->Exec("aliroot -b -q rec.C > rec.log 2>&1");
148   cout << ">>>>>> TAG <<<<<<" << endl;
149   gSystem->Exec("aliroot -b -q tag.C > tag.log 2>&1");
150   cout << ">>>>>> CHECK ESD <<<<<<" << endl;
151   gSystem->Exec("aliroot -b -q CheckESD.C > check.log 2>&1");
152
153 }