]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSTrackSegmentMakerv1.cxx
Corrected copy constructor and assignment operator, fixed memory leaks (Christian)
[u/mrichter/AliRoot.git] / PHOS / AliPHOSTrackSegmentMakerv1.cxx
index 59d9f1a700ac1b91949b5092e5de489fd289be61..67fda5813d7617f4adab9cd7c3322758658752f2 100644 (file)
 /* History of cvs commits:
  *
  * $Log$
+ * Revision 1.90  2007/07/11 13:43:30  hristov
+ * New class AliESDEvent, backward compatibility with the old AliESD (Christian)
+ *
+ * Revision 1.89  2007/07/03 08:13:04  kharlov
+ * Bug fix in CPV local coordinates
+ *
+ * Revision 1.88  2007/06/27 09:11:07  kharlov
+ * Bug fix for CPV-EMC distance
+ *
+ * Revision 1.87  2007/05/04 14:49:29  policheh
+ * AliPHOSRecPoint inheritance from AliCluster
+ *
+ * Revision 1.86  2007/04/02 15:00:16  cvetan
+ * No more calls to gAlice in the reconstruction
+ *
+ * Revision 1.85  2007/03/28 19:18:15  kharlov
+ * RecPoints recalculation in TSM removed
+ *
+ * Revision 1.84  2007/03/07 07:01:21  hristov
+ * Fixing copy/paste erro. Additional protections
+ *
+ * Revision 1.83  2007/03/06 21:07:37  kharlov
+ * DP: xz CPV-EMC distance filled to TS
+ *
  * Revision 1.82  2007/03/06 06:54:48  kharlov
  * DP:Calculation of cluster properties dep. on vertex added
  *
 #include "AliPHOSTrackSegment.h"
 #include "AliPHOSLink.h"
 #include "AliPHOSGetter.h"
-#include "AliESD.h"
+#include "AliESDEvent.h"
 #include "AliESDtrack.h"
+#include "AliPHOSQualAssDataMaker.h"
 
 ClassImp( AliPHOSTrackSegmentMakerv1) 
 
@@ -104,6 +129,7 @@ AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1() :
   fNTrackSegments(0),
   fRcpv(0.f),
   fRtpc(0.f),
+  fVtx(0.f), 
   fLinkUpArray(0),
   fEmcFirst(0),
   fEmcLast(0),
@@ -125,6 +151,7 @@ AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(const TString & alirunFil
   fNTrackSegments(0),
   fRcpv(0.f),
   fRtpc(0.f),
+  fVtx(0.f), 
   fLinkUpArray(0),
   fEmcFirst(0),
   fEmcLast(0),
@@ -147,6 +174,7 @@ AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(const AliPHOSTrackSegment
   fNTrackSegments(0),
   fRcpv(0.f),
   fRtpc(0.f),
+  fVtx(0.f), 
   fLinkUpArray(0),
   fEmcFirst(0),
   fEmcLast(0),
@@ -185,10 +213,9 @@ void  AliPHOSTrackSegmentMakerv1::FillOneModule()
   // clusters from one PHOS module are
 
   AliPHOSGetter * gime = AliPHOSGetter::Instance() ; 
-  
   TObjArray * emcRecPoints = gime->EmcRecPoints() ; 
   TObjArray * cpvRecPoints = gime->CpvRecPoints() ; 
+   
   //First EMC clusters
   Int_t totalEmc = emcRecPoints->GetEntriesFast() ;
   for(fEmcFirst = fEmcLast; (fEmcLast < totalEmc) &&  
@@ -237,13 +264,13 @@ void  AliPHOSTrackSegmentMakerv1::GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * em
     
   Double_t xCPV,zCPV ; //EMC-projected coordinates of CPV cluster 
   TVector3 cpvGlobal; // Global position of the CPV recpoint
-  geom->GetGlobal((AliRecPoint*)cpvClu,cpvGlobal);
+  geom->GetGlobalPHOS((AliPHOSRecPoint*)cpvClu,cpvGlobal);
   Double_t vtxCPV[3]={cpvGlobal.X(),cpvGlobal.Y(),cpvGlobal.Z()} ;
+  Int_t dummyMod ;
 
   if (fESD == 0x0) {
      //if no track information available, assume straight line from IP to emcal
-     Int_t dummyMod ;
-     geom->ImpactOnEmc(vtxCPV,cpvGlobal.Theta(),cpvGlobal.Phi(),dummyMod,xCPV,zCPV) ;
+     geom->ImpactOnEmc(vtxCPV,cpvGlobal.Theta(),cpvGlobal.Phi(),dummyMod,zCPV,xCPV) ;
      dx=xCPV - vecEmc.X() ;
      dz=zCPV - vecEmc.Z() ;
      return ;
@@ -284,7 +311,7 @@ void  AliPHOSTrackSegmentMakerv1::GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * em
       if (track->GetPxPyPzAt(rCPV, fESD->GetMagneticField(), pxyz)) { // track momentum ibid.
         vecP.SetXYZ(pxyz[0],pxyz[1],pxyz[2]);
         Int_t dummyMod ;
-       geom->ImpactOnEmc(vtxCPV,vecP.Theta(),vecP.Phi(),dummyMod,xCPV,zCPV) ;
+       geom->ImpactOnEmc(vtxCPV,vecP.Theta(),vecP.Phi(),dummyMod,zCPV,xCPV) ;
       }
     }
     
@@ -293,12 +320,15 @@ void  AliPHOSTrackSegmentMakerv1::GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * em
     }
   }
   if(trackindex!=-1){
+    // If the closest global track is found, calculate EMC-CPV distance from it
     dx=xCPV - vecEmc.X() ;
     dz=zCPV - vecEmc.Z() ;
   }
   else{
-    dz=999. ;
-    dx=999. ;
+    // If no global track was found, just take the nearest CPV point
+    geom->ImpactOnEmc(vtxCPV,cpvGlobal.Theta(),cpvGlobal.Phi(),dummyMod,zCPV,xCPV) ;
+    dx=xCPV - vecEmc.X() ;
+    dz=zCPV - vecEmc.Z() ;
   }
   return ;
 }
@@ -486,17 +516,15 @@ void  AliPHOSTrackSegmentMakerv1::Exec(Option_t *option)
     
     gime->TrackSegments()->Clear();
 
-    GetVertex() ;
-    EvalRecPoints() ;
-
-    //    if(!ReadRecPoints(ievent))   continue; //reads RecPoints for event ievent
+   //   if(!ReadRecPoints(ievent))   continue; //reads RecPoints for event ievent
     
     for(fModule = 1; fModule <= geom->GetNModules() ; fModule++ ) {
       FillOneModule() ; 
       MakeLinks() ;
       MakePairs() ;
     }
-
+   
+    
     WriteTrackSegments() ;
 
     if(strstr(option,"deb"))
@@ -514,50 +542,6 @@ void  AliPHOSTrackSegmentMakerv1::Exec(Option_t *option)
    }
   if(fWrite) //do not unload in "on flight" mode
     Unload();
-}
-//____________________________________________________________________________
-void AliPHOSTrackSegmentMakerv1::GetVertex(void)
-{ //extract vertex either using ESD or generator
-  
-  //Try to extract vertex from data
-  if(fESD){
-    const AliESDVertex *esdVtx = fESD->GetVertex() ;
-    if(esdVtx){
-      fVtx.SetXYZ(esdVtx->GetXv(),esdVtx->GetYv(),esdVtx->GetZv()) ;
-      return ;
-    }
-  }
-  
-  AliWarning("Can not read vertex from data, use fixed \n") ;
-  fVtx.SetXYZ(0.,0.,0.) ;
-}
-//____________________________________________________________________________
-void AliPHOSTrackSegmentMakerv1::EvalRecPoints(void)
-{ //calculate parameters of RecPoints using vertex and writing them
-
-  AliPHOSGetter * gime = AliPHOSGetter::Instance() ; 
-  TClonesArray * digits = gime->Digits() ;
-  AliPHOSClusterizer * cl = gime->Clusterizer() ;
-  Double_t w0=cl->GetEmcLogWeight() ;
-  TObjArray * emcRecPoints = gime->EmcRecPoints() ; 
-  for(Int_t i=0; i<emcRecPoints->GetEntriesFast() ; i++){
-    static_cast<AliPHOSEmcRecPoint*>(emcRecPoints->At(i))->EvalAll(w0,fVtx,digits) ;
-  }
-  emcRecPoints->Sort() ;
-
-  TObjArray * cpvRecPoints = gime->CpvRecPoints() ; 
-  Double_t w0CPV=cl->GetCpvLogWeight() ;
-  for(Int_t i=0; i<emcRecPoints->GetEntriesFast() ; i++){
-    static_cast<AliPHOSCpvRecPoint*>(cpvRecPoints->At(i))->EvalAll(w0CPV,fVtx,digits) ;
-  }
-  cpvRecPoints->Sort() ;
-
-  //write recaculated RecPoints
-  gime->WriteRecPoints("OVERWRITE");
-  gime->WriteClusterizer("OVERWRITE");
-
 }
 //____________________________________________________________________________
 void AliPHOSTrackSegmentMakerv1::Unload() 
@@ -625,7 +609,7 @@ void AliPHOSTrackSegmentMakerv1::PrintTrackSegments(Option_t * option)
   TClonesArray * trackSegments = AliPHOSGetter::Instance()->TrackSegments() ; 
 
   Info("PrintTrackSegments", "Results from TrackSegmentMaker:") ; 
-  printf("nevent: %d\n", gAlice->GetEvNumber()) ; 
+  printf("nevent: %d\n", AliPHOSGetter::Instance()->EventNumber()) ; 
   printf("        Found %d TrackSegments\n", trackSegments->GetEntriesFast() ); 
   
   if(strstr(option,"all")) {  // printing found TS