]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/global/AliHLTGlobalTrackMatcher.cxx
activating automatic emulation of TPC compressed clusters
[u/mrichter/AliRoot.git] / HLT / global / AliHLTGlobalTrackMatcher.cxx
1 //$Id$
2 /**************************************************************************
3  * This file is property of and copyright by the ALICE HLT Project        * 
4  * ALICE Experiment at CERN, All rights reserved.                         *
5  *                                                                        *
6  * Primary Authors: Svein Lindal (slindal@fys.uio.no)                 *
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
19     @author Svein Lindal
20     @date   
21     @brief  The HLT class Matching Calorimeter clusters to TPC tracks
22 */
23
24 #include "AliHLTGlobalTrackMatcher.h"
25
26
27 #if __GNUC__>= 3
28 using namespace std;
29 #endif
30
31 ClassImp(AliHLTGlobalTrackMatcher)
32
33
34 AliHLTGlobalTrackMatcher::AliHLTGlobalTrackMatcher() :
35   fPhosMaxZ(0),
36   fPhosMaxX(0),
37   fEmcalMaxZ(0),
38   fEmcalMaxX(0),
39   fMatchDistance(0),
40   fMatchDistanceEMCal(0),
41   fPhosRadius(460),
42   fEmcalRadius(448),
43   fStep(100.),
44   fMass(0.139)
45 {
46   //Default constructor
47   DoInit();
48 }
49
50 //_____________________________________________________________________________
51 AliHLTGlobalTrackMatcher::~AliHLTGlobalTrackMatcher()
52 {
53   //Destructor
54
55 }
56
57 void AliHLTGlobalTrackMatcher::DoInit( ) {
58   //See header file for documentation
59   //BALLE TODO: Change hardcoded values to something that is initialised through command line or something!!!
60
61
62   fMatchDistance = 40*40;
63   fMatchDistanceEMCal = 0.1; // EMCal EtaxPhi cut 
64
65   fPhosMaxX = 355 + TMath::Sqrt(fMatchDistance) + 30;
66   fPhosMaxZ = 64.+ TMath::Sqrt(fMatchDistance) + 30;
67
68   fEmcalMaxZ = 350 + TMath::Sqrt(fMatchDistance) + 30;
69   fEmcalMaxX = 3000;
70
71   fStep=100.;// Step for EMCAL extrapolation
72   fMass=0.139;// Mass for EMCAL extrapolation hipothesis
73
74 }
75
76 Int_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   }
86
87   return nMatches;
88 }
89
90 Int_t AliHLTGlobalTrackMatcher::AddTrackToCluster(Int_t tId, Int_t* matchArray, bool bestMatch, Int_t nMatches ){
91
92   //  HLTInfo("Adding track %d to cluster with %d previous matches", tId, nMatches);
93   
94   //BALLE TODO: remove hardcoded 9
95   if (nMatches > 9) {                                                   //BALLE this on tooo
96     HLTDebug("The number of matching tracks (%d) exceeds the array size of %d", nMatches, 9);
97     return 0;
98   }
99  
100    
101   if(bestMatch) {
102     matchArray[nMatches] = matchArray[0];
103     matchArray[0] = tId;
104   } else  {
105     matchArray[nMatches] = tId;
106   }
107
108   return nMatches;
109
110 };
111
112 Bool_t AliHLTGlobalTrackMatcher::IsTrackCloseToDetector(AliExternalTrackParam * track, Double_t bz, Double_t fMaxX, Bool_t ySign, Double_t fMaxZ, Double_t dRadius) {
113   //See header file for documentation
114   
115   //Positive y for EMCAL, negative for PHOS
116   if(ySign) {
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;   
121   } else {
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     }
128     if (trackPosition[1] > 0 ) 
129       return kFALSE;
130     if ( (TMath::Abs(trackPosition[2]) > fMaxZ) ) 
131       return kFALSE;
132     if (TMath::Abs(trackPosition[0]) > fMaxX )
133       return kFALSE;
134   }
135   return kTRUE;  
136 }