]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCClusterTransformation.cxx
Bug fix
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCClusterTransformation.cxx
CommitLineData
0bbbbd17 1// $Id: AliHLTTPCClusterTransformation.cxx 41244 2010-05-14 08:13:35Z kkanaki $
2
3//**************************************************************************
4//* This file is property of and copyright by the ALICE HLT Project *
5//* ALICE Experiment at CERN, All rights reserved. *
6//* *
7//* Primary Authors: Kalliopi Kanaki <Kalliopi.Kanaki@ift.uib.no> *
8//* for The ALICE HLT Project. *
9//* *
10//* Permission to use, copy, modify and distribute this software and its *
11//* documentation strictly for non-commercial purposes is hereby granted *
12//* without fee, provided that the above copyright notice appears in all *
13//* copies and that both the copyright notice and this permission notice *
14//* appear in the supporting documentation. The authors make no claims *
15//* about the suitability of this software for any purpose. It is *
16//* provided "as is" without express or implied warranty. *
17//**************************************************************************
18
19/** @file AliHLTTPCClusterTransformation.cxx
20 @author Kalliopi Kanaki, Sergey Gorbubnov
21 @date
22 @brief
23*/
24
25
26#include "AliHLTTPCClusterTransformation.h"
27#include "AliHLTTPCTransform.h"
28
29#include "AliTPCcalibDB.h"
30#include "AliTPCTransform.h"
31#include "AliTPCRecoParam.h"
32#include "AliTPCParam.h"
33
34
35ClassImp(AliHLTTPCClusterTransformation) //ROOT macro for the implementation of ROOT specific class methods
36
37AliHLTTPCClusterTransformation::AliHLTTPCClusterTransformation()
38:
39 fOfflineTransform(NULL),
40 fOfflineTPCParam( NULL ),
41 fOfflineTPCRecoParam(*AliTPCRecoParam::GetHLTParam())
42{
43 // see header file for class documentation
44 // or
45 // refer to README to build package
46 // or
47 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
48}
49
50AliHLTTPCClusterTransformation::AliHLTTPCClusterTransformation(const AliHLTTPCClusterTransformation&)
51:
52 fOfflineTransform(NULL),
53 fOfflineTPCParam( NULL ),
54 fOfflineTPCRecoParam(*AliTPCRecoParam::GetHLTParam())
55{
56 // copy constructor prohibited
57}
58
59AliHLTTPCClusterTransformation& AliHLTTPCClusterTransformation::operator=(const AliHLTTPCClusterTransformation&)
60{
61 // assignment operator prohibited
62 return *this;
63}
64
65AliHLTTPCClusterTransformation::~AliHLTTPCClusterTransformation()
66{
67 // see header file for class documentation
68 delete fOfflineTransform;
69}
70
71
72int AliHLTTPCClusterTransformation::Init( double FieldBz, UInt_t /*TimeStamp*/ )
73{
74 // Initialisation
75
76 AliTPCcalibDB* pCalib=AliTPCcalibDB::Instance();
77
78 if(!pCalib ) return -1;
79
80 pCalib->SetExBField(FieldBz);
81
82 if( !pCalib->GetTransform() ) return -2;
83
84 fOfflineTransform = new AliTPCTransform (*pCalib->GetTransform());
85 fOfflineTransform->SetCurrentRecoParam(&fOfflineTPCRecoParam);
86
87 fOfflineTPCParam = pCalib->GetParameters();
88 if( !fOfflineTPCParam ) return -3;
89
90 fOfflineTPCParam->Update();
91 fOfflineTPCParam->ReadGeoMatrices();
92
93 return 0;
94}
95
96
97void AliHLTTPCClusterTransformation::SetTimeStamp( UInt_t /*TimeStamp*/ )
98{
99 // Set the current time stamp
100}
101
102
103int AliHLTTPCClusterTransformation::Transform( int Slice, int Row, float Pad, float Time, float XYZ[] )
104{
105 // Convert row, pad, time to X Y Z
106
107 Int_t sector=-99, thisrow=-99;
108 AliHLTTPCTransform::Slice2Sector( Slice, Row, sector, thisrow);
109
110 if( !fOfflineTransform ){
111 AliHLTTPCTransform::Raw2Local( XYZ, sector, thisrow, Pad, Time);
112 if(Slice>17) XYZ[1]= - XYZ[1];
113 return 0;
114 }
115
116 Int_t iSector[1]= {sector};
117 Double_t x[3] = { thisrow, Pad, Time };
118 fOfflineTransform->Transform(x,iSector,0,1);
119 Double_t y[3]= {x[0],x[1],x[2]};
120
121
122 if( fOfflineTPCParam && sector<fOfflineTPCParam->GetNSector() ){
123 TGeoHMatrix *alignment = fOfflineTPCParam->GetClusterMatrix( sector );
124 if ( alignment ) alignment->LocalToMaster( x, y);
125 }
126
127 XYZ[0] = y[0];
128 XYZ[1] = y[1];
129 XYZ[2] = y[2];
130
131 return 0;
132}