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