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