Replace the PHOS version from IHEP to Run1 and fix the compilation, when possibletest...
[u/mrichter/AliRoot.git] / test / genkine / sim / Config.C
CommitLineData
5c4f93c0 1// Configuration of simulation
3928b038 2
3enum PprRad_t
4{
5 kGluonRadiation, kNoGluonRadiation
6};
7
3928b038 8enum PprTrigConf_t
9{
10 kDefaultPPTrig, kDefaultPbPbTrig
11};
12
13const char * pprTrigConfName[] = {
14 "p-p","Pb-Pb"
15};
16
3b90f080 17
3928b038 18// This part for configuration
19
20static PprRad_t srad = kGluonRadiation;
f7a1cc68 21static AliMagF::BMap_t smag = AliMagF::k5kG;
3928b038 22static Int_t sseed = 12345; //Set 0 to use the current time
23
24static PprTrigConf_t strig = kDefaultPPTrig; // default PbPb trigger configuration
25// Comment line
26static TString comment;
27
28// Functions
29Float_t EtaToTheta(Float_t arg);
30AliGenerator* GeneratorFactory();
31
32void Config()
33{
34 // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
35 // Theta range given through pseudorapidity limits 22/6/2001
36
37 // Set Random Number seed
38 gRandom->SetSeed(sseed);
39 cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl;
40
41
42
5c4f93c0 43 // libraries required by geant321 and Pythia6: loaded in sim.C
3928b038 44
45 new TGeant3TGeo("C++ Interface to Geant3");
46
47 AliRunLoader* rl=0x0;
48
49 cout<<"Config.C: Creating Run Loader ..."<<endl;
50 rl = AliRunLoader::Open("galice.root",
51 AliConfig::GetDefaultEventFolderName(),
52 "recreate");
53 if (rl == 0x0)
54 {
55 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
56 return;
57 }
58 rl->SetCompressionLevel(2);
59 rl->SetNumberOfEventsPerFile(100);
60 gAlice->SetRunLoader(rl);
61
62 // Set the trigger configuration
28da60d3 63 AliSimulation::Instance()->SetTriggerConfig(pprTrigConfName[strig]);
3928b038 64 cout<<"Trigger configuration is set to "<<pprTrigConfName[strig]<<endl;
65
66
67 //
68 // Set External decayer
69 AliDecayer *decayer = new AliDecayerPythia();
70 decayer->SetForceDecay(kAll);
71 decayer->Init();
72
73 //forbid some decays
74 AliPythia * py= AliPythia::Instance();
f1047fdc 75 py->SetMDME(737,1,0); //forbid D*+->D+ + pi0
76 py->SetMDME(738,1,0);//forbid D*+->D+ + gamma
3928b038 77
f1047fdc 78 for(Int_t d=747; d<=762; d++){
3928b038 79 py->SetMDME(d,1,0);
80 }
81
f1047fdc 82 for(Int_t d=764; d<=807; d++){
3928b038 83 py->SetMDME(d,1,0);
84 }
85
5c4f93c0 86 TVirtualMC * vmc = TVirtualMC::GetMC();
3928b038 87
5c4f93c0 88 vmc->SetExternalDecayer(decayer);
3928b038 89 //
90 //
91 //=======================================================================
92 //
93 //=======================================================================
94 // ************* STEERING parameters FOR ALICE SIMULATION **************
95 // --- Specify event type to be tracked through the ALICE setup
96 // --- All positions are in cm, angles in degrees, and P and E in GeV
97
5c4f93c0 98 vmc->SetProcess("DCAY",1);
99 vmc->SetProcess("PAIR",1);
100 vmc->SetProcess("COMP",1);
101 vmc->SetProcess("PHOT",1);
102 vmc->SetProcess("PFIS",0);
103 vmc->SetProcess("DRAY",0);
104 vmc->SetProcess("ANNI",1);
105 vmc->SetProcess("BREM",1);
106 vmc->SetProcess("MUNU",1);
107 vmc->SetProcess("CKOV",1);
108 vmc->SetProcess("HADR",1);
109 vmc->SetProcess("LOSS",2);
110 vmc->SetProcess("MULS",1);
111 vmc->SetProcess("RAYL",1);
3928b038 112
113 Float_t cut = 1.e-3; // 1MeV cut by default
114 Float_t tofmax = 1.e10;
115
5c4f93c0 116 vmc->SetCut("CUTGAM", cut);
117 vmc->SetCut("CUTELE", cut);
118 vmc->SetCut("CUTNEU", cut);
119 vmc->SetCut("CUTHAD", cut);
120 vmc->SetCut("CUTMUO", cut);
121 vmc->SetCut("BCUTE", cut);
122 vmc->SetCut("BCUTM", cut);
123 vmc->SetCut("DCUTE", cut);
124 vmc->SetCut("DCUTM", cut);
125 vmc->SetCut("PPCUTM", cut);
126 vmc->SetCut("TOFMAX", tofmax);
3928b038 127
128 // Debug and log level
129 // AliLog::SetGlobalDebugLevel(0);
130 // AliLog::SetGlobalLogLevel(AliLog::kError);
131
132 // Generator Configuration
133 AliGenerator* gener = GeneratorFactory();
134 gener->SetOrigin(0, 0, 0); // vertex position
135 gener->SetSigma(0, 0, 5.3); // Sigma in (X,Y,Z) (cm) on IP position
136 gener->SetCutVertexZ(1.); // Truncate at 1 sigma
137 gener->SetVertexSmear(kPerEvent);
138 gener->SetTrackingFlag(1);
139 gener->Init();
140
f7a1cc68 141 if (smag == AliMagF::k2kG) {
3928b038 142 comment = comment.Append(" | L3 field 0.2 T");
f7a1cc68 143 } else if (smag == AliMagF::k5kG) {
3928b038 144 comment = comment.Append(" | L3 field 0.5 T");
145 }
146
147
148 if (srad == kGluonRadiation)
149 {
150 comment = comment.Append(" | Gluon Radiation On");
151
152 } else {
153 comment = comment.Append(" | Gluon Radiation Off");
154 }
155
156
157 printf("\n \n Comment: %s \n \n", comment.Data());
158
159
160// Field (L3 0.4 T)
4642ac4b 161 AliMagF* field = new AliMagF("Maps","Maps",-1., -1., smag);
f7a1cc68 162 TGeoGlobalMagField::Instance()->SetField(field);
163
3928b038 164 rl->CdGAFile();
f7a1cc68 165 //
3928b038 166 Int_t iABSO = 1;
167 Int_t iDIPO = 1;
168 Int_t iFMD = 1;
169 Int_t iFRAME = 1;
170 Int_t iHALL = 1;
171 Int_t iITS = 1;
172 Int_t iMAG = 1;
173 Int_t iMUON = 1;
174 Int_t iPHOS = 1;
175 Int_t iPIPE = 1;
176 Int_t iPMD = 1;
177 Int_t iHMPID = 1;
178 Int_t iSHIL = 1;
179 Int_t iT0 = 1;
180 Int_t iTOF = 1;
181 Int_t iTPC = 1;
182 Int_t iTRD = 1;
183 Int_t iZDC = 1;
184 Int_t iEMCAL = 1;
185 Int_t iVZERO = 1;
186 Int_t iACORDE = 0;
187
188 //=================== Alice BODY parameters =============================
189 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
190
191
192 if (iMAG)
193 {
194 //=================== MAG parameters ============================
195 // --- Start with Magnet since detector layouts may be depending ---
196 // --- on the selected Magnet dimensions ---
197 AliMAG *MAG = new AliMAG("MAG", "Magnet");
198 }
199
200
201 if (iABSO)
202 {
203 //=================== ABSO parameters ============================
96fb3353 204 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
3928b038 205 }
206
207 if (iDIPO)
208 {
209 //=================== DIPO parameters ============================
210
96fb3353 211 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
3928b038 212 }
213
214 if (iHALL)
215 {
216 //=================== HALL parameters ============================
217
96fb3353 218 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
3928b038 219 }
220
221
222 if (iFRAME)
223 {
224 //=================== FRAME parameters ============================
225
226 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
bab433b3 227 FRAME->SetHoles(1);
3928b038 228 }
229
230 if (iSHIL)
231 {
232 //=================== SHIL parameters ============================
233
96fb3353 234 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
3928b038 235 }
236
237
238 if (iPIPE)
239 {
240 //=================== PIPE parameters ============================
241
96fb3353 242 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
3928b038 243 }
244
e89fa83b 245 if (iITS)
246 {
247 //=================== ITS parameters ============================
3928b038 248
07787d1d 249 AliITS *ITS = new AliITSv11("ITS","ITS v11");
3928b038 250 }
251
252 if (iTPC)
253 {
254 //============================ TPC parameters =====================
255 AliTPC *TPC = new AliTPCv2("TPC", "Default");
256 }
257
258
259 if (iTOF) {
260 //=================== TOF parameters ============================
0d7ef405 261 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
3928b038 262 }
263
264
265 if (iHMPID)
266 {
267 //=================== HMPID parameters ===========================
99887042 268 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
3928b038 269
270 }
271
272
273 if (iZDC)
274 {
275 //=================== ZDC parameters ============================
276
047922b1 277 AliZDC *ZDC = new AliZDCv4("ZDC", "normal ZDC");
3928b038 278 }
279
280 if (iTRD)
281 {
282 //=================== TRD parameters ============================
283
284 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
285 }
286
287 if (iFMD)
288 {
289 //=================== FMD parameters ============================
290 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
291 }
292
293 if (iMUON)
294 {
295 //=================== MUON parameters ===========================
296 // New MUONv1 version (geometry defined via builders)
297 AliMUON *MUON = new AliMUONv1("MUON", "default");
298 }
299 //=================== PHOS parameters ===========================
300
301 if (iPHOS)
302 {
5889a25e 303 AliPHOS *PHOS = new AliPHOSv1("PHOS", "Run1");
3928b038 304 }
305
306
307 if (iPMD)
308 {
309 //=================== PMD parameters ============================
310 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
311 }
312
313 if (iT0)
314 {
315 //=================== T0 parameters ============================
316 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
317 }
318
319 if (iEMCAL)
320 {
321 //=================== EMCAL parameters ============================
c76b9217 322 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETEV1");
3928b038 323 }
324
325 if (iACORDE)
326 {
327 //=================== ACORDE parameters ============================
f7882672 328 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
3928b038 329 }
330
331 if (iVZERO)
332 {
333 //=================== VZERO parameters ============================
334 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
335 }
336
337
338}
339
340Float_t EtaToTheta(Float_t arg){
341 return (180./TMath::Pi())*2.*atan(exp(-arg));
342}
343
344
345
346AliGenerator* GeneratorFactory() {
347
348 AliGenExtFile *gener = new AliGenExtFile(-1);
349 AliGenReaderTreeK * reader = new AliGenReaderTreeK();
350
351 reader->SetFileName("galice.root");
352 reader->AddDir("../gen");
353 gener->SetReader(reader);
354
355 return gener;
356
357
358}
359