]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSTrackSegment.cxx
add AliTPCcalibV0 class (Marian)
[u/mrichter/AliRoot.git] / PHOS / AliPHOSTrackSegment.cxx
index f1e871bcb26c985eb05f3ca7a4bbca9c0440191f..6d9707f95924c216f6274e1c7da01ed5e97db3df 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
+/* $Id$ */
+
+/* History of cvs commits:
+ *
+ * $Log$
+ * Revision 1.30  2006/08/28 10:01:56  kharlov
+ * Effective C++ warnings fixed (Timur Pocheptsov)
+ *
+ * Revision 1.29  2005/05/28 14:19:05  schutz
+ * Compilation warnings fixed by T.P.
+ *
+ */
 
 //_________________________________________________________________________
-// class of PHOS Sub Track
-//*-- Author : Dmitri Peressounko RRC KI 
-//////////////////////////////////////////////////////////////////////////////
+//  Track segment in PHOS
+//  Can be : 1 EmcRecPoint
+//           1 EmcRecPoint + 1 CPV
+//           1 EmcRecPoint + 1 CPV + 1 charged track
+//                  
+//*-- Author:  Dmitri Peressounko (RRC KI & SUBATECH)
 
 // --- ROOT system ---
  
-#include "TVector3.h"
 
 // --- Standard library ---
 
-#include "iostream.h"
-
 // --- AliRoot header files ---
-
+#include "AliPHOSEmcRecPoint.h" 
 #include "AliPHOSTrackSegment.h" 
-#include "AliPHOSv0.h"
+#include "AliESDtrack.h" 
 
 ClassImp(AliPHOSTrackSegment)
 
 //____________________________________________________________________________
-AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc , AliPHOSPpsdRecPoint * ppsdRP1,
-                  AliPHOSPpsdRecPoint * ppsdRP2  ) 
-{     
+AliPHOSTrackSegment::AliPHOSTrackSegment()
+                       : fEmcRecPoint(0),
+                         fIndexInList(0),
+                         fCpvRecPoint(0),
+                         fTrack(0)
+{
+  //def ctor
+  fDcpv[0]=999. ;
+  fDcpv[1]=999. ;
+}
+
+//____________________________________________________________________________
+AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc , 
+                                         AliPHOSRecPoint * cpvrp1)
+                       : fEmcRecPoint(0),
+                         fIndexInList(0),
+                         fCpvRecPoint(0),
+                         fTrack(0)
+{
+  // ctor
+
   if( emc )   
-    fEmcRecPoint =  emc ;
+    fEmcRecPoint =  emc->GetIndexInList() ;
+  else 
+    fEmcRecPoint = -1 ;
 
-  if( ppsdRP1 )  
-    fPpsdUp = ppsdRP1 ;
+  if( cpvrp1 )  
+    fCpvRecPoint = cpvrp1->GetIndexInList() ;
+ else 
+    fCpvRecPoint = -1 ;
 
-  if( ppsdRP2  ) 
-    fPpsdLow = ppsdRP2 ;
+  fTrack = -1 ; 
 
-  fCutOnDispersion = 1.5 ; 
+  fIndexInList = -1 ;
+  fDcpv[0]=999. ;
+  fDcpv[1]=999. ;
 }
 
 //____________________________________________________________________________
-AliPHOSTrackSegment::~AliPHOSTrackSegment() // dtor
+AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc , 
+                                         AliPHOSRecPoint * cpvrp1, 
+                                         Int_t track)
+                       : fEmcRecPoint(0),
+                         fIndexInList(0),
+                         fCpvRecPoint(0),
+                         fTrack(0)
 {
-//    fEmcRecPoint.Delete() ;   Not Owners !!!
-//    fPpsdUp.Delete() ;
-//    fPpsdLow.Delete() ;
+  // ctor
+
+  if( emc )   
+    fEmcRecPoint =  emc->GetIndexInList() ;
+  else 
+    fEmcRecPoint = -1 ;
+
+  if( cpvrp1 )  
+    fCpvRecPoint = cpvrp1->GetIndexInList() ;
+ else 
+    fCpvRecPoint = -1 ;
+  
+  fTrack = track ; 
+
+  fIndexInList = -1 ;
+  fDcpv[0]=999. ;
+  fDcpv[1]=999. ;
 }
 
 //____________________________________________________________________________
