]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSRecParticle.cxx
New PID in AliPHOSPIDv1
[u/mrichter/AliRoot.git] / PHOS / AliPHOSRecParticle.cxx
index d42a13e3ff777381a0ad89ae99dd146722aced50..f32259e8f2e4fc4dac7d726e4314d374d87ab75d 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
+/* $Id$ */
+
 //_________________________________________________________________________
-// Reconstructed Particle
-//*-- Y. Schutz:   SUBATECH 
-//////////////////////////////////////////////////////////////////////////////
+//  A Reconstructed Particle in PHOS    
+//  To become a general class of AliRoot ?        
+//       
+//*-- Author: Yves Schutz (SUBATECH)
+
 
 // --- ROOT system ---
 
@@ -26,6 +30,7 @@
 
 #include "AliPHOSRecParticle.h"
 #include "TPad.h"
+#include "AliPHOSIndexToObject.h"
 
 ClassImp(AliPHOSRecParticle)
 
@@ -35,21 +40,26 @@ ClassImp(AliPHOSRecParticle)
 {
   // ctor
  
-  fPHOSTrackSegment = new AliPHOSTrackSegment(*ts) ; 
-  fE                = ts->GetEnergy() ; 
+  fPHOSTrackSegment = ts->GetIndexInList() ;
+  fIndexInList      = -1 ;
+  Float_t kenergy   = ts->GetEnergy() ; 
   TVector3 momdir   = ts->GetMomentumDirection() ;
-  fPx               = fE * momdir.X() ; 
-  fPy               = fE * momdir.Y() ; 
-  fPz               = fE * momdir.Z() ; 
-  fType             = kUNDEFINED ;  
-                           
+  fPx               = kenergy * momdir.X() ; 
+  fPy               = kenergy * momdir.Y() ; 
+  fPz               = kenergy * momdir.Z() ; 
+  fType             = kUNDEFINED;  
+  fE                = kenergy ;    // !!! all particles have mass = 0 
 }
 
 //____________________________________________________________________________
  AliPHOSRecParticle::AliPHOSRecParticle(const AliPHOSRecParticle & rp)
 {
-  fPHOSTrackSegment = new AliPHOSTrackSegment( *( rp.GetPHOSTrackSegment()) ) ; 
+  // copy ctor
+
+  fPHOSTrackSegment = rp.fPHOSTrackSegment ; 
   fType             = rp.fType ; 
+  fIndexInList      = rp.fIndexInList ;
+
   fPdgCode     = rp.fPdgCode;
   fStatusCode  = rp.fStatusCode;
   fMother[0]   = rp.fMother[0];
@@ -72,139 +82,57 @@ ClassImp(AliPHOSRecParticle)
 }
 
 //____________________________________________________________________________
- AliPHOSRecParticle::~AliPHOSRecParticle()
+Int_t * AliPHOSRecParticle::GetPrimaries(Int_t & number) 
 {
-  if(!fPHOSTrackSegment) {
-    delete fPHOSTrackSegment ;
-    fPHOSTrackSegment = 0 ; 
-  } 
-}
+  // Retrieves all the primary particles at the origine of this reconstructed particle
 
-//____________________________________________________________________________
-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;
-}
+  AliPHOSTrackSegment * ts = GetPHOSTrackSegment() ;
 
-//___________________________________________________________________________
- void AliPHOSRecParticle::Draw(Option_t *option)
- {
-   // Draw this AliPHOSRecParticle with its current attributes
-    
-   AppendPad(option);
- }
+  Int_t emcnumber = 0 ; 
+  Int_t * emclist = ts->GetPrimariesEmc(emcnumber) ;
+  
+  Int_t ppsdlnumber = 0 ;
+  Int_t * ppsdllist = ts->GetPrimariesPpsdLow(ppsdlnumber) ;
+  Int_t ppsdunumber = 0 ; 
+  Int_t * ppsdulist = ts->GetPrimariesPpsdUp(ppsdunumber) ;
 
-//______________________________________________________________________________
-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 ;
-  }
+  number = emcnumber + ppsdlnumber + ppsdunumber ;
+  Int_t * list   = new Int_t[number] ;
   
-  case kButton1Up: {
-    delete clustertext ; 
-    clustertext = 0 ; 
-    gPad->Update() ; 
-   break ;
+  Int_t index ; 
+  for ( index = 0 ; index < emcnumber ; index++)
+    list[index] = emclist[index] ;
+
+  Int_t jndex ; 
+  for ( jndex = 0 ; jndex < ppsdlnumber ; jndex++) {
+    assert(index < number) ;
+    list[index] = ppsdllist[jndex] ;
+    index++ ; 
   }
-  
+
+  for ( jndex = 0 ; jndex < ppsdunumber ; jndex++) {
+    assert(index < number) ;
+    list[index] = ppsdulist[jndex] ;
+    index++ ; 
   }
 
+  delete emclist ;
+  delete ppsdllist ;
+  delete ppsdulist ;
+
+  return list ; 
 }
+
 //____________________________________________________________________________
-TString AliPHOSRecParticle::Name()
+AliPHOSTrackSegment * AliPHOSRecParticle::GetPHOSTrackSegment() const 
 {
-  TString  name ; 
-  switch (fType) {
-  case kGAMMA:
-    name = "PHOTON" ;
-    break ; 
-   case kELECTRON:
-     name = "ELECTRON" ;
-    break ; 
-  case kNEUTRAL:
-    name = "NEUTRAL" ;
-    break ; 
-   case kCHARGEDHADRON:
-    name = "CHARGED HADRON" ;
-    break ; 
-  case kNEUTRALHADRON:
-    name = "NEUTRAL HADRON" ; 
-    break ; 
-  case kNEUTRALEM:
-    name = "NEUTRAL EM" ; 
-    break ; 
-  case kGAMMAHADRON:
-    name = "PHOTON HADRON" ; 
-    break ; 
+  // Retrieves the PHOS track segment at the origine of this reconstructed particle
 
-  }
-  return name ; 
-}
+  AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
+  return please->GimeTrackSegment( fPHOSTrackSegment ) ;
 
-//______________________________________________________________________________
-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()
-{
-  cout << "AliPHOSRecParticle > " << "type is  " << Name() << endl 
-       << "                     " << "Energy = " << fE << endl 
-       << "                     " << "Px     = " << fPx << endl 
-       << "                     " << "Py     = " << fPy << endl 
-       << "                     " << "Pz     = " << fPz << endl ; 
-}
+
+