-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAliMCConf.cxx
454 lines (416 loc) · 10.9 KB
/
AliMCConf.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
#include "AliMCConf.h"
#include "AliLog.h"
ClassImp(AliMCConf)
const char* AliMCConf::fgkDetConfName = "ConfigDet";
/*
Int_t iABSO = 1;
Int_t iDIPO = 1;
Int_t iFMD = 1;
Int_t iFRAME = 1;
Int_t iHALL = 1;
Int_t iITS = 1;
Int_t iMAG = 1;
Int_t iMUON = 1;
Int_t iPHOS = 1;
Int_t iPIPE = 1;
Int_t iPMD = 1;
Int_t iHMPID = 1;
Int_t iSHIL = 1;
Int_t iT0 = 1;
Int_t iTOF = 1;
Int_t iTPC = 1;
Int_t iTRD = 1;
Int_t iZDC = 1;
Int_t iEMCAL = 1;
Int_t iVZERO = 1;
Int_t iACORDE = 1;
Int_t iAD = 1;
*/
//______________________________________________
AliMCConf::AliMCConf()
:fYear(0)
,fCollSystem(kPP)
,fBeamEnergy(0)
,fFlOut(0)
,fOffs(0)
,fDetConfName(fgkDetConfName)
{
}
//______________________________________________
void AliMCConf::WriteConfigDet()
{
// write detector configuration
//
OpenFile(Form("%s.C",fDetConfName.Data()));
ToFile(Form("void %s()",fDetConfName));
ToFile("{");
IncOffs();
//
DoBody(); //OK
DoMagnet(); //OK
DoAbsorber(); //OK
DoDipole(); //OK
DoHall(); //OK
DoFrame(); //OK
DoShield(); //OK
DoPipe(); //OK
DoITS(); //OK
DoTPC(); //OK
DoTOF(); //OK
DoHMPID(); //OK
DoZDC(); //TODOOOOOOOOOOOOOOOOOOOOOO
DoTRD(); //OK
DoFMD(); //OK
DoMUON(); //OK
DoPHOS(); //OK
DoPMD(); //OK
DoT0(); //OK
DoEMCAL(); //OK
DoACORDE(); //OK
DoVZERO(); //OK
DoAD(); //OK
//
DecOffs();
ToFile("}");
CloseFile();
}
//______________________________________________
void AliMCConf::SetDetConfName(const char* nm)
{
// set detector conf. name
fDetConfName = nm;
if (fDetConfName.IsNull()) fDetConfName = fgkDetConfName;
if (fDetConfName.EndsWith(".C")) fDetConfName.Remove(fDetConfName.Length()-strlen(".C"));
//
}
//______________________________________________
void AliMCConf::ToFile(const char* cmd, int offsInc)
{
// write string to file with, prepending by offset
int offs = fOffs;
if (offsInc) offs += offsInc*kOffsStep;
fprintf(fFlOut,Form("%%%ds%%s\n",offs),"",cmd);
}
//______________________________________________
void AliMCConf::OpenFile(const char* name)
{
// creare output file
if (fFlOut) fclose(fFlOut);
fFlOut = fopen(Form("%s.C",fDetConfName.Data()),"w");
if (!flout) AliFatalF("Failed to create file %s",fDetConfName.Data());
fOffs = 0;
}
//______________________________________________
void AliMCConf::CloseFile()
{
// close output file
fclose(fFlOut);
}
//=====================================================================
//______________________________________________
void AliMCConf::DoBody()
{
// body
ToFile("//=============== ALICE BODY PARAMETERS ===============");
ToFile("AliBODY *BODY = new AliBODY(\"BODY\", \"Alice envelop\");");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoMagnet()
{
// L3 magnet
ToFile("//=============== MAGNET PARAMETERS ===============");
ToFile("if (iMAG) {");
ToFile("AliMAG *MAG = new AliMAG(\"MAG\", \"Magnet\");",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoAbsorber()
{
// absorber
ToFile("//=============== ABSORBER PARAMETERS ===============");
ToFile("if (iABSO) {");
ToFile("AliABSO *ABSO = new AliABSOv3(\"ABSO\", \"Muon Absorber\");",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoDipole()
{
// dipole
ToFile("//=============== DIPOLE PARAMETERS ===============");
ToFile("if (iDIPO) {");
ToFile("AliDIPO *DIPO = new AliDIPOv3(\"DIPO\", \"Dipole version 3\");",1);
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoHall()
{
// alice hall
ToFile("//=============== HALL PARAMETERS ===============");
ToFile("if (iHALL) AliHALL *HALL = new AliHALLv3(\"HALL\", \"Alice Hall\");");
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoFrame()
{
// alice frame
ToFile("//=============== FRAME PARAMETERS ===============");
ToFile("if (iFRAME) {");
ToFile("AliFRAMEv3 *FRAME = new AliFRAMEv3(\"FRAME\", \"Space Frame\");",1);
ToFile("FRAME->SetHoles(1);",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoShield()
{
// shield
ToFile("//=============== SHIELD PARAMETERS ===============");
ToFile("if (iSHIL) {");
ToFile("AliSHIL *SHIL = new AliSHILv3(\"SHIL\", \"Shielding Version 3\");",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoPipe()
{
// beam pipe
ToFile("//=============== PIPE PARAMETERS ===============");
ToFile("if (iPIPE) {");
ToFile("AliPIPE *PIPE = new AliPIPEv3(\"PIPE\", \"Beam Pipe\");",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoITS()
{
// ITS
ToFile("//=============== ITS PARAMETERS ===============");
ToFile("if (iITS) {");
ToFile("AliITS *ITS = new AliITSv11(\"ITS\",\"ITS v11\");",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoTPC()
{
// TPC
ToFile("//=============== TPC PARAMETERS ===============");
ToFile("if (iTPC) {");
ToFile("AliTPC *TPC = new AliTPCv2(\"TPC\", \"Default\");",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoTOF()
{
// TOF
ToFile("//=============== TOF PARAMETERS ===============");
ToFile("if (iTOF) {");
ToFile("AliTOF *TOF = new AliTOFv6T0(\"TOF\", \"normal TOF\");",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoHMPID()
{
// HMPID
ToFile("//=============== HMPID PARAMETERS ===============");
ToFile("if (iHMPID) {");
ToFile("AliHMPID *HMPID = new AliHMPIDv3(\"HMPID\", \"normal HMPID\");",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoTRD()
{
// TRD
ToFile("//=============== TRD PARAMETERS ===============");
ToFile("if (iTRD) {");
IncOffs();
ToFile("AliTRD *TRD = new AliTRDv1(\"TRD\", \"TRD slow simulator\");");
ToFile("AliTRDgeometry *geoTRD = TRD->GetGeometry();");
if (fYear<2011) {
ToFile("geoTRD->SetSMstatus(11,0);");
ToFile("geoTRD->SetSMstatus(15,0);");
ToFile("geoTRD->SetSMstatus(16,0);");
}
if (fYear<2012) {
ToFile("geoTRD->SetSMstatus(2,0);");
ToFile("geoTRD->SetSMstatus(3,0);");
ToFile("geoTRD->SetSMstatus(6,0);");
}
if (fYear<2015) {
ToFile("geoTRD->SetSMstatus(4,0);");
ToFile("geoTRD->SetSMstatus(5,0);");
ToFile("geoTRD->SetSMstatus(12,0);");
ToFile("geoTRD->SetSMstatus(13,0);");
ToFile("geoTRD->SetSMstatus(14,0);");
}
//
DecOffs();
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoFMD()
{
// FMD
ToFile("//=============== FMD PARAMETERS ===============");
ToFile("if (iFMD) {");
ToFile("AliFMD *FMD = new AliFMDv1(\"FMD\", \"normal FMD\");",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoMUON()
{
// MUON
ToFile("//=============== MUON PARAMETERS ===============");
ToFile("if (iMUON) {");
ToFile("AliMUON *MUON = new AliMUONv1(\"MUON\", \"default\");",1);
ToFile("MUON->SetTriggerResponseV1(2);",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoPHOS()
{
// PHOS
ToFile("//=============== PHOS PARAMETERS ===============");
ToFile("if (iPHOS) {");
if (fYear>2014)
ToFile("AliPHOS *PHOS = new AliPHOSv1(\"PHOS\", \"Run2\");",1);
else
ToFile("AliPHOS *PHOS = new AliPHOSv1(\"PHOS\", \"noCPV_Modules123\");",1);
//
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoPMD()
{
// HPD
ToFile("//=============== PMD PARAMETERS ===============");
ToFile("if (iPMD) {");
ToFile("AliPMD *PMD = new AliPMDv1(\"PMD\", \"normal PMD\");",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoT0()
{
// T0
ToFile("//=============== T0 PARAMETERS ===============");
ToFile("if (iT0) {");
ToFile("AliT0 *T0 = new AliT0v1(\"T0\", \"T0 Detector\");",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoEMCAL()
{
// EMCAL
TString version;
if (fYear<=2010) version = "EMCAL_FIRSTYEARV1";
else if (fYear==2011) version = "EMCAL_COMPLETEV1";
else if (fYear<=2014) version = "EMCAL_COMPLETE12SMV1";
else version = "EMCAL_COMPLETE12SMV1_DCAL_8SM";
//
ToFile("//=============== EMCAL PARAMETERS ===============");
ToFile("if (iEMCAL) {");
ToFile(Form("AliEMCAL *EMCAL = new AliEMCALv2(\"EMCAL\", \"%s\", kFALSE);",version.Data()),1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoACORDE()
{
// ACORDE
ToFile("//=============== ACORDE PARAMETERS ===============");
ToFile("if (iACORDE) {");
ToFile("AliACORDE *ACORDE = new AliACORDEv1(\"ACORDE\", \"normal ACORDE\");",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoVZERO()
{
// V0
ToFile("//=============== VZERO PARAMETERS ===============");
ToFile("if (iVZERO) {");
ToFile("AliVZERO *VZERO = new AliVZEROv7(\"VZERO\", \"normal VZERO\");",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoAD()
{
// AD
if (fYear<2015) return;
ToFile("//=============== AD PARAMETERS ===============");
ToFile("if (iAD) {");
ToFile("AliAD *AD = new AliADv1(\"AD\", \"normal AD\");",1);
ToFile("}");
ToFile("");
//
}
//______________________________________________
void AliMCConf::DoZDC()
{
// ZDC
if (fCollSystem == kPP) return;
//
TString zdcV = "AliZDCv3";
TString zdcOpt;
if (fYear>=2013) zdcV = "AliZDCv4";
ToFile("//=============== ZDC PARAMETERS ===============");
ToFile("if (iZDC) {");
IncOffs();
ToFile(Form("AliZDC *ZDC = new %s(\"ZDC\", \"normal ZDC\");",zdcV.Data()));
//
ToFile("ZDC->SetLumiLenght(0.);");
if (fCollSystem==kPA || fCollSystem=kAP) {
ToFile("ZDC->SetpASystem();");
ToFile(Form("ZDC->SetBeamEnergy(82.*%f/208.);",fBeamEnergy));
}
ToFile("ZDC->SetSpectatorsTrack();");
if (fPeriod==kLHC11h && TMath::Abs(fCrossAngle)>0) {
ToFile("ZDC->SetVCollSideAAperture(2.8);");
ToFile("ZDC->SetVCollSideAApertureNeg(2.8);");
ToFile("ZDC->SetVCollSideCAperture(2.8);");
ToFile("ZDC->SetVCollSideCApertureNeg(2.8);");
ToFile("ZDC->SetTDIAperturePos(5.5);");
ToFile("ZDC->SetTDIApertureNeg(5.5);");
ToFile("ZDC->SetTCDDAperturePos(2.);");
ToFile("ZDC->SetTCDDApertureNeg(2.2);");
}
DecOffs();
ToFile("}");
ToFile("");
//
}