-Float_t AliPHOSTrackSegment::GetDistanceInPHOSPlane()
+AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc , 
+                                         AliPHOSRecPoint * cpvrp1, 
+                                         Int_t track, Float_t dx,Float_t dz)
+                       : fEmcRecPoint(0),
+                         fIndexInList(0),
+                         fCpvRecPoint(0),
+                         fTrack(0)
 {
-  TVector3 vecEmc ;
-  fEmcRecPoint->GetLocalPosition(vecEmc) ;
+  // ctor
 
-  TVector3 vecPpsd ;
-  if( fPpsdLow->GetMultiplicity() )  
-    fPpsdLow->GetLocalPosition(vecPpsd)  ; 
-  else { 
-    vecPpsd.SetX(10000.) ;
-  } 
-  vecEmc -= vecPpsd ;
+  if( emc )   
+    fEmcRecPoint =  emc->GetIndexInList() ;
+  else 
+    fEmcRecPoint = -1 ;
 
-  Float_t R = vecEmc.Mag();;
+  if( cpvrp1 )  
+    fCpvRecPoint = cpvrp1->GetIndexInList() ;
+ else 
+    fCpvRecPoint = -1 ;
+  
+  fTrack = track ; 
 
-  return R ;
-}
+  fIndexInList = -1 ;
 
-//____________________________________________________________________________
-Bool_t AliPHOSTrackSegment::GetMomentumDirection( TVector3 & dir ) 
-{   
-  // True if determined
-  Bool_t ifdeterm = kTRUE ;
-
-  if( fPpsdLow ){
-    TMatrix mdummy ;
-    if( fPpsdUp->GetMultiplicity() ) { // draw line trough 2 points
-      TVector3 posEmc ;
-      fEmcRecPoint->GetGlobalPosition(posEmc,mdummy) ;
-      TVector3 posPpsd ;
-      fPpsdLow->GetGlobalPosition(posPpsd,mdummy) ; 
-      dir = posEmc - posPpsd ;
-      dir.SetMag(1.) ;
-    }
-
-    else { // draw line through 3 pionts
-      TVector3 posEmc ;
-      fEmcRecPoint->GetGlobalPosition(posEmc,mdummy) ;
-      TVector3 posPpsdl ;
-      fPpsdLow->GetGlobalPosition(posPpsdl,mdummy) ; 
-      TVector3 posPpsdup ;
-      fPpsdUp->GetGlobalPosition(posPpsdup,mdummy) ;
-      posPpsdl = 0.5*( posPpsdup+posPpsdl ) ; 
-      dir = posEmc - posPpsdl ;
-      dir.SetMag(1.) ;
-    }
-  
-  }
-  else 
-    ifdeterm = kFALSE ;
-  return ifdeterm ;
+  fDcpv[0] = dx ;
+  fDcpv[1] = dz ;
 }
 
 //____________________________________________________________________________
