]> git.uio.no Git - u/mrichter/AliRoot.git/blob - AD/AliAD.cxx
Fixed compilation warnings (clang)
[u/mrichter/AliRoot.git] / AD / AliAD.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: AliAD.cxx  $ */
17
18 ///////////////////////////////////////////////////////////////////////////
19 //                                                                       //
20 //                  AD (ALICE Diffractive)  Detector                     //
21 //                                                                       //
22 //  This class contains the base procedures for the AD  detector         //
23 //  All comments should be sent to :                                     //
24 //                                                                       //
25 //                                                                       //
26 ///////////////////////////////////////////////////////////////////////////
27
28
29 // --- Standard libraries ---
30 #include <Riostream.h>
31 #include <stdlib.h>
32
33 // --- ROOT libraries ---
34 #include <TNamed.h>
35 #include "TROOT.h"
36 #include "TFile.h"
37 #include "TNetFile.h"
38 #include "TRandom.h"
39 #include "TTree.h"
40 #include "TBranch.h"
41 #include "TClonesArray.h"
42 #include "TGeoGlobalMagField.h"
43 #include "AliMagF.h"
44 #include "TStopwatch.h"
45 #include "TParameter.h"
46 #include "TF1.h"
47
48 // --- AliRoot header files ---
49 #include "AliRun.h"
50 #include "AliMC.h"
51 #include "AliAD.h"
52 #include "AliADhit.h"
53 #include "AliADLoader.h"
54 #include "AliADDigitizer.h"
55 #include "AliDigitizationInput.h"
56 #include "AliADdigit.h"
57 #include "AliADSDigit.h"
58 #include "AliDAQ.h"
59 #include "AliRawReader.h"
60 #include "AliCDBManager.h"
61 #include "AliCDBEntry.h"
62 #include "AliADReconstructor.h"
63
64 ClassImp(AliAD)
65  //__________________________________________________________________
66 AliAD::AliAD()
67    : AliDetector(),
68      fSetADAToInstalled(0),
69      fSetADCToInstalled(0)
70 {
71         /// Default Constructor
72     
73
74 }
75
76 //_____________________________________________________________________________
77 AliAD::AliAD(const char *name, const char *title)
78    : AliDetector(name,title),
79      fSetADAToInstalled(kTRUE),
80      fSetADCToInstalled(kTRUE)
81
82 {
83   
84    // Standard constructor for AD Detector
85   
86
87 }
88
89 //_____________________________________________________________________________
90 AliAD::~AliAD()
91 {
92    //
93    // Default destructor for AD Detector
94    //
95   
96 }
97
98 //_____________________________________________________________________________
99 void AliAD::CreateMaterials()
100 {
101    //
102    // MATERIALS FOR ADC AND ADA
103    //
104    
105    // Parameters for simulation scope for ADA and ADC (stolen from AliVZEROv7::CreateMaterials )
106    Int_t    fieldType       = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();     // Field type 
107    Double_t maxField        = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();       // Field max.
108    Double_t maxBending      = 10;    // Max Angle
109    Double_t maxStepSize     = 0.01;  // Max step size 
110    Double_t maxEnergyLoss   = 1;     // Max Delta E
111    Double_t precision       = 0.003; // Precision
112    Double_t minStepSize     = 0.003; // Minimum step size 
113    Float_t  density,  as[11], zs[11], ws[11];
114    Double_t radLength, absLength, a_ad, z_ad;
115    Int_t    id;
116    
117    //
118    // Parameters  for AD scintillator: NE-102 (BC400)
119    //
120    // NE-102, has the following properties : (from internet, need better reference)
121    //    Density : ca. 1.03 g/cm3
122    //    Electrons/cm3: 3.39 x 10^23
123    //    H atoms/cm3: 5.28 x 10^22
124    //    C atoms/cm3: 4.78 x 10^22
125    //    Ratio of H to C : 1.104 .
126    //    wavelength of emission : ~4.23 nm.
127    //    Decay time : ~2.4 ns.
128    //    Luminescent efficiency : typically 18% of NaI(Tl)
129    //    Photons/MeV: 2.5 x 10^4 
130    //
131    // H                // C 
132    as[0] = 1.00794;    as[1] = 12.011;
133    zs[0] = 1.;         zs[1] = 6.;
134    ws[0] = 5.23;       ws[1] = 4.74;
135    density = 1.032;
136    id      = 1;
137    AliMixture( id, "NE102", as, zs, density, -2, ws );
138    AliMedium( id, "NE102", id, 1, fieldType, maxField, maxBending, maxStepSize,
139               maxEnergyLoss, precision, minStepSize );
140
141    //
142    // Parameters for lightGuide:  
143    //     TODO check material 
144    // Should be Poly(methyl methacrylate) (PMMA) acrylic 
145    // (C5O2H8)n 
146    // Density  1.18 g/cm3
147    // Mixture PMMA    Aeff=12.3994 Zeff=6.23653 rho=1.18 radlen=34.0677 intlen=63.3073
148    // Element #0 : C  Z=  6.00 A= 12.01 w= 0.600 natoms=5
149    // Element #1 : H  Z=  1.00 A=  1.01 w= 0.081 natoms=8
150    // Element #2 : O  Z=  8.00 A= 16.00 w= 0.320 natoms=2
151
152    // Carbon          Hydrogen          Oxygen
153    as[0] = 12.0107;   as[1] = 1.00794;  as[2] = 15.9994;
154    zs[0] = 6.;        zs[1] = 1.;       zs[2] = 8.;
155    ws[0] = 0.60;      ws[1] = 0.081;    ws[2] = 0.32;
156    density = 1.18;
157    id      = 2;
158    AliMixture( id, "PMMA", as, zs, density, 3, ws );
159    AliMedium( id,"PMMA", id, 1, fieldType, maxField, maxBending, maxStepSize,
160               maxEnergyLoss, precision, minStepSize );
161
162    
163    // mu-metal
164    // Niquel          Iron              Molybdenum        Manganese
165    as[0] = 58.6934;   as[1] = 55.845;   as[2] = 95.94;    as[3] = 54.9380;  
166    zs[0] = 28.;       zs[1] = 26.;      zs[2] = 42.;      zs[3] = 25.;   
167    ws[0] = 0.802;     ws[1] = 0.14079;  ws[2] = 0.0485;   ws[3] = 0.005;
168    // Silicon         Chromium          Cobalt            Aluminium
169    as[4] = 28.0855;   as[5] = 51.9961;  as[6] = 58.9332;  as[7] = 26.981539;   
170    zs[4] = 14.;       zs[5] = 24.;      zs[6] = 27.;      zs[7] = 13.;   
171    ws[4] = 0.003;     ws[5] = 0.0002;   ws[6] = 0.0002;   ws[7] = 0.0001;
172    // Carbon          Phosphorus        Sulfur
173    as[8] = 12.0107;   as[9] = 30.97376; as[10] = 32.066;
174    zs[8] = 6.;        zs[9] = 15.;      zs[10] = 16.;
175    ws[8] = 0.00015;   ws[9] = 0.00005;  ws[10] = 0.00001;
176    density = 8.25;
177    id      = 3;
178    AliMixture( id, "MuMetal", as, zs, density, 11, ws );
179    AliMedium( id,"MuMetal", id, 1, fieldType, maxField, maxBending, maxStepSize,
180               maxEnergyLoss, precision, minStepSize );
181
182    // Parameters for ADCPMA: Aluminium
183    a_ad = 26.98; 
184    z_ad = 13.00;
185    density   = 2.7;
186    radLength = 8.9;
187    absLength = 37.2;
188    id = 4;
189    AliMaterial (id, "Alum",  a_ad, z_ad, density, radLength, absLength, 0, 0 );
190    AliMedium( id, "Alum", id, 1, fieldType, maxField, maxBending, maxStepSize,
191               maxEnergyLoss, precision, minStepSize );
192
193    // Parameters for ADCPMG: Glass for the simulation Aluminium 
194    // TODO fix material
195    a_ad = 26.98; 
196    z_ad = 13.00;
197    density   = 2.7;
198    radLength = 8.9;
199    absLength = 37.2;
200    id = 5;
201    AliMaterial( id, "Glass",  a_ad, z_ad, density, radLength, absLength, 0, 0 );
202    AliMedium( id, "Glass", id, 1, fieldType, maxField, maxBending, maxStepSize,
203               maxEnergyLoss, precision, minStepSize );
204
205
206 }
207 //_____________________________________________________________________________
208 void AliAD::SetTreeAddress()
209 {
210    //
211    // Sets tree address for hits.
212    //
213
214         TBranch *branch;
215         char branchname[20];
216         snprintf(branchname,19,"%s",GetName());
217         // Branch address for hit tree
218         TTree *treeH = fLoader->TreeH();
219         if (treeH ) 
220         {
221                 branch = treeH->GetBranch(branchname);
222                 if (branch) branch->SetAddress(&fHits);
223         }
224 }
225
226
227 //_____________________________________________________________________________
228 void AliAD::MakeBranch(Option_t* opt)
229 {
230         const char* oH = strstr(opt,"H");
231         if (fLoader->TreeH() && oH && (fHits==0x0))
232         {
233                 fHits = new TClonesArray("AliADhit",1000);
234                 fNhits = 0;
235         }
236         AliDetector::MakeBranch(opt);
237 }
238 //_____________________________________________________________________________
239 AliLoader* AliAD::MakeLoader(const char* topfoldername)
240
241  
242    AliDebug(1,Form("Creating AliADLoader, Top folder is %s ",topfoldername));
243    fLoader = new AliADLoader(GetName(),topfoldername);
244    return fLoader;
245 }
246
247 //_____________________________________________________________________________
248 AliDigitizer* AliAD::CreateDigitizer(AliDigitizationInput* digInput) const
249 {
250    //
251    // Creates a digitizer for AD
252    //
253    return new AliADDigitizer(digInput);
254 }
255
256 //_____________________________________________________________________________
257
258 void AliAD::Digits2Raw()
259 {
260         // produces raw data from digits
261         // for AD not implemented yet (needs detailed hardware info)
262 }
263
264 //_____________________________________________________________________________
265
266 Bool_t AliAD::Raw2SDigits(AliRawReader* /*rawReader*/)
267 {
268         // reads raw data to produce digits
269         // for AD not implemented yet (needs detailed hardware info)
270         return kTRUE;
271 }