]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/Config_AliGenCosmicsParam.C
converted multiplicity selector into task
[u/mrichter/AliRoot.git] / macros / Config_AliGenCosmicsParam.C
1 // One can use the configuration macro in compiled mode by
2 // root [0] gSystem->Load("libgeant321");
3 // root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
4 //                   -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
5 // root [0] .x grun.C(1,"Config.C++")
6
7 #if !defined(__CINT__) || defined(__MAKECINT__)
8 #include <Riostream.h>
9 #include <TRandom.h>
10 #include <TSystem.h>
11 #include <TVirtualMC.h>
12 #include <TGeant3TGeo.h>
13 #include "STEER/AliRunLoader.h"
14 #include "STEER/AliRun.h"
15 #include "STEER/AliConfig.h"
16 #include "PYTHIA6/AliDecayerPythia.h"
17 #include "EVGEN/AliGenCocktail.h"
18 #include "EVGEN/AliGenCosmicsParam.h"
19 #include "EVGEN/AliGenHIJINGpara.h"
20 #include "STEER/AliMagFMaps.h"
21 #include "STRUCT/AliBODY.h"
22 #include "STRUCT/AliMAG.h"
23 #include "STRUCT/AliABSOv0.h"
24 #include "STRUCT/AliDIPOv2.h"
25 #include "STRUCT/AliHALL.h"
26 #include "STRUCT/AliFRAMEv2.h"
27 #include "STRUCT/AliSHILv2.h"
28 #include "STRUCT/AliPIPEv0.h"
29 #include "ITS/AliITSvPPRasymmFMD.h"
30 #include "TPC/AliTPCv2.h"
31 #include "TOF/AliTOFv5T0.h"
32 #include "HMPID/AliHMPIDv1.h"
33 #include "ZDC/AliZDCv2.h"
34 #include "TRD/AliTRDv1.h"
35 #include "FMD/AliFMDv1.h"
36 #include "MUON/AliMUONv1.h"
37 #include "PHOS/AliPHOSv1.h"
38 #include "PMD/AliPMDv1.h"
39 #include "START/AliSTARTv1.h"
40 #include "EMCAL/AliEMCALv2.h"
41 #include "ACORDE/AliACORDEv0.h"
42 #include "VZERO/AliVZEROv7.h"
43 #endif
44
45 //--- Magnetic Field ---
46 enum Mag_t
47 {
48     k2kG, k4kG, k5kG
49 };
50
51 enum PprGeo_t
52   {
53     kHoles, kNoHoles
54   };
55
56 Float_t EtaToTheta(Float_t arg);
57
58 static Mag_t         mag      = k5kG; 
59 static PprGeo_t      geo      = kHoles;
60
61 void Config()
62 {
63     // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
64     // Theta range given through pseudorapidity limits 22/6/2001
65
66     // Set Random Number seed
67   TDatime dt;
68   UInt_t curtime=dt.Get();
69   UInt_t procid=gSystem->GetPid();
70   UInt_t seed=curtime-procid;
71   if (gSystem->Getenv("envevno")) {
72     seed=atoi(gSystem->Getenv("envevno"));
73     seed += 1000; // 0 e' il seed dall'orologio....
74     printf("...taking seed as event number + 1000...\n");
75   }
76   printf("...setting seed as %d...\n",seed);
77   gRandom->SetSeed(seed);
78   printf("Seed for random number generation = %d \n",gRandom->GetSeed());
79
80
81   //  AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
82
83
84    // libraries required by geant321
85 #if defined(__CINT__)
86     gSystem->Load("libgeant321");
87 #endif
88
89     new     TGeant3TGeo("C++ Interface to Geant3");
90
91     if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
92       AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
93       AliCDBManager::Instance()->SetRun(0);
94     }
95
96     AliRunLoader* rl=0x0;
97
98     AliLog::Message(AliLog::kInfo, "Creating Run Loader", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
99
100     rl = AliRunLoader::Open("galice.root",
101                             AliConfig::GetDefaultEventFolderName(),
102                             "recreate");
103     if (rl == 0x0)
104       {
105         gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
106         return;
107       }
108     rl->SetCompressionLevel(2);
109     rl->SetNumberOfEventsPerFile(1000);
110     gAlice->SetRunLoader(rl);
111     // gAlice->SetGeometryFromFile("geometry.root");
112     // gAlice->SetGeometryFromCDB();
113
114     // Set the trigger configuration
115     //    gAlice->SetTriggerDescriptor("Pb-Pb");
116     gAlice->SetTriggerDescriptor("ACORDE");
117     cout<<"Trigger configuration is set to  ACORDE"<<endl;
118
119     //
120     // Set External decayer
121     TVirtualMCDecayer *decayer = new AliDecayerPythia();
122
123     decayer->SetForceDecay(kAll);
124     decayer->Init();
125     gMC->SetExternalDecayer(decayer);
126     //=======================================================================
127     // ************* STEERING parameters FOR ALICE SIMULATION **************
128     // --- Specify event type to be tracked through the ALICE setup
129     // --- All positions are in cm, angles in degrees, and P and E in GeV
130
131
132     gMC->SetProcess("DCAY",1);
133     gMC->SetProcess("PAIR",1);
134     gMC->SetProcess("COMP",1);
135     gMC->SetProcess("PHOT",1);
136     gMC->SetProcess("PFIS",0);
137     gMC->SetProcess("DRAY",0);
138     gMC->SetProcess("ANNI",1);
139     gMC->SetProcess("BREM",1);
140     gMC->SetProcess("MUNU",1);
141     gMC->SetProcess("CKOV",1);
142     gMC->SetProcess("HADR",1);
143     gMC->SetProcess("LOSS",2);
144     gMC->SetProcess("MULS",1);
145     gMC->SetProcess("RAYL",1);
146
147     Float_t cut = 1.e-3;        // 1MeV cut by default
148     Float_t tofmax = 1.e10;
149
150     gMC->SetCut("CUTGAM", cut);
151     gMC->SetCut("CUTELE", cut);
152     gMC->SetCut("CUTNEU", cut);
153     gMC->SetCut("CUTHAD", cut);
154     gMC->SetCut("CUTMUO", cut);
155     gMC->SetCut("BCUTE",  cut); 
156     gMC->SetCut("BCUTM",  cut); 
157     gMC->SetCut("DCUTE",  cut); 
158     gMC->SetCut("DCUTM",  cut); 
159     gMC->SetCut("PPCUTM", cut);
160     gMC->SetCut("TOFMAX", tofmax); 
161
162
163     //  AliGenCosmicsParam
164     AliGenCosmicsParam *gener = new AliGenCosmicsParam();
165     gener->SetParamACORDE();
166     gener->SetYOrigin(260.); // warning: just above TPC, no TOF, no ACORDE
167     gener->SetMomentumRange(8.,1000.);
168     gener->SetMaxAngleWRTVertical(3.1415/4.);
169     gener->SetInSPDinner(); // "acceptance trigger"
170     gener->SetBkG(0.); // needed for "acceptance trigger"
171     gener->Init();
172     gGener = gener;
173
174     // MAGNETIC FIELD IN THE BARREL
175     // AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., mag); // FIELD
176         AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 0., 10., mag); // NO FIELD
177     field->SetL3ConstField(0); //Using const. field in the barrel
178     rl->CdGAFile();
179     gAlice->SetField(field);    
180
181
182     Int_t   iABSO  =  1;
183     Int_t   iDIPO  =  0;
184     Int_t   iFMD   =  0;
185     Int_t   iFRAME =  1;
186     Int_t   iHALL  =  1;
187     Int_t   iITS   =  1;
188     Int_t   iMAG   =  1;
189     Int_t   iMUON  =  0;
190     Int_t   iPHOS  =  0;
191     Int_t   iPIPE  =  1;
192     Int_t   iPMD   =  0;
193     Int_t   iHMPID =  0;
194     Int_t   iSHIL  =  1;
195     Int_t   iSTART =  0;
196     Int_t   iTOF   =  0;
197     Int_t   iTPC   =  1;
198     Int_t   iTRD   =  0;
199     Int_t   iZDC   =  0;
200     Int_t   iEMCAL =  0;
201     Int_t   iACORDE   =  1;
202     Int_t   iVZERO =  0;
203     rl->CdGAFile();
204     //=================== Alice BODY parameters =============================
205     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
206
207     if (iMAG)
208     {
209         //=================== MAG parameters ============================
210         // --- Start with Magnet since detector layouts may be depending ---
211         // --- on the selected Magnet dimensions ---
212         AliMAG *MAG = new AliMAG("MAG", "Magnet");
213     }
214
215
216     if (iABSO)
217     {
218         //=================== ABSO parameters ============================
219         AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
220     }
221
222     if (iDIPO)
223     {
224         //=================== DIPO parameters ============================
225
226         AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
227     }
228
229     if (iHALL)
230     {
231         //=================== HALL parameters ============================
232
233         AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
234     }
235
236
237     if (iFRAME)
238     {
239         //=================== FRAME parameters ============================
240
241         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
242         if (geo == kHoles) {
243           FRAME->SetHoles(1);
244         } else {
245           FRAME->SetHoles(0);
246         }
247
248     }
249
250     if (iSHIL)
251     {
252         //=================== SHIL parameters ============================
253
254         AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
255     }
256
257
258     if (iPIPE)
259     {
260         //=================== PIPE parameters ============================
261
262         AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
263     }
264  
265     if (iITS)
266     {
267         //=================== ITS parameters ============================
268
269         AliITSvPPRasymmFMD *ITS  = new AliITSvPPRasymmFMD("ITS","ITS PPR detailed version with asymmetric services");
270     }
271
272     if (iTPC)
273     {
274         //============================ TPC parameters ===================
275         AliTPC *TPC = new AliTPCv2("TPC", "Default");
276     }
277
278
279     if (iTOF) {
280         //=================== TOF parameters ============================
281         AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
282     }
283
284
285     if (iHMPID)
286     {
287         //=================== HMPID parameters ===========================
288         AliHMPID *HMPID = new AliHMPIDv1("HMPID", "normal HMPID");
289
290     }
291
292
293     if (iZDC)
294     {
295         //=================== ZDC parameters ============================
296
297         AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
298     }
299
300     if (iTRD)
301     {
302         //=================== TRD parameters ============================
303
304         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
305     }
306
307     if (iFMD)
308     {
309         //=================== FMD parameters ============================
310         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
311    }
312
313     if (iMUON)
314     {
315         //=================== MUON parameters ===========================
316         // New MUONv1 version (geometry defined via builders)
317         AliMUON *MUON = new AliMUONv1("MUON", "default");
318     }
319     //=================== PHOS parameters ===========================
320
321     if (iPHOS)
322     {
323         AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
324     }
325
326
327     if (iPMD)
328     {
329         //=================== PMD parameters ============================
330         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
331     }
332
333     if (iSTART)
334     {
335         //=================== START parameters ============================
336         AliSTART *START = new AliSTARTv1("START", "START Detector");
337     }
338
339     if (iEMCAL)
340     {
341         //=================== EMCAL parameters ============================
342         AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
343     }
344
345      if (iACORDE)
346     {
347         //=================== ACORDE parameters ============================
348         AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
349     }
350
351      if (iVZERO)
352     {
353         //=================== ACORDE parameters ============================
354         AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
355     }
356
357      AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
358
359 }
360
361 Float_t EtaToTheta(Float_t arg){
362   return (180./TMath::Pi())*2.*atan(exp(-arg));
363 }