]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/g4ConfigCommon.C
filter out additional compile defines to fit into rootcints 1024 char limit
[u/mrichter/AliRoot.git] / macros / g4ConfigCommon.C
1 // $Id$
2 //
3 // AliRoot Configuration for running aliroot with Monte Carlo.
4 // Called from g4Config.C
5
6 Float_t EtaToTheta(Float_t arg);
7 static Int_t    eventsPerRun = 50;
8
9 void ConfigCommon()
10 {
11   // ============================= 
12   // Root file
13   // ============================= 
14
15   // Create the output file
16   AliRunLoader* rl = 0;
17   rl = AliRunLoader::Open("galice.root",
18                            AliConfig::GetDefaultEventFolderName(),
19                            "recreate");
20   if (!rl) {
21     gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
22     return;
23   }
24   rl->SetCompressionLevel(2);
25   rl->SetNumberOfEventsPerFile(3);
26   gAlice->SetRunLoader(rl);
27 //  gAlice->SetRootGeometry();
28 //  gAlice->SetGeometryFileName("geometry.root");
29
30   // Set the trigger configuration
31   gAlice->SetTriggerDescriptor("Pb-Pb");
32   cout<<"Trigger configuration is set to  Pb-Pb"<<endl;
33
34     // Set Random Number seed
35     gRandom->SetSeed(123456); // Set 0 to use the currecnt time
36     AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
37     int     nParticles = 500;
38     if (gSystem->Getenv("CONFIG_NPARTICLES"))
39     {
40         nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
41     }
42
43 ///*
44     AliGenCocktail *gener = new AliGenCocktail();
45     gener->SetPhiRange(0, 360);
46     // Set pseudorapidity range from -8 to 8.
47     Float_t thmin = EtaToTheta(8);   // theta min. <---> eta max
48     Float_t thmax = EtaToTheta(-8);  // theta max. <---> eta min 
49     gener->SetThetaRange(thmin,thmax);
50     gener->SetOrigin(0, 0, 0);  //vertex position
51     gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
52
53     AliGenHIJINGpara *hijingparam = new AliGenHIJINGpara(nParticles);
54     hijingparam->SetMomentumRange(0.2, 999);
55     gener->AddGenerator(hijingparam,"HIJING PARAM",1);
56     gener->Init();
57
58     // 
59     // Activate this line if you want the vertex smearing to happen
60     // track by track
61     //
62     //gener->SetVertexSmear(perTrack); 
63
64   // ============================= 
65   // Magnetic field
66   // ============================= 
67
68     // Field (L3 0.4 T)
69     AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 1);
70     gAlice->SetField(field);    
71
72     Int_t   iABSO  =  1;
73     Int_t   iDIPO  =  1;
74     Int_t   iFMD   =  1;
75     Int_t   iFRAME =  1;
76     Int_t   iHALL  =  1;
77     Int_t   iITS   =  1;
78     Int_t   iMAG   =  1;
79     Int_t   iMUON  =  1;
80     Int_t   iPHOS  =  1;
81     Int_t   iPIPE  =  1;
82     Int_t   iPMD   =  1;
83     Int_t   iHMPID =  1;
84     Int_t   iSHIL  =  1;
85     Int_t   iT0    =  1;
86     Int_t   iTOF   =  1;
87     Int_t   iTPC   =  1;
88     Int_t   iTRD   =  1;
89     Int_t   iZDC   =  1;
90     Int_t   iEMCAL =  1;
91     Int_t   iACORDE = 0;
92     Int_t   iVZERO =  1;
93
94     rl->CdGAFile();
95     //=================== Alice BODY parameters =============================
96     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
97
98     if (iMAG)
99     {
100         //=================== MAG parameters ============================
101         // --- Start with Magnet since detector layouts may be depending ---
102         // --- on the selected Magnet dimensions ---
103         AliMAG *MAG = new AliMAG("MAG", "Magnet");
104     }
105
106
107     if (iABSO)
108     {
109         //=================== ABSO parameters ============================
110         AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
111     }
112
113     if (iDIPO)
114     {
115         //=================== DIPO parameters ============================
116
117         AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
118     }
119
120     if (iHALL)
121     {
122         //=================== HALL parameters ============================
123
124         AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
125     }
126
127
128     if (iFRAME)
129     {
130         //=================== FRAME parameters ============================
131
132         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
133     }
134
135     if (iSHIL)
136     {
137         //=================== SHIL parameters ============================
138
139         AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
140     }
141
142
143     if (iPIPE)
144     {
145         //=================== PIPE parameters ============================
146
147         AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
148     }
149  
150     if(iITS) {
151
152     //=================== ITS parameters ============================
153     //
154     // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
155     // almost all other detectors. This involves the fact that the ITS geometry
156     // still has several options to be followed in parallel in order to determine
157     // the best set-up which minimizes the induced background. All the geometries
158     // available to date are described in the following. Read carefully the comments
159     // and use the default version (the only one uncommented) unless you are making
160     // comparisons and you know what you are doing. In this case just uncomment the
161     // ITS geometry you want to use and run Aliroot.
162     //
163     // Detailed geometries:         
164     //
165     //
166     //AliITS *ITS  = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
167     //
168     //AliITS *ITS  = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
169     //
170         AliITSvPPRasymmFMD *ITS  = new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version with asymmetric services");
171         ITS->SetMinorVersion(2);  // don't touch this parameter if you're not an ITS developer
172         ITS->SetReadDet(kFALSE);          // don't touch this parameter if you're not an ITS developer
173     //    ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det");  // don't touch this parameter if you're not an ITS developer
174         ITS->SetThicknessDet1(200.);   // detector thickness on layer 1 must be in the range [100,300]
175         ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [100,300]
176         ITS->SetThicknessChip1(150.);  // chip thickness on layer 1 must be in the range [150,300]
177         ITS->SetThicknessChip2(150.);  // chip thickness on layer 2 must be in the range [150,300]
178         ITS->SetRails(0);            // 1 --> rails in ; 0 --> rails out
179         ITS->SetCoolingFluid(1);   // 1 --> water ; 0 --> freon
180
181     // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful 
182     // for reconstruction !):
183     //                                                     
184     //
185     //AliITSvPPRcoarseasymm *ITS  = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
186     //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
187     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
188     //
189     //AliITS *ITS  = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
190     //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
191     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
192     //                      
193     //
194     //
195     // Geant3 <-> EUCLID conversion
196     // ============================
197     //
198     // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
199     // media to two ASCII files (called by default ITSgeometry.euc and
200     // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
201     // The default (=0) means that you dont want to use this facility.
202     //
203         ITS->SetEUCLID(0);  
204     }
205
206     if (iTPC)
207     {
208         //============================ TPC parameters ===================
209         AliTPC *TPC = new AliTPCv2("TPC", "Default");
210     }
211
212
213     if (iTOF) {
214         //=================== TOF parameters ============================
215         AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
216         // Partial geometry: modules at 2,3,4,6,7,11,12,14,15,16
217         // starting at 6h in positive direction
218         //      Int_t TOFSectors[18]={-1,-1,0,0,0,-1,0,0,-1,-1,-1,0,0,-1,0,0,0,0};
219         // Partial geometry: modules at 1,2,6,7,9,10,11,12,15,16,17
220         // (ALICE numbering convention)
221         Int_t TOFSectors[18]={-1,0,0,-1,-1,-1,0,0,-1,0,0,0,0,-1,-1,0,0,0};
222         TOF->SetTOFSectors(TOFSectors);
223     }
224
225
226     if (iHMPID)
227     {
228         //=================== HMPID parameters ===========================
229         AliHMPID *HMPID = new AliHMPIDv2("HMPID", "normal HMPID");
230
231     }
232
233
234     if (iZDC)
235     {
236         //=================== ZDC parameters ============================
237
238         AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
239     }
240
241     if (iTRD)
242     {
243         //=================== TRD parameters ============================
244
245         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
246     }
247
248     if (iFMD)
249     {
250         //=================== FMD parameters ============================
251         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
252    }
253
254     if (iMUON)
255     {
256         //=================== MUON parameters ===========================
257         // New MUONv1 version (geometry defined via builders)
258         AliMUON *MUON = new AliMUONv1("MUON", "default");
259     }
260     //=================== PHOS parameters ===========================
261
262     if (iPHOS)
263     {
264         AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
265     }
266
267
268     if (iPMD)
269     {
270         //=================== PMD parameters ============================
271         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
272     }
273
274     if (iT0)
275     {
276         //=================== T0 parameters ============================
277         AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
278     }
279
280     if (iEMCAL)
281     {
282         //=================== EMCAL parameters ============================
283         AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
284     }
285
286      if (iACORDE)
287     {
288         //=================== ACORDE parameters ============================
289         AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
290     }
291
292      if (iVZERO)
293     {
294         //=================== ACORDE parameters ============================
295         AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
296     }
297
298      AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
299
300 }
301
302 Float_t EtaToTheta(Float_t arg){
303   return (180./TMath::Pi())*2.*atan(exp(-arg));
304 }