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