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.12 2000/12/01 08:19:01 coppedis
19 Adding a message error if ZDC is constructed without DIPO
21 Revision 1.11 2000/11/30 17:21:03 coppedis
22 Introduce hit array fStHits reset only at the end of the event (for digitization)
24 Revision 1.10 2000/11/22 11:32:58 coppedis
27 Revision 1.9 2000/10/02 21:28:20 fca
28 Removal of useless dependecies via forward declarations
30 Revision 1.8 2000/07/10 13:58:01 fca
31 New version of ZDC from E.Scomparin & C.Oppedisano
33 Revision 1.7 2000/01/19 17:17:40 fca
35 Revision 1.6 1999/09/29 09:24:35 fca
36 Introduction of the Copyright and cvs Log
40 ///////////////////////////////////////////////////////////////////////////////
42 // Zero Degree Calorimeter //
43 // This class contains the basic functions for the ZDCs //
44 // Functions specific to one particular geometry are //
45 // contained in the derived classes //
47 ///////////////////////////////////////////////////////////////////////////////
52 #include "TGeometry.h"
54 // --- AliRoot header files
56 #include "AliZDCHit.h"
58 #include "AliDetector.h"
59 #include "AliCallf77.h"
66 //_____________________________________________________________________________
70 // Default constructor for the Zero Degree Calorimeter base class
80 //_____________________________________________________________________________
81 AliZDC::AliZDC(const char *name, const char *title)
82 : AliDetector(name,title)
85 // Standard constructor for the Zero Degree Calorimeter base class
88 // Check that DIPO is there (otherwise tracking is wrong!!!)
90 AliModule* DIPO=gAlice->GetModule("DIPO");
92 Error("Constructor","ZDC needs DIPO!!!\n");
97 // Allocate the array of hits
99 fHits = new TClonesArray("AliZDCHit",1000);
100 gAlice->AddHitList(fHits);
102 fStHits = new TClonesArray("AliZDCHit",1000);
146 fDimZEMPb = 0.15*(TMath::Sqrt(2.));
152 fDimZEM[0] = 2*fDivZEM[2]*(fDimZEMPb+fDimZEMAir+fFibRadZEM*(TMath::Sqrt(2.)));
160 fFibZEM[2] = fDimZEM[2]/TMath::Sin(fDimZEM[3]*kDegrad)-fFibRadZEM;
166 //____________________________________________________________________________
176 // fStHits->Delete();
182 //_____________________________________________________________________________
183 void AliZDC::AddHit(Int_t track, Int_t *vol, Float_t *hits)
186 // Add a ZDC hit to the hit list.
187 // -> We make use of 2 array of hits:
188 // [1] fHits (the usual one) that contains hits for each PRIMARY
189 // [2] fStHits that contains hits for each EVENT and is used to
190 // obtain digits at the end of each event
193 static Float_t primKinEn, xImpact, yImpact, sFlag;
195 TClonesArray &lsthits = *fStHits;
198 AliZDCHit *newquad, *curevquad, *curprimquad;
199 newquad = new AliZDCHit(fIshunt, track, vol, hits);
201 TClonesArray &lhits = *fHits;
203 Int_t i,j,kStHit = 1;
204 for(i=0; i<fNStHits; i++){
205 // If the hits are equal (same track, same volume), sum them.
206 curevquad = (AliZDCHit*) lsthits[i];
208 if(*curevquad == *newquad){
209 *curevquad = *curevquad+*newquad;
214 for(j=0; j<fNhits; j++){
215 // If the hits are equal (same track, same volume), sum them.
216 curprimquad = (AliZDCHit*) lhits[j];
217 if(*curprimquad == *newquad){
218 *curprimquad = *curprimquad+*newquad;
225 // First hit -> setting flag for primary or secondary particle
226 Int_t primary = gAlice->GetPrimary(track);
227 if(track != primary){
228 newquad->fSFlag = 1; // Hit created by secondary particle entering the ZDC
230 else if(track == primary){
231 newquad->fSFlag = 0; // Hit created by PRIMARY particle entering the ZDC
233 fNPrimaryHits = fNPrimaryHits + 1;
234 sFlag = newquad->fSFlag;
235 primKinEn = newquad->fPrimKinEn;
236 xImpact = newquad->fXImpact;
237 yImpact = newquad->fYImpact;
240 newquad->fPrimKinEn = primKinEn;
241 newquad->fXImpact = xImpact;
242 newquad->fYImpact = yImpact;
243 newquad->fSFlag = sFlag;
246 //Otherwise create a new hit
247 new(lhits[fNhits]) AliZDCHit(newquad);
251 new(lsthits[fNStHits]) AliZDCHit(newquad);
255 // printf("\n Primary Hits --------------------------------------------------------\n");
257 // printf("\n Event Hits --------------------------------------------------------\n");
258 // fStHits->Print("");
263 //_____________________________________________________________________________
264 void AliZDC::ResetDigits()
267 // Reset number of digits and the digits array
270 AliDetector::ResetDigits();
272 // if(fStHits) fStHits->Clear();
275 //_____________________________________________________________________________
276 void AliZDC::BuildGeometry()
279 // Build the ROOT TNode geometry for event display
280 // in the Zero Degree Calorimeter
281 // This routine is dummy for the moment
286 const int kColorZDC = kRed;
289 top=gAlice->GetGeometry()->GetNode("alice");
292 brik = new TBRIK("S_ZDC","ZDC box","void",300,300,5);
294 node = new TNode("ZDC","ZDC","S_ZDC",0,0,600,"");
295 node->SetLineColor(kColorZDC);
299 //_____________________________________________________________________________
300 Int_t AliZDC::DistancetoPrimitive(Int_t , Int_t )
303 // Distance from the mouse to the Zero Degree Calorimeter
309 //_____________________________________________________________________________
310 void AliZDC::StepManager()
313 // Routine called at every step in the Zero Degree Calorimeter