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.14 2000/12/12 13:17:01 coppedis
19 Minor corrections suggested by P. Hristov
21 Revision 1.12 2000/12/01 08:19:01 coppedis
22 Adding a message error if ZDC is constructed without DIPO
24 Revision 1.11 2000/11/30 17:21:03 coppedis
25 Introduce hit array fStHits reset only at the end of the event (for digitization)
27 Revision 1.10 2000/11/22 11:32:58 coppedis
30 Revision 1.9 2000/10/02 21:28:20 fca
31 Removal of useless dependecies via forward declarations
33 Revision 1.8 2000/07/10 13:58:01 fca
34 New version of ZDC from E.Scomparin & C.Oppedisano
36 Revision 1.7 2000/01/19 17:17:40 fca
38 Revision 1.6 1999/09/29 09:24:35 fca
39 Introduction of the Copyright and cvs Log
43 ///////////////////////////////////////////////////////////////////////////////
45 // Zero Degree Calorimeter //
46 // This class contains the basic functions for the ZDCs //
47 // Functions specific to one particular geometry are //
48 // contained in the derived classes //
50 ///////////////////////////////////////////////////////////////////////////////
57 #include <TGeometry.h>
61 // --- AliRoot header files
63 #include "AliZDCHit.h"
65 #include "AliDetector.h"
66 #include "AliCallf77.h"
73 //_____________________________________________________________________________
77 // Default constructor for the Zero Degree Calorimeter base class
84 fStHits = new TClonesArray("AliZDCHit",1000);
88 //_____________________________________________________________________________
89 AliZDC::AliZDC(const char *name, const char *title)
90 : AliDetector(name,title)
93 // Standard constructor for the Zero Degree Calorimeter base class
96 // Check that DIPO is there (otherwise tracking is wrong!!!)
98 AliModule* DIPO=gAlice->GetModule("DIPO");
100 Error("Constructor","ZDC needs DIPO!!!\n");
105 // Allocate the array of hits
107 fHits = new TClonesArray("AliZDCHit",1000);
108 gAlice->AddHitList(fHits);
110 fStHits = new TClonesArray("AliZDCHit",1000);
154 fDimZEMPb = 0.15*(TMath::Sqrt(2.));
160 fDimZEM[0] = 2*fDivZEM[2]*(fDimZEMPb+fDimZEMAir+fFibRadZEM*(TMath::Sqrt(2.)));
168 fFibZEM[2] = fDimZEM[2]/TMath::Sin(fDimZEM[3]*kDegrad)-fFibRadZEM;
174 //____________________________________________________________________________
184 // fStHits->Delete();
190 //_____________________________________________________________________________
191 void AliZDC::AddHit(Int_t track, Int_t *vol, Float_t *hits)
194 // Add a ZDC hit to the hit list.
195 // -> We make use of 2 array of hits:
196 // [1] fHits (the usual one) that contains hits for each PRIMARY
197 // [2] fStHits that contains hits for each EVENT and is used to
198 // obtain digits at the end of each event
201 static Float_t primKinEn, xImpact, yImpact, sFlag;
203 TClonesArray &lsthits = *fStHits;
206 AliZDCHit *newquad, *curevquad, *curprimquad;
207 newquad = new AliZDCHit(fIshunt, track, vol, hits);
209 TClonesArray &lhits = *fHits;
211 Int_t i,j,kStHit = 1;
212 for(i=0; i<fNStHits; i++){
213 // If the hits are equal (same track, same volume), sum them.
214 curevquad = (AliZDCHit*) lsthits[i];
216 if(*curevquad == *newquad){
217 *curevquad = *curevquad+*newquad;
222 for(j=0; j<fNhits; j++){
223 // If the hits are equal (same track, same volume), sum them.
224 curprimquad = (AliZDCHit*) lhits[j];
225 if(*curprimquad == *newquad){
226 *curprimquad = *curprimquad+*newquad;
233 // First hit -> setting flag for primary or secondary particle
234 Int_t primary = gAlice->GetPrimary(track);
235 if(track != primary){
236 newquad->fSFlag = 1; // Hit created by secondary particle entering the ZDC
238 else if(track == primary){
239 newquad->fSFlag = 0; // Hit created by PRIMARY particle entering the ZDC
241 fNPrimaryHits = fNPrimaryHits + 1;
242 sFlag = newquad->fSFlag;
243 primKinEn = newquad->fPrimKinEn;
244 xImpact = newquad->fXImpact;
245 yImpact = newquad->fYImpact;
248 newquad->fPrimKinEn = primKinEn;
249 newquad->fXImpact = xImpact;
250 newquad->fYImpact = yImpact;
251 newquad->fSFlag = sFlag;
254 //Otherwise create a new hit
255 new(lhits[fNhits]) AliZDCHit(newquad);
259 new(lsthits[fNStHits]) AliZDCHit(newquad);
263 // printf("\n Primary Hits --------------------------------------------------------\n");
265 // printf("\n Event Hits --------------------------------------------------------\n");
266 // fStHits->Print("");
271 //_____________________________________________________________________________
272 void AliZDC::ResetDigits()
275 // Reset number of digits and the digits array
278 AliDetector::ResetDigits();
280 // if(fStHits) fStHits->Clear();
283 //_____________________________________________________________________________
284 void AliZDC::BuildGeometry()
287 // Build the ROOT TNode geometry for event display
288 // in the Zero Degree Calorimeter
289 // This routine is dummy for the moment
294 const int kColorZDC = kRed;
297 top=gAlice->GetGeometry()->GetNode("alice");
300 brik = new TBRIK("S_ZDC","ZDC box","void",300,300,5);
302 node = new TNode("ZDC","ZDC","S_ZDC",0,0,600,"");
303 node->SetLineColor(kColorZDC);
307 //_____________________________________________________________________________
308 Int_t AliZDC::DistancetoPrimitive(Int_t , Int_t )
311 // Distance from the mouse to the Zero Degree Calorimeter
317 //_____________________________________________________________________________
318 void AliZDC::StepManager()
321 // Routine called at every step in the Zero Degree Calorimeter