o add options for other gases and Epsilons
[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, Int_t gas=0)
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   AliToyMCEventGeneratorSimple::EGasType gasType=AliToyMCEventGeneratorSimple::kNeCO2_9010;
26   
27   switch (gas) {
28     case 0:
29       gasType=AliToyMCEventGeneratorSimple::kNeCO2_9010;
30       outputFile.Appen("_NeCO2");
31       break;
32     case 1:
33       gasType=AliToyMCEventGeneratorSimple::kNeCO2N2_90105;
34       outputFile.Appen("_NeCO2N2");
35       break;
36   }
37   
38   switch (SCtype) {
39     case 0:
40       s.SetSpaceCharge(AliToyMCEventGeneratorSimple::kEps5, gasType);
41       outputFile.Append("_eps05");
42       break;
43     case 1:
44       s.SetSpaceCharge(AliToyMCEventGeneratorSimple::kEps10, gasType);
45       outputFile.Append("_eps10");
46       break;
47     case 2:
48       s.SetSpaceCharge(AliToyMCEventGeneratorSimple::kEps20, gasType);
49       outputFile.Append("_eps20");
50       break;
51     case 3:
52       s.SetSpaceCharge(AliToyMCEventGeneratorSimple::kEps25, gasType);
53       outputFile.Append("_eps25");
54       break;
55     case 4:
56       s.SetSpaceCharge(AliToyMCEventGeneratorSimple::kEps30, gasType);
57       outputFile.Append("_eps30");
58       break;
59     case 5:
60       s.SetSpaceCharge(AliToyMCEventGeneratorSimple::kEps35, gasType);
61       outputFile.Append("_eps35");
62       break;
63     case 6:
64       s.SetSpaceCharge(AliToyMCEventGeneratorSimple::kEps40, gasType);
65       outputFile.Append("_eps40");
66       break;
67   }
68
69   outputFile.Append(Form("_%04dev_%04dtr",nevents,ntracks));
70   outputFile.Append(".root");
71   s.SetOutputFileName(outputFile.Data());
72
73   //TODO: Add other types
74   switch (simtype) {
75     case 0:
76       s.RunSimulation(nevents,ntracks,rate);
77       break;
78     case 1:
79       s.RunSimulationBunchTrain(nevents,ntracks);
80       break;
81   }
82
83   //reconstruction part
84   AliToyMCReconstruction rec;
85   // rec.SetUseMaterialBudget(kTRUE)
86
87   if (recoType==0){
88     rec.SetRecoSettings(1,0,AliToyMCReconstruction::kNoCorrection);
89     if (!subRecoType||subRecoType==1) rec.RunReco(outputFile.Data());
90
91     rec.SetRecoSettings(1,1,AliToyMCReconstruction::kIdeal);
92     if (!subRecoType||subRecoType==2) rec.RunReco(outputFile.Data());
93
94     rec.SetRecoSettings(0,1,AliToyMCReconstruction::kIdeal);
95     if (!subRecoType||subRecoType==3) rec.RunReco(outputFile.Data());
96
97     rec.SetRecoSettings(0,1,AliToyMCReconstruction::kAverageEta);
98     if (!subRecoType||subRecoType==4) rec.RunReco(outputFile.Data());
99
100     rec.SetRecoSettings(0,1,AliToyMCReconstruction::kNoCorrection);
101     if (!subRecoType||subRecoType==5) rec.RunReco(outputFile.Data());
102
103     rec.SetRecoSettings(0,0,AliToyMCReconstruction::kNoCorrection);
104     if (!subRecoType||subRecoType==6) rec.RunReco(outputFile.Data());
105   }
106
107   if (recoType==1) {
108     rec.SetRecoSettings(0,1,AliToyMCReconstruction::kNoCorrection);
109     if (!subRecoType||subRecoType==1) rec.RunFullTracking(outputFile.Data());
110     
111     rec.SetRecoSettings(0,0,AliToyMCReconstruction::kNoCorrection);
112     if (!subRecoType||subRecoType==2) rec.RunFullTracking(outputFile.Data());
113   }
114   
115 }