]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/macros/Config.C
reduce to 50 MeV cut the print and exclude too low energy clusters
[u/mrichter/AliRoot.git] / EMCAL / macros / Config.C
1 // Config modified from production LHC12a11a
2 // One can use the configuration macro in compiled mode by
3 // root [0] gSystem->Load("libgeant321");
4 // root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
5 //                   -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
6 // root [0] .x grun.C(1,"Config.C++")
7
8 #if !defined(__CINT__) || defined(__MAKECINT__)
9 #include <Riostream.h>
10 #include <TPDGCode.h>
11 #include <TRandom.h>
12 #include <TSystem.h>
13 #include <TVirtualMC.h>
14 #include <TGeant3TGeo.h>
15 #include "STEER/AliRunLoader.h"
16 #include "STEER/AliRun.h"
17 #include "STEER/AliConfig.h"
18 #include "PYTHIA6/AliDecayerPythia.h"
19 #include "EVGEN/AliGenCocktail.h"
20 #include "EVGEN/AliGenHIJINGpara.h"
21 #include "STEER/AliMagF.h"
22 #include "STRUCT/AliBODY.h"
23 #include "STRUCT/AliMAG.h"
24 #include "STRUCT/AliABSOv3.h"
25 #include "STRUCT/AliDIPOv3.h"
26 #include "STRUCT/AliHALLv3.h"
27 #include "STRUCT/AliFRAMEv2.h"
28 #include "STRUCT/AliSHILv3.h"
29 #include "STRUCT/AliPIPEv3.h"
30 #include "ITS/AliITSv11.h"
31 #include "TPC/AliTPCv2.h"
32 #include "TOF/AliTOFv6T0.h"
33 #include "HMPID/AliHMPIDv2.h"
34 #include "ZDC/AliZDCv3.h"
35 #include "TRD/AliTRDv1.h"
36 #include "FMD/AliFMDv1.h"
37 #include "MUON/AliMUONv1.h"
38 #include "PHOS/AliPHOSv1.h"
39 #include "PMD/AliPMDv1.h"
40 #include "T0/AliT0v1.h"
41 #include "EMCAL/AliEMCALv2.h"
42 #include "ACORDE/AliACORDEv1.h"
43 #include "VZERO/AliVZEROv7.h"
44 #endif
45
46 Float_t EtaToTheta(Float_t arg);
47 void    LoadPythia();
48 AliGenerator *GenParamCalo(Int_t nPart, Int_t type, TString calo);
49
50 Int_t  year = 2012;
51 Bool_t checkGeoAndRun = kFALSE;
52
53 void Config()
54 {
55   //AliLog::SetGlobalDebugLevel(2);
56   
57   // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
58   // Theta range given through pseudorapidity limits 22/6/2001
59   
60   // Set Random Number seed
61   //gRandom->SetSeed(123456); // Set 0 to use the currecnt time
62   AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
63   
64   // Load Pythia libraries                                        
65   LoadPythia();
66   
67   // libraries required by geant321
68 #if defined(__CINT__)
69   gSystem->Load("libgeant321");
70 #endif
71   
72   new     TGeant3TGeo("C++ Interface to Geant3");
73   
74   AliRunLoader* rl=0x0;
75   
76   AliLog::Message(AliLog::kInfo, "Creating Run Loader", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
77   
78   rl = AliRunLoader::Open("galice.root",
79                           AliConfig::GetDefaultEventFolderName(),
80                           "recreate");
81   if (rl == 0x0)
82   {
83     gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
84     return;
85   }
86   rl->SetCompressionLevel(2);
87   rl->SetNumberOfEventsPerFile(10000);
88   gAlice->SetRunLoader(rl);
89   
90   // Set the trigger configuration
91   AliSimulation::Instance()->SetTriggerConfig("Pb-Pb");
92   cout<<"Trigger configuration is set to  Pb-Pb"<<endl;
93   
94   //
95   // Set External decayer
96   TVirtualMCDecayer *decayer = new AliDecayerPythia();
97   
98   decayer->SetForceDecay(kAll);
99   decayer->Init();
100   gMC->SetExternalDecayer(decayer);
101   //=======================================================================
102   // ************* STEERING parameters FOR ALICE SIMULATION **************
103   // --- Specify event type to be tracked through the ALICE setup
104   // --- All positions are in cm, angles in degrees, and P and E in GeV
105   
106   
107   gMC->SetProcess("DCAY",1);
108   gMC->SetProcess("PAIR",1);
109   gMC->SetProcess("COMP",1);
110   gMC->SetProcess("PHOT",1);
111   gMC->SetProcess("PFIS",0);
112   gMC->SetProcess("DRAY",0);
113   gMC->SetProcess("ANNI",1);
114   gMC->SetProcess("BREM",1);
115   gMC->SetProcess("MUNU",1);
116   gMC->SetProcess("CKOV",1);
117   gMC->SetProcess("HADR",1);
118   gMC->SetProcess("LOSS",2);
119   gMC->SetProcess("MULS",1);
120   gMC->SetProcess("RAYL",1);
121   
122   Float_t cut    = 1.e-3;  // 1MeV cut by default
123   Float_t tofmax = 1.e10;
124   
125   gMC->SetCut("CUTGAM", cut);
126   gMC->SetCut("CUTELE", cut);
127   gMC->SetCut("CUTNEU", cut);
128   gMC->SetCut("CUTHAD", cut);
129   gMC->SetCut("CUTMUO", cut);
130   gMC->SetCut("BCUTE",  cut); 
131   gMC->SetCut("BCUTM",  cut); 
132   gMC->SetCut("DCUTE",  cut); 
133   gMC->SetCut("DCUTM",  cut); 
134   gMC->SetCut("PPCUTM", cut);
135   gMC->SetCut("TOFMAX", tofmax); 
136   
137   
138 //  int     nParticles = 1;
139 //  if (gSystem->Getenv("CONFIG_NPARTICLES"))
140 //  {
141 //    nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
142 //  }
143 //  
144 //  if (gSystem->Getenv("CONFIG_YEAR"))
145 //  {
146 //    year = atoi(gSystem->Getenv("CONFIG_YEAR"));
147 //  }
148 //  
149 //  AliGenBox *gener = new AliGenBox(nParticles);
150 //  gener->SetMomentumRange(1.,10.);
151 //  
152 //  if     (year == 2010)
153 //    gener->SetPhiRange(80.0,120.0);
154 //  else if(year == 2011)
155 //    gener->SetPhiRange(80.0,180.0);
156 //  else
157 //    gener->SetPhiRange(80.0,190.0);
158 //  
159 //  gener->SetThetaRange(EtaToTheta(0.7), EtaToTheta(-0.7));
160 //  
161 //  gener->SetOrigin(0,0,0);        //vertex position
162 //  gener->SetSigma(0,0,0);         //Sigma in (X,Y,Z) (cm) on IP position
163 //  gener->SetPart(221);
164 //  gener->SetDecayParticle(22);
165 //  gener->SetNeutralMesonDecayInto2Photon(kTRUE);
166 //  gener->SetDecayPhiRange(80,180);
167 //  gener->SetDecayEtaRange(-0.7,0.7);
168 //  gener->SetDecayERange(0.5,10000);
169 //  gener->SetDecayPtRange(0.5,10000);
170   
171 //  AliGenLib* lib   = new AliGenPHOSlib();
172 //  Int_t      type  = AliGenPHOSlib::kEtaFlat;
173 //  AliGenParam *gener = new AliGenParam(1,lib,type,"");
174 //      gener->SetMomentumRange(0,999);
175 //      gener->SetPtRange(1,30);
176 //      gener->SetPhiRange(80, 200.);
177 //      gener->SetYRange(-2,2);
178 //      gener->SetThetaRange(EtaToTheta(0.7),EtaToTheta(-0.7));
179 //      gener->SetCutOnChild(1);
180 //  gener->SetChildPtRange(0.1,30);
181 //      gener->SetChildThetaRange(EtaToTheta(0.7),EtaToTheta(-0.7));
182 //  gener->SetChildPhiRange(80, 180.);
183 //      gener->SetOrigin(0,0,0);        //vertex position
184 //      gener->SetSigma(0,0,5.3);       //Sigma in (X,Y,Z) (cm) on IP position
185 //      gener->SetForceDecay(kGammaEM);
186 //
187 //  gener->SetTrackingFlag(0);
188   
189   AliGenCocktail *gener = new AliGenCocktail();
190   gener->SetProjectile("A", 208, 82);
191   gener->SetTarget    ("A", 208, 82);
192   
193   // 1 Pi0 in EMCAL, 2010 configuration, 4 SM
194   AliGenParam *gEMCPi0 = GenParamCalo(1, AliGenPHOSlib::kPi0Flat, "EMCAL");
195   gener->AddGenerator(gEMCPi0,"pi0EMC", 1);
196   
197   // 1 Pi0 in PHOS
198   AliGenParam *gPHSPi0 = GenParamCalo(1, AliGenPHOSlib::kPi0Flat, "PHOS");
199   gener->AddGenerator(gPHSPi0,"pi0PHS", 1);
200   
201   // 1 Eta in EMCAL, 2010 configuration, 4 SM
202   AliGenParam *gEMCEta = GenParamCalo(1, AliGenPHOSlib::kEtaFlat, "EMCAL");
203   gener->AddGenerator(gEMCEta,"etaEMC", 1);
204   
205   // 1 Pi0 in PHOS
206   AliGenParam *gPHSEta = GenParamCalo(1, AliGenPHOSlib::kEtaFlat, "PHOS");
207   gener->AddGenerator(gPHSEta,"etaPHS", 1);
208   
209   gener->Init();
210   
211   // 
212   // Activate this line if you want the vertex smearing to happen
213   // track by track
214   //
215   //gener->SetVertexSmear(perTrack); 
216   // Field (L3 0.5 T)
217   TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG));
218   
219   Int_t   iABSO  =  0;
220   Int_t   iDIPO  =  0;
221   Int_t   iFMD   =  0;
222   Int_t   iFRAME =  0;
223   Int_t   iHALL  =  0;
224   Int_t   iITS   =  0;
225   Int_t   iMAG   =  0;
226   Int_t   iMUON  =  0;
227   Int_t   iPHOS  =  1;
228   Int_t   iPIPE  =  0;
229   Int_t   iPMD   =  0;
230   Int_t   iHMPID =  0;
231   Int_t   iSHIL  =  0;
232   Int_t   iT0    =  0;
233   Int_t   iTOF   =  0;
234   Int_t   iTPC   =  0;
235   Int_t   iTRD   =  0;
236   Int_t   iZDC   =  0;
237   Int_t   iEMCAL =  1;
238   Int_t   iACORDE=  0;
239   Int_t   iVZERO =  0;
240   rl->CdGAFile();
241   //=================== Alice BODY parameters =============================
242   AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
243   
244   if (iMAG)
245   {
246     //=================== MAG parameters ============================
247     // --- Start with Magnet since detector layouts may be depending ---
248     // --- on the selected Magnet dimensions ---
249     AliMAG *MAG = new AliMAG("MAG", "Magnet");
250   }
251   
252   
253   if (iABSO)
254   {
255     //=================== ABSO parameters ============================
256     AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
257   }
258   
259   if (iDIPO)
260   {
261     //=================== DIPO parameters ============================
262     
263     AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
264   }
265   
266   if (iHALL)
267   {
268     //=================== HALL parameters ============================
269     
270     AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
271   }
272   
273   
274   if (iFRAME)
275   {
276     //=================== FRAME parameters ============================
277     
278     AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
279   }
280   
281   if (iSHIL)
282   {
283     //=================== SHIL parameters ============================
284     
285     AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
286   }
287   
288   
289   if (iPIPE)
290   {
291     //=================== PIPE parameters ============================
292     
293     AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
294   }
295   
296   if(iITS) {
297     
298     //=================== ITS parameters ============================
299     
300     AliITS *ITS  = new AliITSv11("ITS","ITS v11");
301   }
302   
303   if (iTPC)
304   {
305     //============================ TPC parameters ===================
306     AliTPC *TPC = new AliTPCv2("TPC", "Default");
307   }
308   
309   
310   if (iTOF) {
311     //=================== TOF parameters ============================
312     AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
313   }
314   
315   
316   if (iHMPID)
317   {
318     //=================== HMPID parameters ===========================
319     AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
320     
321   }
322   
323   
324   if (iZDC)
325   {
326     //=================== ZDC parameters ============================
327     
328     AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
329   }
330   
331   if (iTRD)
332   {
333     //=================== TRD parameters ============================
334     
335     AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
336     AliTRDgeometry *geoTRD = TRD->GetGeometry();
337     // starting at 3h in positive direction
338     if(year==2011 || year == 2010)
339     { // not sure if good for 2010
340       // Partial geometry: modules at 0,1,7,8,9,10,11,15,16,17
341       printf("*** TRD configuration for 2011\n");
342       geoTRD->SetSMstatus(2,0);
343       geoTRD->SetSMstatus(3,0);
344       geoTRD->SetSMstatus(4,0);
345       geoTRD->SetSMstatus(5,0);
346       geoTRD->SetSMstatus(6,0);
347       geoTRD->SetSMstatus(12,0);
348       geoTRD->SetSMstatus(13,0);
349       geoTRD->SetSMstatus(14,0);
350     }
351     else if(year==2012)
352     {
353       printf("*** TRD configuration for 2012\n");
354       geoTRD->SetSMstatus(4,0);
355       geoTRD->SetSMstatus(5,0);
356       geoTRD->SetSMstatus(12,0);
357       geoTRD->SetSMstatus(13,0);
358       geoTRD->SetSMstatus(14,0); 
359     }
360   }
361   
362   if (iFMD)
363   {
364     //=================== FMD parameters ============================
365     AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
366   }
367   
368   if (iMUON)
369   {
370     //=================== MUON parameters ===========================
371     // New MUONv1 version (geometry defined via builders)
372     AliMUON *MUON = new AliMUONv1("MUON", "default");
373   }
374   //=================== PHOS parameters ===========================
375   
376   if (iPHOS)
377   {
378     AliPHOS *PHOS = new AliPHOSv1("PHOS", "noCPV_Modules123");
379   }
380   
381   
382   if (iPMD)
383   {
384     //=================== PMD parameters ============================
385     AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
386   }
387   
388   if (iT0)
389   {
390     //=================== T0 parameters ============================
391     AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
392   }
393   
394   if (iEMCAL)
395   {
396     //=================== EMCAL parameters ============================
397     if      (year == 2010)  // d phi = 40 degrees
398       AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_FIRSTYEARV1",    checkGeoAndRun);
399     else if (year == 2011)  // d phi = 100 degrees
400       AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETEV1",     checkGeoAndRun);
401     else if (year > 2011)   // d phi = 110 degrees
402       AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE12SMV1", checkGeoAndRun);
403     else // Old configuration with 110 degrees but not perfect geometry
404       AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE",       checkGeoAndRun);
405   }
406   
407   if (iACORDE)
408   {
409     //=================== ACORDE parameters ============================
410     AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
411   }
412   
413   if (iVZERO)
414   {
415     //=================== ACORDE parameters ============================
416     AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
417   }
418   
419   AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
420   
421 }
422
423 Float_t EtaToTheta(Float_t arg){
424   return (180./TMath::Pi())*2.*atan(exp(-arg));
425 }
426
427 void LoadPythia()
428 {
429   // Load Pythia related libraries                                                                
430   gSystem->Load("liblhapdf.so");      // Parton density functions                                 
431   gSystem->Load("libEGPythia6.so");   // TGenerator interface                                     
432   gSystem->Load("libpythia6.so");     // Pythia                                                   
433   gSystem->Load("libAliPythia6.so");  // ALICE specific
434   // implementations                           
435 }
436
437
438 AliGenerator * GenParamCalo(Int_t nPart, Int_t type, TString calo)
439 {
440   // nPart of type (Pi0, Eta, Pi0Flat, EtaFlat, ...) in EMCAL or PHOS
441   // CAREFUL EMCAL year 2010 configuration
442   AliGenParam *gener = new AliGenParam(nPart,new AliGenPHOSlib(),type,"");
443   
444   // meson cuts
445   gener->SetMomentumRange(0,999);
446   gener->SetYRange(-2,2);
447   gener->SetPtRange(1,30);
448   // photon cuts
449   gener->SetForceDecay(kGammaEM); // Ensure the decays are photons
450   gener->SetCutOnChild(1);
451   gener->SetChildPtRange(0.,30);
452   
453   if(calo=="EMCAL")
454   {
455     //meson acceptance
456     gener->SetPhiRange(80., 100.); // year 2010
457     //gener->SetPhiRange(80., 180.); // year 2011
458     gener->SetThetaRange(EtaToTheta(0.7),EtaToTheta(-0.7));
459     //decay acceptance
460     gener->SetChildThetaRange(EtaToTheta(0.7),EtaToTheta(-0.7));
461     gener->SetChildPhiRange(80., 100.); // year 2010
462     //gener->SetChildPhiRange(80., 180.); // year 2011
463   }
464   else if(calo=="PHOS")
465   {
466     //meson acceptance
467     gener->SetPhiRange(260., 320.);
468     gener->SetThetaRange(EtaToTheta(0.13),EtaToTheta(-0.13));
469     //decay acceptance
470     gener->SetChildThetaRange(EtaToTheta(0.13),EtaToTheta(-0.13));
471     gener->SetChildPhiRange(260., 320.);
472   }
473   
474   return gener;
475   
476 }
477