Updated geometries, bug fixes in SSD cone.
[u/mrichter/AliRoot.git] / CRT / AliCRT.cxx
CommitLineData
fb7a1f55 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
88cb7938 16/* $Id$ */
fb7a1f55 17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// Cosmic Rays ALICE Trigger //
21// This class contains the basic functions for the Cosmic Ray ALICE //
22// detector. Functions specific to one particular geometry are //
23// contained in the derived classes //
24//
25// Begin_Html
26/*
27<img src="picts/AliCRTClass.gif">
28</pre>
29<p>The responsible person for this module is
30<a href="mailto:Enrique.Gamez.Flores@cern.ch">Enrique Gamez Flores</a>.
31</font>
32<pre>
33*/
34//End_Html
35//
36//
37// //
38///////////////////////////////////////////////////////////////////////////////
39
fb7a1f55 40#include <TTree.h>
88cb7938 41#include <TVirtualMC.h>
fb7a1f55 42
43#include "AliCRT.h"
44#include "AliCRTConstants.h"
fb7a1f55 45#include "AliCRThit.h"
88cb7938 46#include "AliLoader.h"
47#include "AliMagF.h"
48#include "AliRun.h"
fb7a1f55 49
50ClassImp(AliCRT)
51
fb7a1f55 52//_____________________________________________________________________________
53AliCRT::AliCRT()
54{
55 //
d2293f45 56 // Default constructor for the CRT
fb7a1f55 57 //
58
d2293f45 59 fIshunt = 0;
fb7a1f55 60 fHits = 0;
d2293f45 61
fb7a1f55 62}
63
64//_____________________________________________________________________________
65AliCRT::AliCRT(const char *name, const char *title)
66 : AliDetector(name,title)
67{
68 //
69 // Standard constructor for the CRT module
70 //
71
72 fIshunt = 1; // All hits are associated with primary particles
73
74 fHits = new TClonesArray("AliCRThit",400) ;
fb7a1f55 75
76 gAlice->AddHitList(fHits);
77
78 SetMarkerColor(7);
79 SetMarkerStyle(2);
80 SetMarkerSize(0.4);
81
82}
83
d2293f45 84//_____________________________________________________________________________
85AliCRT::AliCRT(const AliCRT& crt)
86{
87 //
88 // Copy ctor.
89 //
90 crt.Copy(*this);
91}
92
93//_____________________________________________________________________________
94AliCRT& AliCRT::operator= (const AliCRT& crt)
95{
96 //
97 // Asingment operator.
98 //
99 crt.Copy(*this);
100 return *this;
101}
102
fb7a1f55 103//_____________________________________________________________________________
104AliCRT::~AliCRT()
105{
106 //
107 // Standar destructor.
108 //
109 if (fHits) {
110 fHits->Delete();
111 delete fHits;
112 }
113}
114
115//_____________________________________________________________________________
116void AliCRT::AddHit(Int_t track, Int_t *vol, Float_t *hits)
117{
118 //
119 // Add a CRT hit
120 //
121 TClonesArray &lhits = *fHits;
122 new(lhits[fNhits++]) AliCRThit(fIshunt,track,vol,hits);
123}
124
125//_____________________________________________________________________________
126void AliCRT::AddDigit(Int_t *tracks,Int_t *digits)
127{
d2293f45 128 //
fb7a1f55 129 // Add a CRT digit to the list. Dummy function.
d2293f45 130 //
fb7a1f55 131}
132
133//_____________________________________________________________________________
134void AliCRT::Init() const
135{
136 //
137 // Initialise ...
138 //
139
140 Int_t i;
141 //
142 if(fDebug) {
143 printf("\n%s: ",ClassName());
144 for(i=0;i<35;i++) printf("*");
145 printf(" CRT_INIT ");
146 for(i=0;i<35;i++) printf("*");
147 printf("\n%s: ",ClassName());
148 //
149 // Here the CRT initialisation code (if any!)
150 for(i=0;i<80;i++) printf("*");
151 printf("\n");
152 }
153}
154
155//_____________________________________________________________________________
d2293f45 156void AliCRT::ResetHits()
fb7a1f55 157{
158 // Reset number of clusters and the cluster array for this detector
d2293f45 159 AliDetector::ResetHits();
fb7a1f55 160}
161
162//_____________________________________________________________________________
d2293f45 163void AliCRT::ResetDigits()
fb7a1f55 164{
165 //
166 // Reset number of digits and the digits array for this detector
d2293f45 167 AliDetector::ResetDigits();
fb7a1f55 168}
169
170//____________________________________________________________________________
171void AliCRT::FinishEvent()
172{
173// do nothing
174}
175
176//_____________________________________________________________________________
177void AliCRT::BuildGeometry()
178{
179 //
180 // Build simple ROOT TNode geometry for event display
181 //
182}
183
184//_____________________________________________________________________________
185void AliCRT::CreateGeometry()
186{
187 //
188 // Build simple ROOT TNode geometry for GEANT simulations
189 //
190}
191
192//_____________________________________________________________________________
193void AliCRT::CreateMaterials()
194{
195 // Magnatic field inside the pit
196 Int_t isxfld = gAlice->Field()->Integ();
197 Float_t sxmgmx = gAlice->Field()->Max();
198
199 //Magnetic field above the Magnet.
200 Int_t xfield = 0; // no Magnetic field.
201 Float_t xfieldm = 0;
202 Float_t xepsil = 0.1; // Tracking precission in cm. obove the pit
203
204 // --- Define the various materials for GEANT ---
fb7a1f55 205 Float_t epsil, stmin, tmaxfd, deemax, stemax;
206 //
207 // Aluminum
208 AliMaterial(9, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
209 AliMaterial(29, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
210 AliMaterial(49, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
211 //
212 // Iron
213 AliMaterial(10, "IRON$ ", 55.85, 26., 7.87, 1.76, 17.1);
214 AliMaterial(30, "IRON$ ", 55.85, 26., 7.87, 1.76, 17.1);
215 AliMaterial(50, "IRON$ ", 55.85, 26., 7.87, 1.76, 17.1);
216 //
217 // Air
218 AliMaterial(15, "AIR$ ", 14.61, 7.3, .001205, 30423.24, 67500.);
219 AliMaterial(35, "AIR$ ", 14.61, 7.3, .001205, 30423.24, 67500.);
220 AliMaterial(55, "AIR$ ", 14.61, 7.3, .001205, 30423.24, 67500.);
d2293f45 221 AliMaterial(75, "AIR$ ", 14.61, 7.3, .001205, 30423.24, 67500.);
222 AliMaterial(95, "AIR$ ", 14.61, 7.3, .001205, 30423.24, 67500.);
223
fb7a1f55 224
225 // Scintillator material polystyrene
226 Float_t aP[2] = {12.011, 1.00794};
227 Float_t zP[2] = {6.0, 1.0};
228 Float_t wP[2] = {1.0, 1.0};
229 Float_t dP = 1.032;
2c3b33cd 230 AliMixture(13, "Polystyrene$", aP, zP, dP, -2, wP);
c8a19f01 231 // Subalpine Molasse over the ALICE hall.
2c3b33cd 232 Float_t aMolasse[10] = { 1., 12.01, 15.994, 22.99, 24.305, 26.98, 28.086, 39.1, 40.08, 55.85 };
c8a19f01 233 Float_t zMolasse[10] = {1., 6., 8., 11., 12., 13., 14., 19., 20., 26.};
2c3b33cd 234 Float_t wMolasse[10] = {0.008, 0.043, 0.485, 0.007, 0.042, 0.037, 0.215, 0.023, 0.1, 0.04};
c8a19f01 235 Float_t dMolasse = 2.40;
2c3b33cd 236 AliMixture(24, "Molasse$", aMolasse, zMolasse, dMolasse, 10, wMolasse);
fb7a1f55 237
238 // ****************
239 // Defines tracking media parameters.
240 // Les valeurs sont commentees pour laisser le defaut
241 // a GEANT (version 3-21, page CONS200), f.m.
242 epsil = .001; // Tracking precision, Inside the pit
243 stemax = -1.; // Maximum displacement for multiple scattering
244 tmaxfd = -20.; // Maximum angle due to field deflection
245 deemax = -.3; // Maximum fractional energy loss, DLS
246 stmin = -.8;
247 // ***************
248
d2293f45 249 Float_t atmaxfd = 10.;
250 Float_t adeemax = -0.1;
251 Float_t aepsil = 0.1;
252 Float_t astmin = -10.;
253
fb7a1f55 254 //
255 // Aluminum
256 AliMedium(9, "ALU_C0 ", 9, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
257 AliMedium(29, "ALU_C1 ", 29, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
258 AliMedium(49, "ALU_C2 ", 49, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
259 //
260 // Iron
261 AliMedium(10, "FE_C0 ", 10, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
262 AliMedium(30, "FE_C1 ", 30, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
263 AliMedium(50, "FE_C2 ", 50, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
264 //
265 // Air
d2293f45 266 AliMedium(15, "AIR_C0 ", 15, 0, isxfld, sxmgmx, atmaxfd, stemax, adeemax, aepsil, astmin);
267 AliMedium(35, "AIR_C1 ", 35, 0, isxfld, sxmgmx, atmaxfd, stemax, adeemax, aepsil, astmin);
268 AliMedium(55, "AIR_C2 ", 55, 0, isxfld, sxmgmx, atmaxfd, stemax, adeemax, aepsil, astmin);
269 AliMedium(75, "AIR_C4 ", 75, 0, isxfld, sxmgmx, atmaxfd, stemax, adeemax, aepsil, astmin);
270 AliMedium(75, "AIR_C5 ", 95, 0, isxfld, sxmgmx, atmaxfd, stemax, adeemax, aepsil, astmin);
271
fb7a1f55 272
273
274 // The scintillator of the CPV made of Polystyrene
2c3b33cd 275 // scintillator -> idtmed[1112]
276 AliMedium(13 , "CPV scint. ", 13, 1, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
fb7a1f55 277
2c3b33cd 278 // Molasse -> idtmed[1123]
279 AliMedium(24 , "Molasse ", 24, 0, xfield, xfieldm, tmaxfd, stemax, deemax, xepsil, stmin);
fb7a1f55 280
d2293f45 281 // Concrete, in case if we need to put hte shafts by ourselves.
fb7a1f55 282
d2293f45 283 Float_t aconc[10] = { 1.,12.01,15.994,22.99,24.305,26.98,28.086,39.1,40.08,55.85 };
284 Float_t zconc[10] = { 1.,6.,8.,11.,12.,13.,14.,19.,20.,26. };
285 Float_t wconc[10] = { .01,.001,.529107,.016,.002,.033872,.337021,.013,.044,.014 };
286
287 AliMixture(17, "CONCRETE$", aconc, zconc, 2.35, 10, wconc);
288 // Concrete
289 AliMedium(17, "CC_C0 ", 17, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
fb7a1f55 290
d2293f45 291}
292/*
fb7a1f55 293//_____________________________________________________________________________
294void AliCRT::MakeBranch(Option_t* option, const char *file)
295{
296 //
297 // Specific CRT branches
298 //
299 // Create Tree branches for the CRT.
300 Int_t buffersize = 400;
301 char branchname[10];
302 sprintf(branchname,"%s",GetName());
303
304 AliDetector::MakeBranch(option,file);
305
306 const char *cD = strstr(option,"D");
307
308 if (cD) {
309 digits = new AliCRTdigit();
310 MakeBranchInTree(gAlice->TreeD(), branchname, "AliCRTdigit",
311 digits, buffersize, 1, file);
312 }
313
314}
d2293f45 315*/
fb7a1f55 316//_____________________________________________________________________________
d2293f45 317void AliCRT::SetTreeAddress()
318{
319
320 TBranch *branch;
321 char branchname[20];
322 sprintf(branchname,"%s",GetName());
323
324 // Branch address for hit tree
88cb7938 325 TTree *treeH = fLoader->TreeH();
d2293f45 326 if (treeH && fHits) {
327 branch = treeH->GetBranch(branchname);
328 if (branch) branch->SetAddress(&fHits);
329 }
330
331}