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.17 2001/03/16 16:18:03 coppedis
19 Correction for superposition of ZDC volumes with MUON arm one
21 Revision 1.16 2001/03/15 16:01:11 coppedis
24 Revision 1.15 2001/01/26 19:56:27 hristov
25 Major upgrade of AliRoot code
27 Revision 1.14 2000/12/12 13:17:01 coppedis
28 Minor corrections suggested by P. Hristov
30 Revision 1.12 2000/12/01 08:19:01 coppedis
31 Adding a message error if ZDC is constructed without DIPO
33 Revision 1.11 2000/11/30 17:21:03 coppedis
34 Introduce hit array fStHits reset only at the end of the event (for digitization)
36 Revision 1.10 2000/11/22 11:32:58 coppedis
39 Revision 1.9 2000/10/02 21:28:20 fca
40 Removal of useless dependecies via forward declarations
42 Revision 1.8 2000/07/10 13:58:01 fca
43 New version of ZDC from E.Scomparin & C.Oppedisano
45 Revision 1.7 2000/01/19 17:17:40 fca
47 Revision 1.6 1999/09/29 09:24:35 fca
48 Introduction of the Copyright and cvs Log
52 ///////////////////////////////////////////////////////////////////////////////
54 // Zero Degree Calorimeter //
55 // This class contains the basic functions for the ZDCs //
56 // Functions specific to one particular geometry are //
57 // contained in the derived classes //
59 ///////////////////////////////////////////////////////////////////////////////
66 #include <TGeometry.h>
70 // --- AliRoot header files
72 #include "AliZDCHit.h"
74 #include "AliDetector.h"
75 #include "AliCallf77.h"
82 //_____________________________________________________________________________
86 // Default constructor for the Zero Degree Calorimeter base class
92 fStHits = new TClonesArray("AliZDCHit",1000);
100 //_____________________________________________________________________________
101 AliZDC::AliZDC(const char *name, const char *title)
102 : AliDetector(name,title)
105 // Standard constructor for the Zero Degree Calorimeter base class
108 // Check that DIPO is there (otherwise tracking is wrong!!!)
110 AliModule* PIPE=gAlice->GetModule("PIPE");
111 AliModule* ABSO=gAlice->GetModule("ABSO");
112 AliModule* DIPO=gAlice->GetModule("DIPO");
113 AliModule* SHIL=gAlice->GetModule("SHIL");
114 if((!PIPE) || (!ABSO) || (!DIPO) || (!SHIL)) {
115 Error("Constructor","ZDC needs PIPE, ABSO, DIPO and SHIL!!!\n");
120 // Allocate the array of hits
122 fHits = new TClonesArray("AliZDCHit",1000);
123 gAlice->AddHitList(fHits);
125 fStHits = new TClonesArray("AliZDCHit",1000);
134 //____________________________________________________________________________
144 // fStHits->Delete();
150 //_____________________________________________________________________________
151 void AliZDC::AddHit(Int_t track, Int_t *vol, Float_t *hits)
154 // Add a ZDC hit to the hit list.
155 // -> We make use of 2 array of hits:
156 // [1] fHits (the usual one) that contains hits for each PRIMARY
157 // [2] fStHits that contains hits for each EVENT and is used to
158 // obtain digits at the end of each event
161 static Float_t primKinEn, xImpact, yImpact, sFlag;
163 TClonesArray &lsthits = *fStHits;
166 AliZDCHit *newquad, *curevquad, *curprimquad;
167 newquad = new AliZDCHit(fIshunt, track, vol, hits);
169 TClonesArray &lhits = *fHits;
171 Int_t i,j,kStHit = 1;
172 for(i=0; i<fNStHits; i++){
173 // If the hits are equal (same track, same volume), sum them.
174 curevquad = (AliZDCHit*) lsthits[i];
176 if(*curevquad == *newquad){
177 *curevquad = *curevquad+*newquad;
182 for(j=0; j<fNhits; j++){
183 // If the hits are equal (same track, same volume), sum them.
184 curprimquad = (AliZDCHit*) lhits[j];
185 if(*curprimquad == *newquad){
186 *curprimquad = *curprimquad+*newquad;
193 // First hit -> setting flag for primary or secondary particle
194 Int_t primary = gAlice->GetPrimary(track);
195 if(track != primary){
196 newquad->fSFlag = 1; // Hit created by secondary particle entering the ZDC
198 else if(track == primary){
199 newquad->fSFlag = 0; // Hit created by PRIMARY particle entering the ZDC
202 sFlag = newquad->fSFlag;
203 primKinEn = newquad->fPrimKinEn;
204 xImpact = newquad->fXImpact;
205 yImpact = newquad->fYImpact;
208 newquad->fPrimKinEn = primKinEn;
209 newquad->fXImpact = xImpact;
210 newquad->fYImpact = yImpact;
211 newquad->fSFlag = sFlag;
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");
233 //_____________________________________________________________________________
234 void AliZDC::ResetDigits()
237 // Reset number of digits and the digits array
240 AliDetector::ResetDigits();
242 // if(fStHits) fStHits->Clear();
245 //_____________________________________________________________________________
246 void AliZDC::BuildGeometry()
249 // Build the ROOT TNode geometry for event display
250 // in the Zero Degree Calorimeter
251 // This routine is dummy for the moment
256 const int kColorZDC = kRed;
259 top=gAlice->GetGeometry()->GetNode("alice");
262 brik = new TBRIK("S_ZDC","ZDC box","void",300,300,5);
264 node = new TNode("ZDC","ZDC","S_ZDC",0,0,600,"");
265 node->SetLineColor(kColorZDC);
269 //_____________________________________________________________________________
270 Int_t AliZDC::DistancetoPrimitive(Int_t , Int_t )
273 // Distance from the mouse to the Zero Degree Calorimeter
279 //_____________________________________________________________________________
280 void AliZDC::StepManager()
283 // Routine called at every step in the Zero Degree Calorimeter