]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/Config.C
TPCCEda.cxx.diff Simplification of the AMORE DB part
[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 void Config(char directory[100]="", char option[6]="param", const char* digitstore="AliMUONDigitStoreV2S")
27 {
28   //=====================================================================
29   // Config file for MUON test
30   //=====================================================================
31   //  Libraries required by geant321
32   gSystem->Load("liblhapdf.so");      // Parton density functions
33   gSystem->Load("libpythia6.so");     // Pythia
34   gSystem->Load("libgeant321.so");
35   gSystem->Load("libEG");
36   gSystem->Load("libEGPythia6");
37   gSystem->Load("libAliPythia6.so");  // ALICE specific implementations
38
39   new TGeant3TGeo("C++ Interface to Geant3");
40
41   //=======================================================================
42   //  Create the output file    
43   Text_t filename[100];
44   sprintf(filename,"%sgalice.root",directory);
45   cout << ">>> Output file is " << filename << endl;   
46   cout << ">>> Config.C: Creating Run Loader ..."<<endl;
47   AliRunLoader* rl=0x0;
48   rl = AliRunLoader::Open(
49                           filename, AliConfig::GetDefaultEventFolderName(), "recreate");
50   if (rl == 0x0) 
51     { gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
52       return; }
53   rl->SetCompressionLevel(2);
54   rl->SetNumberOfEventsPerFile(100);
55   gAlice->SetRunLoader(rl);
56   //=======================================================================
57   // For having more debuging messages
58   //AliLog::SetModuleDebugLevel("MUON", 1);
59   //=======================================================================
60   // Set External decayer
61   TVirtualMCDecayer *decayer = new AliDecayerPythia();
62   decayer->SetForceDecay(kAll);
63   decayer->Init();
64   gMC->SetExternalDecayer(decayer);
65   //=======================================================================
66   // ******* GEANT STEERING parameters FOR ALICE SIMULATION *******
67   gMC->SetProcess("DCAY",1);
68   gMC->SetProcess("PAIR",1);
69   gMC->SetProcess("COMP",1);
70   gMC->SetProcess("PHOT",1);
71   gMC->SetProcess("PFIS",0);
72   gMC->SetProcess("DRAY",0);
73   gMC->SetProcess("ANNI",1);
74   gMC->SetProcess("BREM",1);
75   gMC->SetProcess("MUNU",1);
76   gMC->SetProcess("CKOV",1);
77   gMC->SetProcess("HADR",1);
78   gMC->SetProcess("LOSS",2);
79   gMC->SetProcess("MULS",1);
80   gMC->SetProcess("RAYL",1);
81   Float_t cut = 1.e-3;        // 1MeV cut by default
82   Float_t tofmax = 1.e10;
83   gMC->SetCut("CUTGAM", cut);
84   gMC->SetCut("CUTELE", cut);
85   gMC->SetCut("CUTNEU", cut);
86   gMC->SetCut("CUTHAD", cut);
87   gMC->SetCut("CUTMUO", cut);
88   gMC->SetCut("BCUTE",  cut); 
89   gMC->SetCut("BCUTM",  cut); 
90   gMC->SetCut("DCUTE",  cut); 
91   gMC->SetCut("DCUTM",  cut); 
92   gMC->SetCut("PPCUTM", cut);
93   gMC->SetCut("TOFMAX", tofmax); 
94   //=======================================================================
95   // Examples of generators. Only option param is sistematically tested
96   if (!strcmp(option,"box")) {
97     AliGenBox * gener = new AliGenBox(1);
98     gener->SetMomentumRange(20.,20.1);
99     gener->SetPhiRange(0., 360.);         
100     gener->SetThetaRange(171.000,178.001);
101     gener->SetPart(kMuonMinus);           // Muons
102     gener->SetOrigin(0.,0., 0.);  //vertex position
103     gener->SetSigma(0.0, 0.0, 0.0);         //Sigma in (X,Y,Z) (cm) on IP position
104   }
105   if (!strcmp(option,"gun")) {
106     AliGenFixed *gener = new AliGenFixed(1);
107     gener->SetMomentum(10);
108     gener->SetPhiRange(0.);
109     gener->SetThetaRange(0.);
110     gener->SetOrigin(30,30,-1200);//vertex position
111     gener->SetPart(kMuonMinus);          //GEANT particle type  13 is muons
112   }
113   if (!strcmp(option,"scan")) {
114     AliGenScan *gener = new AliGenScan(-1);
115     gener->SetMomentumRange(10,10);
116     gener->SetPhiRange(0, 0);
117     gener->SetThetaRange(-180, -180);
118     //vertex position
119     //gener->SetSigma(1,1,0);           //Sigma in (X,Y,Z) (cm) on IP position
120     gener->SetPart(kRootino); 
121     gener->SetRange(100, -300., 300., 100, -300., 300., 1, 2000, 2000);
122   }  
123   if (!strcmp(option,"param")) {
124     AliGenParam *gener = new AliGenParam(1, AliGenMUONlib::kUpsilon);
125     gener->SetMomentumRange(0,999);
126     gener->SetPtRange(0,100.);
127     gener->SetPhiRange(0., 360.);
128     gener->SetCutOnChild(1);
129     gener->SetChildPhiRange(0.,360.);
130     gener->SetChildThetaRange(171.0,178.0);
131     gener->SetOrigin(0,0,0);          //vertex position    gener->SetSigma(0,0,0);           //Sigma in (X,Y,Z) (cm) on IP position
132     gener->SetForceDecay(kDiMuon);
133     gener->SetTrackingFlag(1);
134     gener->Init();
135   }
136   if (!strcmp(option,"hijing")) { //Hijing generator from ConfigPPR in macros
137     AliGenHijing *gener = new AliGenHijing(-1);
138     // centre of mass energy 
139     gener->SetEnergyCMS(5500.);
140     // reference frame
141     gener->SetReferenceFrame("CMS");
142     // projectile
143     gener->SetProjectile("A", 208, 82);
144     gener->SetTarget    ("A", 208, 82);
145     // tell hijing to keep the full parent child chain
146     gener->KeepFullEvent();
147     // enable jet quenching
148     gener->SetJetQuenching(1);
149     // enable shadowing
150     gener->SetShadowing(1);
151     // neutral pion and heavy particle decays switched off
152     gener->SetDecaysOff(1);
153     // Don't track spectators
154     gener->SetSpectators(0);
155     // kinematic selection
156     gener->SetSelectAll(0);
157     // impact parameter range
158     gener->SetImpactParameterRange(0., 5.); // 0. - 5. fm corresponds to ~10% most central
159     gener->Init();
160   }
161   if (!strcmp(option,"muoncocktail")) { // Muon cocktail for PbPb
162     AliGenMUONCocktail * gener = new AliGenMUONCocktail();
163     gener->SetPtRange(1.,100.);       // Transverse momentum range  
164     gener->SetPhiRange(0.,360.);    // Azimuthal angle range 
165     gener->SetYRange(-4.0,-2.5);
166     gener->SetMuonPtCut(0.5);
167     gener->SetMuonThetaCut(171.,178.);
168     gener->SetMuonMultiplicity(2);
169     gener->SetImpactParameterRange(0.,5.); // 10% most centra PbPb collisions
170     gener->SetVertexSmear(kPerTrack);  
171     gener->SetOrigin(0,0,0);        // Vertex position
172     gener->SetSigma(0,0,0.0);       // Sigma in (X,Y,Z) (cm) on IP position
173     gener->Init();
174   }  
175   //============================================================= 
176   // Field (L3 0.5 T)
177   TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 2, 1., 1, 10., AliMagF::k5kG));
178   //============================================================= 
179   //=================== Alice BODY parameters =============================
180   AliBODY *BODY = new AliBODY("BODY","Alice envelop");
181   //=================== ABSO parameters ============================
182   AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
183   //=================== DIPO parameters ============================
184   AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 2");
185   //================== HALL parameters ============================
186   AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
187   //=================== PIPE parameters ============================
188   AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
189   //=================== SHIL parameters ============================
190   AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 2");
191
192   //=================== MUON Subsystem ===========================
193   AliMUON *MUON = new AliMUONv1("MUON", "default");
194
195   // The 3 switches below are to be used for the trigger code
196   // their default value is set in AliMUON.h
197   // activate trigger cluster-size (0=default, 1=cluster-size according to AliMUONResponseTriggerV1
198   //  MUON->SetTriggerResponseV1(0);
199   // activate 4/4 trigger coincidence (0=default (coinc 3/4), 1=coinc 4/4)
200   //  MUON->SetTriggerCoinc44(0);
201   // activate trigger chamber efficiency by cells (0=default, 1=trigger efficiency according to AliMUONTriggerEfficiencyCells
202   //  MUON->SetTriggerEffCells(0);
203
204   // Use SetDigitStoreClassName() to change the digitStore implementation used by (s)digitizer
205   MUON->SetDigitStoreClassName(digitstore);
206   
207   cout << "MUON DigitStore is " << MUON->DigitStoreClassName().Data() << endl;
208   
209   // Noise-only digits in tracker/trigger (0=no noise, 1=default (noise in tracker), 2=noise in tracker and trigger):
210   //MUON->SetDigitizerWithNoise(kFALSE);
211
212   // Use non-high performance raw data decoder 
213   //MUON->SetFastTrackerDecoder(kFALSE);  
214   //MUON->SetFastTriggerDecoder(kFALSE);  
215   
216   //
217   // If SetAlign, the detection elements transformations
218   // are taken from the input file and not from the code
219   // MUON->SetAlign("transform.dat");
220
221   // To generate and read scaler trigger events in rawdata
222   // MUON->SetTriggerScalerEvent();
223   
224   // To switch off the tail effect
225   // MUON->SetTailEffect(kFALSE);
226
227   // If you want to play with builders, first reset the geometry builder,
228   // and then add yours.
229   //  MUON->ResetGeometryBuilder();
230   //  MUON->AddGeometryBuilder(new AliMUONSt1GeometryBuilderV2(MUON));
231   //  MUON->AddGeometryBuilder(new AliMUONSt2GeometryBuilderV2(MUON));
232   //  MUON->AddGeometryBuilder(new AliMUONSlatGeometryBuilder(MUON));
233   //  MUON->AddGeometryBuilder(new AliMUONTriggerGeometryBuilder(MUON));
234 }