]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALTracker.cxx
disable the runtype setting (done from GRP inside aliroot)
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALTracker.cxx
index d622f952444e6f774b27ff31ac28f0e229ddeb0c..9b8d594a3d052908990d3efdb2cd3f3d6804e60f 100644 (file)
 #include "AliEMCALTrack.h"
 #include "AliEMCALLoader.h"
 #include "AliEMCALGeometry.h"
+#include "AliEMCALReconstructor.h"
+#include "AliEMCALRecParam.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
 
 #include "AliEMCALTracker.h"
 
 ClassImp(AliEMCALTracker)
+
+AliEMCALRecParam* AliEMCALTracker::fgkRecParam = 0;  // EMCAL rec. parameters
+
 //
 //------------------------------------------------------------------------------
 //
@@ -66,7 +73,7 @@ AliEMCALTracker::AliEMCALTracker()
     fCutAlphaMin(-200.0),
     fCutAlphaMax(200.0),
     fCutAngle(100.0),
-    fMaxDist(100.0),
+    fMaxDist(10.0),
     fRho(1.0),
     fX0(1.0),
     fTracks(0),
@@ -80,6 +87,8 @@ AliEMCALTracker::AliEMCALTracker()
        // and all collections to NULL.
        // Output file name is set to a default value.
        //
+       
+       InitParameters();
 }
 //
 //------------------------------------------------------------------------------
@@ -136,8 +145,45 @@ AliEMCALTracker& AliEMCALTracker::operator=(const AliEMCALTracker& copy)
 //
 //------------------------------------------------------------------------------
 //
+void AliEMCALTracker::InitParameters()
+{
+       //
+       // Retrieve initialization parameters
+       //
+       
+  // Check if the instance of AliEMCALRecParam exists, 
+  // if not, get it from OCDB if available, otherwise create a default one
+  
+  if (!fgkRecParam  && (AliCDBManager::Instance()->IsDefaultStorageSet())) {
+    AliCDBEntry *entry = (AliCDBEntry*) 
+      AliCDBManager::Instance()->Get("EMCAL/Config/RecParam");
+    if (entry) fgkRecParam =  (AliEMCALRecParam*) entry->GetObject();
+  }
+  
+  if(!fgkRecParam){
+    AliWarning("The Track Matching parameters for EMCAL nonitialized - Used default one");
+    fgkRecParam = new AliEMCALRecParam;
+  }
+  
+  fCutX =  fgkRecParam->GetTrkCutX();
+  fCutY =  fgkRecParam->GetTrkCutY();
+  fCutZ =  fgkRecParam->GetTrkCutZ();
+  fMaxDist =  fgkRecParam->GetTrkCutR();
+  fCutAngle =  fgkRecParam->GetTrkCutAngle();
+  fCutAlphaMin =  fgkRecParam->GetTrkCutAlphaMin();
+  fCutAlphaMax =  fgkRecParam->GetTrkCutAlphaMax();
+  
+}
+//
+//------------------------------------------------------------------------------
+//
 TTree* AliEMCALTracker::SearchTrueMatches()
 {
+  //Search through the list of
+  //track match candidates and clusters
+  //and look for true matches
+  //
+  //
        if (!fClusters) return 0;
        if (fClusters->IsEmpty()) return 0;
        if (!fTracks) return 0;
@@ -524,7 +570,10 @@ Double_t AliEMCALTracker::CheckPair
        // check against cut on difference 'alpha - phi'
        Double_t phi = TMath::ATan2(cl->Y(), cl->X());
        phi = AngleDiff(phi, tr->GetAlpha());
-       if (phi < fCutAlphaMin || phi > fCutAlphaMax) return distance;
+       if (phi < fCutAlphaMin || phi > fCutAlphaMax){
+         delete tr;
+         return distance;
+       }
        
        // try to propagate to cluster radius
        // (return the 'distance' value if it fails)
@@ -562,7 +611,10 @@ Double_t AliEMCALTracker::CheckPair
                if (isTrue) cout << "Init : " << rt << ' ' << x << ' ' << y << ' ' << z << endl;
                for (i = 0; i < fNPropSteps; i++) {
                        r = rt + (rc - rt) * ((Double_t)(i+1)/(Double_t)fNPropSteps);
-                       if (!tr->PropagateTo(r, x0, rho)) return distance;
+                       if (!tr->PropagateTo(r, x0, rho)){
+                         delete tr;
+                         return distance;
+                       }
                        tr->GetXYZ(pos);
                        if (isTrue) cout << "Step : " << r << ' ' << x << ' ' << y << ' ' << z << endl;
                }
@@ -571,7 +623,10 @@ Double_t AliEMCALTracker::CheckPair
        else {
                // when no steps are used, no correction makes sense
                //if (!tr->PropagateTo(rc, 0.0, 0.0)) return distance;
-               if (!tr->PropagateToGlobal(cl->X(), cl->Y(), cl->Z(), 0.0, 0.0)) return distance;
+               if (!tr->PropagateToGlobal(cl->X(), cl->Y(), cl->Z(), 0.0, 0.0)){
+                 delete tr;
+                 return distance;
+               }
                /*
                Bool_t propOK = kFALSE;
                cout << "START" << endl;
@@ -607,6 +662,7 @@ Double_t AliEMCALTracker::CheckPair
        
        if (angle > fCutAngle) {
                //cout << "angle" << endl;
+         delete tr;
                return distance;
        }
                
@@ -614,16 +670,19 @@ Double_t AliEMCALTracker::CheckPair
        x -= cl->X();
        if (TMath::Abs(x) > fCutX) {
                //cout << "cut X" << endl;
+         delete tr;
                return distance;
        }
        y -= cl->Y();
        if (TMath::Abs(y) > fCutY) {
                //cout << "cut Y" << endl;
+         delete tr;
                return distance;
        }
        z -= cl->Z();
        if (TMath::Abs(z) > fCutZ) {
                //cout << "cut Z" << endl;
+         delete tr;
                return distance;
        }
        
@@ -739,6 +798,7 @@ Double_t AliEMCALTracker::CheckPairV2
        TVector3 vdiff = vt-vc;
                
        // compute differences wr to each coordinate
+       delete track;
        if (vdiff.X() > fCutX) return distance;
        if (vdiff.Y() > fCutY) return distance;
        if (vdiff.Z() > fCutZ) return distance;