-Int_t AliPHOSTrackSegment::GetPartType()  
-{  
-  // Returns 0 - gamma
-  //         1 - e+, e-
-  //         2 - neutral hadron  
-  //         3 - charged hadron
+AliPHOSTrackSegment::AliPHOSTrackSegment( const AliPHOSTrackSegment & ts) 
+  : TObject(ts),
+    fEmcRecPoint(0),
+    fIndexInList(0),
+    fCpvRecPoint(0),
+    fTrack(0)
+{
+  // Copy ctor
+
+  ( (AliPHOSTrackSegment &)ts ).Copy(*this) ; 
+}
 
-  Int_t PartType =0;                            
-  if( fPpsdUp ){     // Neutral
 
-    if( fPpsdLow ) // Neutral hadron  
-      PartType = 2 ;   
-    else                                // Gamma
-      PartType = 0 ;               
+//____________________________________________________________________________
+void AliPHOSTrackSegment::Copy(TObject & obj) const
+{
+  // Copy of a track segment into another track segment
 
-  }
+   TObject::Copy(obj) ;
+   ( (AliPHOSTrackSegment &)obj ).fEmcRecPoint     = fEmcRecPoint ; 
+   ( (AliPHOSTrackSegment &)obj ).fCpvRecPoint     = fCpvRecPoint ; 
+   ( (AliPHOSTrackSegment &)obj ).fIndexInList     = fIndexInList ; 
+   ( (AliPHOSTrackSegment &)obj ).fTrack           = fTrack ;
+   ( (AliPHOSTrackSegment &)obj ).fDcpv[0]         = fDcpv[0] ;
+   ( (AliPHOSTrackSegment &)obj ).fDcpv[1]         = fDcpv[1] ;
+} 
 
-  else {             // Charged           
 
-    if( fEmcRecPoint->GetDispersion() > fCutOnDispersion) 
-      PartType = 3 ;
-    else  
-      PartType = 1 ;  
-  
-  }
+//____________________________________________________________________________
+void AliPHOSTrackSegment::Print(const Option_t *) const
+{
+  // Print all information on this track Segment
   
-  return   PartType ;                     
 
+  Info("Print", "");
+  printf("Stored at position %d\n", fIndexInList) ;
+  printf(" Emc RecPoint #     %d\n", fEmcRecPoint) ;
+  if(fCpvRecPoint >= 0)
+    printf(" CPV RecPoint #     %d\n", fCpvRecPoint) ;
+  else
+    printf(" No CPV RecPoint\n");
+  if (fTrack >= 0) 
+    printf(" Charged track #     %d\n", fTrack) ;
+  else
+    printf(" No Charged track\n");
+  printf(" Distance to CPV: x=%f, z=%f\n",fDcpv[0],fDcpv[1]) ;
 }
 
 //____________________________________________________________________________
-void AliPHOSTrackSegment::GetPosition( TVector3 & pos ) 
-{  
-  // Returns positions of hits
-  TMatrix Dummy ;
-  fEmcRecPoint->GetGlobalPosition(pos, Dummy) ;
+void AliPHOSTrackSegment::SetCpvRecPoint(AliPHOSRecPoint * cpvRecPoint) 
+{
+  // gives an id from its position in the list
+  if( cpvRecPoint )  
+    fCpvRecPoint = cpvRecPoint->GetIndexInList() ;
+ else 
+    fCpvRecPoint = -1 ;
 }
-
 //____________________________________________________________________________
-void AliPHOSTrackSegment::Print()
+Float_t AliPHOSTrackSegment::GetCpvDistance(const Option_t* dr) const
 {
-  cout << "--------AliPHOSTrackSegment-------- "<<endl ;
-  cout << "EMC Reconstructed Point: " << fEmcRecPoint << endl;
-  
-  TVector3 pos ;
-  TMatrix Dummy ;  
-
-  fEmcRecPoint->GetGlobalPosition( pos, Dummy ) ;
-  cout << "    position " << pos.X() << "   " << pos.Y() << "  " << pos.Z() << "      Energy " << fEmcRecPoint->GetTotalEnergy() << endl ;
-  cout << "PPSD Low Reconstructed Point: " << endl;
-  
-  if(fPpsdLow){
-    fPpsdLow->GetGlobalPosition( pos , Dummy ) ;
-    cout << "    position " << pos.X() << "   " << pos.Y() << "  " << pos.Z() << endl ;
-  }
-
-  cout << "PPSD Up Reconstructed Point: " << endl;
-  
-  if(fPpsdUp ){
-    fPpsdUp->GetGlobalPosition( pos, Dummy ) ;
-    cout << "    position " << pos.X() << "   " << pos.Y() << "  " << pos.Z()  << endl ;
-  }
+ if(strcmp(dr,"x")==0||strcmp(dr,"X")==0) return fDcpv[0] ; 
+ if(strcmp(dr,"z")==0||strcmp(dr,"Z")==0) return fDcpv[1] ; 
+ if(strcmp(dr,"r")==0||strcmp(dr,"R")==0) return TMath::Sqrt(fDcpv[0]*fDcpv[0]+fDcpv[1]*fDcpv[1]) ; 
+ return 999. ;
 
 }
-