]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ZDC/AliZDC.cxx
Initialise static variable sRandom in constructor: sRandom = fRandom;
[u/mrichter/AliRoot.git] / ZDC / AliZDC.cxx
CommitLineData
4c039060 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$
f901045b 18Revision 1.10 2000/11/22 11:32:58 coppedis
19Major code revision
20
866ab5a2 21Revision 1.9 2000/10/02 21:28:20 fca
22Removal of useless dependecies via forward declarations
23
94de3818 24Revision 1.8 2000/07/10 13:58:01 fca
25New version of ZDC from E.Scomparin & C.Oppedisano
26
68ca986e 27Revision 1.7 2000/01/19 17:17:40 fca
28
1cedd08a 29Revision 1.6 1999/09/29 09:24:35 fca
30Introduction of the Copyright and cvs Log
31
4c039060 32*/
33
fe4da5cc 34///////////////////////////////////////////////////////////////////////////////
35// //
36// Zero Degree Calorimeter //
f901045b 37// This class contains the basic functions for the ZDCs //
38// Functions specific to one particular geometry are //
fe4da5cc 39// contained in the derived classes //
40// //
fe4da5cc 41///////////////////////////////////////////////////////////////////////////////
42
f901045b 43// --- ROOT system
fe4da5cc 44#include <TBRIK.h>
45#include <TNode.h>
94de3818 46#include "TGeometry.h"
fe4da5cc 47
f901045b 48// --- AliRoot header files
fe4da5cc 49#include "AliZDC.h"
f901045b 50#include "AliZDCHit.h"
fe4da5cc 51#include "AliRun.h"
f901045b 52#include "AliDetector.h"
fe4da5cc 53#include "AliCallf77.h"
54#include "AliConst.h"
55#include "AliMC.h"
56
fe4da5cc 57
58ClassImp(AliZDC)
59
60//_____________________________________________________________________________
61AliZDC::AliZDC()
62{
63 //
64 // Default constructor for the Zero Degree Calorimeter base class
65 //
68ca986e 66 fIshunt = 1;
f901045b 67
68ca986e 68 fHits = 0;
f901045b 69 fNhits = 0;
70
71 fStHits = 0;
72 fNStHits = 0;
73
74 fNPrimaryHits = 0;
fe4da5cc 75}
76
77//_____________________________________________________________________________
78AliZDC::AliZDC(const char *name, const char *title)
79 : AliDetector(name,title)
80{
81 //
82 // Standard constructor for the Zero Degree Calorimeter base class
83 //
84
85 //
86 // Allocate the array of hits
f901045b 87
88 fHits = new TClonesArray("AliZDCHit",1000);
1cedd08a 89 gAlice->AddHitList(fHits);
fe4da5cc 90
f901045b 91 fStHits = new TClonesArray("AliZDCHit",1000);
92
93 fNStHits = 0;
94
95 fNPrimaryHits = 0;
96
68ca986e 97 fIshunt = 1;
98
99 fDimZN[0] = 3.52;
100 fDimZN[1] = 3.52;
101 fDimZN[2] = 50.;
102 fDimZP[0] = 11.2;
103 fDimZP[1] = 6.;
104 fDimZP[2] = 75.;
105 fPosZN[0] = 0.;
106 fPosZN[1] = 0.;
107 fPosZN[2] = 11650.;
108 fPosZP[0] = -23.;
109 fPosZP[1] = 0.;
110 fPosZP[2] = 11600.;
111 fFibZN[0] = 0.;
112 fFibZN[1] = 0.01825;
113 fFibZN[2] = 50.;
114 fFibZP[0] = 0.;
115 fFibZP[1] = 0.0275;
116 fFibZP[2] = 75.;
117 fGrvZN[0] = 0.03;
118 fGrvZN[1] = 0.03;
119 fGrvZN[2] = 50.;
120 fGrvZP[0] = 0.04;
121 fGrvZP[1] = 0.04;
122 fGrvZP[2] = 75.;
123 fDivZN[0] = 11;
124 fDivZN[1] = 11;
125 fDivZN[2] = 0;
126 fDivZP[0] = 7;
127 fDivZP[1] = 15;
128 fDivZP[2] = 0;
129 fTowZN[0] = 2;
130 fTowZN[1] = 2;
131 fTowZP[0] = 4;
132 fTowZP[1] = 1;
866ab5a2 133
134 // EM Calorimeter
135 fDimZEMPb = 0.15*(TMath::Sqrt(2.));
136 fDimZEMAir = 0.001;
137 fFibRadZEM = 0.0315;
138 fDivZEM[0] = 92;
139 fDivZEM[1] = 0;
140 fDivZEM[2] = 20;
141 fDimZEM[0] = 2*fDivZEM[2]*(fDimZEMPb+fDimZEMAir+fFibRadZEM*(TMath::Sqrt(2.)));
142 fDimZEM[1] = 3.5;
143 fDimZEM[2] = 3.5;
144 fDimZEM[3] = 45.;
145 fDimZEM[4] = 0.;
146 fDimZEM[5] = 0.;
147 fFibZEM[0] = 0.;
148 fFibZEM[1] = 0.0275;
149 fFibZEM[2] = fDimZEM[2]/TMath::Sin(fDimZEM[3]*kDegrad)-fFibRadZEM;
150 fPosZEM[0] = 0.;
151 fPosZEM[1] = 5.8;
152 fPosZEM[2] = 11600.;
153
154}
155//____________________________________________________________________________
156AliZDC::~AliZDC()
157{
158 //
159 // ZDC destructor
160 //
161
162 fIshunt = 0;
163 delete fHits;
f901045b 164 if(fStHits){
165 fStHits->Delete();
166 delete fStHits;
167 fNStHits = 0;
168 }
169 delete fDigits;
fe4da5cc 170}
fe4da5cc 171//_____________________________________________________________________________
172void AliZDC::AddHit(Int_t track, Int_t *vol, Float_t *hits)
173{
174 //
f901045b 175 // Add a ZDC hit to the hit list.
176 // -> We make use of 2 array of hits:
177 // [1] fHits (the usual one) that contains hits for each PRIMARY
178 // [2] fStHits that contains hits for each EVENT and is used to
179 // obtain digits at the end of each event
fe4da5cc 180 //
f901045b 181
68ca986e 182 static Float_t primKinEn, xImpact, yImpact, sFlag;
183
f901045b 184 TClonesArray &lsthits = *fStHits;
fe4da5cc 185 TClonesArray &lhits = *fHits;
68ca986e 186
f901045b 187
188 AliZDCHit *newquad, *curevquad, *curprimquad;
189 newquad = new AliZDCHit(fIshunt, track, vol, hits);
190
191 Int_t i,j,kStHit = 1;
192 for(i=0; i<fNStHits; i++){
193 // If the hits are equal (same track, same volume), sum them.
194 curevquad = (AliZDCHit*) lsthits[i];
195 kStHit = 1;
196 if(*curevquad == *newquad){
197 *curevquad = *curevquad+*newquad;
198 kStHit = 0;
199 }
200 }
201
202 for(j=0; j<fNhits; j++){
68ca986e 203 // If the hits are equal (same track, same volume), sum them.
f901045b 204 curprimquad = (AliZDCHit*) lhits[j];
205 if(*curprimquad == *newquad){
206 *curprimquad = *curprimquad+*newquad;
207 delete newquad;
68ca986e 208 return;
f901045b 209 }
210 }
211
212 if(fNhits==0){
68ca986e 213 // First hit -> setting flag for primary or secondary particle
214 Int_t primary = gAlice->GetPrimary(track);
215 if(track != primary){
216 newquad->fSFlag = 1; // Hit created by secondary particle entering the ZDC
217 }
218 else if(track == primary){
219 newquad->fSFlag = 0; // Hit created by PRIMARY particle entering the ZDC
220 }
f901045b 221 fNPrimaryHits = fNPrimaryHits + 1;
68ca986e 222 sFlag = newquad->fSFlag;
223 primKinEn = newquad->fPrimKinEn;
224 xImpact = newquad->fXImpact;
225 yImpact = newquad->fYImpact;
226 }
227 else{
228 newquad->fPrimKinEn = primKinEn;
229 newquad->fXImpact = xImpact;
230 newquad->fYImpact = yImpact;
231 newquad->fSFlag = sFlag;
232 }
f901045b 233
234 //Otherwise create a new hit
235 new(lhits[fNhits]) AliZDCHit(newquad);
236 fNhits++;
237
238 if(kStHit){
239 new(lsthits[fNStHits]) AliZDCHit(newquad);
240 fNStHits++;
241 }
242
243// printf("\nPrimary Hits --------------------------------------------------------\n");
68ca986e 244// fHits->Print("");
f901045b 245// printf("\n Event Hits --------------------------------------------------------\n");
246// fStHits->Print("");
247
866ab5a2 248 delete newquad;
249 }
68ca986e 250
866ab5a2 251//_____________________________________________________________________________
252void AliZDC::ResetHits()
253{
254 //
255 // Reset number of hits and the hits array
256 //
f901045b 257
258// fStHits->Clear();
259// fNStHits = 0;
260
866ab5a2 261 AliDetector::ResetHits();
fe4da5cc 262}
f901045b 263
264//_____________________________________________________________________________
265void AliZDC::ResetDigits()
266{
267 //
268 // Reset number of digits and the digits array
269 //
270
271 AliDetector::ResetDigits();
272 if(fStHits){
273 fStHits->Delete();
274 fNStHits = 0;
275 }
276}
277
fe4da5cc 278//_____________________________________________________________________________
279void AliZDC::BuildGeometry()
280{
281 //
282 // Build the ROOT TNode geometry for event display
283 // in the Zero Degree Calorimeter
284 // This routine is dummy for the moment
285 //
286
68ca986e 287 TNode *node, *top;
288 TBRIK *brik;
289 const int kColorZDC = kRed;
fe4da5cc 290
291 //
68ca986e 292 top=gAlice->GetGeometry()->GetNode("alice");
fe4da5cc 293
294 // ZDC
fe4da5cc 295 brik = new TBRIK("S_ZDC","ZDC box","void",300,300,5);
68ca986e 296 top->cd();
297 node = new TNode("ZDC","ZDC","S_ZDC",0,0,600,"");
298 node->SetLineColor(kColorZDC);
299 fNodes->Add(node);
fe4da5cc 300}
301
302//_____________________________________________________________________________
303Int_t AliZDC::DistancetoPrimitive(Int_t , Int_t )
304{
305 //
306 // Distance from the mouse to the Zero Degree Calorimeter
307 // Dummy routine
308 //
309 return 9999;
310}
311
fe4da5cc 312//_____________________________________________________________________________
313void AliZDC::StepManager()
314{
315 //
316 // Routine called at every step in the Zero Degree Calorimeter
fe4da5cc 317 //
fe4da5cc 318}