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