1 // $Id: AliHLTTPCClusterTransformation.cxx 41244 2010-05-14 08:13:35Z kkanaki $
3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Kalliopi Kanaki <Kalliopi.Kanaki@ift.uib.no> *
8 //* for The ALICE HLT Project. *
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 //**************************************************************************
19 /** @file AliHLTTPCClusterTransformation.cxx
20 @author Kalliopi Kanaki, Sergey Gorbubnov
26 #include "AliHLTTPCClusterTransformation.h"
27 #include "AliHLTTPCTransform.h"
29 #include "AliTPCcalibDB.h"
30 #include "AliTPCTransform.h"
31 #include "AliTPCParam.h"
32 #include "AliTPCRecoParam.h"
33 #include "AliGeomManager.h"
35 ClassImp(AliHLTTPCClusterTransformation) //ROOT macro for the implementation of ROOT specific class methods
37 AliHLTTPCClusterTransformation::AliHLTTPCClusterTransformation()
39 fOfflineTransform(NULL),
40 fOfflineTPCParam( NULL )
42 // see header file for class documentation
44 // refer to README to build package
46 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
49 AliHLTTPCClusterTransformation::AliHLTTPCClusterTransformation(const AliHLTTPCClusterTransformation&)
51 fOfflineTransform(NULL),
52 fOfflineTPCParam( NULL )
54 // copy constructor prohibited
57 AliHLTTPCClusterTransformation& AliHLTTPCClusterTransformation::operator=(const AliHLTTPCClusterTransformation&)
59 // assignment operator prohibited
63 AliHLTTPCClusterTransformation::~AliHLTTPCClusterTransformation()
65 // see header file for class documentation
66 delete fOfflineTransform;
70 int AliHLTTPCClusterTransformation::Init( double FieldBz, UInt_t TimeStamp )
74 delete fOfflineTransform;
77 AliTPCcalibDB* pCalib=AliTPCcalibDB::Instance();
79 if(!pCalib ) return -1;
81 pCalib->SetExBField(FieldBz);
83 if(!AliGeomManager::GetGeometry()){
84 AliGeomManager::LoadGeometry();
87 if( !pCalib->GetTransform() ) return -2;
89 fOfflineTransform = new AliTPCTransform (*pCalib->GetTransform());
90 fOfflineTransform->SetCurrentRecoParam( AliTPCRecoParam::GetHLTParam() );
91 fOfflineTransform->SetCurrentTimeStamp( TimeStamp );
92 fOfflineTPCParam = pCalib->GetParameters();
93 if( !fOfflineTPCParam ) return -3;
95 fOfflineTPCParam->Update();
96 fOfflineTPCParam->ReadGeoMatrices();
102 void AliHLTTPCClusterTransformation::SetCurrentTimeStamp( UInt_t TimeStamp )
104 // Set the current time stamp
105 if( fOfflineTransform ) fOfflineTransform->SetCurrentTimeStamp( TimeStamp );
109 int AliHLTTPCClusterTransformation::Transform( int Slice, int Row, float Pad, float Time, float XYZ[] )
111 // Convert row, pad, time to X Y Z
113 Int_t sector=-99, thisrow=-99;
114 AliHLTTPCTransform::Slice2Sector( Slice, Row, sector, thisrow);
116 if( !fOfflineTransform ){
117 AliHLTTPCTransform::Raw2Local( XYZ, sector, thisrow, Pad, Time);
118 if(Slice>17) XYZ[1]= - XYZ[1];
122 Int_t iSector[1]= {sector};
123 Double_t x[3] = { thisrow, Pad, Time };
124 fOfflineTransform->Transform(x,iSector,0,1);
125 Double_t y[3]= {x[0],x[1],x[2]};
128 if( fOfflineTPCParam && sector<fOfflineTPCParam->GetNSector() ){
129 TGeoHMatrix *alignment = fOfflineTPCParam->GetClusterMatrix( sector );
130 if ( alignment ) alignment->LocalToMaster( x, y);