1ff502b84ee6566085f6dfff73ee30d7549b6d11
[u/mrichter/AliRoot.git] / TPC / Upgrade / macros / runSimRec.C
1 void runSimRec(Int_t simtype, Int_t SCtype, Int_t nevents, Int_t ntracks, Int_t rate=50)
2 {
3   //rate is in kHz
4
5   Int_t recoType=simtype/10;
6   recoType%=10;
7   Int_t subRecoType=simtype/100;
8   simtype%=10;
9   
10   //simulation part
11   AliToyMCEventGeneratorSimple s;
12
13   TString outputFile="toyMC";
14
15   //for simtype also below
16   switch (simtype) {
17     case 0:
18       outputFile.Append(Form("_fixed_%dkHz",rate));
19       break;
20     case 1:
21       outputFile.Append(Form("_train_%dkHz",rate));
22       break;
23   }
24   
25   switch (SCtype) {
26     case 0:
27       s.SetSpaceCharge(AliToyMCEventGeneratorSimple::kEps5);
28       outputFile.Append("_eps05");
29       break;
30     case 1:
31       s.SetSpaceCharge(AliToyMCEventGeneratorSimple::kEps10);
32       outputFile.Append("_eps10");
33       break;
34     case 2:
35       s.SetSpaceCharge(AliToyMCEventGeneratorSimple::kEps20);
36       outputFile.Append("_eps20");
37       break;
38   }
39
40   outputFile.Append(Form("_%04dev_%04dtr",nevents,ntracks));
41   outputFile.Append(".root");
42   s.SetOutputFileName(outputFile.Data());
43
44   //TODO: Add other types
45   switch (simtype) {
46     case 0:
47       s.RunSimulation(nevents,ntracks,rate);
48       break;
49     case 1:
50       s.RunSimulationBunchTrain(nevents,ntracks);
51       break;
52   }
53
54   //reconstruction part
55   AliToyMCReconstruction rec;
56   // rec.SetUseMaterialBudget(kTRUE)
57
58   if (recoType==0){
59     rec.SetRecoSettings(1,0,AliToyMCReconstruction::kNoCorrection);
60     if (!subRecoType||subRecoType==1) rec.RunReco(outputFile.Data());
61
62     rec.SetRecoSettings(1,1,AliToyMCReconstruction::kIdeal);
63     if (!subRecoType||subRecoType==2) rec.RunReco(outputFile.Data());
64
65     rec.SetRecoSettings(0,1,AliToyMCReconstruction::kIdeal);
66     if (!subRecoType||subRecoType==3) rec.RunReco(outputFile.Data());
67
68     rec.SetRecoSettings(0,1,AliToyMCReconstruction::kAverageEta);
69     if (!subRecoType||subRecoType==4) rec.RunReco(outputFile.Data());
70
71     rec.SetRecoSettings(0,1,AliToyMCReconstruction::kNoCorrection);
72     if (!subRecoType||subRecoType==5) rec.RunReco(outputFile.Data());
73
74     rec.SetRecoSettings(0,0,AliToyMCReconstruction::kNoCorrection);
75     if (!subRecoType||subRecoType==6) rec.RunReco(outputFile.Data());
76   }
77
78   if (recoType==1) {
79     rec.SetRecoSettings(0,1,AliToyMCReconstruction::kNoCorrection);
80     if (!subRecoType||subRecoType==1) rec.RunFullTracking(outputFile.Data());
81     
82     rec.SetRecoSettings(0,0,AliToyMCReconstruction::kNoCorrection);
83     if (!subRecoType||subRecoType==2) rec.RunFullTracking(outputFile.Data());
84   }
85   
86 }