]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
The AliRecParticle objects are now drawable objects
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 22 Feb 2000 13:06:42 +0000 (13:06 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 22 Feb 2000 13:06:42 +0000 (13:06 +0000)
PHOS/AliPHOSAnalyze.cxx
PHOS/AliPHOSRecParticle.cxx
PHOS/AliPHOSRecParticle.h
PHOS/AliPHOSRecPoint.cxx
PHOS/AliPHOSRecPoint.h
PHOS/AliPHOSTrackSegmentMaker.h

index 667b6ffbcd80947393a324b1238bf457ab9dc7cd..d11f6492a2600b19a281f910d3914a2b185c94ca 100644 (file)
@@ -489,7 +489,7 @@ void AliPHOSAnalyze::DisplayKineEvent(Int_t evt)
 void AliPHOSAnalyze::DisplayRecParticles()
 {
   if (fEvt == -999) {
-    cout << "DisplayRecPoints > Analyze an event first ... (y/n) " ; 
+    cout << "DisplayRecParticles > Analyze an event first ... (y/n) " ; 
     Text_t answer[1] ; 
     cin >> answer ; cout << answer ; 
     if ( answer == "y" ) 
@@ -498,7 +498,7 @@ void AliPHOSAnalyze::DisplayRecParticles()
     if (fEvt != -999) {
       
       Int_t module ; 
-      cout <<  "DisplayRecPoints > which module (1-5,  -1: all) ? " ; 
+      cout <<  "DisplayRecParticles > which module (1-5,  -1: all) ? " ; 
       cin >> module ; cout << module << endl ;
       Text_t histoname[80] ; 
       sprintf(histoname,"Event %d: Reconstructed particles in module %d", fEvt, module) ; 
@@ -535,6 +535,14 @@ void AliPHOSAnalyze::DisplayRecParticles()
        }
       }
       histoRparticle->Draw("color") ; 
+
+      nextRecPart.Reset() ; 
+      while ( (rp = (AliPHOSRecParticle *)nextRecPart() ) ) {
+       AliPHOSTrackSegment * ts = rp->GetPHOSTrackSegment() ; 
+       if ( ts->GetPHOSMod() == module )  
+         rp->Draw("P") ; 
+      }
+
       Text_t text[80] ; 
       sprintf(text, "reconstructed particles: %d", nRecParticlesInModule) ;
       TPaveText *  pavetext = new TPaveText(292, 100, 300, 101); 
index 67da3bf4310982e194540d25ede078eeeb7379c4..d88d1993f022fbbc4f82d1f61f523fc0cfaa9c8b 100644 (file)
@@ -25,6 +25,7 @@
 // --- AliRoot header files ---
 
 #include "AliPHOSRecParticle.h"
+#include "TPad.h"
 
 ClassImp(AliPHOSRecParticle)
 
@@ -44,6 +45,73 @@ ClassImp(AliPHOSRecParticle)
                            
 }
 
+//____________________________________________________________________________
+Int_t AliPHOSRecParticle::DistancetoPrimitive(Int_t px, Int_t py)
+{
+  //  Compute distance from point px,py to a AliPHOSRecParticle considered as a Tmarker
+  //  Compute the closest distance of approach from point px,py to this marker.
+  //  The distance is computed in pixels units.
+
+  Double_t kRADDEG = 180. / TMath::Pi() ; 
+  Coord_t x = Phi() * kRADDEG     ;
+  Coord_t y = Theta() * kRADDEG     ;
+  const Int_t kMaxDiff = 10;
+  Int_t pxm  = gPad->XtoAbsPixel(x);
+  Int_t pym  = gPad->YtoAbsPixel(y);
+  Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
+  
+  if (dist > kMaxDiff) return 9999;
+  return dist;
+}
+
+//___________________________________________________________________________
+ void AliPHOSRecParticle::Draw(Option_t *option)
+ {
+   // Draw this AliPHOSRecParticle with its current attributes
+    
+   AppendPad(option);
+ }
+
+//______________________________________________________________________________
+void AliPHOSRecParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py)
+{
+  //  Execute action corresponding to one event
+  //  This member function is called when a AliPHOSRecParticle is clicked with the locator
+  //
+    
+  if (!gPad->IsEditable()) 
+    return ;
+
+  static TPaveText * clustertext = 0 ; 
+
+  switch (event) {
+    
+  case kButton1Down: {
+    Double_t kRADDEG = 180. / TMath::Pi() ; 
+    Coord_t x = Phi() * kRADDEG     ;
+    Coord_t y = Theta() * kRADDEG     ;
+    clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ;
+    Text_t  line1[40] ;
+    Text_t  line2[40] ;
+    sprintf( line1, "PID: %s ", (const char*)Name() ) ;
+    sprintf( line2, "ENERGY: %f ", Energy() ) ;
+    clustertext ->AddText(line1) ;
+    clustertext ->AddText(line2) ;
+    clustertext ->Draw("");   
+    gPad->Update() ; 
+    break ;
+  }
+  
+  case kButton1Up: {
+    delete clustertext ; 
+    clustertext = 0 ; 
+    gPad->Update() ; 
+   break ;
+  }
+  
+  }
+
+}
 //____________________________________________________________________________
 TString AliPHOSRecParticle::Name()
 {
@@ -75,6 +143,27 @@ TString AliPHOSRecParticle::Name()
   return name ; 
 }
 
