Using getter instead of global constant
[u/mrichter/AliRoot.git] / TRD / AliTRDconfig.C
CommitLineData
793ff80c 1void Config()
2{
3
f9428ca8 4 Int_t iField = 0;
5
95cd7d4c 6 // libraries required by geant321
7 gSystem->Load("libgeant321");
8
9 new TGeant3("C++ Interface to Geant3");
793ff80c 10
11 // Create the output file
12 TFile *rootfile = new TFile("TRD_test.root","recreate");
13 rootfile->SetCompressionLevel(2);
14
15 // Define the monte carlo
16 TGeant3 *geant3 = (TGeant3*) gMC;
17
1f4ee546 18 AliRunLoader* rl=0x0;
19 cout << "AliTRDconfig.C: Creating Run Loader ..." <<endl;
20 rl = AliRunLoader::Open("TRD_test.root"
f5a857b2 21 ,AliConfig::GetDefaultEventFolderName()
1f4ee546 22 ,"recreate");
23 if (rl == 0x0) {
24 gAlice->Fatal("AliTRDconfig.C","Can not instatiate the Run Loader");
25 return;
26 }
27 rl->SetCompressionLevel(2);
28 rl->SetNumberOfEventsPerFile(3);
29 gAlice->SetRunLoader(rl);
30
793ff80c 31 // Set external decayer
1f4ee546 32 TVirtualMCDecayer *decayer = new AliDecayerPythia();
39207f8c 33 decayer->SetForceDecay(kAll);
793ff80c 34 decayer->Init();
35 gMC->SetExternalDecayer(decayer);
36
37 // ******* GEANT STEERING parameters FOR ALICE SIMULATION *******
38 geant3->SetTRIG(1); // Number of events to be processed
39 geant3->SetSWIT(4,10);
40 geant3->SetDEBU(0,0,1);
41 //geant3->SetSWIT(2,2);
42 geant3->SetDCAY(1);
43 geant3->SetPAIR(1);
44 geant3->SetCOMP(1);
45 geant3->SetPHOT(1);
46 geant3->SetPFIS(0);
47 geant3->SetDRAY(0);
48 geant3->SetANNI(1);
49 geant3->SetBREM(1);
50 geant3->SetMUNU(1);
51 geant3->SetCKOV(1);
52 geant3->SetHADR(1); // Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3)
53 geant3->SetLOSS(2);
54 geant3->SetMULS(1);
55 geant3->SetRAYL(1);
56 geant3->SetAUTO(1); // Select automatic STMIN etc... calc. (AUTO 1) or manual (AUTO 0)
57 geant3->SetABAN(0); // Restore 3.16 behaviour for abandoned tracks
58 geant3->SetOPTI(2); // Select optimisation level for GEANT geometry searches (0,1,2)
59 geant3->SetERAN(5.e-7);
60
61 Float_t cut = 1.e-3; // 1MeV cut by default
62 Float_t tofmax = 1.e10;
63 // GAM ELEC NHAD CHAD MUON EBREM MUHAB EDEL MUDEL MUPA TOFMAX
64 geant3->SetCUTS(cut,cut, cut, cut, cut, cut, cut, cut, cut, cut, tofmax);
65
66 // ************* STEERING parameters FOR ALICE SIMULATION **************
67 // --- Specify event type to be tracked through the ALICE setup
68 // --- All positions are in cm, angles in degrees, and P and E in GeV
4a0fe73c 69
70 AliGenCocktail *gener = new AliGenCocktail();
71
72 AliGenBox *genEl = new AliGenBox(100);
73 genEl->SetOrigin(0,0,0); // Vertex position
74 genEl->SetSigma(0,0,0); // Sigma in (X,Y,Z) (cm) on IP position
75 genEl->SetPart(11); // Only electrons
76
77 AliGenBox *genPi = new AliGenBox(100);
78 genPi->SetOrigin(0,0,0); // Vertex position
79 genPi->SetSigma(0,0,0); // Sigma in (X,Y,Z) (cm) on IP position
80 genPi->SetPart(-211); // Only pions
81
82 gener->AddGenerator(genEl,"Electrons",1);
83 gener->AddGenerator(genPi,"Pions" ,1);
84
f9428ca8 85 if (iField) {
86
87 // With magnetic field on
88 AliGenerator *gg = gener->FirstGenerator()->Generator();
89 gg->SetMomentumRange(3.00,3.01);
90 gg->SetPhiRange(76.0,92.0);
91 gg->SetThetaRange(83.0,97.0);
92 gg = gener->NextGenerator()->Generator();
93 gg->SetMomentumRange(0.560,0.561);
94 gg->SetPhiRange(62.0,78.0);
95 gg->SetThetaRange(83.0,97.0);
96
97 gener->Init();
98
99 // Specify maximum magnetic field in Tesla (neg. ==> default field)
100 // 0.4 T
101 gAlice->SetField(-999,2,2.0);
102
103 }
104 else {
105
106 // With magnetic field off
107 AliGenerator *gg = gener->FirstGenerator()->Generator();
108 gg->SetMomentumRange(3.00,3.01);
109 gg->SetPhiRange(82.0,98.0);
110 gg->SetThetaRange(83.0,97.0);
111 gg = gener->NextGenerator()->Generator();
112 gg->SetMomentumRange(0.560,0.561);
113 gg->SetPhiRange(82.0,98.0);
114 gg->SetThetaRange(83.0,97.0);
115
116 gener->Init();
4a0fe73c 117
f9428ca8 118 // Specify maximum magnetic field in Tesla (neg. ==> default field)
119 // No field
120 gAlice->SetField(0);
793ff80c 121
f9428ca8 122 }
793ff80c 123
124 Int_t iMAG = 1;
125 Int_t iITS = 1;
126 Int_t iTPC = 1;
127 Int_t iTRD = 1;
128 Int_t iABSO = 1;
129 Int_t iDIPO = 1;
130 Int_t iHALL = 1;
131 Int_t iFRAME = 1;
132 Int_t iSHIL = 1;
133 Int_t iPIPE = 1;
134
1f4ee546 135 rl->CdGAFile();
136
793ff80c 137 //=================== Alice BODY parameters =============================
138 AliBODY *BODY = new AliBODY("BODY","Alice envelop");
139
140 if (iMAG) {
141 //=================== MAG parameters ============================
142 // --- Start with Magnet since detector layouts may be depending ---
143 // --- on the selected Magnet dimensions ---
144 AliMAG *MAG = new AliMAG("MAG","Magnet");
145 }
146
147 if (iABSO) {
148 //=================== ABSO parameters ============================
149 AliABSO *ABSO = new AliABSOv0("ABSO","Muon Absorber");
150 }
151
152 if (iDIPO) {
153 //=================== DIPO parameters ============================
154 AliDIPO *DIPO = new AliDIPOv2("DIPO","Dipole version 2");
155 }
156
157 if (iHALL) {
158 //=================== HALL parameters ============================
159 AliHALL *HALL = new AliHALL("HALL","Alice Hall");
160 }
161
162 if (iFRAME) {
163 //=================== FRAME parameters ============================
164 AliFRAME *FRAME = new AliFRAMEv1("FRAME","Space Frame");
165 }
166
167 if (iSHIL) {
168 //=================== SHIL parameters ============================
169 AliSHIL *SHIL = new AliSHILv0("SHIL","Shielding");
170 }
171
172 if (iPIPE) {
173 //=================== PIPE parameters ============================
174 AliPIPE *PIPE = new AliPIPEv0("PIPE","Beam Pipe");
175 }
176
177 if (iITS) {
178 //=================== ITS parameters ============================
179 //
180 // EUCLID is a flag to output (=1) both geometry and media to two ASCII files
181 // (called by default ITSgeometry.euc and ITSgeometry.tme) in a format
182 // understandable to the CAD system EUCLID. The default (=0) means that you
183 // dont want to use this facility.
184 //
f9428ca8 185
6244debe 186 AliITS *ITS = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
793ff80c 187 ITS->SetEUCLID(0);
f9428ca8 188
793ff80c 189 }
190
191 if (iTPC) {
192 //============================ TPC parameters ================================
193 // --- This allows the user to specify sectors for the SLOW (TPC geometry 2)
194 // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
195 // --- sectors are specified, any value other than that requires at least one
196 // --- sector (lower or upper)to be specified!
197 // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
198 // --- sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
199 // --- SecLows - number of lower sectors specified (up to 6)
200 // --- SecUps - number of upper sectors specified (up to 12)
201 // --- Sens - sensitive strips for the Slow Simulator !!!
202 // --- This does NOT work if all S or L-sectors are specified, i.e.
203 // --- if SecAL or SecAU < 0
204 //
205 //
206 //-----------------------------------------------------------------------------
207
6244debe 208 AliTPC *TPC = new AliTPCv2("TPC","Default");
209 // All sectors included
210 TPC->SetSecAL(-1);
211 TPC->SetSecAU(-1);
793ff80c 212
213 }
214
215 if (iTRD) {
216 //=================== TRD parameters ============================
217
218 AliTRD *TRD = new AliTRDv1("TRD","TRD slow simulator");
219 TRD->SetSensChamber(2);
220 TRD->SetSensSector(13);
221
793ff80c 222 // Set to detailed display
223 TRD->SetDisplayType(1);
224
f9428ca8 225 // Draw TR photons
226 TRD->SetDrawTR(1);
227
793ff80c 228 // Switch on TR
229 AliTRDsim *TRDsim = TRD->CreateTR();
230
231 }
232
233}