adding HLT interface components for TPC calibration, adding corresponding test macros,
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCCalibTimeGainComponent.cxx
CommitLineData
33a4976d 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: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
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 AliHLTTPCCalibTimeGainComponent.cxx
19 @author Kalliopi Kanaki
20 @date 2009-07-08
21 @brief A calibration component for the TPC gain variation vs. time.
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 "AliHLTTPCCalibTimeGainComponent.h"
35
36#include "AliHLTTPCDefinitions.h"
37#include "AliTPCcalibTimeGain.h"
38
39#include <cstdlib>
40#include <cerrno>
41#include "TString.h"
42
43ClassImp(AliHLTTPCCalibTimeGainComponent) // ROOT macro for the implementation of ROOT specific class methods
44
45AliHLTTPCCalibTimeGainComponent::AliHLTTPCCalibTimeGainComponent()
46 :
47 fCalibTimeGain(NULL),
48 fESDEvent(NULL),
49 fMinPartition(5),
50 fMaxPartition(0),
51 fMinSlice(35),
52 fMaxSlice(0),
53 fSpecification(0) ,
54 fEnableAnalysis(kTRUE)
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
61}
62
63AliHLTTPCCalibTimeGainComponent::~AliHLTTPCCalibTimeGainComponent() {
64// see header file for class documentation
65}
66
67const char* AliHLTTPCCalibTimeGainComponent::GetComponentID() {
68// see header file for class documentation
69
70 return "TPCCalibTimeGain";
71}
72
73void AliHLTTPCCalibTimeGainComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
74// see header file for class documentation
75
76 list.clear();
77 list.push_back( kAliHLTDataTypeTObjArray ); // output of TPCCalibSeedMaker
78 list.push_back( kAliHLTDataTypeESDTree ); // output of global merger
79}
80
81AliHLTComponentDataType AliHLTTPCCalibTimeGainComponent::GetOutputDataType() {
82// see header file for class documentation
83
84 return AliHLTTPCDefinitions::fgkCalibCEDataType;
85}
86
87void AliHLTTPCCalibTimeGainComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) {
88// see header file for class documentation
89
90 constBase = 0;
91 inputMultiplier = (2.0); // to be estimated
92}
93
94AliHLTComponent* AliHLTTPCCalibTimeGainComponent::Spawn() {
95// see header file for class documentation
96
97 return new AliHLTTPCCalibTimeGainComponent();
98}
99
100
101Int_t AliHLTTPCCalibTimeGainComponent::ScanArgument( Int_t argc, const char** argv ) {
102// see header file for class documentation
103
104 Int_t iResult = 0;
105 TString argument = "";
106 TString parameter = "";
107
108 if(!argc) return -EINVAL;
109
110 argument = argv[iResult];
111
112 if(argument.IsNull()) return -EINVAL;
113
114 if( argument.CompareTo("-enable-analysis") == 0 ){
115 HLTInfo( "Analysis before shipping data to FXS enabled." );
116 fEnableAnalysis = kTRUE;
117 }
118 else {
119 iResult = -EINVAL;
120 }
121
122 return iResult;
123}
124
125Int_t AliHLTTPCCalibTimeGainComponent::InitCalibration() {
126// see header file for class documentation
127
128 if(fCalibTimeGain) return EINPROGRESS;
129 fCalibTimeGain = new AliTPCcalibTimeGain(); // KK
130 //AliTPCcalibTimeGain::AliTPCcalibTimeGain(const Text_t *name, const Text_t *title, UInt_t StartTime, UInt_t EndTime, Int_t deltaIntegrationTimeGain)
131 return 0;
132}
133
134Int_t AliHLTTPCCalibTimeGainComponent::DeinitCalibration() {
135// see header file for class documentation
136
137 if(fCalibTimeGain) delete fCalibTimeGain;
138 fCalibTimeGain = NULL;
139
140 return 0;
141}
142
143Int_t AliHLTTPCCalibTimeGainComponent::ProcessCalibration( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ){
144// see header file for class documentation
145
146 if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0;
147
148 const AliHLTComponentBlockData *iter = NULL;
149
150 for(iter = GetFirstInputBlock(kAliHLTDataTypeESDTree|kAliHLTDataOriginTPC); iter != NULL; iter = GetNextInputBlock()){
151
152 if(iter->fDataType != (kAliHLTDataTypeESDTree | kAliHLTDataOriginTPC)) continue;
153
154 AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr(*iter);
155 AliHLTUInt8_t partition = AliHLTTPCDefinitions::GetMinPatchNr(*iter);
156
157 if( partition < fMinPartition ) fMinPartition = partition;
158 if( partition > fMaxPartition ) fMaxPartition = partition;
159 if( slice < fMinSlice ) fMinSlice = slice;
160 if( slice > fMaxSlice ) fMaxSlice = slice;
161
162 //fESDEvent = (AliESDEvent*)iter;
163
164 }
165
166 // loop over TObjArray of seeds missing
167
168 //fCalibTimeGain->Process(fESDEvent);
169
170 fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( fMinSlice, fMaxSlice, fMinPartition, fMaxPartition );
171 PushBack( (TObject*) fCalibTimeGain, AliHLTTPCDefinitions::fgkCalibCEDataType, fSpecification);
172
173 return 0;
174}
175
176Int_t AliHLTTPCCalibTimeGainComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ){
177 // see header file for class documentation
178
179 if(fEnableAnalysis) fCalibTimeGain->Analyze();
180
181 PushToFXS( (TObject*) fCalibTimeGain, "TPC", "TimeGain" ) ;
182
183 return 0;
184}
185
186