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.22 2001/05/14 09:53:32 coppedis
19 Adding functions ZMin and ZMax
21 Revision 1.21 2001/04/20 10:05:02 coppedis
24 Revision 1.20 2001/03/26 13:39:20 coppedis
27 Revision 1.19 2001/03/26 09:10:23 coppedis
28 Corrected bug in constructor (fIshunt has to be =1)
30 Revision 1.18 2001/03/20 08:21:55 coppedis
31 ZDC needs PIPE, ABSO, DIPO and SHIL
33 Revision 1.17 2001/03/16 16:18:03 coppedis
34 Correction for superposition of ZDC volumes with MUON arm one
36 Revision 1.16 2001/03/15 16:01:11 coppedis
39 Revision 1.15 2001/01/26 19:56:27 hristov
40 Major upgrade of AliRoot code
42 Revision 1.14 2000/12/12 13:17:01 coppedis
43 Minor corrections suggested by P. Hristov
45 Revision 1.12 2000/12/01 08:19:01 coppedis
46 Adding a message error if ZDC is constructed without DIPO
48 Revision 1.11 2000/11/30 17:21:03 coppedis
49 Introduce hit array fStHits reset only at the end of the event (for digitization)
51 Revision 1.10 2000/11/22 11:32:58 coppedis
54 Revision 1.9 2000/10/02 21:28:20 fca
55 Removal of useless dependecies via forward declarations
57 Revision 1.8 2000/07/10 13:58:01 fca
58 New version of ZDC from E.Scomparin & C.Oppedisano
60 Revision 1.7 2000/01/19 17:17:40 fca
62 Revision 1.6 1999/09/29 09:24:35 fca
63 Introduction of the Copyright and cvs Log
67 ///////////////////////////////////////////////////////////////////////////////
69 // Zero Degree Calorimeter //
70 // This class contains the basic functions for the ZDCs //
71 // Functions specific to one particular geometry are //
72 // contained in the derived classes //
74 ///////////////////////////////////////////////////////////////////////////////
81 #include <TGeometry.h>
85 // --- AliRoot header files
87 #include "AliZDCHit.h"
89 #include "AliDetector.h"
90 #include "AliCallf77.h"
97 //_____________________________________________________________________________
101 // Default constructor for the Zero Degree Calorimeter base class
110 // fNPrimaryHits = 0;
114 //_____________________________________________________________________________
115 AliZDC::AliZDC(const char *name, const char *title)
116 : AliDetector(name,title)
119 // Standard constructor for the Zero Degree Calorimeter base class
123 // Allocate the array of hits
127 fHits = new TClonesArray("AliZDCHit",1000);
128 gAlice->AddHitList(fHits);
130 // fStHits = new TClonesArray("AliZDCHit",1000);
133 // fNPrimaryHits = 0;
137 //____________________________________________________________________________
148 // fStHits->Delete();
154 //_____________________________________________________________________________
155 void AliZDC::AddHit(Int_t track, Int_t *vol, Float_t *hits)
158 // Add a ZDC hit to the hit list.
159 // -> We make use of 2 array of hits:
160 // [1] fHits (the usual one) that contains hits for each PRIMARY
161 // [2] fStHits that contains hits for each EVENT and is used to
162 // obtain digits at the end of each event
165 static Float_t primKinEn, xImpact, yImpact, sFlag;
167 AliZDCHit *newquad, *curprimquad;
168 // AliZDCHit *curevquad;
169 newquad = new AliZDCHit(fIshunt, track, vol, hits);
171 // TClonesArray &lsthits = *fStHits;
172 TClonesArray &lhits = *fHits;
175 // First hit -> setting flag for primary or secondary particle
176 Int_t primary = gAlice->GetPrimary(track);
177 if(track != primary){
178 newquad->fSFlag = 1; // SECONDARY particle entering the ZDC
180 else if(track == primary){
181 newquad->fSFlag = 0; // PRIMARY particle entering the ZDC
183 // fNPrimaryHits += 1;
184 sFlag = newquad->fSFlag;
185 primKinEn = newquad->fPrimKinEn;
186 xImpact = newquad->fXImpact;
187 yImpact = newquad->fYImpact;
190 newquad->fPrimKinEn = primKinEn;
191 newquad->fXImpact = xImpact;
192 newquad->fYImpact = yImpact;
193 newquad->fSFlag = sFlag;
197 // Int_t i,kStHit = 1;
198 // for(i=0; i<fNStHits; i++){
199 // // If hits are equal (same track, same volume), sum them.
200 // curevquad = (AliZDCHit*) lsthits[i];
202 // if(*curevquad == *newquad){
203 // *curevquad = *curevquad+*newquad;
206 // if(kStHit == 0) break;
209 for(j=0; j<fNhits; j++){
210 // If hits are equal (same track, same volume), sum them.
211 curprimquad = (AliZDCHit*) lhits[j];
212 if(*curprimquad == *newquad){
213 *curprimquad = *curprimquad+*newquad;
219 //Otherwise create a new hit
220 new(lhits[fNhits]) AliZDCHit(newquad);
224 // new(lsthits[fNStHits]) AliZDCHit(newquad);
229 printf("\n Primary Hits --------------------------------------------------------\n");
231 // printf("\n Event Hits --------------------------------------------------------\n");
232 // fStHits->Print("");
237 //____________________________________________________________________________
238 Float_t AliZDC::ZMin(void) const
240 // Minimum dimension of the ZDC module in z
244 //____________________________________________________________________________
245 Float_t AliZDC::ZMax(void) const
247 // Maximum dimension of the ZDC module in z
251 //_____________________________________________________________________________
252 void AliZDC::ResetDigits()
255 // Reset number of digits and the digits array
258 AliDetector::ResetDigits();
260 // if(fStHits) fStHits->Clear();
263 //_____________________________________________________________________________
264 void AliZDC::BuildGeometry()
267 // Build the ROOT TNode geometry for event display
268 // in the Zero Degree Calorimeter
269 // This routine is dummy for the moment
274 const int kColorZDC = kRed;
277 top=gAlice->GetGeometry()->GetNode("alice");
280 brik = new TBRIK("S_ZDC","ZDC box","void",300,300,5);
282 node = new TNode("ZDC","ZDC","S_ZDC",0,0,600,"");
283 node->SetLineColor(kColorZDC);
287 //_____________________________________________________________________________
288 Int_t AliZDC::DistancetoPrimitive(Int_t , Int_t )
291 // Distance from the mouse to the Zero Degree Calorimeter
297 //_____________________________________________________________________________
298 void AliZDC::StepManager()
301 // Routine called at every step in the Zero Degree Calorimeter