]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCAL.cxx
Several pointers were set to zero in the default constructors to avoid memory managem...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCAL.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 /* $Id$ */
17
18 //_________________________________________________________________________
19 // Base Class for EMCAL description:
20 //    
21 // 
22 //*-- Author: Yves Schutz (SUBATECH) 
23 //////////////////////////////////////////////////////////////////////////////
24
25 // --- Standard library ---
26 #include <strstream.h>
27
28 // --- ROOT system ---
29 #include "TBranch.h" 
30 #include "TClonesArray.h" 
31 #include "TTree.h" 
32
33 // --- AliRoot header files ---
34
35 #include "AliEMCAL.h"
36 #include "AliEMCALGeometry.h"
37 #include "AliMC.h"
38 #include "AliRun.h"
39 #include "AliMagF.h"
40
41 ClassImp(AliEMCAL)
42
43 //____________________________________________________________________________
44 AliEMCAL::AliEMCAL():AliDetector()
45 {
46   // ctor 
47   //We do not create objects, because these pointers will be overwritten during reading from file.
48   fGeom = 0;
49   fSDigits       = 0 ;
50   fDigits = 0;
51 }
52 //____________________________________________________________________________
53 AliEMCAL::AliEMCAL(const char* name, const char* title): AliDetector(name,title) 
54 {
55   // ctor : title is used to identify the layout
56   
57   // gets an instance of the geometry parameters class  
58  
59   if (strcmp(GetTitle(),"") != 0 ) 
60     fGeom =  AliEMCALGeometry::GetInstance(GetTitle(), "") ; 
61 }
62 //____________________________________________________________________________
63 AliEMCAL::~AliEMCAL()
64 {
65   // dtor
66
67 }
68
69 //____________________________________________________________________________
70 void AliEMCAL::CreateMaterials()
71 {
72   // Definitions of materials to build EMCAL and associated tracking media.
73   // media number in idtmed are 1599 to 1698.
74
75   // --- Air ---
76   AliMaterial(0, "Air$", 14.61, 7.3, 0.001205, 30420., 67500., 0, 0) ;
77
78   // --- Lead ---                                                                     
79   AliMaterial(1, "Pb$", 207.2, 82, 11.35, 0.56, 0., 0, 0) ;
80
81   // --- Average properties of the active material ---                                                                     
82   AliMaterial(2, "EmcalMat$", fGeom->GetAmat(), 
83                               fGeom->GetZmat(),
84                               fGeom->GetDmat(),
85                               fGeom->GetRmat(), 
86                               0) ;
87
88   // DEFINITION OF THE TRACKING MEDIA
89
90   // for EMCAL: idtmed[1599->1698] equivalent to fIdtmed[0->100]
91   Int_t * idtmed = fIdtmed->GetArray() - 1599 ; 
92   Int_t   isxfld = gAlice->Field()->Integ() ;
93   Float_t sxmgmx = gAlice->Field()->Max() ;
94
95    // Air                                                                           -> idtmed[1599] 
96   AliMedium(0, "Air          $", 0, 0,
97              isxfld, sxmgmx, 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
98
99   // The Lead                                                                       -> idtmed[1600]
100  
101   AliMedium(1, "Lead      $", 1, 0,
102              isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
103
104   // The Average properties of the active material                                  -> idtmed[1601]
105
106   AliMedium(2, "EmcalMat  $", 2, 0,
107              isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
108
109  // --- Set decent energy thresholds for gamma and electron tracking
110
111   // Tracking threshold for photons and electrons in Lead 
112   gMC->Gstpar(idtmed[1600], "CUTGAM",0.5E-4) ; 
113   gMC->Gstpar(idtmed[1600], "CUTELE",1.0E-4) ;
114   gMC->Gstpar(idtmed[1601], "CUTGAM",0.5E-4) ; 
115   gMC->Gstpar(idtmed[1601], "CUTELE",1.0E-4) ;
116
117   // --- Generate explicitly delta rays in Lead ---
118   gMC->Gstpar(idtmed[1600], "LOSS",3.) ;
119   gMC->Gstpar(idtmed[1600], "DRAY",1.) ;
120   gMC->Gstpar(idtmed[1601], "LOSS",3.) ;
121   gMC->Gstpar(idtmed[1601], "DRAY",1.) ;
122  
123 }
124 //____________________________________________________________________________
125 void AliEMCAL::SetTreeAddress()
126
127
128   TBranch *branch;
129   char branchname[20];
130   sprintf(branchname,"%s",GetName());
131   
132   // Branch address for hit tree
133   TTree *treeH = gAlice->TreeH();
134   if (treeH && fHits) {
135     branch = treeH->GetBranch(branchname);
136     if (branch) branch->SetAddress(&fHits);
137   }
138  
139   // Branch address for digit tree
140   TTree *treeD = gAlice->TreeD();
141   
142   if(fDigits)
143     fDigits->Clear();
144
145   if (treeD && fDigits) {
146     branch = treeD->GetBranch(branchname);
147     if (branch) branch->SetAddress(&fDigits);
148   }
149
150   if(fSDigits)
151     fSDigits->Clear();
152
153   if (gAlice->TreeS()  && fSDigits ) {
154     branch = gAlice->TreeS()->GetBranch("EMCAL");
155     if (branch) branch->SetAddress(&fSDigits) ;
156   } 
157 }
158
159