]>
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" | |
dc9f7928 | 28 | #include "AliHLTTPCFastTransform.h" |
0bbbbd17 | 29 | |
750126e1 | 30 | #include "AliCDBPath.h" |
31 | #include "AliCDBManager.h" | |
9eb867b1 | 32 | #include "AliCDBEntry.h" |
33 | #include "AliGRPObject.h" | |
0bbbbd17 | 34 | #include "AliTPCcalibDB.h" |
35 | #include "AliTPCTransform.h" | |
0bbbbd17 | 36 | #include "AliTPCParam.h" |
67e7ad4f | 37 | #include "AliTPCRecoParam.h" |
8f2bd9bd | 38 | #include "AliGeomManager.h" |
9eb867b1 | 39 | #include "AliRunInfo.h" |
40 | #include "AliEventInfo.h" | |
41 | #include "AliRawEventHeaderBase.h" | |
48fd12f9 | 42 | #include <iostream> |
43 | #include <iomanip> | |
44 | ||
45 | using namespace std; | |
0bbbbd17 | 46 | |
47 | ClassImp(AliHLTTPCClusterTransformation) //ROOT macro for the implementation of ROOT specific class methods | |
48 | ||
96122515 | 49 | AliRecoParam AliHLTTPCClusterTransformation::fOfflineRecoParam; |
50 | ||
0bbbbd17 | 51 | AliHLTTPCClusterTransformation::AliHLTTPCClusterTransformation() |
52 | : | |
96122515 | 53 | fError(), |
54 | fFastTransform() | |
0bbbbd17 | 55 | { |
56 | // see header file for class documentation | |
57 | // or | |
58 | // refer to README to build package | |
59 | // or | |
60 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
0bbbbd17 | 61 | } |
96122515 | 62 | |
0bbbbd17 | 63 | AliHLTTPCClusterTransformation::~AliHLTTPCClusterTransformation() |
64 | { | |
65 | // see header file for class documentation | |
0bbbbd17 | 66 | } |
67 | ||
68 | ||
96122515 | 69 | int AliHLTTPCClusterTransformation::Init( double FieldBz, Long_t TimeStamp ) |
0bbbbd17 | 70 | { |
71 | // Initialisation | |
9eb867b1 | 72 | |
8f2bd9bd | 73 | if(!AliGeomManager::GetGeometry()){ |
9eb867b1 | 74 | AliGeomManager::LoadGeometry(); |
8f2bd9bd | 75 | } |
0bbbbd17 | 76 | |
96122515 | 77 | if(!AliGeomManager::GetGeometry()) return Error(-1,"AliHLTTPCClusterTransformation::Init: Can not initialise geometry"); |
9eb867b1 | 78 | |
96122515 | 79 | AliTPCcalibDB* pCalib=AliTPCcalibDB::Instance(); |
80 | ||
81 | if(!pCalib ) return Error(-2,"AliHLTTPCClusterTransformation::Init: Calibration not found"); | |
9eb867b1 | 82 | |
96122515 | 83 | pCalib->SetExBField(FieldBz); |
84 | ||
85 | if( !pCalib->GetTransform() ) return Error(-3,"AliHLTTPCClusterTransformation::Init: No TPC transformation found"); | |
9eb867b1 | 86 | |
87 | // -- Get AliRunInfo variables | |
88 | ||
89 | AliGRPObject tmpGRP, *pGRP=0; | |
90 | ||
96122515 | 91 | AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/GRP/Data"); |
92 | ||
93 | if(!entry) return Error(-4,"AliHLTTPCClusterTransformation::Init: No GRP object found in data base"); | |
9eb867b1 | 94 | |
95 | { | |
96 | TMap* m = dynamic_cast<TMap*>(entry->GetObject()); // old GRP entry | |
97 | ||
98 | if (m) { | |
99 | //cout<<"Found a TMap in GRP/GRP/Data, converting it into an AliGRPObject"<<endl; | |
100 | m->Print(); | |
101 | pGRP = &tmpGRP; | |
102 | pGRP->ReadValuesFromMap(m); | |
103 | } | |
104 | else { | |
105 | //cout<<"Found an AliGRPObject in GRP/GRP/Data, reading it"<<endl; | |
106 | pGRP = dynamic_cast<AliGRPObject*>(entry->GetObject()); // new GRP entry | |
107 | } | |
108 | } | |
96122515 | 109 | |
9eb867b1 | 110 | if( !pGRP ){ |
96122515 | 111 | return Error(-5,"AliHLTTPCClusterTransformation::Init: Unknown format of the GRP object in data base"); |
9eb867b1 | 112 | } |
113 | ||
114 | AliRunInfo runInfo(pGRP->GetLHCState(),pGRP->GetBeamType(),pGRP->GetBeamEnergy(),pGRP->GetRunType(),pGRP->GetDetectorMask()); | |
115 | AliEventInfo evInfo; | |
116 | evInfo.SetEventType(AliRawEventHeaderBase::kPhysicsEvent); | |
96122515 | 117 | |
118 | entry=AliCDBManager::Instance()->Get("TPC/Calib/RecoParam"); | |
119 | ||
120 | if(!entry) return Error(-6,"AliHLTTPCClusterTransformation::Init: No TPC reco param entry found in data base"); | |
121 | ||
122 | TObject *recoParamObj = entry->GetObject(); | |
123 | if(!recoParamObj) return Error(-7,"AliHLTTPCClusterTransformation::Init: Empty TPC reco param entry in data base"); | |
124 | ||
125 | if (dynamic_cast<TObjArray*>(recoParamObj)) { | |
126 | //cout<<"\n\nSet reco param from AliHLTTPCClusterTransformation: TObjArray found \n"<<endl; | |
127 | fOfflineRecoParam.AddDetRecoParamArray(1,dynamic_cast<TObjArray*>(recoParamObj)); | |
128 | } | |
129 | else if (dynamic_cast<AliDetectorRecoParam*>(recoParamObj)) { | |
130 | //cout<<"\n\nSet reco param from AliHLTTPCClusterTransformation: AliDetectorRecoParam found \n"<<endl; | |
131 | fOfflineRecoParam.AddDetRecoParam(1,dynamic_cast<AliDetectorRecoParam*>(recoParamObj)); | |
132 | } else { | |
133 | return Error(-8,"AliHLTTPCClusterTransformation::Init: Unknown format of the TPC Reco Param entry in the data base"); | |
134 | } | |
135 | ||
9eb867b1 | 136 | |
96122515 | 137 | fOfflineRecoParam.SetEventSpecie(&runInfo, evInfo, 0); |
9eb867b1 | 138 | |
9eb867b1 | 139 | // |
750126e1 | 140 | |
96122515 | 141 | AliTPCRecoParam* recParam = (AliTPCRecoParam*)fOfflineRecoParam.GetDetRecoParam(1); |
0bbbbd17 | 142 | |
96122515 | 143 | if( !recParam ) return Error(-9,"AliHLTTPCClusterTransformation::Init: No TPC Reco Param entry found for the given event specification"); |
85b28c8f | 144 | |
96122515 | 145 | |
146 | pCalib->GetTransform()->SetCurrentRecoParam(recParam); | |
9eb867b1 | 147 | |
96122515 | 148 | // set current time stamp and initialize the fast transformation |
149 | ||
150 | int err = fFastTransform.Init( pCalib->GetTransform(), TimeStamp ); | |
151 | ||
152 | if( err!=0 ){ | |
153 | return Error(-10,Form( "AliHLTTPCClusterTransformation::Init: Initialisation of Fast Transformation failed with error %d :%s",err,fFastTransform.GetLastError()) ); | |
154 | } | |
9eb867b1 | 155 | |
0bbbbd17 | 156 | return 0; |
157 | } | |
158 | ||
96122515 | 159 | Bool_t AliHLTTPCClusterTransformation::IsInitialised() const |
0bbbbd17 | 160 | { |
96122515 | 161 | // Is the transformation initialised |
162 | return fFastTransform.IsInitialised(); | |
0bbbbd17 | 163 | } |
164 | ||
96122515 | 165 | void AliHLTTPCClusterTransformation::DeInit() |
0bbbbd17 | 166 | { |
96122515 | 167 | // Deinitialisation |
168 | fFastTransform.DeInit(); | |
0bbbbd17 | 169 | } |
48fd12f9 | 170 | |
96122515 | 171 | Int_t AliHLTTPCClusterTransformation::SetCurrentTimeStamp( Long_t TimeStamp ) |
48fd12f9 | 172 | { |
96122515 | 173 | // Set the current time stamp |
48fd12f9 | 174 | |
96122515 | 175 | AliTPCRecoParam* recParam = (AliTPCRecoParam*)fOfflineRecoParam.GetDetRecoParam(1); |
176 | if( !recParam ) return Error(-1,"AliHLTTPCClusterTransformation::SetCurrentTimeStamp: No TPC Reco Param entry found"); | |
48fd12f9 | 177 | |
96122515 | 178 | AliTPCcalibDB* pCalib=AliTPCcalibDB::Instance(); |
179 | if(!pCalib ) return Error(-2,"AliHLTTPCClusterTransformation::Init: Calibration not found"); | |
180 | ||
181 | if( !pCalib->GetTransform() ) return Error(-3,"AliHLTTPCClusterTransformation::SetCurrentTimeStamp: No TPC transformation found"); | |
182 | ||
183 | pCalib->GetTransform()->SetCurrentRecoParam(recParam); | |
48fd12f9 | 184 | |
96122515 | 185 | int err = fFastTransform.SetCurrentTimeStamp( TimeStamp ); |
186 | if( err!=0 ){ | |
187 | return Error(-4,Form( "AliHLTTPCClusterTransformation::SetCurrentTimeStamp: SetCurrentTimeStamp to the Fast Transformation failed with error %d :%s",err,fFastTransform.GetLastError()) ); | |
48fd12f9 | 188 | } |
96122515 | 189 | return 0; |
48fd12f9 | 190 | } |
191 | ||
192 | void AliHLTTPCClusterTransformation::Print(const char* /*option*/) const | |
193 | { | |
194 | // print info | |
96122515 | 195 | fFastTransform.Print(); |
48fd12f9 | 196 | } |