]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/calibration/AliHLTTPCCalibrationComponent.cxx
At the start of the online GUI sterring window we will read the list of already activ...
[u/mrichter/AliRoot.git] / HLT / TPCLib / calibration / AliHLTTPCCalibrationComponent.cxx
CommitLineData
9b99ccf1 1// $Id$
2/**************************************************************************
3 * This file is property of and copyright by the ALICE HLT Project *
4 * ALICE Experiment at CERN, All rights reserved. *
5 * *
6 * Primary Authors: Kalliopi Kanaki <Kalliopi.Kanaki@ift.uib.no> *
7 * for The ALICE HLT Project. *
8 * *
9 * Permission to use, copy, modify and distribute this software and its *
10 * documentation strictly for non-commercial purposes is hereby granted *
11 * without fee, provided that the above copyright notice appears in all *
12 * copies and that both the copyright notice and this permission notice *
13 * appear in the supporting documentation. The authors make no claims *
14 * about the suitability of this software for any purpose. It is *
15 * provided "as is" without express or implied warranty. *
16 **************************************************************************/
17
18/** @file AliHLTTPCCalibrationComponent.cxx
19 @author Kalliopi Kanaki
20 @date
21 @brief
22*/
23
24// see header file for class documentation
25// or
26// refer to README to build package
27// or
28// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
29
30#if __GNUC__>= 3
31using namespace std;
32#endif
33
34#include "AliHLTTPCCalibrationComponent.h"
35#include "AliHLTTPCDefinitions.h"
36#include "AliHLTTPCAnalysisTaskcalib.h"
37
38#include "AliAnalysisManager.h"
39#include "AliESDInputHandler.h"
40
41#include "AliTPCcalibTime.h"
42#include "AliTPCcalibTimeGain.h"
43#include "AliESDEvent.h"
44
45#include <cstdlib>
46#include <cerrno>
47
48#include "TString.h"
49#include "TObjArray.h"
50#include "TTimeStamp.h"
51
52ClassImp(AliHLTTPCCalibrationComponent) // ROOT macro for the implementation of ROOT specific class methods
53
54AliHLTTPCCalibrationComponent::AliHLTTPCCalibrationComponent()
55 :
56 fCalibTask(NULL),
57 fCalibTime(NULL),
58 fCalibTimeGain(NULL),
59 fESDEvent(NULL),
60 fSeedArray(NULL),
61 fMinPartition(5),
62 fMaxPartition(0),
63 fMinSlice(35),
64 fMaxSlice(0),
65 fSpecification(0) ,
66 fEnableAnalysis(kTRUE)
67{
68 // see header file for class documentation
69 // or
70 // refer to README to build package
71 // or
72 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
73}
74
75AliHLTTPCCalibrationComponent::~AliHLTTPCCalibrationComponent() {
76// see header file for class documentation
77}
78
79const char* AliHLTTPCCalibrationComponent::GetComponentID() {
80// see header file for class documentation
81
82 return "TPCCalibration";
83}
84
85void AliHLTTPCCalibrationComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
86// see header file for class documentation
87
88 list.clear();
89 list.push_back( kAliHLTDataTypeTObjArray ); // output of TPCCalibSeedMaker
90 list.push_back( kAliHLTDataTypeESDObject ); // output of TPCEsdConverter
91}
92
93AliHLTComponentDataType AliHLTTPCCalibrationComponent::GetOutputDataType() {
94// see header file for class documentation
95
96 return AliHLTTPCDefinitions::fgkCalibCEDataType;
97}
98
99void AliHLTTPCCalibrationComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) {
100// see header file for class documentation
101
102 constBase = 0;
103 inputMultiplier = (2.0); // to be estimated
104}
105
106AliHLTComponent* AliHLTTPCCalibrationComponent::Spawn() {
107// see header file for class documentation
108
109 return new AliHLTTPCCalibrationComponent();
110}
111
112
113Int_t AliHLTTPCCalibrationComponent::ScanArgument( Int_t argc, const char** argv ) {
114// see header file for class documentation
115
116 Int_t iResult = 0;
117 TString argument = "";
118 TString parameter = "";
119
120 if(!argc) return -EINVAL;
121
122 argument = argv[iResult];
123
124 if(argument.IsNull()) return -EINVAL;
125
126 if( argument.CompareTo("-enable-analysis") == 0 ){
127 HLTInfo( "Analysis before shipping data to FXS enabled." );
128 fEnableAnalysis = kTRUE;
129 }
130 else {
131 iResult = -EINVAL;
132 }
133
134 return iResult;
135}
136
137Int_t AliHLTTPCCalibrationComponent::InitCalibration() {
138// see header file for class documentation
139
140 //TTimeStamp startTime(2008,9,0,0,0,0);
141 //TTimeStamp stopTime(2008,11,0,0,0,0);
142
143// AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
144// AliESDInputHandler *esdH = new AliESDInputHandler;
145// esdH->SetActiveBranches("ESDfriend");
146// mgr->SetInputEventHandler(esdH);
147
148 if(fCalibTask) return EINPROGRESS;
149 fCalibTask = new AliHLTTPCAnalysisTaskcalib("TPC Calibration Task");
150
151 if(fCalibTime) return EINPROGRESS;
f6c3210f 152 fCalibTime = new AliTPCcalibTime();
9b99ccf1 153
154 fCalibTime->SetDebugLevel(20);
155 fCalibTime->SetStreamLevel(10);
156 fCalibTime->SetTriggerMask(-1,-1,kFALSE); //accept everything
157
158 if(fCalibTimeGain) return EINPROGRESS;
f6c3210f 159 fCalibTimeGain = new AliTPCcalibTimeGain("calibTimeGain","time dependent gain calibration",-2, 2, 1);
9b99ccf1 160
161 fCalibTask->AddJob(fCalibTime);
162 fCalibTask->AddJob(fCalibTimeGain);
163 fCalibTask->GetJobs();
164
165 return 0;
166}
167
168Int_t AliHLTTPCCalibrationComponent::DeinitCalibration() {
169// see header file for class documentation
170
171 if(fCalibTask) delete fCalibTask; fCalibTask = NULL;
172 if(fCalibTime) delete fCalibTime; fCalibTime = NULL;
173 if(fCalibTimeGain) delete fCalibTimeGain; fCalibTimeGain = NULL;
174
175 return 0;
176}
177
178Int_t AliHLTTPCCalibrationComponent::ProcessCalibration( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ){
179// see header file for class documentation
180
181 if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0;
182
183 TObject *iterESD, *iterSEED = NULL;
184
185 //----------- loop over output of TPCEsdConverter ----------------//
186
187 for(iterESD = (TObject*)GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC); iterESD != NULL; iterESD = (TObject*)GetNextInputObject()){
188
189 if(GetDataType(iterSEED) != (kAliHLTDataTypeESDObject | kAliHLTDataOriginTPC)) continue;
190
191 AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(iterESD));
192 AliHLTUInt8_t partition = AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(iterESD));
193
194 if( partition < fMinPartition ) fMinPartition = partition;
195 if( partition > fMaxPartition ) fMaxPartition = partition;
196 if( slice < fMinSlice ) fMinSlice = slice;
197 if( slice > fMaxSlice ) fMaxSlice = slice;
198
199 fESDEvent = dynamic_cast<AliESDEvent*>(iterESD);
200 fESDEvent->CreateStdContent();
201 }
202
203
204 //--------------- output over TObjArray of AliTPCseed objects (output of TPCSeedMaker) -------------------//
205
206 for(iterSEED = (TObject*)GetFirstInputObject(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC); iterSEED != NULL; iterSEED = (TObject*)GetNextInputObject()){
207
208 if(GetDataType(iterSEED) != (kAliHLTDataTypeTObjArray | kAliHLTDataOriginTPC)) continue;
209
210 fSeedArray = dynamic_cast<TObjArray*>(iterSEED);
211 }
212
213 fCalibTask->Process(fESDEvent);
214
215 fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( fMinSlice, fMaxSlice, fMinPartition, fMaxPartition );
216 PushBack( (TObject*) fCalibTask, AliHLTTPCDefinitions::fgkCalibCEDataType, fSpecification);
217
218 return 0;
219}
220
221Int_t AliHLTTPCCalibrationComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ){
222 // see header file for class documentation
223
224 if(fEnableAnalysis) fCalibTask->Analyze();
225 PushToFXS( (TObject*) fCalibTask, "TPC", "CALIB" ) ;
226
227 return 0;
228}
229
230