]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCClusterTransformation.cxx
- macro to overlay plots produced by HLT/QA/tasks/macros/drawTHnSparse.C
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCClusterTransformation.cxx
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 "AliTPCParam.h"
32 #include "AliTPCRecoParam.h"
33
34
35 ClassImp(AliHLTTPCClusterTransformation) //ROOT macro for the implementation of ROOT specific class methods
36
37 AliHLTTPCClusterTransformation::AliHLTTPCClusterTransformation()
38 :
39   fOfflineTransform(NULL),
40   fOfflineTPCParam( NULL )
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),
52   fOfflineTPCParam( NULL )
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
66   delete fOfflineTransform;
67 }
68
69
70 int  AliHLTTPCClusterTransformation::Init( double FieldBz, UInt_t TimeStamp )
71 {
72   // Initialisation
73
74   delete fOfflineTransform;
75   fOfflineTPCParam = 0;
76
77   AliTPCcalibDB* pCalib=AliTPCcalibDB::Instance();
78
79   if(!pCalib ) return -1;
80
81   pCalib->SetExBField(FieldBz);
82
83   if( !pCalib->GetTransform() ) return -2; 
84
85   fOfflineTransform = new AliTPCTransform (*pCalib->GetTransform());
86   fOfflineTransform->SetCurrentRecoParam( AliTPCRecoParam::GetHLTParam() );
87   fOfflineTransform->SetCurrentTimeStamp( TimeStamp );
88   fOfflineTPCParam = pCalib->GetParameters(); 
89   if( !fOfflineTPCParam ) return -3;
90
91   fOfflineTPCParam->Update();
92   fOfflineTPCParam->ReadGeoMatrices();
93
94   return 0;
95 }
96
97
98 void AliHLTTPCClusterTransformation::SetCurrentTimeStamp( UInt_t TimeStamp )
99 {
100   // Set the current time stamp
101   if( fOfflineTransform ) fOfflineTransform->SetCurrentTimeStamp( TimeStamp );
102 }
103
104
105 int  AliHLTTPCClusterTransformation::Transform( int Slice, int Row, float Pad, float Time, float XYZ[] )
106 {
107   // Convert row, pad, time to X Y Z
108            
109   Int_t sector=-99, thisrow=-99;
110   AliHLTTPCTransform::Slice2Sector( Slice, Row, sector, thisrow);
111
112   if( !fOfflineTransform ){                
113     AliHLTTPCTransform::Raw2Local( XYZ, sector, thisrow, Pad, Time); 
114     if(Slice>17) XYZ[1]= - XYZ[1];         
115     return 0;
116   }
117
118   Int_t iSector[1]= {sector};   
119   Double_t x[3] = { thisrow, Pad, Time }; 
120   fOfflineTransform->Transform(x,iSector,0,1);
121   Double_t y[3]= {x[0],x[1],x[2]};
122
123           
124   if( fOfflineTPCParam && sector<fOfflineTPCParam->GetNSector() ){
125     TGeoHMatrix  *alignment = fOfflineTPCParam->GetClusterMatrix( sector );
126     if ( alignment ) alignment->LocalToMaster( x, y);
127   }      
128
129   XYZ[0] = y[0];
130   XYZ[1] = y[1];
131   XYZ[2] = y[2];
132
133   return 0; 
134 }