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