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 **************************************************************************/
16 //_________________________________________________________________________
17 // RecPoint in the PHOS PPSD: a list of AliPHOSDigit's
18 //*-- Author : Yves Schutz SUBATECH
19 //////////////////////////////////////////////////////////////////////////////
21 // --- ROOT system ---
23 // --- Standard library ---
28 // --- AliRoot header files ---
30 #include "AliPHOSGeometry.h"
31 #include "AliPHOSPpsdRecPoint.h"
34 ClassImp(AliPHOSPpsdRecPoint)
36 //____________________________________________________________________________
37 AliPHOSPpsdRecPoint::AliPHOSPpsdRecPoint(void)
40 AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
41 fDelta = geom->GetCrystalSize(0) ;
42 fLocPos.SetX(1000000.) ; //Local position should be evaluated
45 //____________________________________________________________________________
46 AliPHOSPpsdRecPoint::~AliPHOSPpsdRecPoint(void) // dtor
51 //____________________________________________________________________________
52 void AliPHOSPpsdRecPoint::AddDigit(AliDigitNew & digit, Float_t Energy)
54 // adds a digit to the digits list
55 // and accumulates the total amplitude and the multiplicity
58 if ( fMulDigit >= fMaxDigit ) { // increase the size of the lists
60 int * tempo = new ( int[fMaxDigit] ) ;
63 for ( index = 0 ; index < fMulDigit ; index++ )
64 tempo[index] = fDigitsList[index] ;
66 delete [] fDigitsList ;
67 fDigitsList = new ( int[fMaxDigit] ) ;
69 for ( index = 0 ; index < fMulDigit ; index++ )
70 fDigitsList[index] = tempo[index] ;
75 fDigitsList[fMulDigit++] = (int) &digit ;
82 //____________________________________________________________________________
83 Int_t AliPHOSPpsdRecPoint::Compare(TObject * obj)
87 AliPHOSPpsdRecPoint * clu = (AliPHOSPpsdRecPoint *)obj ;
99 if(GetUp()) // upper layer
104 if(clu->GetUp()) // upper layer
110 this->GetLocalPosition(PosLoc) ;
113 PhosMod1 = this->GetPHOSMod();
114 clu->GetLocalPosition(PosLoc) ;
117 PhosMod2 = clu->GetPHOSMod();
119 if(PhosMod1 == PhosMod2 ) {
122 Int_t rowdif = (Int_t)TMath::Ceil(x1/fDelta) - (Int_t) TMath::Ceil(x2/fDelta) ;
136 if(up1 < up2 ) // Upper level first (up = True or False, True > False)
142 } // if PhosMod1 == PhosMod2
146 if(PhosMod1 < PhosMod2 )
156 //____________________________________________________________________________
157 void AliPHOSPpsdRecPoint::GetLocalPosition(TVector3 &LPos){
159 if( fLocPos.X() < 1000000.) { //allready evaluated
169 AliPHOSGeometry * PHOSGeom = (AliPHOSGeometry *) fGeom ;
171 AliPHOSDigit * digit ;
174 for(iDigit = 0; iDigit < fMulDigit; iDigit++) {
175 digit = (AliPHOSDigit *) fDigitsList[iDigit];
179 PHOSGeom->AbsToRelNumbering(digit->GetId(), relid) ;
180 PHOSGeom->RelPosInModule(relid, xi, zi);
196 //____________________________________________________________________________
197 Bool_t AliPHOSPpsdRecPoint::GetUp()
201 AliPHOSGeometry * PHOSGeom = (AliPHOSGeometry *) fGeom ;
203 AliPHOSDigit *digit = (AliPHOSDigit *)fDigitsList[0] ;
205 PHOSGeom->AbsToRelNumbering(digit->GetId(),relid);
208 if((Int_t)TMath::Ceil((Float_t)relid[1]/
209 (PHOSGeom->GetNumberOfModulesPhi()*PHOSGeom->GetNumberOfModulesZ())-0.0001 ) > 1)
216 //______________________________________________________________________________
217 void AliPHOSPpsdRecPoint::Paint(Option_t *)
219 //*-*-*-*-*-*-*-*-*-*-*Paint this ALiRecPoint as a TMarker with its current attributes*-*-*-*-*-*-*
220 //*-* =============================================
221 TVector3 pos(0.,0.,0.) ;
222 GetLocalPosition(pos) ;
223 Coord_t x = pos.X() ;
224 Coord_t y = pos.Z() ;
225 Color_t MarkerColor = 1 ;
226 Size_t MarkerSize = 1. ;
227 Style_t MarkerStyle = 2 ;
231 if (!gPad->IsBatch()) {
232 gVirtualX->SetMarkerColor(MarkerColor);
233 gVirtualX->SetMarkerSize (MarkerSize);
234 gVirtualX->SetMarkerStyle(MarkerStyle);
236 gPad->SetAttMarkerPS(MarkerColor,MarkerStyle,MarkerSize);
237 gPad->PaintPolyMarker(1,&x,&y,"");
242 //____________________________________________________________________________
243 void AliPHOSPpsdRecPoint::Print(Option_t * option)
245 cout << "AliPHOSPpsdRecPoint: " << endl ;
247 AliPHOSDigit * digit ;
249 AliPHOSGeometry * PHOSGeom = (AliPHOSGeometry *) fGeom ;
255 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
256 digit = (AliPHOSDigit *) fDigitsList[iDigit];
257 PHOSGeom->AbsToRelNumbering(digit->GetId(), relid) ;
258 PHOSGeom->RelPosInModule(relid, xi, zi);
259 cout << " Id = " << digit->GetId() ;
260 cout << " Phos mod = " << relid[0] ;
261 cout << " PPSD mod = " << relid[1] ;
262 cout << " x = " << xi ;
263 cout << " z = " << zi ;
264 cout << " Energy = " << digit->GetAmp() << endl ;
266 cout << " Multiplicity = " << fMulDigit << endl ;
270 // //____________________________________________________________________________
271 // AliPHOSPpsdRecPoint& AliPHOSPpsdRecPoint::operator = (AliPHOSPpsdRecPoint Clu)
273 // int* DL = Clu.GetDigitsList() ;
276 // delete fDigitsList ;
278 // AliPHOSDigit * digit ;
282 // for(iDigit=0; iDigit<fMulDigit; iDigit++) {
283 // digit = (AliPHOSDigit *) DL[iDigit];
284 // AddDigit(*digit) ;
287 // fDelta = Clu.GetDelta() ;
290 // fAmp = Clu.GetEnergy() ;
291 // fGeom = Clu.GetGeom() ;
293 // Clu.GetLocalPosition(LocPos) ;
295 // fMulDigit = Clu.GetMultiplicity() ;
296 // fMaxDigit = Clu.GetMaximumMultiplicity() ;
297 // fPHOSMod = Clu.GetPHOSMod() ;