]> git.uio.no Git - u/mrichter/AliRoot.git/blob - test/embedding/simrun.C
more end of lines
[u/mrichter/AliRoot.git] / test / embedding / 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           << endl;
75
76
77   // Background simulation
78   gSystem->Setenv("CONFIG_EMBEDDING","kBackground");
79
80   cout<<">>>>> BACKGROUND SIMULATION <<<<<"<<endl;
81   gSystem->Exec("mkdir BackgroundFull");
82   gSystem->Exec("cp Config.C BackgroundFull/");
83   gSystem->Exec("cp sim.C BackgroundFull/");
84   gSystem->Exec("cp rec.C BackgroundFull/");
85   gSystem->ChangeDirectory("BackgroundFull/");
86   gSystem->Exec("aliroot -b -q 'sim.C(0)' > sim.log 2>&1");
87   cout<<">>>>> BACKGROUND RECONSTRUCTION <<<<<"<<endl;
88   gSystem->Exec("aliroot -b -q 'rec.C(0)' > rec.log 2>&1");
89   gSystem->ChangeDirectory("../");
90
91   // Convert Raw to SDigits
92   cout << ">>>>> CONVERTING RAW 2 SDIGITS <<<<<" << endl;
93   gSystem->Exec("mkdir Background");
94   gSystem->Exec("cp BackgroundFull/raw.root Background/");
95   gSystem->Exec("cp BackgroundFull/AliESDs.root Background/");
96   gSystem->Exec("cp -a BackgroundFull/GRP Background/");
97   gSystem->Exec("cp sim.C Background/");
98   gSystem->Exec("cp Config.C Background/");
99   gSystem->ChangeDirectory("Background/");
100   gSystem->Exec("aliroot -b -q 'sim.C(4)' > sim.log 2>&1");
101   gSystem->ChangeDirectory("../");
102   gSystem->Exec("mkdir BackgroundSDigits");
103   gSystem->Exec("cp Background/*SDigits.root BackgroundSDigits");
104   gSystem->Exec("cp BackgroundFull/galice.root BackgroundSDigits/");
105   gSystem->Exec("cp BackgroundFull/AliESDs.root BackgroundSDigits/");
106
107   // Merged simulation
108   gSystem->Setenv("CONFIG_EMBEDDING","kMerged");
109
110   cout<<">>>>> MERGED SIMULATION <<<<<<"<< endl;
111   gSystem->Exec("mkdir Merged");
112   gSystem->Exec("cp Config.C Merged/");
113   gSystem->Exec("cp sim.C Merged/");
114   gSystem->Exec("cp rec.C Merged/");
115   gSystem->ChangeDirectory("Merged/");
116   gSystem->Exec("aliroot -b -q 'sim.C(1)' > sim.log 2>&1");
117   cout<<">>>>> MERGED RECONSTRUCTION <<<<<"<<endl;
118   gSystem->Exec("aliroot -b -q 'rec.C(1)' > rec.log 2>&1");
119   gSystem->ChangeDirectory("../");
120
121   // Pure signal re-reconstruction
122   gSystem->Setenv("CONFIG_EMBEDDING","kSignal");
123   
124   cout<<">>>>> SIGNAL SIMULATION <<<<<<"<< endl;
125   gSystem->Exec("mkdir Signal");
126   gSystem->Exec("cp Config.C Signal/");
127   gSystem->Exec("cp sim.C Signal/");
128   gSystem->Exec("cp rec.C Signal/");
129   gSystem->Exec("cp Merged/*SDigits*.root Signal/");
130   gSystem->Exec("cp Merged/galice.root Signal/");
131   gSystem->Exec("cp Merged/Kinematics.root Signal/");
132   gSystem->Exec("cp -a Merged/GRP Signal/");
133   gSystem->ChangeDirectory("Signal/");
134   gSystem->Exec("aliroot -b -q 'sim.C(2)' > sim.log 2>&1");
135   cout<<">>>>> SIGNAL RECONSTRUCTION <<<<<"<<endl;
136   gSystem->Exec("aliroot -b -q 'rec.C(2)' > rec.log 2>&1");
137   gSystem->ChangeDirectory("../");
138   
139   //  cout<<">>>>> TAG <<<<<"<<endl;
140   //  gSystem->Exec("aliroot -b -q tag.C > tag.log 2>&1");
141   //  cout<<">>>>> CHECK ESD <<<<<"<<endl;
142   //  gSystem->Exec("aliroot -b -q CheckESD.C > check.log 2>&1");
143   //  cout<<">>>>> AOD <<<<<"<<endl;
144   //  gSystem->Exec("aliroot -b -q CreateAODfromESD.C > aod.log 2>&1");
145 }