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