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