]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSTracker.cxx
Protection against gMinuit deletion by third party added
[u/mrichter/AliRoot.git] / PHOS / AliPHOSTracker.cxx
index 0951c096063bc73b33ffdbe2e05694f885b6e5d7..715f9a53c31a4dce4f1da569583872db777c295e 100644 (file)
 /* History of cvs commits:
  *
  * $Log$
+ * Revision 1.9  2007/10/10 09:05:10  schutz
+ * Changing name QualAss to QA
+ *
+ * Revision 1.8  2007/08/28 12:55:08  policheh
+ * Loaders removed from the reconstruction code (C.Cheshkov)
+ *
+ * Revision 1.7  2007/08/07 14:12:03  kharlov
+ * Quality assurance added (Yves Schutz)
+ *
+ * Revision 1.6  2007/08/03 14:41:37  cvetan
+ * Missing header files
+ *
  * Revision 1.5  2007/08/03 13:52:16  kharlov
  * Working skeleton of matching the ESD tracks and ESD clusters (Iouri Belikov)
  *
@@ -30,6 +42,8 @@
 #include "AliPHOSEmcRecPoint.h"
 #include "AliESDEvent.h"
 #include "AliESDtrack.h"
+#include "AliPHOSTrackSegmentMakerv1.h"
+#include "AliPHOSPIDv1.h"
 
 //-------------------------------------------------------------------------
 //                          PHOS tracker.
@@ -52,15 +66,21 @@ const Double_t kZmax=65.; // Approximately: the maximal possible z-coord.(cm)
 
 
 
-AliPHOSTracker::AliPHOSTracker(): AliTracker(), fRunLoader(0) {
+//____________________________________________________________________________
+AliPHOSTracker::AliPHOSTracker(): 
+  AliTracker()
+{
   //--------------------------------------------------------------------
   // The default constructor
   //--------------------------------------------------------------------
   for (Int_t i=0; i<5; i++) 
       fModules[i]=new TClonesArray("AliPHOSEmcRecPoint",777);
+
 }
 
-AliPHOSTracker::~AliPHOSTracker() {
+//____________________________________________________________________________
+AliPHOSTracker::~AliPHOSTracker() 
+{
   //--------------------------------------------------------------------
   // The destructor
   //--------------------------------------------------------------------
@@ -70,10 +90,15 @@ AliPHOSTracker::~AliPHOSTracker() {
   }
 }
 
-Int_t AliPHOSTracker::LoadClusters(TTree *cTree) {
+//____________________________________________________________________________
+Int_t AliPHOSTracker::LoadClusters(TTree *) {
   //--------------------------------------------------------------------
   // This function loads the PHOS clusters
   //--------------------------------------------------------------------
+  return 0 ; //At this stage we can not strore result 
+             // the closest track and distance to it
+             //We perform same task later in AliPHOSTrackSegmentMakerv1
+/*
   TObjArray *arr=NULL;
   TBranch *branch=cTree->GetBranch("PHOSEmcRP");
   if (branch==0) {
@@ -97,7 +122,8 @@ Int_t AliPHOSTracker::LoadClusters(TTree *cTree) {
       }
 
       // Here is how the alignment is treated
-      if (!cl->Misalign()) AliWarning("Can't misalign this cluster !");
+      // Misalignment is already in cluster coordinates
+//      if (!cl->Misalign()) AliWarning("Can't misalign this cluster !");
 
       cl->SetBit(14,kFALSE); // The clusters are not yet attached to any track
 
@@ -109,24 +135,25 @@ Int_t AliPHOSTracker::LoadClusters(TTree *cTree) {
 
     }
   }  
-
+  arr->Delete();
   Info("LoadClusters","Number of loaded clusters: %d",nclusters);
 
   return 0;
+*/
 }
 
