]>
Commit | Line | Data |
---|---|---|
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" | |
0bbbbd17 | 31 | #include "AliTPCParam.h" |
67e7ad4f | 32 | #include "AliTPCRecoParam.h" |
8f2bd9bd | 33 | #include "AliGeomManager.h" |
0bbbbd17 | 34 | |
35 | ClassImp(AliHLTTPCClusterTransformation) //ROOT macro for the implementation of ROOT specific class methods | |
36 | ||
37 | AliHLTTPCClusterTransformation::AliHLTTPCClusterTransformation() | |
38 | : | |
39 | fOfflineTransform(NULL), | |
67e7ad4f | 40 | fOfflineTPCParam( NULL ) |
0bbbbd17 | 41 | { |
42 | // see header file for class documentation | |
43 | // or | |
44 | // refer to README to build package | |
45 | // or | |
46 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
47 | } | |
48 | ||
49 | AliHLTTPCClusterTransformation::AliHLTTPCClusterTransformation(const AliHLTTPCClusterTransformation&) | |
50 | : | |
51 | fOfflineTransform(NULL), | |
67e7ad4f | 52 | fOfflineTPCParam( NULL ) |
0bbbbd17 | 53 | { |
54 | // copy constructor prohibited | |
55 | } | |
56 | ||
57 | AliHLTTPCClusterTransformation& AliHLTTPCClusterTransformation::operator=(const AliHLTTPCClusterTransformation&) | |
58 | { | |
59 | // assignment operator prohibited | |
60 | return *this; | |
61 | } | |
62 | ||
63 | AliHLTTPCClusterTransformation::~AliHLTTPCClusterTransformation() | |
64 | { | |
65 | // see header file for class documentation | |
d039e59e | 66 | //delete fOfflineTransform; |
0bbbbd17 | 67 | } |
68 | ||
69 | ||
dccee396 | 70 | int AliHLTTPCClusterTransformation::Init( double FieldBz, UInt_t TimeStamp ) |
0bbbbd17 | 71 | { |
72 | // Initialisation | |
73 | ||
d039e59e | 74 | //delete fOfflineTransform; |
75 | fOfflineTransform = 0; | |
67e7ad4f | 76 | fOfflineTPCParam = 0; |
77 | ||
0bbbbd17 | 78 | AliTPCcalibDB* pCalib=AliTPCcalibDB::Instance(); |
79 | ||
80 | if(!pCalib ) return -1; | |
81 | ||
82 | pCalib->SetExBField(FieldBz); | |
8f2bd9bd | 83 | |
84 | if(!AliGeomManager::GetGeometry()){ | |
85 | AliGeomManager::LoadGeometry(); | |
86 | } | |
0bbbbd17 | 87 | |
67e7ad4f | 88 | if( !pCalib->GetTransform() ) return -2; |
89 | ||
d039e59e | 90 | //fOfflineTransform = new AliTPCTransform (*pCalib->GetTransform()); |
91 | fOfflineTransform = pCalib->GetTransform(); | |
67e7ad4f | 92 | fOfflineTransform->SetCurrentRecoParam( AliTPCRecoParam::GetHLTParam() ); |
dccee396 | 93 | fOfflineTransform->SetCurrentTimeStamp( TimeStamp ); |
0bbbbd17 | 94 | fOfflineTPCParam = pCalib->GetParameters(); |
95 | if( !fOfflineTPCParam ) return -3; | |
96 | ||
97 | fOfflineTPCParam->Update(); | |
98 | fOfflineTPCParam->ReadGeoMatrices(); | |
99 | ||
100 | return 0; | |
101 | } | |
102 | ||
103 | ||
67e7ad4f | 104 | void AliHLTTPCClusterTransformation::SetCurrentTimeStamp( UInt_t TimeStamp ) |
0bbbbd17 | 105 | { |
106 | // Set the current time stamp | |
67e7ad4f | 107 | if( fOfflineTransform ) fOfflineTransform->SetCurrentTimeStamp( TimeStamp ); |
0bbbbd17 | 108 | } |
109 | ||
110 | ||
111 | int AliHLTTPCClusterTransformation::Transform( int Slice, int Row, float Pad, float Time, float XYZ[] ) | |
112 | { | |
113 | // Convert row, pad, time to X Y Z | |
114 | ||
115 | Int_t sector=-99, thisrow=-99; | |
116 | AliHLTTPCTransform::Slice2Sector( Slice, Row, sector, thisrow); | |
117 | ||
118 | if( !fOfflineTransform ){ | |
119 | AliHLTTPCTransform::Raw2Local( XYZ, sector, thisrow, Pad, Time); | |
120 | if(Slice>17) XYZ[1]= - XYZ[1]; | |
121 | return 0; | |
122 | } | |
123 | ||
124 | Int_t iSector[1]= {sector}; | |
125 | Double_t x[3] = { thisrow, Pad, Time }; | |
126 | fOfflineTransform->Transform(x,iSector,0,1); | |
127 | Double_t y[3]= {x[0],x[1],x[2]}; | |
128 | ||
129 | ||
130 | if( fOfflineTPCParam && sector<fOfflineTPCParam->GetNSector() ){ | |
131 | TGeoHMatrix *alignment = fOfflineTPCParam->GetClusterMatrix( sector ); | |
132 | if ( alignment ) alignment->LocalToMaster( x, y); | |
133 | } | |
134 | ||
135 | XYZ[0] = y[0]; | |
136 | XYZ[1] = y[1]; | |
137 | XYZ[2] = y[2]; | |
138 | ||
139 | return 0; | |
140 | } |