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 // PHOSRecPoint base class deriving from AliRecPoint
18 //*-- Author : Gines MARTINEZ SUBATECH
19 //////////////////////////////////////////////////////////////////////////////
21 // --- ROOT system ---
24 // --- Standard library ---
28 // --- AliRoot header files ---
30 #include "AliPHOSGeometry.h"
31 #include "AliPHOSDigit.h"
32 #include "AliPHOSRecPoint.h"
36 ClassImp(AliPHOSRecPoint)
39 //____________________________________________________________________________
40 AliPHOSRecPoint::AliPHOSRecPoint()
43 fGeom = AliPHOSGeometry::GetInstance() ;
47 //____________________________________________________________________________
48 AliPHOSRecPoint::~AliPHOSRecPoint()
52 //____________________________________________________________________________
53 Int_t AliPHOSRecPoint::DistancetoPrimitive(Int_t px, Int_t py)
55 //Compute distance from point px,py to a AliPHOSRecPoint considered as a Tmarker
56 // Compute the closest distance of approach from point px,py to this marker.
57 // The distance is computed in pixels units.
60 TVector3 pos(0.,0.,0.) ;
61 GetLocalPosition( pos) ;
64 const Int_t kMaxDiff = 10;
65 Int_t pxm = gPad->XtoAbsPixel(x);
66 Int_t pym = gPad->YtoAbsPixel(y);
67 Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
69 if (dist > kMaxDiff) return 9999;
73 //___________________________________________________________________________
74 void AliPHOSRecPoint::Draw(Option_t *option)
76 // Draw this AliPHOSRecPoint with its current attributes
81 //______________________________________________________________________________
82 void AliPHOSRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py)
84 // Execute action corresponding to one event
85 // This member function is called when a AliPHOSRecPoint is clicked with the locator
87 // If Left button is clicked on AliPHOSRecPoint, the digits are switched on
88 // and switched off when the mouse button is released.
91 // static Int_t pxold, pyold;
93 static TGraph * DigitGraph = 0 ;
94 static TPaveText* ClusterText = 0 ;
96 if (!gPad->IsEditable()) return;
102 AliPHOSDigit * digit ;
103 AliPHOSGeometry * PHOSGeom = (AliPHOSGeometry *) fGeom ;
106 Float_t xi[fMulDigit] ;
107 Float_t zi[fMulDigit] ;
109 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
110 digit = (AliPHOSDigit *) fDigitsList[iDigit];
111 PHOSGeom->AbsToRelNumbering(digit->GetId(), relid) ;
112 PHOSGeom->RelPosInModule(relid, xi[iDigit], zi[iDigit]) ;
116 DigitGraph = new TGraph(fMulDigit,xi,zi);
117 DigitGraph-> SetMarkerStyle(5) ;
118 DigitGraph-> SetMarkerSize(1.) ;
119 DigitGraph-> SetMarkerColor(1) ;
120 DigitGraph-> Draw("P") ;
124 TVector3 pos(0.,0.,0.) ;
125 GetLocalPosition(pos) ;
126 ClusterText = new TPaveText(pos.X()-10,pos.Z()+10,pos.X()+50,pos.Z()+35,"") ;
129 sprintf(line1,"Energy=%1.2f GeV",GetEnergy()) ;
130 sprintf(line2,"%d Digits",GetDigitsMultiplicity()) ;
131 ClusterText ->AddText(line1) ;
132 ClusterText ->AddText(line2) ;
133 ClusterText ->Draw("");
157 //____________________________________________________________________________
158 Int_t AliPHOSRecPoint::GetPHOSMod()
165 AliPHOSDigit * digit ;
166 digit = (AliPHOSDigit *) fDigitsList[0] ;
167 AliPHOSGeometry * PHOSGeom = (AliPHOSGeometry *) fGeom ;
169 PHOSGeom->AbsToRelNumbering(digit->GetId(), relid) ;
174 //______________________________________________________________________________
175 void AliPHOSRecPoint::Paint(Option_t *)
177 // Paint this ALiRecPoint as a TMarker with its current attributes
179 TVector3 pos(0.,0.,0.) ;
180 GetLocalPosition(pos) ;
181 Coord_t x = pos.X() ;
182 Coord_t y = pos.Z() ;
183 Color_t MarkerColor = 1 ;
184 Size_t MarkerSize = 1. ;
185 Style_t MarkerStyle = 5 ;
187 if (!gPad->IsBatch()) {
188 gVirtualX->SetMarkerColor(MarkerColor) ;
189 gVirtualX->SetMarkerSize (MarkerSize) ;
190 gVirtualX->SetMarkerStyle(MarkerStyle) ;
192 gPad->SetAttMarkerPS(MarkerColor,MarkerStyle,MarkerSize) ;
193 gPad->PaintPolyMarker(1,&x,&y,"") ;