]> git.uio.no Git - u/mrichter/AliRoot.git/blame - macros/Config_PDC06_MUON.C
coverity #24434 #24433, add check on nullness of primary particles pointer, default...
[u/mrichter/AliRoot.git] / macros / Config_PDC06_MUON.C
CommitLineData
dfd0f589 1// Config file MUON + ITS (for vertex) for PDC06
2// Tuned for p+p min biais and quarkonia production (AliGenMUONCocktailpp)
3// Remember to define the directory and option
4// gAlice->SetConfigFunction("Config('$HOME','box');");
e1f732d4 5// april 3rd: added L3 magnet
dfd0f589 6
c0784315 7void LoadPythia();
37ff1457 8
e1f732d4 9void Config(char directory[100]="", char option[6]="trg1mu")
dfd0f589 10{
11
12 static Int_t sseed = 0; // Set 0 to use the current time
13
14 //=====================================================================
c0784315 15 LoadPythia();
dfd0f589 16 gSystem->Load("libgeant321.so");
17 new TGeant3TGeo("C++ Interface to Geant3");
37ff1457 18
dfd0f589 19 //=======================================================================
20
458041af 21 if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
162637e4 22 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
458041af 23 AliCDBManager::Instance()->SetRun(0);
24 }
25
dfd0f589 26 // Set Random Number seed
27 gRandom->SetSeed(sseed);
28
29 // Create the output file
30 Text_t filename[100];
31 sprintf(filename,"%sgalice.root",directory);
32
33 AliRunLoader* rl=0x0;
34 rl = AliRunLoader::Open(
35 filename, AliConfig::GetDefaultEventFolderName(), "recreate");
36 if (rl == 0x0) {
37 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
38 return;
39 }
40 rl->SetCompressionLevel(2);
e1f732d4 41 rl->SetNumberOfEventsPerFile(1000);
dfd0f589 42 gAlice->SetRunLoader(rl);
458041af 43 // gAlice->SetGeometryFromFile("geometry.root");
44 // gAlice->SetGeometryFromCDB();
dfd0f589 45
6521ae06 46 //=======================================================================
47 // Set the trigger configuration
28da60d3 48 AliSimulation::Instance()->SetTriggerConfig("p-p");
6521ae06 49 cout<<"Trigger configuration is set to p-p"<<endl;
50
dfd0f589 51 //=======================================================================
52 // Set External decayer
53 TVirtualMCDecayer *decayer = new AliDecayerPythia();
54 decayer->SetForceDecay(kAll);
55 decayer->Init();
56 gMC->SetExternalDecayer(decayer);
57
58 //=======================================================================
59 // ******* GEANT STEERING parameters FOR ALICE SIMULATION *******
60 gMC->SetProcess("DCAY",1);
61 gMC->SetProcess("PAIR",1);
62 gMC->SetProcess("COMP",1);
63 gMC->SetProcess("PHOT",1);
64 gMC->SetProcess("PFIS",0);
65 gMC->SetProcess("DRAY",0);
66 gMC->SetProcess("ANNI",1);
67 gMC->SetProcess("BREM",1);
68 gMC->SetProcess("MUNU",1);
69 gMC->SetProcess("CKOV",1);
70 gMC->SetProcess("HADR",1);
71 gMC->SetProcess("LOSS",2);
72 gMC->SetProcess("MULS",1);
73 gMC->SetProcess("RAYL",1);
74
75 Float_t cut = 1.e-3; // 1MeV cut by default
76 Float_t tofmax = 1.e10;
77
78 gMC->SetCut("CUTGAM", cut);
79 gMC->SetCut("CUTELE", cut);
80 gMC->SetCut("CUTNEU", cut);
81 gMC->SetCut("CUTHAD", cut);
82 gMC->SetCut("CUTMUO", cut);
83 gMC->SetCut("BCUTE", cut);
84 gMC->SetCut("BCUTM", cut);
85 gMC->SetCut("DCUTE", cut);
86 gMC->SetCut("DCUTM", cut);
87 gMC->SetCut("PPCUTM", cut);
88 gMC->SetCut("TOFMAX", tofmax);
89 //
90 //=======================================================================
91 // ************* STEERING parameters FOR ALICE SIMULATION **************
92 // Chamber positions
93 // From AliMUONConstants class we get :
94 // Position Z (along beam) of the chambers (in cm)
95 // (from AliMUONConstants class):
96 // 533.5, 546.5, 678.5, 693.5, 964.0, 986.0, 1251.5, 1278.5,
97 // 1416.5, 1443.5, 1610, 1625., 1710., 1725.
98 // Internal Radius (in cm)
99 // 36.4, 46.2, 66.0, 80., 80., 100., 100.
100 // External Radius (in cm)
101 // 183., 245., 395., 560., 563., 850., 900.
102 //=======================================================================
37ff1457 103 AliGenPythia* PythiaForMUONCocktail(Decay_t dt)
104 {
105 AliGenPythia *pythia = new AliGenPythia(1);
106 pythia->SetProcess(kPyMbMSEL1);
107 pythia->SetStrucFunc(kCTEQ5L);
108 pythia->SetEnergyCMS(14000.);
109 pythia->SetForceDecay(dt);
110 pythia->SetPtRange(0.,100.);
111 pythia->SetYRange(-8.,8.);
112 pythia->SetPhiRange(0.,360.);
113 pythia->SetPtHard(2.76,-1.0);
114 pythia->SwitchHFOff();
115 return pythia;
116 }
dfd0f589 117
118 if (!strcmp(option,"trg2mu")) {
119 AliGenMUONCocktailpp *gener = new AliGenMUONCocktailpp();
120 gener->SetPtRange(0.,100.);
121 gener->SetYRange(-4.,-2.4);
e1f732d4 122 gener->SetPhiRange(0.,360.);
dfd0f589 123 gener->SetMuonMultiplicity(2);
e1f732d4 124 gener->SetMuonPtCut(0.5);
dfd0f589 125 gener->SetMuonThetaRange(171.,178.);
126 gener->SetOrigin(0.,0.,0.);
127 gener->SetSigma(0.,0.,5.);
128 gener->SetVertexSmear(kPerEvent);
37ff1457 129 Decay_t dt = gener->GetDecayModePythia(dt);
130 AliGenPythia* pythia = PythiaForMUONCocktail(dt);
131 pythia->Init();
132 gener->AddGenerator(pythia,"Pythia",1);
dfd0f589 133 gener->Init();
134 }
135
136 if (!strcmp(option,"trg1mu")) {
137 AliGenMUONCocktailpp *gener = new AliGenMUONCocktailpp();
138 gener->SetPtRange(0.,100.);
139 gener->SetYRange(-4.,-2.4);
e1f732d4 140 gener->SetPhiRange(0.,360.);
dfd0f589 141 gener->SetMuonMultiplicity(1);
e1f732d4 142 gener->SetMuonPtCut(0.5);
dfd0f589 143 gener->SetMuonThetaRange(171.,178.);
144 gener->SetOrigin(0.,0.,0.);
145 gener->SetSigma(0.,0.,5.);
146 gener->SetVertexSmear(kPerEvent);
37ff1457 147 Decay_t dt = gener->GetDecayModePythia();
148 AliGenPythia* pythia = PythiaForMUONCocktail(dt);
149 pythia->Init();
150 gener->AddGenerator(pythia,"Pythia",1);
dfd0f589 151 gener->Init();
152 }
153 //=============================================================
e1f732d4 154 // Field (L3 0.5 T) outside dimuon spectrometer
4642ac4b 155 AliMagF* field = new AliMagF("Maps","Maps",1.,1.,AliMagF::k5kG);
f3cba114 156 field->SetL3ConstField(0); // Using const. field in the barrel
f7a1cc68 157 TGeoGlobalMagField::Instance()->SetField(field);
dfd0f589 158
e1f732d4 159 Int_t iITS = 1;
160 Int_t iZDC = 1;
161 Int_t iFMD = 1;
162 Int_t iPHOS = 1;
163 Int_t iPMD = 1;
ababa197 164 Int_t iT0 = 1;
e1f732d4 165 Int_t iVZERO = 1;
166
dfd0f589 167 rl->CdGAFile();
168
169 //=================== Alice BODY parameters =============================
170 AliBODY *BODY = new AliBODY("BODY","Alice envelop");
171 //=================== ABSO parameters ============================
96fb3353 172 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
dfd0f589 173 //=================== DIPO parameters ============================
96fb3353 174 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
dfd0f589 175 //================== HALL parameters ============================
96fb3353 176 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
dfd0f589 177 //================== The L3 Magnet ==============================
178 AliMAG *MAG = new AliMAG("MAG", "L3 Magnet");
179 //=================== PIPE parameters ============================
96fb3353 180 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
dfd0f589 181 //=================== SHIL parameters ============================
96fb3353 182 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
dfd0f589 183 //=================== ITS parameters =============================
184 if(iITS) {
3a5fcc75 185 AliITS *ITS = new AliITSv11("ITS","ITS v11");
dfd0f589 186 }
e1f732d4 187 //=================== ZDC parameters =============================
188 if(iZDC) {
9d07603a 189 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
e1f732d4 190 }
191 //=================== FMD parameters =============================
192 if(iFMD) {
193 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
194 }
195 //=================== PHOS parameters =============================
196 if(iPHOS) {
197 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
198 }
199 //=================== PMD parameters =============================
200 if(iPMD) {
201 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
202 }
ababa197 203 //=================== T0 parameters =============================
204 if (iT0) {
205 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
e1f732d4 206 }
207 //=================== VZERO parameters =============================
208 if (iVZERO) {
209 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
210 }
dfd0f589 211
212 //=================== MUON Subsystem ===========================
213 cout << ">>> Config.C: Creating AliMUONv1 ..."<<endl;
214
215 // With the following compactor, what you get (in case you wonder...) is :
216 //
217 // - "FactoryV4", that is all stations using new segmentations/mapping
218 // - "sdigitizer:AliMUONSDigitizerV2", performing decalibration
219 // - "digitizer:NewDigitizerOldTrigger" <=> digitizer=AliMUONDigitizerV3,
220 // using the "old" trigger code, performing calibration
221 //
222 AliMUON *MUON = new AliMUONv1("MUON");
223}
224
225Float_t EtaToTheta(Float_t arg){
226 return (180./TMath::Pi())*2.*atan(exp(-arg));
227}
37ff1457 228
229
c0784315 230void LoadPythia()
231{
232 // Load Pythia related libraries
233 gSystem->Load("liblhapdf.so"); // Parton density functions
234 gSystem->Load("libEGPythia6.so"); // TGenerator interface
235 gSystem->Load("libpythia6.so"); // Pythia
236 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations
237}
238
37ff1457 239