- Disentangle masks effect from trigger chamber efficiency estimation.
[u/mrichter/AliRoot.git] / MUON / Config.C
CommitLineData
e54bf126 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18/// \ingroup macros
19/// \file Config.C
20/// \brief Configuration macro for MUON spectormeter simulation
21///
22/// Remember to define the directory and event generator option:
23///
24/// gAlice->SetConfigFunction("Config('$HOME','box');");
ca8c8223 25///
26/// Can be compiled by :
27/// .L Config.C+
28/// (depends on the correct rootlogon.C though...)
29
30#if !defined(__CINT__) || defined(__MAKECINT__)
31
32#include "AliABSOv3.h"
33#include "AliBODY.h"
34#include "AliConfig.h"
35#include "AliDIPOv3.h"
36#include "AliDecayerPythia.h"
37#include "AliFRAMEv2.h"
38#include "AliGenBox.h"
39#include "AliGenFixed.h"
40#include "AliGenHijing.h"
41#include "AliGenMUONCocktail.h"
42#include "AliGenMUONlib.h"
43#include "AliGenParam.h"
44#include "AliGenScan.h"
45#include "AliHALLv3.h"
46#include "AliITSv11Hybrid.h"
47#include "AliMAG.h"
48#include "AliMagF.h"
49#include "AliMUONv1.h"
50#include "AliPIPEv3.h"
51#include "AliRun.h"
52#include "AliRunLoader.h"
53#include "AliSHILv3.h"
54#include <Riostream.h>
55#include <TDatime.h>
56#include <TGeant3TGeo.h>
57#include <TGeoGlobalMagField.h>
58#include <TPDGCode.h>
59#include <TRandom.h>
60#include <TSystem.h>
61#include <TVirtualMC.h>
62
63//#include "AliZDCv3.h"
64//#include "AliFMDv1.h"
65//#include "AliPMDv1.h"
66//#include "AliVZEROv7.h"
67
68#endif
8d6c1ae0 69
ca8c8223 70void Config(const char* directory="",
71 const char* option="param",
72 const char* digitstore="AliMUONDigitStoreV2S",
73 bool forEmbedding=kFALSE)
8d6c1ae0 74{
bd0cb923 75 //=====================================================================
8d6c1ae0 76 // Config file for MUON test
8d6c1ae0 77 //=====================================================================
78 // Libraries required by geant321
ca8c8223 79
eeb4f277 80 gSystem->Load("liblhapdf.so"); // Parton density functions
81 gSystem->Load("libpythia6.so"); // Pythia
c5cee034 82 gSystem->Load("libgeant321.so");
83 gSystem->Load("libEG");
84 gSystem->Load("libEGPythia6");
eeb4f277 85 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations
86
6570c14d 87 new TGeant3TGeo("C++ Interface to Geant3");
eeb4f277 88
8d6c1ae0 89 //=======================================================================
90 // Create the output file
91 Text_t filename[100];
92 sprintf(filename,"%sgalice.root",directory);
93 cout << ">>> Output file is " << filename << endl;
94 cout << ">>> Config.C: Creating Run Loader ..."<<endl;
95 AliRunLoader* rl=0x0;
96 rl = AliRunLoader::Open(
bd0cb923 97 filename, AliConfig::GetDefaultEventFolderName(), "recreate");
98 if (rl == 0x0)
99 { gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
100 return; }
8d6c1ae0 101 rl->SetCompressionLevel(2);
102 rl->SetNumberOfEventsPerFile(100);
103 gAlice->SetRunLoader(rl);
bd0cb923 104 //=======================================================================
105 // For having more debuging messages
b5fb1f3e 106 //AliLog::SetModuleDebugLevel("MUON", 1);
8d6c1ae0 107 //=======================================================================
108 // Set External decayer
109 TVirtualMCDecayer *decayer = new AliDecayerPythia();
110 decayer->SetForceDecay(kAll);
111 decayer->Init();
112 gMC->SetExternalDecayer(decayer);
8d6c1ae0 113 //=======================================================================
114 // ******* GEANT STEERING parameters FOR ALICE SIMULATION *******
bd0cb923 115 gMC->SetProcess("DCAY",1);
116 gMC->SetProcess("PAIR",1);
117 gMC->SetProcess("COMP",1);
118 gMC->SetProcess("PHOT",1);
119 gMC->SetProcess("PFIS",0);
120 gMC->SetProcess("DRAY",0);
121 gMC->SetProcess("ANNI",1);
122 gMC->SetProcess("BREM",1);
123 gMC->SetProcess("MUNU",1);
124 gMC->SetProcess("CKOV",1);
125 gMC->SetProcess("HADR",1);
126 gMC->SetProcess("LOSS",2);
127 gMC->SetProcess("MULS",1);
128 gMC->SetProcess("RAYL",1);
129 Float_t cut = 1.e-3; // 1MeV cut by default
130 Float_t tofmax = 1.e10;
131 gMC->SetCut("CUTGAM", cut);
132 gMC->SetCut("CUTELE", cut);
133 gMC->SetCut("CUTNEU", cut);
134 gMC->SetCut("CUTHAD", cut);
135 gMC->SetCut("CUTMUO", cut);
136 gMC->SetCut("BCUTE", cut);
137 gMC->SetCut("BCUTM", cut);
138 gMC->SetCut("DCUTE", cut);
139 gMC->SetCut("DCUTM", cut);
140 gMC->SetCut("PPCUTM", cut);
141 gMC->SetCut("TOFMAX", tofmax);
8d6c1ae0 142 //=======================================================================
bd0cb923 143 // Examples of generators. Only option param is sistematically tested
8d6c1ae0 144 if (!strcmp(option,"box")) {
145 AliGenBox * gener = new AliGenBox(1);
146 gener->SetMomentumRange(20.,20.1);
147 gener->SetPhiRange(0., 360.);
148 gener->SetThetaRange(171.000,178.001);
9bb2665f 149 gener->SetPart(kMuonMinus); // Muons
8d6c1ae0 150 gener->SetOrigin(0.,0., 0.); //vertex position
151 gener->SetSigma(0.0, 0.0, 0.0); //Sigma in (X,Y,Z) (cm) on IP position
152 }
153 if (!strcmp(option,"gun")) {
f47563ed 154 AliGenFixed *gener = new AliGenFixed(1);
8d6c1ae0 155 gener->SetMomentum(10);
156 gener->SetPhiRange(0.);
157 gener->SetThetaRange(0.);
f47563ed 158 gener->SetOrigin(30,30,-1200);//vertex position
9bb2665f 159 gener->SetPart(kMuonMinus); //GEANT particle type 13 is muons
8d6c1ae0 160 }
161 if (!strcmp(option,"scan")) {
162 AliGenScan *gener = new AliGenScan(-1);
163 gener->SetMomentumRange(10,10);
164 gener->SetPhiRange(0, 0);
165 gener->SetThetaRange(-180, -180);
166 //vertex position
167 //gener->SetSigma(1,1,0); //Sigma in (X,Y,Z) (cm) on IP position
168 gener->SetPart(kRootino);
169 gener->SetRange(100, -300., 300., 100, -300., 300., 1, 2000, 2000);
170 }
171 if (!strcmp(option,"param")) {
8d6c1ae0 172 AliGenParam *gener = new AliGenParam(1, AliGenMUONlib::kUpsilon);
173 gener->SetMomentumRange(0,999);
174 gener->SetPtRange(0,100.);
175 gener->SetPhiRange(0., 360.);
176 gener->SetCutOnChild(1);
177 gener->SetChildPhiRange(0.,360.);
178 gener->SetChildThetaRange(171.0,178.0);
179 gener->SetOrigin(0,0,0); //vertex position gener->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
180 gener->SetForceDecay(kDiMuon);
181 gener->SetTrackingFlag(1);
182 gener->Init();
183 }
f80c094e 184 if (!strcmp(option,"paramJpsi")) {
185 AliGenParam *gener = new AliGenParam(1, AliGenMUONlib::kJpsi);
186 gener->SetMomentumRange(0,999);
187 gener->SetPtRange(0,100.);
188 gener->SetPhiRange(0., 360.);
189 gener->SetCutOnChild(1);
190 gener->SetChildPhiRange(0.,360.);
191 gener->SetChildThetaRange(171.0,178.0);
192 gener->SetOrigin(0,0,0);
193 gener->SetForceDecay(kDiMuon);
194 gener->SetTrackingFlag(1);
195 gener->Init();
196 }
bd0cb923 197 if (!strcmp(option,"hijing")) { //Hijing generator from ConfigPPR in macros
198 AliGenHijing *gener = new AliGenHijing(-1);
199 // centre of mass energy
200 gener->SetEnergyCMS(5500.);
201 // reference frame
202 gener->SetReferenceFrame("CMS");
203 // projectile
204 gener->SetProjectile("A", 208, 82);
205 gener->SetTarget ("A", 208, 82);
206 // tell hijing to keep the full parent child chain
207 gener->KeepFullEvent();
208 // enable jet quenching
209 gener->SetJetQuenching(1);
210 // enable shadowing
211 gener->SetShadowing(1);
212 // neutral pion and heavy particle decays switched off
213 gener->SetDecaysOff(1);
214 // Don't track spectators
215 gener->SetSpectators(0);
216 // kinematic selection
217 gener->SetSelectAll(0);
218 // impact parameter range
219 gener->SetImpactParameterRange(0., 5.); // 0. - 5. fm corresponds to ~10% most central
220 gener->Init();
221 }
222 if (!strcmp(option,"muoncocktail")) { // Muon cocktail for PbPb
223 AliGenMUONCocktail * gener = new AliGenMUONCocktail();
224 gener->SetPtRange(1.,100.); // Transverse momentum range
225 gener->SetPhiRange(0.,360.); // Azimuthal angle range
226 gener->SetYRange(-4.0,-2.5);
227 gener->SetMuonPtCut(0.5);
228 gener->SetMuonThetaCut(171.,178.);
229 gener->SetMuonMultiplicity(2);
230 gener->SetImpactParameterRange(0.,5.); // 10% most centra PbPb collisions
231 gener->SetVertexSmear(kPerTrack);
232 gener->SetOrigin(0,0,0); // Vertex position
233 gener->SetSigma(0,0,0.0); // Sigma in (X,Y,Z) (cm) on IP position
234 gener->Init();
235 }
8d6c1ae0 236 //=============================================================
bd0cb923 237 // Field (L3 0.5 T)
4642ac4b 238 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1, AliMagF::k5kG));
bd0cb923 239 //=============================================================
8d6c1ae0 240 //=================== Alice BODY parameters =============================
ca8c8223 241 new AliBODY("BODY","Alice envelop");
8d6c1ae0 242 //=================== ABSO parameters ============================
ca8c8223 243 new AliABSOv3("ABSO", "Muon Absorber");
8d6c1ae0 244 //=================== DIPO parameters ============================
ca8c8223 245 new AliDIPOv3("DIPO", "Dipole version 2");
8d6c1ae0 246 //================== HALL parameters ============================
ca8c8223 247 new AliHALLv3("HALL", "Alice Hall");
8d6c1ae0 248 //=================== PIPE parameters ============================
ca8c8223 249 new AliPIPEv3("PIPE", "Beam Pipe");
8d6c1ae0 250 //=================== SHIL parameters ============================
ca8c8223 251 new AliSHILv3("SHIL", "Shielding Version 2");
e107e560 252
8d6c1ae0 253 //=================== MUON Subsystem ===========================
9bf406e1 254 AliMUON *MUON = new AliMUONv1("MUON", "default");
e107e560 255
2849388f 256 // The 3 switches below are to be used for the trigger code
08db3bf4 257 // their default value is set in AliMUON.h
afb3ccf0 258 // activate trigger cluster-size (0=default, 1=cluster-size according to AliMUONResponseTriggerV1
259 // MUON->SetTriggerResponseV1(0);
08db3bf4 260 // activate 4/4 trigger coincidence (0=default (coinc 3/4), 1=coinc 4/4)
afb3ccf0 261 // MUON->SetTriggerCoinc44(0);
262 // activate trigger chamber efficiency by cells (0=default, 1=trigger efficiency according to AliMUONTriggerEfficiencyCells
08db3bf4 263 // MUON->SetTriggerEffCells(0);
264
d631bec8 265 // Activate the following line when running with Fluka
266 // MUON->SetIsMaxStep(kFALSE);
267
5ee595ac 268 // Use SetDigitStoreClassName() to change the digitStore implementation used by (s)digitizer
269 MUON->SetDigitStoreClassName(digitstore);
5812b5ad 270
ca8c8223 271 if ( forEmbedding )
272 {
273 // Noise-only digits in tracker/trigger (0=no noise, 1=default (noise in tracker), 2=noise in tracker and trigger):
274 cout << "****** DISABLING NOISE GENERATION AS WE DO EMBEDDING ******" << endl;
275 MUON->SetDigitizerWithNoise(0);
c3305598 276 MUON->SetConvertTrigger(true);
ca8c8223 277
278 new AliITSv11Hybrid("ITS","ITS v11Hybrid");
279
280 }
281
5f3519d9 282 // Use non-high performance raw data decoder
283 //MUON->SetFastTrackerDecoder(kFALSE);
284 //MUON->SetFastTriggerDecoder(kFALSE);
bee76de2 285
826f8de7 286 //
599766cd 287 // If SetAlign, the detection elements transformations
288 // are taken from the input file and not from the code
289 // MUON->SetAlign("transform.dat");
df729182 290
d83a3fce 291 // To generate and read scaler trigger events in rawdata
292 // MUON->SetTriggerScalerEvent();
542e9a38 293
5fe36481 294 // To switch off the tail effect
295 // MUON->SetTailEffect(kFALSE);
df729182 296
e107e560 297 // If you want to play with builders, first reset the geometry builder,
298 // and then add yours.
299 // MUON->ResetGeometryBuilder();
300 // MUON->AddGeometryBuilder(new AliMUONSt1GeometryBuilderV2(MUON));
301 // MUON->AddGeometryBuilder(new AliMUONSt2GeometryBuilderV2(MUON));
302 // MUON->AddGeometryBuilder(new AliMUONSlatGeometryBuilder(MUON));
303 // MUON->AddGeometryBuilder(new AliMUONTriggerGeometryBuilder(MUON));
8d6c1ae0 304}