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.10 2000/11/22 11:32:58 coppedis
21 Revision 1.9 2000/10/02 21:28:20 fca
22 Removal of useless dependecies via forward declarations
24 Revision 1.8 2000/07/10 13:58:01 fca
25 New version of ZDC from E.Scomparin & C.Oppedisano
27 Revision 1.7 2000/01/19 17:17:40 fca
29 Revision 1.6 1999/09/29 09:24:35 fca
30 Introduction of the Copyright and cvs Log
34 ///////////////////////////////////////////////////////////////////////////////
36 // Zero Degree Calorimeter //
37 // This class contains the basic functions for the ZDCs //
38 // Functions specific to one particular geometry are //
39 // contained in the derived classes //
41 ///////////////////////////////////////////////////////////////////////////////
46 #include "TGeometry.h"
48 // --- AliRoot header files
50 #include "AliZDCHit.h"
52 #include "AliDetector.h"
53 #include "AliCallf77.h"
60 //_____________________________________________________________________________
64 // Default constructor for the Zero Degree Calorimeter base class
77 //_____________________________________________________________________________
78 AliZDC::AliZDC(const char *name, const char *title)
79 : AliDetector(name,title)
82 // Standard constructor for the Zero Degree Calorimeter base class
86 // Allocate the array of hits
88 fHits = new TClonesArray("AliZDCHit",1000);
89 gAlice->AddHitList(fHits);
91 fStHits = new TClonesArray("AliZDCHit",1000);
135 fDimZEMPb = 0.15*(TMath::Sqrt(2.));
141 fDimZEM[0] = 2*fDivZEM[2]*(fDimZEMPb+fDimZEMAir+fFibRadZEM*(TMath::Sqrt(2.)));
149 fFibZEM[2] = fDimZEM[2]/TMath::Sin(fDimZEM[3]*kDegrad)-fFibRadZEM;
155 //____________________________________________________________________________
171 //_____________________________________________________________________________
172 void AliZDC::AddHit(Int_t track, Int_t *vol, Float_t *hits)
175 // Add a ZDC hit to the hit list.
176 // -> We make use of 2 array of hits:
177 // [1] fHits (the usual one) that contains hits for each PRIMARY
178 // [2] fStHits that contains hits for each EVENT and is used to
179 // obtain digits at the end of each event
182 static Float_t primKinEn, xImpact, yImpact, sFlag;
184 TClonesArray &lsthits = *fStHits;
185 TClonesArray &lhits = *fHits;
188 AliZDCHit *newquad, *curevquad, *curprimquad;
189 newquad = new AliZDCHit(fIshunt, track, vol, hits);
191 Int_t i,j,kStHit = 1;
192 for(i=0; i<fNStHits; i++){
193 // If the hits are equal (same track, same volume), sum them.
194 curevquad = (AliZDCHit*) lsthits[i];
196 if(*curevquad == *newquad){
197 *curevquad = *curevquad+*newquad;
202 for(j=0; j<fNhits; j++){
203 // If the hits are equal (same track, same volume), sum them.
204 curprimquad = (AliZDCHit*) lhits[j];
205 if(*curprimquad == *newquad){
206 *curprimquad = *curprimquad+*newquad;
213 // First hit -> setting flag for primary or secondary particle
214 Int_t primary = gAlice->GetPrimary(track);
215 if(track != primary){
216 newquad->fSFlag = 1; // Hit created by secondary particle entering the ZDC
218 else if(track == primary){
219 newquad->fSFlag = 0; // Hit created by PRIMARY particle entering the ZDC
221 fNPrimaryHits = fNPrimaryHits + 1;
222 sFlag = newquad->fSFlag;
223 primKinEn = newquad->fPrimKinEn;
224 xImpact = newquad->fXImpact;
225 yImpact = newquad->fYImpact;
228 newquad->fPrimKinEn = primKinEn;
229 newquad->fXImpact = xImpact;
230 newquad->fYImpact = yImpact;
231 newquad->fSFlag = sFlag;
234 //Otherwise create a new hit
235 new(lhits[fNhits]) AliZDCHit(newquad);
239 new(lsthits[fNStHits]) AliZDCHit(newquad);
243 // printf("\nPrimary Hits --------------------------------------------------------\n");
245 // printf("\n Event Hits --------------------------------------------------------\n");
246 // fStHits->Print("");
251 //_____________________________________________________________________________
252 void AliZDC::ResetHits()
255 // Reset number of hits and the hits array
261 AliDetector::ResetHits();
264 //_____________________________________________________________________________
265 void AliZDC::ResetDigits()
268 // Reset number of digits and the digits array
271 AliDetector::ResetDigits();
278 //_____________________________________________________________________________
279 void AliZDC::BuildGeometry()
282 // Build the ROOT TNode geometry for event display
283 // in the Zero Degree Calorimeter
284 // This routine is dummy for the moment
289 const int kColorZDC = kRed;
292 top=gAlice->GetGeometry()->GetNode("alice");
295 brik = new TBRIK("S_ZDC","ZDC box","void",300,300,5);
297 node = new TNode("ZDC","ZDC","S_ZDC",0,0,600,"");
298 node->SetLineColor(kColorZDC);
302 //_____________________________________________________________________________
303 Int_t AliZDC::DistancetoPrimitive(Int_t , Int_t )
306 // Distance from the mouse to the Zero Degree Calorimeter
312 //_____________________________________________________________________________
313 void AliZDC::StepManager()
316 // Routine called at every step in the Zero Degree Calorimeter