]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/global/AliHLTGlobalTrackMatcher.cxx
Added constant needed by the EMCAL debug onlinedisplay.
[u/mrichter/AliRoot.git] / HLT / global / AliHLTGlobalTrackMatcher.cxx
CommitLineData
a46c7ba5 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 * *
01d100c8 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"
a46c7ba5 25//#include "AliESDCaloCluster.h"
26
2a24cbbe 27
3cfb9c56 28
29#if __GNUC__>= 3
30using namespace std;
31#endif
32
33ClassImp(AliHLTGlobalTrackMatcher)
34
434146d0 35
3cfb9c56 36AliHLTGlobalTrackMatcher::AliHLTGlobalTrackMatcher() :
a46c7ba5 37 fPhosMaxZ(0),
38 fPhosMaxX(0),
39 fEmcalMaxZ(0),
40 fEmcalMaxX(0),
434146d0 41 fMatchDistance(0),
a46c7ba5 42 fPhosRadius(460),
43 fEmcalRadius(448)
3cfb9c56 44{
434146d0 45 //Default constructor
a46c7ba5 46 DoInit();
3cfb9c56 47}
48
a46c7ba5 49//_____________________________________________________________________________
3cfb9c56 50AliHLTGlobalTrackMatcher::~AliHLTGlobalTrackMatcher()
51{
52 //Destructor
a46c7ba5 53
54}
55
01d100c8 56void AliHLTGlobalTrackMatcher::DoInit( )
57{
a46c7ba5 58 //See header file for documentation
01d100c8 59 //BALLE TODO: Change hardcoded values to something that is initialised through
60 //command line or something!!!
a46c7ba5 61 fMatchDistance = 40*40;
a46c7ba5 62 fPhosMaxX = 355 + TMath::Sqrt(fMatchDistance) + 30;
63 fPhosMaxZ = 64.+ TMath::Sqrt(fMatchDistance) + 30;
a46c7ba5 64 fEmcalMaxZ = 350 + TMath::Sqrt(fMatchDistance) + 30;
65 fEmcalMaxX = 3000;
434146d0 66}
67
01d100c8 68
2a24cbbe 69Int_t AliHLTGlobalTrackMatcher::AddTrackToCluster(Int_t tId, TArrayI* matchedTracksArray, Bool_t bestMatch, Int_t nMatches){
70 //See header file for documentation
71
72 matchedTracksArray->Set(matchedTracksArray->GetSize() + 1);
73 if ( bestMatch ) {
74 matchedTracksArray->AddAt(matchedTracksArray->At(0), matchedTracksArray->GetSize() - 1);
75 matchedTracksArray->AddAt(tId, 0);
76 } else {
77 matchedTracksArray->AddAt(tId, matchedTracksArray->GetSize() - 1);
78 }
434146d0 79
2a24cbbe 80 return nMatches;
81}
434146d0 82
2a24cbbe 83Int_t AliHLTGlobalTrackMatcher::AddTrackToCluster(Int_t tId, Int_t* matchArray, bool bestMatch, Int_t nMatches ){
a46c7ba5 84
85 // HLTInfo("Adding track %d to cluster with %d previous matches", tId, nMatches);
de31859c 86
2a24cbbe 87 //BALLE TODO: remove hardcoded 9
a46c7ba5 88 if (nMatches > 9) { //BALLE this on tooo
89 HLTDebug("The number of matching tracks (%d) exceeds the array size of %d", nMatches, 9);
2a24cbbe 90 return 0;
de31859c 91 }
434146d0 92
2a24cbbe 93 if(bestMatch) {
2a24cbbe 94 matchArray[nMatches] = matchArray[0];
95 matchArray[0] = tId;
96 } else {
97 matchArray[nMatches] = tId;
434146d0 98 }
bad7877b 99
2a24cbbe 100 return nMatches;
434146d0 101
2a24cbbe 102};
434146d0 103
434146d0 104
2a24cbbe 105Bool_t AliHLTGlobalTrackMatcher::IsTrackCloseToDetector(AliExternalTrackParam * track, Double_t bz, Double_t fMaxX, Bool_t ySign, Double_t fMaxZ, Double_t dRadius) {
434146d0 106 //See header file for documentation
a46c7ba5 107
434146d0 108 //Get track instersection with cylinder defined by detector radius
70cad768 109 Double_t trackPosition[3] = {0, 0, 0};
2a24cbbe 110 if (! (track->GetXYZAt(dRadius, bz, trackPosition)) ) {
434146d0 111 return kFALSE;
2a24cbbe 112 }
113
4502b5bb 114 //HLTInfo("Track coordinate at R = PHOS radius %f %f %f", trackPosition[0],trackPosition[1],trackPosition[2]);
a46c7ba5 115
116
2a24cbbe 117 //Positive y for EMCAL, negative for PHOS
434146d0 118 if(ySign) {
a46c7ba5 119 if (trackPosition[1] < 0 )
434146d0 120 return kFALSE;
121 } else {
a46c7ba5 122 if (trackPosition[1] > 0 )
434146d0 123 return kFALSE;
124 }
125
126
127 if ( (TMath::Abs(trackPosition[2]) > fMaxZ) )
128 return kFALSE;
129
130 if (TMath::Abs(trackPosition[0]) > fMaxX )
131 return kFALSE;
70cad768 132
a46c7ba5 133 // HLTInfo("kTRUE");
134
434146d0 135 return kTRUE;
136}