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 // A RecPoint (cluster) in the PPSD
18 // A PPSD RecPoint ends up to be a single digit
19 // Why should I put meaningless comments
23 //*-- Yves Schutz (SUBATECH)
25 // --- ROOT system ---
29 // --- Standard library ---
33 // --- AliRoot header files ---
35 #include "AliPHOSGeometry.h"
36 #include "AliPHOSPpsdRecPoint.h"
37 #include "AliPHOSCpvRecPoint.h"
39 #include "AliPHOSIndexToObject.h"
41 ClassImp(AliPHOSPpsdRecPoint)
43 //____________________________________________________________________________
44 AliPHOSPpsdRecPoint::AliPHOSPpsdRecPoint(void)
49 fGeom = AliPHOSGeometry::GetInstance() ;
50 fDelta = ((AliPHOSGeometry *)fGeom)->GetCrystalSize(0) ;
51 fLocPos.SetX(1000000.) ; //Local position should be evaluated
54 //____________________________________________________________________________
55 void AliPHOSPpsdRecPoint::AddDigit(AliPHOSDigit & digit, Float_t Energy)
57 // adds a digit to the digits list
58 // and accumulates the total amplitude and the multiplicity
61 if ( fMulDigit >= fMaxDigit ) { // increase the size of the lists
63 int * tempo = new ( int[fMaxDigit] ) ;
66 for ( index = 0 ; index < fMulDigit ; index++ )
67 tempo[index] = fDigitsList[index] ;
69 delete [] fDigitsList ;
70 fDigitsList = new ( int[fMaxDigit] ) ;
72 for ( index = 0 ; index < fMulDigit ; index++ )
73 fDigitsList[index] = tempo[index] ;
78 fDigitsList[fMulDigit++] = digit.GetIndexInList() ;
82 //____________________________________________________________________________
83 Int_t AliPHOSPpsdRecPoint::Compare(const TObject * obj) const
85 // Compares according to the position
89 if( (strcmp(obj->ClassName() , "AliPHOSPpsdRecPoint" )) == 0) // PPSD Rec Point
91 AliPHOSPpsdRecPoint * clu = (AliPHOSPpsdRecPoint *)obj ;
102 if(GetUp()) // upper layer
107 if(clu->GetUp()) // upper layer
113 this->GetLocalPosition(posloc) ;
116 phosmod1 = this->GetPHOSMod();
117 clu->GetLocalPosition(posloc) ;
120 phosmod2 = clu->GetPHOSMod();
122 if(phosmod1 == phosmod2 ) {
125 Int_t rowdif = (Int_t)TMath::Ceil(x1/fDelta) - (Int_t) TMath::Ceil(x2/fDelta) ;
139 if(up1 < up2 ) // Upper level first (up = True or False, True > False)
145 } // if phosmod1 == phosmod2
149 if(phosmod1 < phosmod2 )
160 AliPHOSCpvRecPoint * clu = (AliPHOSCpvRecPoint *) obj ;
161 if(this->GetPHOSMod() < clu->GetPHOSMod() )
171 //____________________________________________________________________________
172 void AliPHOSPpsdRecPoint::EvalAll( ){
173 AliPHOSRecPoint::EvalAll() ;
174 EvalLocalPosition( ) ;
177 //____________________________________________________________________________
178 void AliPHOSPpsdRecPoint::EvalLocalPosition( )
180 // Calculates the local position in the PHOS-PPSD-module corrdinates
182 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
189 AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
191 AliPHOSDigit * digit ;
194 for(iDigit = 0; iDigit < fMulDigit; iDigit++) {
195 digit = (AliPHOSDigit *) ( please->GimeDigit(fDigitsList[iDigit]) );
199 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
200 phosgeom->RelPosInModule(relid, xi, zi);
214 //____________________________________________________________________________
215 Bool_t AliPHOSPpsdRecPoint::GetUp() const
217 // Are we in the uper PPSD module ?
221 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
223 AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
226 AliPHOSDigit *digit = (AliPHOSDigit *) ( please->GimeDigit(fDigitsList[0]) ) ;
228 phosgeom->AbsToRelNumbering(digit->GetId(),relid);
231 if((Int_t)TMath::Ceil((Float_t)relid[1]/
232 (phosgeom->GetNumberOfModulesPhi()*phosgeom->GetNumberOfModulesZ())-0.0001 ) > 1)
239 //______________________________________________________________________________
240 void AliPHOSPpsdRecPoint::Paint(Option_t *)
242 //*-*-*-*-*-*-*-*-*-*-*Paint this ALiRecPoint as a TMarker with its current attributes*-*-*-*-*-*-*
243 //*-* =============================================
245 TVector3 pos(0.,0.,0.) ;
246 GetLocalPosition(pos) ;
247 Coord_t x = pos.X() ;
248 Coord_t y = pos.Z() ;
249 Color_t markercolor = 1 ;
250 Size_t markersize = 1. ;
251 Style_t markerstyle = 2 ;
255 if (!gPad->IsBatch()) {
256 gVirtualX->SetMarkerColor(markercolor);
257 gVirtualX->SetMarkerSize (markersize);
258 gVirtualX->SetMarkerStyle(markerstyle);
260 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize);
261 gPad->PaintPolyMarker(1,&x,&y,"");
266 //____________________________________________________________________________
267 void AliPHOSPpsdRecPoint::Print(Option_t * option)
269 // Print the digits information
271 cout << "AliPHOSPpsdRecPoint: " << endl ;
273 AliPHOSDigit * digit ;
275 AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
281 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
282 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
283 digit = please->GimeDigit( fDigitsList[iDigit] ) ;
285 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
286 phosgeom->RelPosInModule(relid, xi, zi);
287 cout << " Id = " << digit->GetId() ;
288 cout << " Phos mod = " << relid[0] ;
289 cout << " PPSD mod = " << relid[1] ;
290 cout << " x = " << xi ;
291 cout << " z = " << zi ;
292 cout << " Energy = " << digit->GetAmp() << endl ;
295 cout << " Multiplicity = " << fMulDigit << endl ;
296 cout << " Stored at position " << fIndexInList << endl ;