]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Reverting previous changes
authorphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 21 May 2010 22:51:46 +0000 (22:51 +0000)
committerphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 21 May 2010 22:51:46 +0000 (22:51 +0000)
HLT/global/AliHLTGlobalTrackMatcher.cxx
HLT/global/AliHLTGlobalTrackMatcher.h
HLT/global/AliHLTGlobalTrackMatcherComponent.cxx
HLT/global/AliHLTGlobalTrackMatcherComponent.h

index 7fa0805b5ebb9d5f123cb6e6d54ac0f821311ca0..52260559d314fca1e3b3ad91a74bef1250e54112 100644 (file)
@@ -3,7 +3,7 @@
  * This file is property of and copyright by the ALICE HLT Project        * 
  * ALICE Experiment at CERN, All rights reserved.                         *
  *                                                                        *
- * Primary Authors: Svein Lindal (slindal@fys.uio.no)                     *
+ * Primary Authors: Svein Lindal (slindal@fys.uio.no)                 *
  *                  for The ALICE HLT Project.                            *
  *                                                                        *
  * Permission to use, copy, modify and distribute this software and its   *
@@ -53,19 +53,22 @@ AliHLTGlobalTrackMatcher::~AliHLTGlobalTrackMatcher()
 
 }
 
-void AliHLTGlobalTrackMatcher::DoInit( ) 
-{
+void AliHLTGlobalTrackMatcher::DoInit( ) {
   //See header file for documentation
-  //BALLE TODO: Change hardcoded values to something that is initialised through 
-  //command line or something!!!
+  //BALLE TODO: Change hardcoded values to something that is initialised through command line or something!!!
+
+
   fMatchDistance = 40*40;
+
   fPhosMaxX = 355 + TMath::Sqrt(fMatchDistance) + 30;
   fPhosMaxZ = 64.+ TMath::Sqrt(fMatchDistance) + 30;
+
   fEmcalMaxZ = 350 + TMath::Sqrt(fMatchDistance) + 30;
   fEmcalMaxX = 3000;
-}
 
 
+}
+
 Int_t AliHLTGlobalTrackMatcher::AddTrackToCluster(Int_t tId, TArrayI* matchedTracksArray, Bool_t bestMatch, Int_t nMatches){
   //See header file for documentation
     
index 14ca8165041ff5ef1fd1f5590547ccfa310005ad..91320ca96e6bd344596a1b810777a47eb14c209b 100644 (file)
@@ -1,5 +1,3 @@
-//$Id$
-
 #ifndef ALIHLTGLOBALTRACKMATCHER_H
 #define ALIHLTGLOBALTRACKMATCHER_H
 
@@ -15,6 +13,7 @@
 */
 
 
+
 #include "AliHLTLogging.h"
 #include "AliESDtrack.h"
 #include "TObjArray.h"
@@ -67,11 +66,10 @@ private:
 
 
 template <class T>
-Int_t AliHLTGlobalTrackMatcher::Match( TObjArray * trackArray, vector<T*>  &phosClustersVector, 
-                                      vector<T*> &emcalClustersVector,  Double_t bz ) 
-{
+Int_t AliHLTGlobalTrackMatcher::Match( TObjArray * trackArray, vector<T*>  &phosClustersVector, vector<T*> &emcalClustersVector,  Double_t bz ) {
   //See above for documentation
 
+
   Int_t nTracks = trackArray->GetEntriesFast();
   Int_t nPhosClusters = phosClustersVector.size();
   Int_t nEmcalClusters = emcalClustersVector.size(); 
@@ -86,6 +84,7 @@ Int_t AliHLTGlobalTrackMatcher::Match( TObjArray * trackArray, vector<T*>  &phos
     return 0;
   }
 
+
   Float_t bestMatchPhos[nPhosClusters];   
   for(int ic = 0; ic < nPhosClusters; ic++) {
     bestMatchPhos[ic] = 999999;
@@ -100,82 +99,78 @@ Int_t AliHLTGlobalTrackMatcher::Match( TObjArray * trackArray, vector<T*>  &phos
   for (int it = 0; it < nTracks; it++ ) {
     AliExternalTrackParam * track = static_cast<AliExternalTrackParam*>(trackArray->At(it));
 
-    if ( IsTrackCloseToDetector(track, bz, fPhosMaxX, kFALSE, fPhosMaxZ, fPhosRadius ) ) 
-      {
-       MatchTrackToClusters( track, phosClustersVector, nPhosClusters, bestMatchPhos, bz);
-      } 
-    else 
-      if ( IsTrackCloseToDetector(track, bz, fEmcalMaxX, kTRUE, fEmcalMaxZ, fEmcalRadius ) ) 
-       {
-         MatchTrackToClusters( track, emcalClustersVector, nEmcalClusters, bestMatchEmcal, bz);
-       } 
+    if ( IsTrackCloseToDetector(track, bz, fPhosMaxX, kFALSE, fPhosMaxZ, fPhosRadius ) ) {
+      MatchTrackToClusters( track, phosClustersVector, nPhosClusters, bestMatchPhos, bz);
+
+    } else if ( IsTrackCloseToDetector(track, bz, fEmcalMaxX, kTRUE, fEmcalMaxZ, fEmcalRadius ) ) {
+      MatchTrackToClusters( track, emcalClustersVector, nEmcalClusters, bestMatchEmcal, bz);
+    } 
+
   }   
+    
   return 0;
 } 
 
 
+
 template <class T>
 Int_t AliHLTGlobalTrackMatcher::MatchTrackToClusters( AliExternalTrackParam * track, vector<T*>  &clustersVector, Int_t nClusters, Float_t * bestMatch, Double_t bz) {
   
   //See header file for documentation
   Int_t iResult = 0;
   Float_t clusterPosition[3];
   Double_t trackPosition[3];
   
-  for(int ic = 0; ic < nClusters; ic++) 
-    {
-      T * cluster = clustersVector.at(ic);
-      //Get cluster global coordinates
-      cluster->GetPosition(clusterPosition);
-      Double_t rCluster = TMath::Sqrt(clusterPosition[0]*clusterPosition[0] 
-                                     + clusterPosition[1]*clusterPosition[1]);      
-      //Rotate tracking system to the angle of the cluster
-      TVector3 cVec(clusterPosition);
-      
-      if (! (track->Rotate(cVec.Phi())) ) 
-       {
-         continue;
-       }
+  for(int ic = 0; ic < nClusters; ic++) {
     
-      if(! (track->GetXYZAt(rCluster, bz, trackPosition)) ) 
-       {
-         continue;
-       }
+    T * cluster = clustersVector.at(ic);
+    
+    //Get cluster global coordinates
+    cluster->GetPosition(clusterPosition);
+
+    Double_t rCluster = TMath::Sqrt(clusterPosition[0]*clusterPosition[0] + clusterPosition[1]*clusterPosition[1]);      
+
+    //Rotate tracking system to the angle of the cluster
+    TVector3 cVec(clusterPosition);
+    if (! (track->Rotate(cVec.Phi())) ) {
+      continue;
+    }
+   
+    if(! (track->GetXYZAt(rCluster, bz, trackPosition)) ) {
+      continue;
+    }
     
     //Get residual in z= 0 plane (squared)
-      Double_t dxy = 0;
-      for(int i = 0; i < 2; i++) 
-       {
-         Double_t dd = trackPosition[i] - clusterPosition[i];
-         dxy += dd*dd;
-       }
-
-      //Get z residual (squared)
-      Double_t dd = trackPosition[2] - clusterPosition[2];
-      Double_t dz = dd*dd;
-      Double_t match = dz + dxy;
-      
-      if( match > fMatchDistance  )  
-       {     
-         continue;
-       }
-      if (match < bestMatch[ic]) 
-       {
-         bestMatch[ic] = match;
-         cluster->SetEmcCpvDistance(TMath::Sqrt(match));
-         cluster->SetTrackDistance(TMath::Sqrt(dxy), TMath::Sqrt(dz));
-       }
+    Double_t dxy = 0;
+    for(int i = 0; i < 2; i++) {
+      Double_t dd = trackPosition[i] - clusterPosition[i];
+      dxy += dd*dd;
+    }
+
+    //Get z residual (squared)
+    Double_t dd = trackPosition[2] - clusterPosition[2];
+    Double_t dz = dd*dd;
+  
+    Double_t match = dz + dxy;
     
-      //Add track to cluster's array of matching tracks
-      Int_t nTracksMatched = cluster->GetNTracksMatched();
-      iResult = AddTrackToCluster(track->GetID(), cluster->GetTracksMatched(), 
-                                 match < bestMatch[ic], nTracksMatched);
+    if( match > fMatchDistance  )  {     
+      continue;
+    }
+
+    if (match < bestMatch[ic]) {
+      bestMatch[ic] = match;
+      cluster->SetEmcCpvDistance(TMath::Sqrt(match));
+      cluster->SetTrackDistance(TMath::Sqrt(dxy), TMath::Sqrt(dz));
     }
+    
+    //Add track to cluster's array of matching tracks
+    Int_t nTracksMatched = cluster->GetNTracksMatched();
+    iResult = AddTrackToCluster(track->GetID(), cluster->GetTracksMatched(), match < bestMatch[ic], nTracksMatched);
+  }
   
   return iResult;
 }
 
-
 #endif
-
-
index 7f6f43d1f8997262a033e2b09638d4c4b2b26717..1c07606f647dc42c47a9d2d87fd67f83bbb35f88 100644 (file)
@@ -176,16 +176,13 @@ int AliHLTGlobalTrackMatcherComponent::DoEvent(const AliHLTComponentEventData& /
    for (const AliHLTComponentBlockData* pBlock = GetFirstInputBlock(kAliHLTDataTypeTrack|kAliHLTDataOriginTPC); pBlock!=NULL; pBlock=GetNextInputBlock()) {
 
      if ((iResult=AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(pBlock->fPtr), pBlock->fSize, tracks))>=0) {
-       for(UInt_t it = 0; it < tracks.size(); it++) 
-        {
-          AliHLTGlobalBarrelTrack track = tracks.at(it);
-          fTrackArray->AddLast(dynamic_cast<TObject*>(&(tracks.at(it))));
-        }
-     } 
-     else 
-       {
-        HLTWarning("Converting tracks to vector failed");
-       }
+       for(UInt_t it = 0; it < tracks.size(); it++) {
+        AliHLTGlobalBarrelTrack track = tracks.at(it);
+       fTrackArray->AddLast(dynamic_cast<TObject*>(&(tracks.at(it))));
+              }
+     } else {
+             HLTWarning("Converting tracks to vector failed");
+     }
     
      //     //Push the TPC block on, without any changes
      PushBack(pBlock->fPtr, pBlock->fSize, pBlock->fDataType, pBlock->fSpecification);
@@ -196,23 +193,19 @@ int AliHLTGlobalTrackMatcherComponent::DoEvent(const AliHLTComponentEventData& /
    //Get the PHOS Clusters
    vector<AliHLTCaloClusterDataStruct*> phosClustersVector;
    
-   for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeCaloCluster | kAliHLTDataOriginPHOS); pBlock!=NULL; pBlock=GetNextInputBlock()) 
-     {
-       AliHLTCaloClusterHeaderStruct *caloClusterHeader = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(pBlock->fPtr);
-       fClusterReader->SetMemory(caloClusterHeader);
-       
-       if ( (caloClusterHeader->fNClusters) < 0) 
-        {
-          HLTWarning("Event has negative number of clusters: %d! Very bad for vector resizing", (Int_t) (caloClusterHeader->fNClusters));
-          continue;
-        } else 
-        {    
-          phosClustersVector.reserve( (int) (caloClusterHeader->fNClusters) + phosClustersVector.size() ); 
-          while( (caloClusterStruct = fClusterReader->NextCluster()) != 0) {
-            phosClustersVector.push_back(caloClusterStruct);  
-          }
-        }
+   for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeCaloCluster | kAliHLTDataOriginPHOS); pBlock!=NULL; pBlock=GetNextInputBlock()) {
+     AliHLTCaloClusterHeaderStruct *caloClusterHeader = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(pBlock->fPtr);
+     fClusterReader->SetMemory(caloClusterHeader);
+     if ( (caloClusterHeader->fNClusters) < 0) {
+       HLTWarning("Event has negative number of clusters: %d! Very bad for vector resizing", (Int_t) (caloClusterHeader->fNClusters));
+       continue;
+     } else {    
+       phosClustersVector.reserve( (int) (caloClusterHeader->fNClusters) + phosClustersVector.size() ); 
+       while( (caloClusterStruct = fClusterReader->NextCluster()) != 0) {
+        phosClustersVector.push_back(caloClusterStruct);  
+       }
      }
+   }
    
 
    //Get the EMCAL Clusters
@@ -220,31 +213,26 @@ int AliHLTGlobalTrackMatcherComponent::DoEvent(const AliHLTComponentEventData& /
    for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeCaloCluster | kAliHLTDataOriginEMCAL); pBlock!=NULL; pBlock=GetNextInputBlock()) {
      AliHLTCaloClusterHeaderStruct *caloClusterHeader = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(pBlock->fPtr);
      fClusterReader->SetMemory(caloClusterHeader);
-     if ( (caloClusterHeader->fNClusters) < 0) 
-       {
-        HLTWarning("Event has negative number of clusters: %d! Very bad for vector resizing", (Int_t) (caloClusterHeader->fNClusters));
-        continue;
-     } else 
-       {    
-        emcalClustersVector.reserve( (int) (caloClusterHeader->fNClusters) + emcalClustersVector.size() ); 
-        
-        while( (caloClusterStruct = fClusterReader->NextCluster()) != 0  ) 
-          {
-            emcalClustersVector.push_back(caloClusterStruct);  
-          }
-      
+     if ( (caloClusterHeader->fNClusters) < 0) {
+       HLTWarning("Event has negative number of clusters: %d! Very bad for vector resizing", (Int_t) (caloClusterHeader->fNClusters));
+       continue;
+     } else {    
+       emcalClustersVector.reserve( (int) (caloClusterHeader->fNClusters) + emcalClustersVector.size() ); 
+       while( (caloClusterStruct = fClusterReader->NextCluster()) != 0) {
+        emcalClustersVector.push_back(caloClusterStruct);  
        }
+     }
    }
    
    iResult = fTrackMatcher->Match(fTrackArray, phosClustersVector, emcalClustersVector, fBz);
 
    //Push the blocks on
-   for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeCaloCluster | kAliHLTDataOriginAny); pBlock!=NULL; pBlock=GetNextInputBlock()) 
-     {
-       PushBack(pBlock->fPtr, pBlock->fSize, pBlock->fDataType, pBlock->fSpecification);
-     }
-   
+   for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeCaloCluster | kAliHLTDataOriginAny); pBlock!=NULL; pBlock=GetNextInputBlock()) {
+     PushBack(pBlock->fPtr, pBlock->fSize, pBlock->fDataType, pBlock->fSpecification);
+   }
+
    fTrackArray->Clear();
+   
    return iResult;
 }
 
index e1fb3a258d3e286bb0b1af3f32994e92eefd7b59..3f81438b4f4d7f7934280ce703e688c747ce5ce0 100644 (file)
@@ -8,6 +8,7 @@
 */
 
 
+
 #ifndef ALIHLTGLOBALTRACKMATCHERCOMPONENT_H
 #define ALIHLTGLOBALTRACKMATCHERCOMPONENT_H