-
-Int_t AliPHOSTracker::PropagateBack(AliESDEvent *esd) {
+//____________________________________________________________________________
+Int_t AliPHOSTracker::PropagateBack(AliESDEvent *) {
   //--------------------------------------------------------------------
   // Called by AliReconstruction 
   // Performs the track matching with the PHOS modules
   // Makes the PID
   //--------------------------------------------------------------------
 
-  // The following old function is a bad function: it uses RunLoader ;(
-  PropagateBackOld(esd);   
-
-
+  return 0 ; //At this stage we can not strore result 
+             // the closest track and distance to it
+             //We perform same task later in AliPHOSTrackSegmentMakerv1
+/*
   Int_t nt=esd->GetNumberOfTracks();
 
   // *** Select and sort the ESD track in accordance with their quality
@@ -140,15 +167,16 @@ Int_t AliPHOSTracker::PropagateBack(AliESDEvent *esd) {
 
 
   // *** Start the matching
-  Double_t bz=GetBz(); 
+  Double_t bz = GetGz() ; //For approximate matching
+  Double_t b[3]; GetBxByBz(b); //For final matching
   Int_t matched=0;
   for (Int_t i=0; i<nt; i++) {
      AliESDtrack *esdTrack=esd->GetTrack(index[i]);
 
-     // Skip the tracks having "wrong" status (has to be checked/tuned)
-     ULong_t status = esdTrack->GetStatus();
-     if ((status & AliESDtrack::kTRDout)   == 0) continue;
-     if ((status & AliESDtrack::kTRDrefit) == 1) continue;
+//     // Skip the tracks having "wrong" status (has to be checked/tuned)
+//     ULong_t status = esdTrack->GetStatus();
+//     if ((status & AliESDtrack::kTRDout)   == 0) continue;
+//     if ((status & AliESDtrack::kTRDrefit) == 1) continue;
 
      AliExternalTrackParam t(*esdTrack);
 
@@ -179,7 +207,7 @@ Int_t AliPHOSTracker::PropagateBack(AliESDEvent *esd) {
      if ((imod<0)||(imod>4)) continue; // Some tracks miss the PHOS in azimuth
 
      //t.CorrectForMaterial(...); // Correct for the TOF material, if needed
-     t.PropagateTo(kR,bz);        // Propagate to the matching module
+     t.PropagateToBxByBz(kR,b);        // Propagate to the matching module
 
 
     // *** Search for the "best" cluster (can be improved)
@@ -187,10 +215,12 @@ Int_t AliPHOSTracker::PropagateBack(AliESDEvent *esd) {
      Int_t ncl=cArray.GetEntriesFast();
      AliPHOSEmcRecPoint *bestCluster=0;            // The "best" cluster
      Double_t maxd2=400; // (cm^2)
-     for (Int_t i=0; i<ncl; i++) {
-       AliPHOSEmcRecPoint *c=(AliPHOSEmcRecPoint *)cArray.UncheckedAt(i);
+     for (Int_t j=0; j<ncl; j++) {
+       AliPHOSEmcRecPoint *c=(AliPHOSEmcRecPoint *)cArray.UncheckedAt(j);
 
-       if (c->TestBit(14)) continue; // This clusters is "used"
+       //we looking at the closest track to the cluster, 
+       //not closest cluster to the track.
+//       if (c->TestBit(14)) continue; // This clusters is "used"
 
        Double_t dy = t.GetY() - c->GetY(), dz = t.GetZ() - c->GetZ();
        Double_t d2 = dy*dy + dz*dz;
@@ -202,18 +232,18 @@ Int_t AliPHOSTracker::PropagateBack(AliESDEvent *esd) {
 
      if (!bestCluster) continue;   // No reasonable matching found 
 
-     bestCluster->SetBit(14,kTRUE); // This clusters is now attached to a track
+//     bestCluster->SetBit(14,kTRUE); // This clusters is now attached to a track
 
      matched++;
 
      // *** Now, do the PID with the "bestCluster"
      // and add the corresponding info to the ESD track pointed by "esdTrack"  
 
-     /*
-     printf("%e %e %e %e\n",t.GetSign(), t.GetX() - bestCluster->GetX(),
-                                        t.GetY() - bestCluster->GetY(),
-                                        t.GetZ() - bestCluster->GetZ());
-     */
+     
+//     printf("%e %e %e %e\n",t.GetSign(), t.GetX() - bestCluster->GetX(),
+//                                      t.GetY() - bestCluster->GetY(),
+//                                      t.GetZ() - bestCluster->GetZ());
+     
   }
     
   Info("PropagateBack","Number of matched tracks: %d",matched);
@@ -222,8 +252,10 @@ Int_t AliPHOSTracker::PropagateBack(AliESDEvent *esd) {
   delete[] index;
 
   return 0;
+*/
 }
 
+//____________________________________________________________________________
 AliCluster *AliPHOSTracker::GetCluster(Int_t index) const {
   //--------------------------------------------------------------------
   // Returns the pointer to a given cluster
@@ -234,61 +266,10 @@ AliCluster *AliPHOSTracker::GetCluster(Int_t index) const {
   return (AliCluster*)(fModules[m])->UncheckedAt(i);
 }
 
+//____________________________________________________________________________
 void AliPHOSTracker::UnloadClusters() {
   //--------------------------------------------------------------------
   // This function unloads the PHOS clusters
   //--------------------------------------------------------------------
-  for (Int_t i=0; i<5; i++) (fModules[i])->Delete();
-}
-
-
-
-// **** The following are bad functions:  they use RunLoader ;(
-// **** To be rewritten.
-
-#include "AliPHOSTrackSegmentMakerv1.h"
-#include "AliPHOSTrackSegmentMakerv2.h"
-#include "AliPHOSPIDv1.h"
-#include "AliRunLoader.h"
-
-Int_t AliPHOSTracker::PropagateBackOld(AliESDEvent *esd) {
-  // Bad function: it uses RunLoader ;(  
-  // Creates the tracksegments and Recparticles
-  // Makes the PID
-  
-  Int_t eventNumber = fRunLoader->GetEventNumber() ;
-
-  TString headerFile(fRunLoader->GetFileName()) ; 
-  TString branchName(fRunLoader->GetEventFolder()->GetName()) ;  
-  AliPHOSTrackSegmentMakerv1 tsm(headerFile, branchName);
-//  AliPHOSTrackSegmentMakerv2 tsm(headerFile, branchName);
-  tsm.SetESD(esd) ; 
-  AliPHOSPIDv1 pid(headerFile, branchName);
-  pid.SetESD(esd) ; 
-
-  //PH  SetDebug() ;
-
-  // do current event; the loop over events is done by AliReconstruction::Run()
-  tsm.SetEventRange(eventNumber, eventNumber) ; 
-  pid.SetEventRange(eventNumber, eventNumber) ; 
-  if ( Debug() ) {
-   tsm.ExecuteTask("deb all") ;
-   pid.ExecuteTask("deb all") ;
-  }
-  else {
-    tsm.ExecuteTask("") ;
-    pid.ExecuteTask("") ;
-  }
-  
-  return 0;
-}
-
-AliPHOSTracker::AliPHOSTracker(AliRunLoader *l): AliTracker(), fRunLoader(l) {
-  //--------------------------------------------------------------------
-  // Bad constructor:  uses RunLoader ;(
-  //--------------------------------------------------------------------
-  for (Int_t i=0; i<5; i++) 
-      fModules[i]=new TClonesArray("AliPHOSEmcRecPoint",777);
+//  for (Int_t i=0; i<5; i++) (fModules[i])->Delete();
 }
-