Update HFE v2 analyses
[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"
3a5fcc75 46#include "AliITSv11.h"
ca8c8223 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",
05315e71 73 bool forEmbedding=kFALSE,
74 bool forRealistic=kFALSE)
8d6c1ae0 75{
bd0cb923 76 //=====================================================================
8d6c1ae0 77 // Config file for MUON test
8d6c1ae0 78 //=====================================================================
79 // Libraries required by geant321
ca8c8223 80
eeb4f277 81 gSystem->Load("liblhapdf.so"); // Parton density functions
82 gSystem->Load("libpythia6.so"); // Pythia
c5cee034 83 gSystem->Load("libgeant321.so");
84 gSystem->Load("libEG");
85 gSystem->Load("libEGPythia6");
eeb4f277 86 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations
87
6570c14d 88 new TGeant3TGeo("C++ Interface to Geant3");
eeb4f277 89
8d6c1ae0 90 //=======================================================================
91 // Create the output file
92 Text_t filename[100];
93 sprintf(filename,"%sgalice.root",directory);
94 cout << ">>> Output file is " << filename << endl;
95 cout << ">>> Config.C: Creating Run Loader ..."<<endl;
96 AliRunLoader* rl=0x0;
97 rl = AliRunLoader::Open(
bd0cb923 98 filename, AliConfig::GetDefaultEventFolderName(), "recreate");
99 if (rl == 0x0)
100 { gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
101 return; }
8d6c1ae0 102 rl->SetCompressionLevel(2);
05315e71 103 rl->SetNumberOfEventsPerFile(10000);
8d6c1ae0 104 gAlice->SetRunLoader(rl);
bd0cb923 105 //=======================================================================
106 // For having more debuging messages
b5fb1f3e 107 //AliLog::SetModuleDebugLevel("MUON", 1);
8d6c1ae0 108 //=======================================================================
109 // Set External decayer
110 TVirtualMCDecayer *decayer = new AliDecayerPythia();
111 decayer->SetForceDecay(kAll);
112 decayer->Init();
113 gMC->SetExternalDecayer(decayer);
8d6c1ae0 114 //=======================================================================
115 // ******* GEANT STEERING parameters FOR ALICE SIMULATION *******
bd0cb923 116 gMC->SetProcess("DCAY",1);
117 gMC->SetProcess("PAIR",1);
118 gMC->SetProcess("COMP",1);
119 gMC->SetProcess("PHOT",1);
120 gMC->SetProcess("PFIS",0);
121 gMC->SetProcess("DRAY",0);
122 gMC->SetProcess("ANNI",1);
123 gMC->SetProcess("BREM",1);
124 gMC->SetProcess("MUNU",1);
125 gMC->SetProcess("CKOV",1);
126 gMC->SetProcess("HADR",1);
127 gMC->SetProcess("LOSS",2);
128 gMC->SetProcess("MULS",1);
129 gMC->SetProcess("RAYL",1);
130 Float_t cut = 1.e-3; // 1MeV cut by default
131 Float_t tofmax = 1.e10;
132 gMC->SetCut("CUTGAM", cut);
133 gMC->SetCut("CUTELE", cut);
134 gMC->SetCut("CUTNEU", cut);
135 gMC->SetCut("CUTHAD", cut);
136 gMC->SetCut("CUTMUO", cut);
137 gMC->SetCut("BCUTE", cut);
138 gMC->SetCut("BCUTM", cut);
139 gMC->SetCut("DCUTE", cut);
140 gMC->SetCut("DCUTM", cut);
141 gMC->SetCut("PPCUTM", cut);
142 gMC->SetCut("TOFMAX", tofmax);
8d6c1ae0 143 //=======================================================================
bd0cb923 144 // Examples of generators. Only option param is sistematically tested
8d6c1ae0 145 if (!strcmp(option,"box")) {
146 AliGenBox * gener = new AliGenBox(1);
147 gener->SetMomentumRange(20.,20.1);
148 gener->SetPhiRange(0., 360.);
149 gener->SetThetaRange(171.000,178.001);
9bb2665f 150 gener->SetPart(kMuonMinus); // Muons
8d6c1ae0 151 gener->SetOrigin(0.,0., 0.); //vertex position
152 gener->SetSigma(0.0, 0.0, 0.0); //Sigma in (X,Y,Z) (cm) on IP position
153 }
154 if (!strcmp(option,"gun")) {
f47563ed 155 AliGenFixed *gener = new AliGenFixed(1);
8d6c1ae0 156 gener->SetMomentum(10);
157 gener->SetPhiRange(0.);
158 gener->SetThetaRange(0.);
f47563ed 159 gener->SetOrigin(30,30,-1200);//vertex position
9bb2665f 160 gener->SetPart(kMuonMinus); //GEANT particle type 13 is muons
8d6c1ae0 161 }
162 if (!strcmp(option,"scan")) {
163 AliGenScan *gener = new AliGenScan(-1);
164 gener->SetMomentumRange(10,10);
165 gener->SetPhiRange(0, 0);
166 gener->SetThetaRange(-180, -180);
167 //vertex position
168 //gener->SetSigma(1,1,0); //Sigma in (X,Y,Z) (cm) on IP position
169 gener->SetPart(kRootino);
170 gener->SetRange(100, -300., 300., 100, -300., 300., 1, 2000, 2000);
171 }
172 if (!strcmp(option,"param")) {
8d6c1ae0 173 AliGenParam *gener = new AliGenParam(1, AliGenMUONlib::kUpsilon);
174 gener->SetMomentumRange(0,999);
175 gener->SetPtRange(0,100.);
176 gener->SetPhiRange(0., 360.);
177 gener->SetCutOnChild(1);
178 gener->SetChildPhiRange(0.,360.);
179 gener->SetChildThetaRange(171.0,178.0);
05315e71 180 gener->SetOrigin(0,0,0); //vertex position gener->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
181 if (forRealistic)
182 {
183 gener->SetVertexSmear(kPerEvent);
184 }
8d6c1ae0 185 gener->SetForceDecay(kDiMuon);
186 gener->SetTrackingFlag(1);
187 gener->Init();
188 }
f80c094e 189 if (!strcmp(option,"paramJpsi")) {
190 AliGenParam *gener = new AliGenParam(1, AliGenMUONlib::kJpsi);
191 gener->SetMomentumRange(0,999);
192 gener->SetPtRange(0,100.);
193 gener->SetPhiRange(0., 360.);
194 gener->SetCutOnChild(1);
195 gener->SetChildPhiRange(0.,360.);
196 gener->SetChildThetaRange(171.0,178.0);
197 gener->SetOrigin(0,0,0);
198 gener->SetForceDecay(kDiMuon);
199 gener->SetTrackingFlag(1);
200 gener->Init();
201 }
bd0cb923 202 if (!strcmp(option,"hijing")) { //Hijing generator from ConfigPPR in macros
203 AliGenHijing *gener = new AliGenHijing(-1);
204 // centre of mass energy
205 gener->SetEnergyCMS(5500.);
206 // reference frame
207 gener->SetReferenceFrame("CMS");
208 // projectile
209 gener->SetProjectile("A", 208, 82);
210 gener->SetTarget ("A", 208, 82);
211 // tell hijing to keep the full parent child chain
212 gener->KeepFullEvent();
213 // enable jet quenching
214 gener->SetJetQuenching(1);
215 // enable shadowing
216 gener->SetShadowing(1);
217 // neutral pion and heavy particle decays switched off
218 gener->SetDecaysOff(1);
219 // Don't track spectators
220 gener->SetSpectators(0);
221 // kinematic selection
222 gener->SetSelectAll(0);
223 // impact parameter range
224 gener->SetImpactParameterRange(0., 5.); // 0. - 5. fm corresponds to ~10% most central
225 gener->Init();
226 }
227 if (!strcmp(option,"muoncocktail")) { // Muon cocktail for PbPb
228 AliGenMUONCocktail * gener = new AliGenMUONCocktail();
229 gener->SetPtRange(1.,100.); // Transverse momentum range
230 gener->SetPhiRange(0.,360.); // Azimuthal angle range
231 gener->SetYRange(-4.0,-2.5);
232 gener->SetMuonPtCut(0.5);
233 gener->SetMuonThetaCut(171.,178.);
234 gener->SetMuonMultiplicity(2);
235 gener->SetImpactParameterRange(0.,5.); // 10% most centra PbPb collisions
236 gener->SetVertexSmear(kPerTrack);
237 gener->SetOrigin(0,0,0); // Vertex position
238 gener->SetSigma(0,0,0.0); // Sigma in (X,Y,Z) (cm) on IP position
239 gener->Init();
240 }
8d6c1ae0 241 //=============================================================
bd0cb923 242 // Field (L3 0.5 T)
4642ac4b 243 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1, AliMagF::k5kG));
bd0cb923 244 //=============================================================
8d6c1ae0 245 //=================== Alice BODY parameters =============================
ca8c8223 246 new AliBODY("BODY","Alice envelop");
8d6c1ae0 247 //=================== ABSO parameters ============================
ca8c8223 248 new AliABSOv3("ABSO", "Muon Absorber");
8d6c1ae0 249 //=================== DIPO parameters ============================
ca8c8223 250 new AliDIPOv3("DIPO", "Dipole version 2");
8d6c1ae0 251 //================== HALL parameters ============================
ca8c8223 252 new AliHALLv3("HALL", "Alice Hall");
8d6c1ae0 253 //=================== PIPE parameters ============================
ca8c8223 254 new AliPIPEv3("PIPE", "Beam Pipe");
8d6c1ae0 255 //=================== SHIL parameters ============================
ca8c8223 256 new AliSHILv3("SHIL", "Shielding Version 2");
e107e560 257
8d6c1ae0 258 //=================== MUON Subsystem ===========================
9bf406e1 259 AliMUON *MUON = new AliMUONv1("MUON", "default");
e107e560 260
2849388f 261 // The 3 switches below are to be used for the trigger code
08db3bf4 262 // their default value is set in AliMUON.h
afb3ccf0 263 // activate trigger cluster-size (0=default, 1=cluster-size according to AliMUONResponseTriggerV1
264 // MUON->SetTriggerResponseV1(0);
08db3bf4 265 // activate 4/4 trigger coincidence (0=default (coinc 3/4), 1=coinc 4/4)
afb3ccf0 266 // MUON->SetTriggerCoinc44(0);
267 // activate trigger chamber efficiency by cells (0=default, 1=trigger efficiency according to AliMUONTriggerEfficiencyCells
08db3bf4 268 // MUON->SetTriggerEffCells(0);
269
d631bec8 270 // Activate the following line when running with Fluka
271 // MUON->SetIsMaxStep(kFALSE);
272
5ee595ac 273 // Use SetDigitStoreClassName() to change the digitStore implementation used by (s)digitizer
274 MUON->SetDigitStoreClassName(digitstore);
5812b5ad 275
ca8c8223 276 if ( forEmbedding )
277 {
278 // Noise-only digits in tracker/trigger (0=no noise, 1=default (noise in tracker), 2=noise in tracker and trigger):
279 cout << "****** DISABLING NOISE GENERATION AS WE DO EMBEDDING ******" << endl;
280 MUON->SetDigitizerWithNoise(0);
c3305598 281 MUON->SetConvertTrigger(true);
ca8c8223 282
3a5fcc75 283 new AliITSv11("ITS","ITS v11");
05315e71 284 }
285 else if (forRealistic)
286 {
3a5fcc75 287 new AliITSv11("ITS","ITS v11");
ca8c8223 288 }
289
5f3519d9 290 // Use non-high performance raw data decoder
291 //MUON->SetFastTrackerDecoder(kFALSE);
292 //MUON->SetFastTriggerDecoder(kFALSE);
bee76de2 293
826f8de7 294 //
599766cd 295 // If SetAlign, the detection elements transformations
296 // are taken from the input file and not from the code
297 // MUON->SetAlign("transform.dat");
df729182 298
d83a3fce 299 // To generate and read scaler trigger events in rawdata
300 // MUON->SetTriggerScalerEvent();
542e9a38 301
5fe36481 302 // To switch off the tail effect
303 // MUON->SetTailEffect(kFALSE);
df729182 304
e107e560 305 // If you want to play with builders, first reset the geometry builder,
306 // and then add yours.
307 // MUON->ResetGeometryBuilder();
308 // MUON->AddGeometryBuilder(new AliMUONSt1GeometryBuilderV2(MUON));
309 // MUON->AddGeometryBuilder(new AliMUONSt2GeometryBuilderV2(MUON));
310 // MUON->AddGeometryBuilder(new AliMUONSlatGeometryBuilder(MUON));
311 // MUON->AddGeometryBuilder(new AliMUONTriggerGeometryBuilder(MUON));
8d6c1ae0 312}