]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/testMC/Config_AliGenCosmicsParam.C
Updated Config files fr standard tests
[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/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 "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 Mag_t         mag      = 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");
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     //    gAlice->SetTriggerDescriptor("Pb-Pb");
112     gAlice->SetTriggerDescriptor("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     AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., mag); // FIELD
185     //    field->SetL3ConstField(0); //Using const. field in the barrel
186     rl->CdGAFile();
187     gAlice->SetField(field);    
188
189
190     Int_t   iABSO  =  1;
191     Int_t   iDIPO  =  0;
192     Int_t   iFMD   =  0;
193     Int_t   iFRAME =  1;
194     Int_t   iHALL  =  1;
195     Int_t   iITS   =  1;
196     Int_t   iMAG   =  1;
197     Int_t   iMUON  =  0;
198     Int_t   iPHOS  =  0;
199     Int_t   iPIPE  =  1;
200     Int_t   iPMD   =  0;
201     Int_t   iRICH  =  0;
202     Int_t   iSHIL  =  1;
203     Int_t   iSTART =  0;
204     Int_t   iTOF   =  0;
205     Int_t   iTPC   =  1;
206     Int_t   iTRD   =  0;
207     Int_t   iZDC   =  0;
208     Int_t   iEMCAL =  0;
209     Int_t   iACORDE   =  1;
210     Int_t   iVZERO =  0;
211     rl->CdGAFile();
212     //=================== Alice BODY parameters =============================
213     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
214
215     if (iMAG)
216     {
217         //=================== MAG parameters ============================
218         // --- Start with Magnet since detector layouts may be depending ---
219         // --- on the selected Magnet dimensions ---
220         AliMAG *MAG = new AliMAG("MAG", "Magnet");
221     }
222
223
224     if (iABSO)
225     {
226         //=================== ABSO parameters ============================
227         AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
228     }
229
230     if (iDIPO)
231     {
232         //=================== DIPO parameters ============================
233
234         AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
235     }
236
237     if (iHALL)
238     {
239         //=================== HALL parameters ============================
240
241         AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
242     }
243
244
245     if (iFRAME)
246     {
247         //=================== FRAME parameters ============================
248
249         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
250     }
251
252     if (iSHIL)
253     {
254         //=================== SHIL parameters ============================
255
256         AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
257     }
258
259
260     if (iPIPE)
261     {
262         //=================== PIPE parameters ============================
263
264         AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
265     }
266  
267     if (iITS)
268     {
269         //=================== ITS parameters ============================
270
271         AliITSvPPRasymmFMD *ITS  = new AliITSvPPRasymmFMD("ITS","ITS PPR detailed version with asymmetric services");
272     }
273
274     if (iTPC)
275     {
276         //============================ TPC parameters ===================
277         AliTPC *TPC = new AliTPCv2("TPC", "Default");
278     }
279
280
281     if (iTOF) {
282         //=================== TOF parameters ============================
283         AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
284     }
285
286
287     if (iRICH)
288     {
289         //=================== RICH parameters ===========================
290         AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
291
292     }
293
294
295     if (iZDC)
296     {
297         //=================== ZDC parameters ============================
298
299         AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
300     }
301
302     if (iTRD)
303     {
304         //=================== TRD parameters ============================
305
306         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
307     }
308
309     if (iFMD)
310     {
311         //=================== FMD parameters ============================
312         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
313    }
314
315     if (iMUON)
316     {
317         //=================== MUON parameters ===========================
318         // New MUONv1 version (geometry defined via builders)
319         AliMUON *MUON = new AliMUONv1("MUON", "default");
320     }
321     //=================== PHOS parameters ===========================
322
323     if (iPHOS)
324     {
325         AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
326     }
327
328
329     if (iPMD)
330     {
331         //=================== PMD parameters ============================
332         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
333     }
334
335     if (iSTART)
336     {
337         //=================== START parameters ============================
338         AliSTART *START = new AliSTARTv1("START", "START Detector");
339     }
340
341     if (iEMCAL)
342     {
343         //=================== EMCAL parameters ============================
344         AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
345     }
346
347      if (iACORDE)
348     {
349         //=================== ACORDE parameters ============================
350         AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
351     }
352
353      if (iVZERO)
354     {
355         //=================== ACORDE parameters ============================
356         AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
357     }
358
359      AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
360
361 }
362
363 Float_t EtaToTheta(Float_t arg){
364   return (180./TMath::Pi())*2.*atan(exp(-arg));
365 }
366
367
368