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 ---
31 // --- AliRoot header files ---
33 #include "AliPHOSGeometry.h"
34 #include "AliPHOSPpsdRecPoint.h"
35 #include "AliPHOSCpvRecPoint.h"
37 #include "AliPHOSGetter.h"
39 ClassImp(AliPHOSPpsdRecPoint)
41 //____________________________________________________________________________
42 AliPHOSPpsdRecPoint::AliPHOSPpsdRecPoint(void)
47 fLocPos.SetX(1000000.) ; //Local position should be evaluated
50 //____________________________________________________________________________
51 void AliPHOSPpsdRecPoint::AddDigit(AliPHOSDigit & digit, Float_t Energy)
53 // adds a digit to the digits list
54 // and accumulates the total amplitude and the multiplicity
57 if ( fMulDigit >= fMaxDigit ) { // increase the size of the lists
59 int * tempo = new ( int[fMaxDigit] ) ;
62 for ( index = 0 ; index < fMulDigit ; index++ )
63 tempo[index] = fDigitsList[index] ;
65 delete [] fDigitsList ;
66 fDigitsList = new ( int[fMaxDigit] ) ;
68 for ( index = 0 ; index < fMulDigit ; index++ )
69 fDigitsList[index] = tempo[index] ;
74 fDigitsList[fMulDigit++] = digit.GetIndexInList() ;
79 //____________________________________________________________________________
80 Int_t AliPHOSPpsdRecPoint::Compare(const TObject * obj) const
82 // Compares according to the position
83 Float_t delta = 1 ; //width of the "Sorting row"
87 if( (strcmp(obj->ClassName() , "AliPHOSPpsdRecPoint" )) == 0) // PPSD Rec Point
89 AliPHOSPpsdRecPoint * clu = (AliPHOSPpsdRecPoint *)obj ;
91 Float_t x1 , z1 ; //This rec point
100 if(GetUp()) // upper layer
105 if(clu->GetUp()) // upper layer
111 GetLocalPosition(posloc) ;
114 phosmod1 = GetPHOSMod();
115 clu->GetLocalPosition(posloc) ;
118 phosmod2 = clu->GetPHOSMod();
120 if(phosmod1 == phosmod2 ) {
123 Int_t rowdif = (Int_t)TMath::Ceil(x1/delta) - (Int_t) TMath::Ceil(x2/delta) ;
137 if(up1 < up2 ) // Upper level first (up = True or False, True > False)
143 } // if phosmod1 == phosmod2
147 if(phosmod1 < phosmod2 )
158 AliPHOSCpvRecPoint * clu = (AliPHOSCpvRecPoint *) obj ;
159 if(GetPHOSMod() < clu->GetPHOSMod() )
169 //____________________________________________________________________________
170 void AliPHOSPpsdRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits )
172 // calculates all the characteristics of the RecPoint
173 AliPHOSRecPoint::EvalAll(logWeight,digits) ;
174 EvalLocalPosition(logWeight,digits) ;
178 //____________________________________________________________________________
179 void AliPHOSPpsdRecPoint::EvalLocalPosition(Float_t logWeight,TClonesArray * digits )
181 // Calculates the local position in the PHOS-PPSD-module coordinates
188 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
189 AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
191 AliPHOSDigit * digit ;
194 for(iDigit = 0; iDigit < fMulDigit; iDigit++) {
195 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
199 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
200 phosgeom->RelPosInModule(relid, xi, zi);
214 //____________________________________________________________________________
215 void AliPHOSPpsdRecPoint::EvalUp(TClonesArray * digits)
217 // Are we in the uper PPSD module ?
221 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
222 AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
225 AliPHOSDigit *digit = (AliPHOSDigit *) digits->At(fDigitsList[0]) ;
227 phosgeom->AbsToRelNumbering(digit->GetId(),relid);
229 if((Int_t)TMath::Ceil((Float_t)relid[1]/
230 (phosgeom->GetNumberOfModulesPhi()*phosgeom->GetNumberOfModulesZ())-0.0001 ) > 1)
236 //______________________________________________________________________________
237 void AliPHOSPpsdRecPoint::Paint(Option_t *)
239 //*-*-*-*-*-*-*-*-*-*-*Paint this ALiRecPoint as a TMarker with its current attributes*-*-*-*-*-*-*
240 //*-* =============================================
242 TVector3 pos(0.,0.,0.) ;
243 GetLocalPosition(pos) ;
244 Coord_t x = pos.X() ;
245 Coord_t y = pos.Z() ;
246 Color_t markercolor = 1 ;
247 Size_t markersize = 1. ;
248 Style_t markerstyle = 2 ;
252 if (!gPad->IsBatch()) {
253 gVirtualX->SetMarkerColor(markercolor);
254 gVirtualX->SetMarkerSize (markersize);
255 gVirtualX->SetMarkerStyle(markerstyle);
257 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize);
258 gPad->PaintPolyMarker(1,&x,&y,"");
263 //____________________________________________________________________________
264 void AliPHOSPpsdRecPoint::Print(Option_t * option)
266 // Print the digits information
268 Info("Print","AliPHOSPpsdRecPoint: " ) ;
271 Info("Print"," Digit{s} # ") ;
272 for(iDigit=0; iDigit<fMulDigit; iDigit++)
273 Info("Print", "%d", fDigitsList[iDigit]) ;
274 Info("Print"," Multiplicity = %d", fMulDigit ) ;
275 Info("Print"," Stored at position %d", fIndexInList ) ;