+//______________________________________________________________________________
+void AliPHOSRecParticle::Paint(Option_t *)
+{
+// Paint this ALiRecParticle in theta,phi coordinate as a TMarker  with its current attributes
+
+  Double_t kRADDEG = 180. / TMath::Pi() ; 
+   Coord_t x = Phi() * kRADDEG     ;
+   Coord_t y = Theta() * kRADDEG     ;
+   Color_t markercolor = 1 ;
+   Size_t  markersize  = 1. ;
+   Style_t markerstyle = 5 ;
+
+   if (!gPad->IsBatch()) {
+     gVirtualX->SetMarkerColor(markercolor) ;
+     gVirtualX->SetMarkerSize (markersize)  ;
+     gVirtualX->SetMarkerStyle(markerstyle) ;
+   }
+   gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
+   gPad->PaintPolyMarker(1,&x,&y,"") ;
+}
+
 //____________________________________________________________________________
 void AliPHOSRecParticle::Print()
 {
index fbc47ccfeb284264d70124f59721c2b5f20db8ce..7b9cac0e5f5bbd5df56f4033c8bacf98999102c7 100644 (file)
@@ -42,9 +42,13 @@ public:
 
   virtual ~AliPHOSRecParticle(){} ; // dtor
 
+  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py) ; 
+  virtual void Draw(Option_t *option) ; 
+  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py) ; 
   AliPHOSTrackSegment * GetPHOSTrackSegment() { return fPHOSTrackSegment ; } 
   Int_t GetType() { return fType ; } 
   TString Name() ; 
+  virtual void Paint(Option_t * option="");
   void Print() ; 
   void SetType(Int_t type) { fType = type ; } 
 
index 9fd62da06abccb9339f2ac3f3b0892840f830818..98229f480a12939db71e2f852bb2c7d75fe6bbf6 100644 (file)
@@ -49,6 +49,7 @@ AliPHOSRecPoint::~AliPHOSRecPoint()
 {
   // dtor
 }
+
 //____________________________________________________________________________
 Int_t AliPHOSRecPoint::DistancetoPrimitive(Int_t px, Int_t py)
 {
index 688d9e8b5f5c7349095428eb1b4e3d6234ee4a67..21c8b09e7acadb65073390d238453073a7bc637a 100644 (file)
@@ -40,7 +40,7 @@ public:
   virtual Int_t   GetPHOSMod(void) ;
   virtual void    GetPrimaries(Int_t & number, Int_t * list) ;
   virtual Bool_t  IsEmc(void){return kTRUE ;} 
-  virtual  void   Paint(Option_t * option="");
+  virtual void    Paint(Option_t * option="");
   virtual void    Print(Option_t * opt = "void") {} 
 
   virtual Int_t   Compare(TObject * obj) {  assert(0==1) ; }   
index 8d79e0bbf6fc26b482fc6cc49ce9b029a1549f7d..21f5be0c006fcef40dcab8cb6b8da41554d1962b 100644 (file)
@@ -40,9 +40,6 @@ public:
   virtual void SetUnfoldFlag() = 0 ;
   virtual void UnsetUnfoldFlag() = 0 ;
 
- protected:
-
-
   ClassDef( AliPHOSTrackSegmentMaker,1)  // subtracking implementation , version 1
 
 };