1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.21 2001/04/20 10:05:02 coppedis
21 Revision 1.20 2001/03/26 13:39:20 coppedis
24 Revision 1.19 2001/03/26 09:10:23 coppedis
25 Corrected bug in constructor (fIshunt has to be =1)
27 Revision 1.18 2001/03/20 08:21:55 coppedis
28 ZDC needs PIPE, ABSO, DIPO and SHIL
30 Revision 1.17 2001/03/16 16:18:03 coppedis
31 Correction for superposition of ZDC volumes with MUON arm one
33 Revision 1.16 2001/03/15 16:01:11 coppedis
36 Revision 1.15 2001/01/26 19:56:27 hristov
37 Major upgrade of AliRoot code
39 Revision 1.14 2000/12/12 13:17:01 coppedis
40 Minor corrections suggested by P. Hristov
42 Revision 1.12 2000/12/01 08:19:01 coppedis
43 Adding a message error if ZDC is constructed without DIPO
45 Revision 1.11 2000/11/30 17:21:03 coppedis
46 Introduce hit array fStHits reset only at the end of the event (for digitization)
48 Revision 1.10 2000/11/22 11:32:58 coppedis
51 Revision 1.9 2000/10/02 21:28:20 fca
52 Removal of useless dependecies via forward declarations
54 Revision 1.8 2000/07/10 13:58:01 fca
55 New version of ZDC from E.Scomparin & C.Oppedisano
57 Revision 1.7 2000/01/19 17:17:40 fca
59 Revision 1.6 1999/09/29 09:24:35 fca
60 Introduction of the Copyright and cvs Log
64 ///////////////////////////////////////////////////////////////////////////////
66 // Zero Degree Calorimeter //
67 // This class contains the basic functions for the ZDCs //
68 // Functions specific to one particular geometry are //
69 // contained in the derived classes //
71 ///////////////////////////////////////////////////////////////////////////////
78 #include <TGeometry.h>
82 // --- AliRoot header files
84 #include "AliZDCHit.h"
86 #include "AliDetector.h"
87 #include "AliCallf77.h"
94 //_____________________________________________________________________________
98 // Default constructor for the Zero Degree Calorimeter base class
107 // fNPrimaryHits = 0;
111 //_____________________________________________________________________________
112 AliZDC::AliZDC(const char *name, const char *title)
113 : AliDetector(name,title)
116 // Standard constructor for the Zero Degree Calorimeter base class
120 // Allocate the array of hits
124 fHits = new TClonesArray("AliZDCHit",1000);
125 gAlice->AddHitList(fHits);
127 fStHits = new TClonesArray("AliZDCHit",1000);
130 // fNPrimaryHits = 0;
134 //____________________________________________________________________________
145 // fStHits->Delete();
151 //_____________________________________________________________________________
152 void AliZDC::AddHit(Int_t track, Int_t *vol, Float_t *hits)
155 // Add a ZDC hit to the hit list.
156 // -> We make use of 2 array of hits:
157 // [1] fHits (the usual one) that contains hits for each PRIMARY
158 // [2] fStHits that contains hits for each EVENT and is used to
159 // obtain digits at the end of each event
162 static Float_t primKinEn, xImpact, yImpact, sFlag;
164 AliZDCHit *newquad, *curprimquad, *curevquad;
165 newquad = new AliZDCHit(fIshunt, track, vol, hits);
167 TClonesArray &lsthits = *fStHits;
168 TClonesArray &lhits = *fHits;
171 // First hit -> setting flag for primary or secondary particle
172 Int_t primary = gAlice->GetPrimary(track);
173 if(track != primary){
174 newquad->fSFlag = 1; // SECONDARY particle entering the ZDC
176 else if(track == primary){
177 newquad->fSFlag = 0; // PRIMARY particle entering the ZDC
179 // fNPrimaryHits += 1;
180 sFlag = newquad->fSFlag;
181 primKinEn = newquad->fPrimKinEn;
182 xImpact = newquad->fXImpact;
183 yImpact = newquad->fYImpact;
186 newquad->fPrimKinEn = primKinEn;
187 newquad->fXImpact = xImpact;
188 newquad->fYImpact = yImpact;
189 newquad->fSFlag = sFlag;
192 Int_t i,j,kStHit = 1;
193 for(i=0; i<fNStHits; i++){
194 // If hits are equal (same track, same volume), sum them.
195 curevquad = (AliZDCHit*) lsthits[i];
197 if(*curevquad == *newquad){
198 *curevquad = *curevquad+*newquad;
201 if(kStHit == 0) break;
204 for(j=0; j<fNhits; j++){
205 // If hits are equal (same track, same volume), sum them.
206 curprimquad = (AliZDCHit*) lhits[j];
207 if(*curprimquad == *newquad){
208 *curprimquad = *curprimquad+*newquad;
214 //Otherwise create a new hit
215 new(lhits[fNhits]) AliZDCHit(newquad);
219 new(lsthits[fNStHits]) AliZDCHit(newquad);
224 printf("\n Primary Hits --------------------------------------------------------\n");
226 printf("\n Event Hits --------------------------------------------------------\n");
232 //____________________________________________________________________________
233 Float_t AliZDC::ZMin(void) const
235 // Minimum dimension of the ZDC module in z
239 //____________________________________________________________________________
240 Float_t AliZDC::ZMax(void) const
242 // Maximum dimension of the ZDC module in z
246 //_____________________________________________________________________________
247 void AliZDC::ResetDigits()
250 // Reset number of digits and the digits array
253 AliDetector::ResetDigits();
255 // if(fStHits) fStHits->Clear();
258 //_____________________________________________________________________________
259 void AliZDC::BuildGeometry()
262 // Build the ROOT TNode geometry for event display
263 // in the Zero Degree Calorimeter
264 // This routine is dummy for the moment
269 const int kColorZDC = kRed;
272 top=gAlice->GetGeometry()->GetNode("alice");
275 brik = new TBRIK("S_ZDC","ZDC box","void",300,300,5);
277 node = new TNode("ZDC","ZDC","S_ZDC",0,0,600,"");
278 node->SetLineColor(kColorZDC);
282 //_____________________________________________________________________________
283 Int_t AliZDC::DistancetoPrimitive(Int_t , Int_t )
286 // Distance from the mouse to the Zero Degree Calorimeter
292 //_____________________________________________________________________________
293 void AliZDC::StepManager()
296 // Routine called at every step in the Zero Degree Calorimeter