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