* 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 *
}
-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
-//$Id$
-
#ifndef ALIHLTGLOBALTRACKMATCHER_H
#define ALIHLTGLOBALTRACKMATCHER_H
*/
+
#include "AliHLTLogging.h"
#include "AliESDtrack.h"
#include "TObjArray.h"
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();
return 0;
}
+
Float_t bestMatchPhos[nPhosClusters];
for(int ic = 0; ic < nPhosClusters; ic++) {
bestMatchPhos[ic] = 999999;
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
-
-
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);
//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
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;
}