]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ZDC/AliZDC.cxx
New field map for the ZDC
[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$
94de3818 18Revision 1.8 2000/07/10 13:58:01 fca
19New version of ZDC from E.Scomparin & C.Oppedisano
20
68ca986e 21Revision 1.7 2000/01/19 17:17:40 fca
22
1cedd08a 23Revision 1.6 1999/09/29 09:24:35 fca
24Introduction of the Copyright and cvs Log
25
4c039060 26*/
27
fe4da5cc 28///////////////////////////////////////////////////////////////////////////////
29// //
30// Zero Degree Calorimeter //
31// This class contains the basic functions for the Time Of Flight //
32// detector. Functions specific to one particular geometry are //
33// contained in the derived classes //
34// //
fe4da5cc 35///////////////////////////////////////////////////////////////////////////////
36
37#include <TBRIK.h>
38#include <TNode.h>
94de3818 39#include "TGeometry.h"
fe4da5cc 40
41#include "AliZDC.h"
42#include "AliRun.h"
43#include "AliCallf77.h"
44#include "AliConst.h"
45#include "AliMC.h"
46
fe4da5cc 47
48ClassImp(AliZDC)
49
50//_____________________________________________________________________________
51AliZDC::AliZDC()
52{
53 //
54 // Default constructor for the Zero Degree Calorimeter base class
55 //
68ca986e 56 fIshunt = 1;
57 fHits = 0;
fe4da5cc 58}
59
60//_____________________________________________________________________________
61AliZDC::AliZDC(const char *name, const char *title)
62 : AliDetector(name,title)
63{
64 //
65 // Standard constructor for the Zero Degree Calorimeter base class
66 //
67
68 //
69 // Allocate the array of hits
70 fHits = new TClonesArray("AliZDChit", 405);
1cedd08a 71 gAlice->AddHitList(fHits);
fe4da5cc 72
68ca986e 73 fIshunt = 1;
74
75 fDimZN[0] = 3.52;
76 fDimZN[1] = 3.52;
77 fDimZN[2] = 50.;
78 fDimZP[0] = 11.2;
79 fDimZP[1] = 6.;
80 fDimZP[2] = 75.;
81 fPosZN[0] = 0.;
82 fPosZN[1] = 0.;
83 fPosZN[2] = 11650.;
84 fPosZP[0] = -23.;
85 fPosZP[1] = 0.;
86 fPosZP[2] = 11600.;
87 fFibZN[0] = 0.;
88 fFibZN[1] = 0.01825;
89 fFibZN[2] = 50.;
90 fFibZP[0] = 0.;
91 fFibZP[1] = 0.0275;
92 fFibZP[2] = 75.;
93 fGrvZN[0] = 0.03;
94 fGrvZN[1] = 0.03;
95 fGrvZN[2] = 50.;
96 fGrvZP[0] = 0.04;
97 fGrvZP[1] = 0.04;
98 fGrvZP[2] = 75.;
99 fDivZN[0] = 11;
100 fDivZN[1] = 11;
101 fDivZN[2] = 0;
102 fDivZP[0] = 7;
103 fDivZP[1] = 15;
104 fDivZP[2] = 0;
105 fTowZN[0] = 2;
106 fTowZN[1] = 2;
107 fTowZP[0] = 4;
108 fTowZP[1] = 1;
fe4da5cc 109}
110
111//_____________________________________________________________________________
112void AliZDC::AddHit(Int_t track, Int_t *vol, Float_t *hits)
113{
114 //
68ca986e 115 // Add a ZDC hit
fe4da5cc 116 //
68ca986e 117 static Float_t primKinEn, xImpact, yImpact, sFlag;
118
fe4da5cc 119 TClonesArray &lhits = *fHits;
68ca986e 120
121 AliZDChit *newquad, *curquad;
122 newquad = new AliZDChit(fIshunt, track, vol, hits);
123 Int_t i;
124 for(i=0; i<fNhits; i++){
125 // If the hits are equal (same track, same volume), sum them.
126 curquad=(AliZDChit*) lhits[i];
127 if(*curquad==*newquad){
128 *curquad = *curquad+*newquad;
129 delete newquad;
130// fHits->Print("");
131 return;
132 }
133 }
134
135 //Otherwise create a new hit.
136 if(fNhits==0){
137 // First hit -> setting flag for primary or secondary particle
138 Int_t primary = gAlice->GetPrimary(track);
139 if(track != primary){
140 newquad->fSFlag = 1; // Hit created by secondary particle entering the ZDC
141 }
142 else if(track == primary){
143 newquad->fSFlag = 0; // Hit created by PRIMARY particle entering the ZDC
144 }
145 sFlag = newquad->fSFlag;
146 primKinEn = newquad->fPrimKinEn;
147 xImpact = newquad->fXImpact;
148 yImpact = newquad->fYImpact;
149 }
150 else{
151 newquad->fPrimKinEn = primKinEn;
152 newquad->fXImpact = xImpact;
153 newquad->fYImpact = yImpact;
154 newquad->fSFlag = sFlag;
155 }
156 new(lhits[fNhits++]) AliZDChit(newquad);
157 if(fNhits==1) {
158// Int_t Curtrack = gAlice->CurrentTrack();
159// Int_t Prim = gAlice->GetPrimary(Curtrack);
160// printf (" Primary track: %d, Current track: %d \n",
161// Prim, Curtrack);
162// fHits->Print("");
163 }
164 delete newquad;
165// fHits->Print("");
166
fe4da5cc 167}
68ca986e 168
fe4da5cc 169//_____________________________________________________________________________
170void AliZDC::BuildGeometry()
171{
172 //
173 // Build the ROOT TNode geometry for event display
174 // in the Zero Degree Calorimeter
175 // This routine is dummy for the moment
176 //
177
68ca986e 178 TNode *node, *top;
179 TBRIK *brik;
180 const int kColorZDC = kRed;
fe4da5cc 181
182 //
68ca986e 183 top=gAlice->GetGeometry()->GetNode("alice");
fe4da5cc 184
185 // ZDC
fe4da5cc 186 brik = new TBRIK("S_ZDC","ZDC box","void",300,300,5);
68ca986e 187 top->cd();
188 node = new TNode("ZDC","ZDC","S_ZDC",0,0,600,"");
189 node->SetLineColor(kColorZDC);
190 fNodes->Add(node);
fe4da5cc 191}
192
193//_____________________________________________________________________________
194Int_t AliZDC::DistancetoPrimitive(Int_t , Int_t )
195{
196 //
197 // Distance from the mouse to the Zero Degree Calorimeter
198 // Dummy routine
199 //
200 return 9999;
201}
202
fe4da5cc 203//_____________________________________________________________________________
204void AliZDC::StepManager()
205{
206 //
207 // Routine called at every step in the Zero Degree Calorimeter
fe4da5cc 208 //
fe4da5cc 209}
210
211ClassImp(AliZDChit)
212
213//_____________________________________________________________________________
214AliZDChit::AliZDChit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
215 AliHit(shunt, track)
216{
217 //
68ca986e 218 // Add a ZDC hit
fe4da5cc 219 //
220 Int_t i;
68ca986e 221 for(i=0; i<2; i++) fVolume[i] = vol[i];
222 fX = hits[0];
223 fY = hits[1];
224 fZ = hits[2];
225 fPrimKinEn = hits[3];
226 fXImpact = hits[4];
227 fYImpact = hits[5];
228 fSFlag = hits[6];
229 fLightPMQ = hits[7];
230 fLightPMC = hits[8];
231 fEnergy = hits[9];
fe4da5cc 232}