]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDconfig.C
Fix bugs in PID assignment
[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     TGeant3TGeo("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   AliRunLoader* rl=0x0;
19   cout << "AliTRDconfig.C: Creating Run Loader ..." <<endl;
20   rl = AliRunLoader::Open("TRD_test.root"
21                           ,AliConfig::GetDefaultEventFolderName()
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
31   // Set external decayer
32   TVirtualMCDecayer *decayer = new AliDecayerPythia();
33   decayer->SetForceDecay(kAll);
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
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
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();
117
118     // Specify maximum magnetic field in Tesla (neg. ==> default field)
119     // No field
120     gAlice->SetField(0);    
121
122   }
123
124   Int_t iMAG   = 1;
125   Int_t iITS   = 0;
126   Int_t iTPC   = 0;
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
135   rl->CdGAFile();
136
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     AliFRAMEv2 *FRAME  = new AliFRAMEv2("FRAME","Space Frame");
165     FRAME->SetHoles(0);
166   }
167
168   if (iSHIL) {
169     //=================== SHIL parameters ============================
170     AliSHIL *SHIL  = new AliSHILv0("SHIL","Shielding");
171   }
172
173   if (iPIPE) {
174     //=================== PIPE parameters ============================
175     AliPIPE *PIPE  = new AliPIPEv0("PIPE","Beam Pipe");
176   }
177
178   if (iITS) {
179     //=================== ITS parameters ============================
180     //
181
182     AliITSvPPRasymmFMD *ITS = new AliITSvPPRasymmFMD("ITS","ITS PPR");
183     ITS->SetMinorVersion(2);
184     ITS->SetReadDet(kTRUE);
185     ITS->SetThicknessDet1(200.);
186     ITS->SetThicknessDet2(200.);
187     ITS->SetThicknessChip1(200.);
188     ITS->SetThicknessChip2(200.);
189     ITS->SetRails(0);
190     ITS->SetCoolingFluid(1);
191     ITS->SetEUCLID(0);
192
193   }
194
195   if (iTPC) {
196     //============================ TPC parameters ================================
197     // --- This allows the user to specify sectors for the SLOW (TPC geometry 2)
198     // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
199     // --- sectors are specified, any value other than that requires at least one 
200     // --- sector (lower or upper)to be specified!
201     // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
202     // ---           sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
203     // --- SecLows - number of lower sectors specified (up to 6)
204     // --- SecUps - number of upper sectors specified (up to 12)
205     // --- Sens - sensitive strips for the Slow Simulator !!!
206     // --- This does NOT work if all S or L-sectors are specified, i.e.
207     // --- if SecAL or SecAU < 0
208     //
209     //
210     //-----------------------------------------------------------------------------
211
212     AliTPC *TPC  = new AliTPCv2("TPC","Default");
213     // All sectors included 
214     //TPC->SetSecAL(-1);
215     //TPC->SetSecAU(-1);
216
217   }
218
219   if (iTRD) {
220     //=================== TRD parameters ============================
221   
222     AliTRD *TRD  = new AliTRDv1("TRD","TRD slow simulator");
223     TRD->SetSensChamber(2);
224     TRD->SetSensSector(13);
225   
226     // Set to detailed display
227     TRD->SetDisplayType(1);
228
229     // Draw TR photons
230     TRD->SetDrawTR(1);
231
232     // Switch on TR
233     AliTRDsim *TRDsim = TRD->CreateTR();
234
235   }
236         
237 }