]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/global/AliHLTGlobalTrackMatcher.cxx
bugfix: library arguments had been filtered out by accident after r40708
[u/mrichter/AliRoot.git] / HLT / global / AliHLTGlobalTrackMatcher.cxx
CommitLineData
05ae9ad4 1//$Id $
3cfb9c56 2/**************************************************************************
3 * This file is property of and copyright by the ALICE HLT Project *
4 * ALICE Experiment at CERN, All rights reserved. *
5 * *
2a24cbbe 6 * Primary Authors: Svein Lindal (slindal@fys.uio.no) *
3cfb9c56 7 * for The ALICE HLT Project. *
8 * *
9 * Permission to use, copy, modify and distribute this software and its *
10 * documentation strictly for non-commercial purposes is hereby granted *
11 * without fee, provided that the above copyright notice appears in all *
12 * copies and that both the copyright notice and this permission notice *
13 * appear in the supporting documentation. The authors make no claims *
14 * about the suitability of this software for any purpose. It is *
15 * provided "as is" without express or implied warranty. *
16 **************************************************************************/
17
18/** @file AliHLTGlobalTrackMatcher.cxx
bad7877b 19 @author Svein Lindal
3cfb9c56 20 @date
bad7877b 21 @brief The HLT class Matching Calorimeter clusters to TPC tracks
3cfb9c56 22*/
23
3cfb9c56 24#include "AliHLTGlobalTrackMatcher.h"
2a24cbbe 25
3cfb9c56 26
27#if __GNUC__>= 3
28using namespace std;
29#endif
30
31ClassImp(AliHLTGlobalTrackMatcher)
32
434146d0 33
3cfb9c56 34AliHLTGlobalTrackMatcher::AliHLTGlobalTrackMatcher() :
05ae9ad4 35 fMaxZ(0),
36 fMaxX(0),
434146d0 37 fMatchDistance(0),
05ae9ad4 38 fRadius(0),
39 fYSign(kFALSE)
3cfb9c56 40{
434146d0 41 //Default constructor
3cfb9c56 42}
43
3cfb9c56 44AliHLTGlobalTrackMatcher::~AliHLTGlobalTrackMatcher()
45{
46 //Destructor
434146d0 47}
48
2a24cbbe 49Int_t AliHLTGlobalTrackMatcher::AddTrackToCluster(Int_t tId, TArrayI* matchedTracksArray, Bool_t bestMatch, Int_t nMatches){
50 //See header file for documentation
51
52 matchedTracksArray->Set(matchedTracksArray->GetSize() + 1);
53 if ( bestMatch ) {
54 matchedTracksArray->AddAt(matchedTracksArray->At(0), matchedTracksArray->GetSize() - 1);
55 matchedTracksArray->AddAt(tId, 0);
56 } else {
57 matchedTracksArray->AddAt(tId, matchedTracksArray->GetSize() - 1);
58 }
434146d0 59
2a24cbbe 60 return nMatches;
61}
434146d0 62
2a24cbbe 63Int_t AliHLTGlobalTrackMatcher::AddTrackToCluster(Int_t tId, Int_t* matchArray, bool bestMatch, Int_t nMatches ){
05ae9ad4 64 //See header file for documentation
de31859c 65
2a24cbbe 66 //BALLE TODO: remove hardcoded 9
05ae9ad4 67 if (nMatches > 9) { //BALLE this one tooo
68 HLTError("The number of matching tracks (%d) exceeds the array size of %d", nMatches, 9);
2a24cbbe 69 return 0;
de31859c 70 }
434146d0 71
2a24cbbe 72 if(bestMatch) {
2a24cbbe 73 matchArray[nMatches] = matchArray[0];
74 matchArray[0] = tId;
75 } else {
76 matchArray[nMatches] = tId;
434146d0 77 }
bad7877b 78
2a24cbbe 79 return nMatches;
434146d0 80
2a24cbbe 81};
434146d0 82
434146d0 83
2a24cbbe 84Bool_t AliHLTGlobalTrackMatcher::IsTrackCloseToDetector(AliExternalTrackParam * track, Double_t bz, Double_t fMaxX, Bool_t ySign, Double_t fMaxZ, Double_t dRadius) {
434146d0 85 //See header file for documentation
05ae9ad4 86
434146d0 87 //Get track instersection with cylinder defined by detector radius
70cad768 88 Double_t trackPosition[3] = {0, 0, 0};
2a24cbbe 89 if (! (track->GetXYZAt(dRadius, bz, trackPosition)) ) {
434146d0 90 return kFALSE;
2a24cbbe 91 }
92
93 //Positive y for EMCAL, negative for PHOS
434146d0 94 if(ySign) {
05ae9ad4 95 if (trackPosition[1] < 0 ) {
434146d0 96 return kFALSE;
05ae9ad4 97 }
98
434146d0 99 } else {
05ae9ad4 100 if (trackPosition[1] > 0 ) {
434146d0 101 return kFALSE;
05ae9ad4 102 }
434146d0 103 }
104
105
106 if ( (TMath::Abs(trackPosition[2]) > fMaxZ) )
107 return kFALSE;
108
109 if (TMath::Abs(trackPosition[0]) > fMaxX )
110 return kFALSE;
70cad768 111
05ae9ad4 112
434146d0 113 return kTRUE;
114}