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 //_________________________________________________________________________
19 // A RecPoint (cluster) in the PPSD
20 // A PPSD RecPoint ends up to be a single digit
22 //*-- Yves Schutz (SUBATECH)
24 // --- ROOT system ---
28 // --- Standard library ---
32 // --- AliRoot header files ---
34 #include "AliPHOSGeometry.h"
35 #include "AliPHOSPpsdRecPoint.h"
37 #include "AliPHOSIndexToObject.h"
39 ClassImp(AliPHOSPpsdRecPoint)
41 //____________________________________________________________________________
42 AliPHOSPpsdRecPoint::AliPHOSPpsdRecPoint(void)
47 AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
48 fDelta = geom->GetCrystalSize(0) ;
49 fLocPos.SetX(1000000.) ; //Local position should be evaluated
52 //____________________________________________________________________________
53 void AliPHOSPpsdRecPoint::AddDigit(AliPHOSDigit & digit, Float_t Energy)
55 // adds a digit to the digits list
56 // and accumulates the total amplitude and the multiplicity
59 if ( fMulDigit >= fMaxDigit ) { // increase the size of the lists
61 int * tempo = new ( int[fMaxDigit] ) ;
64 for ( index = 0 ; index < fMulDigit ; index++ )
65 tempo[index] = fDigitsList[index] ;
67 delete [] fDigitsList ;
68 fDigitsList = new ( int[fMaxDigit] ) ;
70 for ( index = 0 ; index < fMulDigit ; index++ )
71 fDigitsList[index] = tempo[index] ;
76 fDigitsList[fMulDigit++] = digit.GetIndexInList() ;
80 //____________________________________________________________________________
81 Int_t AliPHOSPpsdRecPoint::Compare(TObject * obj)
83 // Compares according to the position
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 // Calculates the local position in the PHOS-PPSD-module corrdinates
161 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
163 if( fLocPos.X() < 1000000.) { //allready evaluated
173 AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
175 AliPHOSDigit * digit ;
178 for(iDigit = 0; iDigit < fMulDigit; iDigit++) {
179 digit = (AliPHOSDigit *) ( please->GimeDigit(fDigitsList[iDigit]) );
183 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
184 phosgeom->RelPosInModule(relid, xi, zi);
200 //____________________________________________________________________________
201 Bool_t AliPHOSPpsdRecPoint::GetUp()
205 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
207 AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
210 AliPHOSDigit *digit = (AliPHOSDigit *) ( please->GimeDigit(fDigitsList[0]) ) ;
212 phosgeom->AbsToRelNumbering(digit->GetId(),relid);
215 if((Int_t)TMath::Ceil((Float_t)relid[1]/
216 (phosgeom->GetNumberOfModulesPhi()*phosgeom->GetNumberOfModulesZ())-0.0001 ) > 1)
223 //______________________________________________________________________________
224 void AliPHOSPpsdRecPoint::Paint(Option_t *)
226 //*-*-*-*-*-*-*-*-*-*-*Paint this ALiRecPoint as a TMarker with its current attributes*-*-*-*-*-*-*
227 //*-* =============================================
229 TVector3 pos(0.,0.,0.) ;
230 GetLocalPosition(pos) ;
231 Coord_t x = pos.X() ;
232 Coord_t y = pos.Z() ;
233 Color_t markercolor = 1 ;
234 Size_t markersize = 1. ;
235 Style_t markerstyle = 2 ;
239 if (!gPad->IsBatch()) {
240 gVirtualX->SetMarkerColor(markercolor);
241 gVirtualX->SetMarkerSize (markersize);
242 gVirtualX->SetMarkerStyle(markerstyle);
244 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize);
245 gPad->PaintPolyMarker(1,&x,&y,"");
250 //____________________________________________________________________________
251 void AliPHOSPpsdRecPoint::Print(Option_t * option)
253 // Print the digits information
255 cout << "AliPHOSPpsdRecPoint: " << endl ;
257 AliPHOSDigit * digit ;
259 AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
265 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
266 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
267 digit = please->GimeDigit( fDigitsList[iDigit] ) ;
269 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
270 phosgeom->RelPosInModule(relid, xi, zi);
271 cout << " Id = " << digit->GetId() ;
272 cout << " Phos mod = " << relid[0] ;
273 cout << " PPSD mod = " << relid[1] ;
274 cout << " x = " << xi ;
275 cout << " z = " << zi ;
276 cout << " Energy = " << digit->GetAmp() << endl ;
279 cout << " Multiplicity = " << fMulDigit << endl ;
280 cout << " Stored at position " << fIndexInList << endl ;