]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/Config.C
Fixing RC20 violations
[u/mrichter/AliRoot.git] / MUON / Config.C
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');");
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 "AliITSv11.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
69
70 void Config(const char* directory="", 
71             const char* option="param", 
72             const char* digitstore="AliMUONDigitStoreV2S",
73             bool forEmbedding=kFALSE,
74             bool forRealistic=kFALSE)
75 {
76   //=====================================================================
77   // Config file for MUON test
78   //=====================================================================
79   //  Libraries required by geant321
80   
81   gSystem->Load("liblhapdf.so");      // Parton density functions
82   gSystem->Load("libpythia6.so");     // Pythia
83   gSystem->Load("libgeant321.so");
84   gSystem->Load("libEG");
85   gSystem->Load("libEGPythia6");
86   gSystem->Load("libAliPythia6.so");  // ALICE specific implementations
87
88   new TGeant3TGeo("C++ Interface to Geant3");
89
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(
98                           filename, AliConfig::GetDefaultEventFolderName(), "recreate");
99   if (rl == 0x0) 
100     { gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
101       return; }
102   rl->SetCompressionLevel(2);
103   rl->SetNumberOfEventsPerFile(10000);
104   gAlice->SetRunLoader(rl);
105   //=======================================================================
106   // For having more debuging messages
107   //AliLog::SetModuleDebugLevel("MUON", 1);
108   //=======================================================================
109   // Set External decayer
110   TVirtualMCDecayer *decayer = new AliDecayerPythia();
111   decayer->SetForceDecay(kAll);
112   decayer->Init();
113   gMC->SetExternalDecayer(decayer);
114   //=======================================================================
115   // ******* GEANT STEERING parameters FOR ALICE SIMULATION *******
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); 
143   //=======================================================================
144   // Examples of generators. Only option param is sistematically tested
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);
150     gener->SetPart(kMuonMinus);           // Muons
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")) {
155     AliGenFixed *gener = new AliGenFixed(1);
156     gener->SetMomentum(10);
157     gener->SetPhiRange(0.);
158     gener->SetThetaRange(0.);
159     gener->SetOrigin(30,30,-1200);//vertex position
160     gener->SetPart(kMuonMinus);          //GEANT particle type  13 is muons
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")) {
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);
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     }
185     gener->SetForceDecay(kDiMuon);
186     gener->SetTrackingFlag(1);
187     gener->Init();
188   }
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   }
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   }  
241   //============================================================= 
242   // Field (L3 0.5 T)
243   TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1, AliMagF::k5kG));
244   //============================================================= 
245   //=================== Alice BODY parameters =============================
246   new AliBODY("BODY","Alice envelop");
247   //=================== ABSO parameters ============================
248   new AliABSOv3("ABSO", "Muon Absorber");
249   //=================== DIPO parameters ============================
250   new AliDIPOv3("DIPO", "Dipole version 2");
251   //================== HALL parameters ============================
252   new AliHALLv3("HALL", "Alice Hall");
253   //=================== PIPE parameters ============================
254   new AliPIPEv3("PIPE", "Beam Pipe");
255   //=================== SHIL parameters ============================
256   new AliSHILv3("SHIL", "Shielding Version 2");
257
258   //=================== MUON Subsystem ===========================
259   AliMUON *MUON = new AliMUONv1("MUON", "default");
260
261   // The 3 switches below are to be used for the trigger code
262   // their default value is set in AliMUON.h
263   // activate trigger cluster-size (0=default, 1=cluster-size according to AliMUONResponseTriggerV1
264   //  MUON->SetTriggerResponseV1(0);
265   // activate 4/4 trigger coincidence (0=default (coinc 3/4), 1=coinc 4/4)
266   //  MUON->SetTriggerCoinc44(0);
267   // activate trigger chamber efficiency by cells (0=default, 1=trigger efficiency according to AliMUONTriggerEfficiencyCells
268   //  MUON->SetTriggerEffCells(0);
269
270   // Activate the following line when running with Fluka
271   // MUON->SetIsMaxStep(kFALSE);
272
273   // Use SetDigitStoreClassName() to change the digitStore implementation used by (s)digitizer
274   MUON->SetDigitStoreClassName(digitstore);
275
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);
281                 MUON->SetConvertTrigger(true);
282     
283     new AliITSv11("ITS","ITS v11");    
284   }
285   else if (forRealistic)
286   {
287     new AliITSv11("ITS","ITS v11");        
288   }
289   
290   // Use non-high performance raw data decoder 
291   //MUON->SetFastTrackerDecoder(kFALSE);  
292   //MUON->SetFastTriggerDecoder(kFALSE);  
293   
294   //
295   // If SetAlign, the detection elements transformations
296   // are taken from the input file and not from the code
297   // MUON->SetAlign("transform.dat");
298
299   // To generate and read scaler trigger events in rawdata
300   // MUON->SetTriggerScalerEvent();
301   
302   // To switch off the tail effect
303   // MUON->SetTailEffect(kFALSE);
304
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));
312 }