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