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.15 2001/01/26 19:56:27 hristov
19 Major upgrade of AliRoot code
21 Revision 1.14 2000/12/12 13:17:01 coppedis
22 Minor corrections suggested by P. Hristov
24 Revision 1.12 2000/12/01 08:19:01 coppedis
25 Adding a message error if ZDC is constructed without DIPO
27 Revision 1.11 2000/11/30 17:21:03 coppedis
28 Introduce hit array fStHits reset only at the end of the event (for digitization)
30 Revision 1.10 2000/11/22 11:32:58 coppedis
33 Revision 1.9 2000/10/02 21:28:20 fca
34 Removal of useless dependecies via forward declarations
36 Revision 1.8 2000/07/10 13:58:01 fca
37 New version of ZDC from E.Scomparin & C.Oppedisano
39 Revision 1.7 2000/01/19 17:17:40 fca
41 Revision 1.6 1999/09/29 09:24:35 fca
42 Introduction of the Copyright and cvs Log
46 ///////////////////////////////////////////////////////////////////////////////
48 // Zero Degree Calorimeter //
49 // This class contains the basic functions for the ZDCs //
50 // Functions specific to one particular geometry are //
51 // contained in the derived classes //
53 ///////////////////////////////////////////////////////////////////////////////
60 #include <TGeometry.h>
64 // --- AliRoot header files
66 #include "AliZDCHit.h"
68 #include "AliDetector.h"
69 #include "AliCallf77.h"
76 //_____________________________________________________________________________
80 // Default constructor for the Zero Degree Calorimeter base class
86 fStHits = new TClonesArray("AliZDCHit",1000);
94 //_____________________________________________________________________________
95 AliZDC::AliZDC(const char *name, const char *title)
96 : AliDetector(name,title)
99 // Standard constructor for the Zero Degree Calorimeter base class
102 // Check that DIPO is there (otherwise tracking is wrong!!!)
104 AliModule* DIPO=gAlice->GetModule("DIPO");
106 Error("Constructor","ZDC needs DIPO!!!\n");
111 // Allocate the array of hits
113 fHits = new TClonesArray("AliZDCHit",1000);
114 gAlice->AddHitList(fHits);
116 fStHits = new TClonesArray("AliZDCHit",1000);
125 //____________________________________________________________________________
135 // fStHits->Delete();
141 //_____________________________________________________________________________
142 void AliZDC::AddHit(Int_t track, Int_t *vol, Float_t *hits)
145 // Add a ZDC hit to the hit list.
146 // -> We make use of 2 array of hits:
147 // [1] fHits (the usual one) that contains hits for each PRIMARY
148 // [2] fStHits that contains hits for each EVENT and is used to
149 // obtain digits at the end of each event
152 static Float_t primKinEn, xImpact, yImpact, sFlag;
154 TClonesArray &lsthits = *fStHits;
157 AliZDCHit *newquad, *curevquad, *curprimquad;
158 newquad = new AliZDCHit(fIshunt, track, vol, hits);
160 TClonesArray &lhits = *fHits;
162 Int_t i,j,kStHit = 1;
163 for(i=0; i<fNStHits; i++){
164 // If the hits are equal (same track, same volume), sum them.
165 curevquad = (AliZDCHit*) lsthits[i];
167 if(*curevquad == *newquad){
168 *curevquad = *curevquad+*newquad;
173 for(j=0; j<fNhits; j++){
174 // If the hits are equal (same track, same volume), sum them.
175 curprimquad = (AliZDCHit*) lhits[j];
176 if(*curprimquad == *newquad){
177 *curprimquad = *curprimquad+*newquad;
184 // First hit -> setting flag for primary or secondary particle
185 Int_t primary = gAlice->GetPrimary(track);
186 if(track != primary){
187 newquad->fSFlag = 1; // Hit created by secondary particle entering the ZDC
189 else if(track == primary){
190 newquad->fSFlag = 0; // Hit created by PRIMARY particle entering the ZDC
193 sFlag = newquad->fSFlag;
194 primKinEn = newquad->fPrimKinEn;
195 xImpact = newquad->fXImpact;
196 yImpact = newquad->fYImpact;
199 newquad->fPrimKinEn = primKinEn;
200 newquad->fXImpact = xImpact;
201 newquad->fYImpact = yImpact;
202 newquad->fSFlag = sFlag;
205 //Otherwise create a new hit
206 new(lhits[fNhits]) AliZDCHit(newquad);
210 new(lsthits[fNStHits]) AliZDCHit(newquad);
215 printf("\n Primary Hits --------------------------------------------------------\n");
217 printf("\n Event Hits --------------------------------------------------------\n");
224 //_____________________________________________________________________________
225 void AliZDC::ResetDigits()
228 // Reset number of digits and the digits array
231 AliDetector::ResetDigits();
233 // if(fStHits) fStHits->Clear();
236 //_____________________________________________________________________________
237 void AliZDC::BuildGeometry()
240 // Build the ROOT TNode geometry for event display
241 // in the Zero Degree Calorimeter
242 // This routine is dummy for the moment
247 const int kColorZDC = kRed;
250 top=gAlice->GetGeometry()->GetNode("alice");
253 brik = new TBRIK("S_ZDC","ZDC box","void",300,300,5);
255 node = new TNode("ZDC","ZDC","S_ZDC",0,0,600,"");
256 node->SetLineColor(kColorZDC);
260 //_____________________________________________________________________________
261 Int_t AliZDC::DistancetoPrimitive(Int_t , Int_t )
264 // Distance from the mouse to the Zero Degree Calorimeter
270 //_____________________________________________________________________________
271 void AliZDC::StepManager()
274 // Routine called at every step in the Zero Degree Calorimeter