]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/macros/testSuite/ConfigTestSuite.C
changes in the MagF constructor
[u/mrichter/AliRoot.git] / PHOS / macros / testSuite / ConfigTestSuite.C
1 #include <TPGCode.h>
2
3 static Int_t    eventsPerRun = 100;
4 enum PprGeo_t 
5 {
6     kHoles, kNoHoles
7 };
8 static PprGeo_t geo = kHoles;
9
10 void Config()
11 {
12
13     // 7-DEC-2000 09:00
14     // Switch on Transition Radiation simulation. 6/12/00 18:00
15     // iZDC=1  7/12/00 09:00
16     // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
17     // Theta range given through pseudorapidity limits 22/6/2001
18
19     // Set Random Number seed
20     // AliLoader::SetDebug(5) ; 
21     gRandom->SetSeed(12345);
22
23
24    // libraries required by geant321
25     gSystem->Load("libgeant321");
26
27     new     TGeant3("C++ Interface to Geant3");
28
29     if (!gSystem->Getenv("CONFIG_FILE"))
30     {
31         cout<<"Config.C: Creating Run Loader ..."<<endl;
32         AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::fgkDefaultEventFolderName,
33                                               "recreate");
34         if (rl == 0x0)
35          {
36            gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
37            return;
38          }
39         rl->SetCompressionLevel(2);
40         rl->SetNumberOfEventsPerFile(1000);
41         gAlice->SetRunLoader(rl);
42     }
43
44     TGeant3 *geant3 = (TGeant3 *) gMC;
45
46     //
47     // Set External decayer
48     TVirtualMCDecayer *decayer = new AliDecayerPythia();
49
50     decayer->SetForceDecay(kAll);
51     decayer->Init();
52     gMC->SetExternalDecayer(decayer);
53     //
54     //
55     //=======================================================================
56     // ******* GEANT STEERING parameters FOR ALICE SIMULATION *******
57     geant3->SetTRIG(1);         //Number of events to be processed 
58     geant3->SetSWIT(4, 10);
59     geant3->SetDEBU(0, 0, 1);
60     //geant3->SetSWIT(2,2);
61     geant3->SetDCAY(1);
62     geant3->SetPAIR(1);
63     geant3->SetCOMP(1);
64     geant3->SetPHOT(1);
65     geant3->SetPFIS(0);
66     geant3->SetDRAY(0);
67     geant3->SetANNI(1);
68     geant3->SetBREM(1);
69     geant3->SetMUNU(1);
70     geant3->SetCKOV(1);
71     geant3->SetHADR(1);         //Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3)
72     geant3->SetLOSS(2);
73     geant3->SetMULS(1);
74     geant3->SetRAYL(1);
75     geant3->SetAUTO(1);         //Select automatic STMIN etc... calc. (AUTO 1) or manual (AUTO 0)
76     geant3->SetABAN(0);         //Restore 3.16 behaviour for abandoned tracks
77     geant3->SetOPTI(2);         //Select optimisation level for GEANT geometry searches (0,1,2)
78     geant3->SetERAN(5.e-7);
79
80     Float_t cut = 1.e-3;        // 1MeV cut by default
81     Float_t tofmax = 1.e10;
82
83     //             GAM ELEC NHAD CHAD MUON EBREM MUHAB EDEL MUDEL MUPA TOFMAX
84     geant3->SetCUTS(cut, cut, cut, cut, cut, cut, cut, cut, cut, cut,
85                     tofmax);
86     //
87     //=======================================================================
88     // ************* STEERING parameters FOR ALICE SIMULATION **************
89     // --- Specify event type to be tracked through the ALICE setup
90     // --- All positions are in cm, angles in degrees, and P and E in GeV
91     if (gSystem->Getenv("CONFIG_NPARTICLES"))
92     {
93         int     nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
94     } else
95     {
96         int     nParticles = 10;
97     }
98  //    AliGenCocktail *gener = new AliGenCocktail();
99 //     gener->SetPhiRange(220, 320);
100 //     // Set pseudorapidity range from -8 to 8.
101 //     Float_t thmin = EtaToTheta(0.12);   // theta min. <---> eta max
102 //     Float_t thmax = EtaToTheta(-0.12);  // theta max. <---> eta min 
103 //     gener->SetThetaRange(thmin,thmax);
104 //     gener->SetOrigin(0, 0, 0);  //vertex position
105 //     gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
106
107 //     AliGenHIJINGpara *hijingparam = new AliGenHIJINGpara(nParticles);
108 //     hijingparam->SetMomentumRange(0.2, 999);
109 //     gener->AddGenerator(hijingparam,"HIJING PARAM",1);
110
111 //     AliGenBox *genbox = new AliGenBox(nParticles);
112 //     genbox->SetPart(kGamma);
113 //     genbox->SetPtRange(0.3, 10.00);
114 //     gener->AddGenerator(genbox,"GENBOX GAMMA for PHOS",1);
115 //     gener->Init();
116
117     AliGenBox *gener = new AliGenBox(1);
118     gener->SetMomentumRange(10,11.);
119     gener->SetPhiRange(270.5,270.7);
120     gener->SetThetaRange(90.5,90.7);
121
122     gener->SetOrigin(0,0,0);        //vertex position
123     gener->SetSigma(0,0,0);         //Sigma in (X,Y,Z) (cm) on IP position
124     gener->SetPart(kGamma);
125     gener->Init();
126  
127     // 
128     // Activate this line if you want the vertex smearing to happen
129     // track by track
130     //
131     //gener->SetVertexSmear(perTrack); 
132     // Field (L3 0.4 T)
133     TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG));
134
135     Int_t   iABSO  =  0;
136     Int_t   iDIPO  =  0;
137     Int_t   iFMD   =  0;
138     Int_t   iFRAME =  0;
139     Int_t   iHALL  =  0;
140     Int_t   iITS   =  0;
141     Int_t   iMAG   =  0;
142     Int_t   iMUON  =  0;
143     Int_t   iPHOS  =  1;
144     Int_t   iPIPE  =  0;
145     Int_t   iPMD   =  0;
146     Int_t   iHMPID  =  0;
147     Int_t   iSHIL  =  0;
148     Int_t   iT0 =  0;
149     Int_t   iTOF   =  0;
150     Int_t   iTPC   =  0;
151     Int_t   iTRD   =  0;
152     Int_t   iZDC   =  0;
153     Int_t   iEMCAL =  0;
154     Int_t   iACORDE   =  0;
155     Int_t   iVZERO =  0;
156     rl->CdGAFile();
157     //=================== Alice BODY parameters =============================
158     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
159
160     if (iMAG)
161     {
162         //=================== MAG parameters ============================
163         // --- Start with Magnet since detector layouts may be depending ---
164         // --- on the selected Magnet dimensions ---
165         AliMAG *MAG = new AliMAG("MAG", "Magnet");
166     }
167
168
169     if (iABSO)
170     {
171         //=================== ABSO parameters ============================
172         AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
173     }
174
175     if (iDIPO)
176     {
177         //=================== DIPO parameters ============================
178
179         AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
180     }
181
182     if (iHALL)
183     {
184         //=================== HALL parameters ============================
185
186         AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
187     }
188
189
190     if (iFRAME)
191     {
192         //=================== FRAME parameters ============================
193
194         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
195         if (geo == kHoles) {
196             FRAME->SetHoles(1);
197         } else {
198             FRAME->SetHoles(0);
199         }
200     }
201
202     if (iSHIL)
203     {
204         //=================== SHIL parameters ============================
205
206         AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
207     }
208
209
210     if (iPIPE)
211     {
212         //=================== PIPE parameters ============================
213
214         AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
215     }
216  
217     if(iITS) {
218
219     //=================== ITS parameters ============================
220     //
221     // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
222     // almost all other detectors. This involves the fact that the ITS geometry
223     // still has several options to be followed in parallel in order to determine
224     // the best set-up which minimizes the induced background. All the geometries
225     // available to date are described in the following. Read carefully the comments
226     // and use the default version (the only one uncommented) unless you are making
227     // comparisons and you know what you are doing. In this case just uncomment the
228     // ITS geometry you want to use and run Aliroot.
229     //
230     // Detailed geometries:         
231     //
232     //
233     //AliITS *ITS  = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
234     //
235     //AliITS *ITS  = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
236     //
237         AliITSvPPRasymm *ITS  = new AliITSvPPRasymm("ITS","New ITS PPR detailed version with asymmetric services");
238         ITS->SetMinorVersion(2);                                         // don't touch this parameter if you're not an ITS developer
239         ITS->SetReadDet(kFALSE);                                         // don't touch this parameter if you're not an ITS developer
240     //    ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det");  // don't touch this parameter if you're not an ITS developer
241         ITS->SetThicknessDet1(200.);   // detector thickness on layer 1 must be in the range [100,300]
242         ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [100,300]
243         ITS->SetThicknessChip1(200.);  // chip thickness on layer 1 must be in the range [150,300]
244         ITS->SetThicknessChip2(200.);  // chip thickness on layer 2 must be in the range [150,300]
245         ITS->SetRails(0);            // 1 --> rails in ; 0 --> rails out
246         ITS->SetCoolingFluid(1);   // 1 --> water ; 0 --> freon
247         //
248     //AliITSvPPRsymm *ITS  = new AliITSvPPRsymm("ITS","New ITS PPR detailed version with symmetric services");
249     //ITS->SetMinorVersion(2);                                       // don't touch this parameter if you're not an ITS developer
250     //ITS->SetReadDet(kFALSE);                                       // don't touch this parameter if you're not an ITS developer
251     //ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRsymm2.det"); // don't touch this parameter if you're not an ITS developer
252     //ITS->SetThicknessDet1(200.);   // detector thickness on layer 1 must be in the range [100,300]
253     //ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [100,300]
254     //ITS->SetThicknessChip1(200.);  // chip thickness on layer 1 must be in the range [150,300]
255     //ITS->SetThicknessChip2(200.);  // chip thickness on layer 2 must be in the range [150,300]
256     //ITS->SetRails(0);              // 1 --> rails in ; 0 --> rails out
257     //ITS->SetCoolingFluid(1);       // 1 --> water ; 0 --> freon
258     //
259     //
260     // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful 
261     // for reconstruction !):
262     //                                                     
263     //
264     //AliITSvPPRcoarseasymm *ITS  = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
265     //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
266     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
267     //
268     //AliITS *ITS  = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
269     //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
270     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
271     //                      
272     //
273     //
274     // Geant3 <-> EUCLID conversion
275     // ============================
276     //
277     // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
278     // media to two ASCII files (called by default ITSgeometry.euc and
279     // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
280     // The default (=0) means that you dont want to use this facility.
281     //
282      ITS->SetEUCLID(0);  
283     }
284
285     if (iTPC)
286     {
287         //============================ TPC parameters ================================
288         // --- This allows the user to specify sectors for the SLOW (TPC geometry 2)
289         // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
290         // --- sectors are specified, any value other than that requires at least one 
291         // --- sector (lower or upper)to be specified!
292         // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
293         // ---           sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
294         // --- SecLows - number of lower sectors specified (up to 6)
295         // --- SecUps - number of upper sectors specified (up to 12)
296         // --- Sens - sensitive strips for the Slow Simulator !!!
297         // --- This does NOT work if all S or L-sectors are specified, i.e.
298         // --- if SecAL or SecAU < 0
299         //
300         //
301         //-----------------------------------------------------------------------------
302
303         //  gROOT->LoadMacro("SetTPCParam.C");
304         //  AliTPCParam *param = SetTPCParam();
305         AliTPC *TPC = new AliTPCv2("TPC", "Default");
306
307         // All sectors included 
308         TPC->SetSecAU(-1);
309         TPC->SetSecAL(-1);
310     }
311
312
313     if (iTOF) {
314         if (geo == kHoles) {
315         //=================== TOF parameters ============================
316             AliTOF *TOF = new AliTOFv2FHoles("TOF", "TOF with Holes");
317         } else {
318             AliTOF *TOF = new AliTOFv4T0("TOF", "normal TOF");
319         }
320     }
321
322
323     if (iHMPID)
324     {
325         //=================== HMPID parameters ===========================
326         AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
327
328     }
329
330
331     if (iZDC)
332     {
333         //=================== ZDC parameters ============================
334
335         AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
336     }
337
338     if (iTRD)
339     {
340         //=================== TRD parameters ============================
341
342         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
343
344         // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
345         TRD->SetGasMix(1);
346         if (geo == kHoles) {
347             // With hole in front of PHOS
348             TRD->SetPHOShole();
349             // With hole in front of HMPID
350             TRD->SetHMPIDhole();
351         }
352             // Switch on TR
353             AliTRDsim *TRDsim = TRD->CreateTR();
354     }
355
356     if (iFMD)
357     {
358         //=================== FMD parameters ============================
359         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
360         FMD->SetRingsSi1(256);
361         FMD->SetRingsSi2(128);
362         FMD->SetSectorsSi1(20);
363         FMD->SetSectorsSi2(40);      
364    }
365
366     if (iMUON)
367     {
368         //=================== MUON parameters ===========================
369
370         AliMUON *MUON = new AliMUONv1("MUON", "default");
371     }
372     //=================== PHOS parameters ===========================
373
374     if (iPHOS)
375     {
376         AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
377     }
378
379
380     if (iPMD)
381     {
382         //=================== PMD parameters ============================
383         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
384     }
385
386     if (iT0)
387     {
388         //=================== T0 parameters ============================
389         AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
390     }
391
392     if (iEMCAL)
393     {
394         //=================== EMCAL parameters ============================
395         AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
396     }
397
398      if (iACORDE)
399     {
400         //=================== ACORDE parameters ============================
401         AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
402     }
403
404      if (iVZERO)
405     {
406         //=================== ACORDE parameters ============================
407         AliVZERO *VZERO = new AliVZEROv2("VZERO", "normal VZERO");
408     }
409
410 }
411
412 Float_t EtaToTheta(Float_t arg){
413   return (180./TMath::Pi())*2.*atan(exp(-arg));
414 }