]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/g4ConfigCommon.C
update from salvatore
[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 // By I. Hrivnacova, IPN Orsay
7
8 enum PprGeo_t
9   {
10     kHoles, kNoHoles
11   };
12 static PprGeo_t geo = kHoles;
13
14 Float_t EtaToTheta(Float_t arg);
15 void    LoadPythia();
16 static Int_t    eventsPerRun = 50;
17
18 void ConfigCommon(Bool_t setRootGeometry = kTRUE)
19 {
20   cout << "Running ConfigCommon.C ... " << endl;
21
22   // Load Pythia libraries
23   LoadPythia();
24
25   // Create the output file
26   AliRunLoader* rl = 0;
27   rl = AliRunLoader::Open("galice.root",
28                            AliConfig::GetDefaultEventFolderName(),
29                            "recreate");
30   if (!rl) {
31     gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
32     return;
33   }
34   rl->SetCompressionLevel(2);
35   rl->SetNumberOfEventsPerFile(3);
36   gAlice->SetRunLoader(rl);
37   
38   // Set Root geometry file
39   //
40   if ( setRootGeometry ) {
41     gAlice->SetRootGeometry();
42     gAlice->SetGeometryFromFile("geometry.root");
43   }
44
45   // Set the trigger configuration
46   AliSimulation::Instance()->SetTriggerConfig("Pb-Pb");
47   cout<<"Trigger configuration is set to  Pb-Pb"<<endl;
48
49     // Set Random Number seed
50     gRandom->SetSeed(123456); // Set 0 to use the currecnt time
51     AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
52     int     nParticles = 100;
53     if (gSystem->Getenv("CONFIG_NPARTICLES"))
54     {
55         nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
56     }
57
58     AliGenCocktail *gener = new AliGenCocktail();
59     gener->SetPhiRange(0, 360);
60     // Set pseudorapidity range from -8 to 8.
61     Float_t thmin = EtaToTheta(8);   // theta min. <---> eta max
62     Float_t thmax = EtaToTheta(-8);  // theta max. <---> eta min 
63     gener->SetThetaRange(thmin,thmax);
64     gener->SetOrigin(0, 0, 0);  //vertex position
65     gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
66
67     AliGenHIJINGpara *hijingparam = new AliGenHIJINGpara(nParticles);
68     hijingparam->SetMomentumRange(0.2, 999);
69     gener->AddGenerator(hijingparam,"HIJING PARAM",1);
70     gener->Init();
71
72     // 
73     // Activate this line if you want the vertex smearing to happen
74     // track by track
75     //
76     //gener->SetVertexSmear(perTrack); 
77
78   // ============================= 
79   // Magnetic field
80   // ============================= 
81
82     // Field (L3 0.4 T)
83     TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG));
84
85     Int_t   iABSO  =  1;
86     Int_t   iDIPO  =  1;
87     Int_t   iFMD   =  1;
88     Int_t   iFRAME =  1;
89     Int_t   iHALL  =  1;
90     Int_t   iITS   =  1;
91     Int_t   iMAG   =  1;
92     Int_t   iMUON  =  1;
93     Int_t   iPHOS  =  1;
94     Int_t   iPIPE  =  1;
95     Int_t   iPMD   =  1;
96     Int_t   iHMPID =  1;
97     Int_t   iSHIL  =  1;
98     Int_t   iT0    =  1;
99     Int_t   iTOF   =  1;
100     Int_t   iTPC   =  1;
101     Int_t   iTRD   =  1;
102     Int_t   iZDC   =  1;
103     Int_t   iEMCAL =  1;
104     Int_t   iACORDE = 0;
105     Int_t   iVZERO =  1;
106 /*
107     Int_t   iABSO  =  0;
108     Int_t   iDIPO  =  0;
109     Int_t   iFMD   =  0;
110     Int_t   iFRAME =  0;
111     Int_t   iHALL  =  0;
112     Int_t   iITS   =  0;
113     Int_t   iMAG   =  0;
114     Int_t   iMUON  =  0;
115     Int_t   iPHOS  =  0;
116     Int_t   iPIPE  =  0;
117     Int_t   iPMD   =  0;
118     Int_t   iHMPID =  0;
119     Int_t   iSHIL  =  0;
120     Int_t   iT0    =  0;
121     Int_t   iTOF   =  0;
122     Int_t   iTPC   =  1;
123     Int_t   iTRD   =  0;
124     Int_t   iZDC   =  0;
125     Int_t   iEMCAL =  0;
126     Int_t   iACORDE = 0;
127     Int_t   iVZERO =  0;
128 */   
129 // Exluded for problems
130
131     rl->CdGAFile();
132     //=================== Alice BODY parameters =============================
133     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
134
135     if (iMAG)
136     {
137         //=================== MAG parameters ============================
138         // --- Start with Magnet since detector layouts may be depending ---
139         // --- on the selected Magnet dimensions ---
140         AliMAG *MAG = new AliMAG("MAG", "Magnet");
141     }
142
143
144     if (iABSO)
145     {
146         //=================== ABSO parameters ============================
147         AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
148     }
149
150     if (iDIPO)
151     {
152         //=================== DIPO parameters ============================
153
154         AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
155     }
156
157     if (iHALL)
158     {
159         //=================== HALL parameters ============================
160
161         AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
162     }
163
164
165     if (iFRAME)
166     {
167         //=================== FRAME parameters ============================
168
169         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
170         if (geo == kHoles) {
171           FRAME->SetHoles(1);
172         } else {
173           FRAME->SetHoles(0);
174         }
175     }
176
177     if (iSHIL)
178     {
179         //=================== SHIL parameters ============================
180
181         AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
182     }
183
184
185     if (iPIPE)
186     {
187         //=================== PIPE parameters ============================
188
189         AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
190     }
191  
192     if (iITS)
193     {
194         //=================== ITS parameters ============================
195
196         AliITS *ITS  = new AliITSv11("ITS","ITS v11");
197     }
198
199     if (iTPC)
200     {
201         //============================ TPC parameters ===================
202         AliTPC *TPC = new AliTPCv2("TPC", "Default");
203     }
204
205
206     if (iTOF) {
207         //=================== TOF parameters ============================
208         AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
209     }
210
211
212     if (iHMPID)
213     {
214         //=================== HMPID parameters ===========================
215         AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
216
217     }
218
219
220     if (iZDC)
221     {
222         //=================== ZDC parameters ============================
223
224         AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
225     }
226
227     if (iTRD)
228     {
229         //=================== TRD parameters ============================
230
231         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
232     }
233
234     if (iFMD)
235     {
236         //=================== FMD parameters ============================
237         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
238    }
239
240     if (iMUON)
241     {
242         //=================== MUON parameters ===========================
243         // New MUONv1 version (geometry defined via builders)
244         AliMUON *MUON = new AliMUONv1("MUON", "default");
245     }
246     //=================== PHOS parameters ===========================
247
248     if (iPHOS)
249     {
250         AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
251     }
252
253
254     if (iPMD)
255     {
256         //=================== PMD parameters ============================
257         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
258     }
259
260     if (iT0)
261     {
262         //=================== T0 parameters ============================
263         AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
264     }
265
266     if (iEMCAL)
267     {
268         //=================== EMCAL parameters ============================
269         AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
270     }
271
272      if (iACORDE)
273     {
274         //=================== ACORDE parameters ============================
275         AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
276     }
277
278      if (iVZERO)
279     {
280         //=================== ACORDE parameters ============================
281         AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
282     }
283
284      AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
285
286      cout << "Running ConfigCommon.C finished ... " << endl;
287
288 }
289
290 Float_t EtaToTheta(Float_t arg){
291   return (180./TMath::Pi())*2.*atan(exp(-arg));
292 }
293
294 void LoadPythia()
295 {
296     // Load Pythia related libraries
297     gSystem->Load("liblhapdf.so");      // Parton density functions
298     gSystem->Load("libEGPythia6.so");   // TGenerator interface
299     gSystem->Load("libpythia6.so");     // Pythia
300     gSystem->Load("libAliPythia6.so");  // ALICE specific implementations
301 }