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