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.19 2001/03/26 09:10:23 coppedis
19 Corrected bug in constructor (fIshunt has to be =1)
21 Revision 1.18 2001/03/20 08:21:55 coppedis
22 ZDC needs PIPE, ABSO, DIPO and SHIL
24 Revision 1.17 2001/03/16 16:18:03 coppedis
25 Correction for superposition of ZDC volumes with MUON arm one
27 Revision 1.16 2001/03/15 16:01:11 coppedis
30 Revision 1.15 2001/01/26 19:56:27 hristov
31 Major upgrade of AliRoot code
33 Revision 1.14 2000/12/12 13:17:01 coppedis
34 Minor corrections suggested by P. Hristov
36 Revision 1.12 2000/12/01 08:19:01 coppedis
37 Adding a message error if ZDC is constructed without DIPO
39 Revision 1.11 2000/11/30 17:21:03 coppedis
40 Introduce hit array fStHits reset only at the end of the event (for digitization)
42 Revision 1.10 2000/11/22 11:32:58 coppedis
45 Revision 1.9 2000/10/02 21:28:20 fca
46 Removal of useless dependecies via forward declarations
48 Revision 1.8 2000/07/10 13:58:01 fca
49 New version of ZDC from E.Scomparin & C.Oppedisano
51 Revision 1.7 2000/01/19 17:17:40 fca
53 Revision 1.6 1999/09/29 09:24:35 fca
54 Introduction of the Copyright and cvs Log
58 ///////////////////////////////////////////////////////////////////////////////
60 // Zero Degree Calorimeter //
61 // This class contains the basic functions for the ZDCs //
62 // Functions specific to one particular geometry are //
63 // contained in the derived classes //
65 ///////////////////////////////////////////////////////////////////////////////
72 #include <TGeometry.h>
76 // --- AliRoot header files
78 #include "AliZDCHit.h"
80 #include "AliDetector.h"
81 #include "AliCallf77.h"
88 //_____________________________________________________________________________
92 // Default constructor for the Zero Degree Calorimeter base class
105 //_____________________________________________________________________________
106 AliZDC::AliZDC(const char *name, const char *title)
107 : AliDetector(name,title)
110 // Standard constructor for the Zero Degree Calorimeter base class
113 // Check that DIPO is there (otherwise tracking is wrong!!!)
115 AliModule* PIPE=gAlice->GetModule("PIPE");
116 AliModule* ABSO=gAlice->GetModule("ABSO");
117 AliModule* DIPO=gAlice->GetModule("DIPO");
118 AliModule* SHIL=gAlice->GetModule("SHIL");
119 if((!PIPE) || (!ABSO) || (!DIPO) || (!SHIL)) {
120 Error("Constructor","ZDC needs PIPE, ABSO, DIPO and SHIL!!!\n");
125 // Allocate the array of hits
129 fHits = new TClonesArray("AliZDCHit",1000);
130 gAlice->AddHitList(fHits);
132 fStHits = new TClonesArray("AliZDCHit",1000);
139 //____________________________________________________________________________
150 // fStHits->Delete();
156 //_____________________________________________________________________________
157 void AliZDC::AddHit(Int_t track, Int_t *vol, Float_t *hits)
160 // Add a ZDC hit to the hit list.
161 // -> We make use of 2 array of hits:
162 // [1] fHits (the usual one) that contains hits for each PRIMARY
163 // [2] fStHits that contains hits for each EVENT and is used to
164 // obtain digits at the end of each event
167 static Float_t primKinEn, xImpact, yImpact, sFlag;
169 AliZDCHit *newquad, *curevquad, *curprimquad;
170 newquad = new AliZDCHit(fIshunt, track, vol, hits);
172 TClonesArray &lsthits = *fStHits;
173 TClonesArray &lhits = *fHits;
175 Int_t i,j,kStHit = 1;
176 for(i=0; i<fNStHits; i++){
177 // If hits are equal (same track, same volume), sum them.
178 curevquad = (AliZDCHit*) lsthits[i];
180 if(*curevquad == *newquad){
181 *curevquad = *curevquad+*newquad;
186 for(j=0; j<fNhits; j++){
187 // If hits are equal (same track, same volume), sum them.
188 curprimquad = (AliZDCHit*) lhits[j];
189 if(*curprimquad == *newquad){
190 *curprimquad = *curprimquad+*newquad;
197 // First hit -> setting flag for primary or secondary particle
198 Int_t primary = gAlice->GetPrimary(track);
199 if(track != primary){
200 newquad->fSFlag = 1; // Hit created by secondary particle entering the ZDC
202 else if(track == primary){
203 newquad->fSFlag = 0; // Hit created by PRIMARY particle entering the ZDC
206 sFlag = newquad->fSFlag;
207 primKinEn = newquad->fPrimKinEn;
208 xImpact = newquad->fXImpact;
209 yImpact = newquad->fYImpact;
212 newquad->fPrimKinEn = primKinEn;
213 newquad->fXImpact = xImpact;
214 newquad->fYImpact = yImpact;
215 newquad->fSFlag = sFlag;
218 //Otherwise create a new hit
219 new(lhits[fNhits]) AliZDCHit(newquad);
223 new(lsthits[fNStHits]) AliZDCHit(newquad);
228 // printf("\n Primary Hits --------------------------------------------------------\n");
230 // printf("\n Event Hits --------------------------------------------------------\n");
231 // fStHits->Print("");
237 //_____________________________________________________________________________
238 void AliZDC::ResetDigits()
241 // Reset number of digits and the digits array
244 AliDetector::ResetDigits();
246 // if(fStHits) fStHits->Clear();
249 //_____________________________________________________________________________
250 void AliZDC::BuildGeometry()
253 // Build the ROOT TNode geometry for event display
254 // in the Zero Degree Calorimeter
255 // This routine is dummy for the moment
260 const int kColorZDC = kRed;
263 top=gAlice->GetGeometry()->GetNode("alice");
266 brik = new TBRIK("S_ZDC","ZDC box","void",300,300,5);
268 node = new TNode("ZDC","ZDC","S_ZDC",0,0,600,"");
269 node->SetLineColor(kColorZDC);
273 //_____________________________________________________________________________
274 Int_t AliZDC::DistancetoPrimitive(Int_t , Int_t )
277 // Distance from the mouse to the Zero Degree Calorimeter
283 //_____________________________________________________________________________
284 void AliZDC::StepManager()
287 // Routine called at every step in the Zero Degree Calorimeter