]>
Commit | Line | Data |
---|---|---|
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 | ||
33a4976d | 30 | #include "AliHLTTPCCalibTimeGainComponent.h" |
33a4976d | 31 | #include "AliHLTTPCDefinitions.h" |
8d53dca2 | 32 | #include "AliHLTReadoutList.h" |
1151db47 | 33 | |
8677d183 | 34 | #include "AliESDEvent.h" |
1151db47 | 35 | #include "AliESDtrack.h" |
36 | ||
37 | #include "AliTPCcalibTimeGain.h" | |
38 | #include "AliTPCseed.h" | |
39 | ||
40 | #include "TObjArray.h" | |
41 | #include "TString.h" | |
42 | ||
33a4976d | 43 | #include <cstdlib> |
44 | #include <cerrno> | |
1151db47 | 45 | |
d5cf9283 | 46 | using namespace std; |
33a4976d | 47 | |
48 | ClassImp(AliHLTTPCCalibTimeGainComponent) // ROOT macro for the implementation of ROOT specific class methods | |
49 | ||
50 | AliHLTTPCCalibTimeGainComponent::AliHLTTPCCalibTimeGainComponent() | |
51 | : | |
52 | fCalibTimeGain(NULL), | |
53 | fESDEvent(NULL), | |
8677d183 | 54 | fSeedArray(NULL), |
33a4976d | 55 | fMinPartition(5), |
56 | fMaxPartition(0), | |
57 | fMinSlice(35), | |
58 | fMaxSlice(0), | |
59 | fSpecification(0) , | |
60 | fEnableAnalysis(kTRUE) | |
61 | { | |
62 | // see header file for class documentation | |
63 | // or | |
64 | // refer to README to build package | |
65 | // or | |
66 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
67 | } | |
68 | ||
69 | AliHLTTPCCalibTimeGainComponent::~AliHLTTPCCalibTimeGainComponent() { | |
70 | // see header file for class documentation | |
71 | } | |
72 | ||
73 | const char* AliHLTTPCCalibTimeGainComponent::GetComponentID() { | |
74 | // see header file for class documentation | |
75 | ||
76 | return "TPCCalibTimeGain"; | |
77 | } | |
78 | ||
79 | void AliHLTTPCCalibTimeGainComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) { | |
80 | // see header file for class documentation | |
81 | ||
82 | list.clear(); | |
1151db47 | 83 | list.push_back( kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC ); // output of TPCCalibSeedMaker |
84 | list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginOut ); // output of global esd converter | |
33a4976d | 85 | } |
86 | ||
87 | AliHLTComponentDataType AliHLTTPCCalibTimeGainComponent::GetOutputDataType() { | |
88 | // see header file for class documentation | |
89 | ||
37250d7e | 90 | return AliHLTTPCDefinitions::CalibCEDataType()|kAliHLTDataOriginOut; |
33a4976d | 91 | } |
92 | ||
93 | void AliHLTTPCCalibTimeGainComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) { | |
94 | // see header file for class documentation | |
95 | ||
96 | constBase = 0; | |
97 | inputMultiplier = (2.0); // to be estimated | |
98 | } | |
99 | ||
100 | AliHLTComponent* AliHLTTPCCalibTimeGainComponent::Spawn() { | |
101 | // see header file for class documentation | |
102 | ||
103 | return new AliHLTTPCCalibTimeGainComponent(); | |
104 | } | |
105 | ||
106 | ||
107 | Int_t AliHLTTPCCalibTimeGainComponent::ScanArgument( Int_t argc, const char** argv ) { | |
108 | // see header file for class documentation | |
109 | ||
110 | Int_t iResult = 0; | |
111 | TString argument = ""; | |
112 | TString parameter = ""; | |
113 | ||
114 | if(!argc) return -EINVAL; | |
115 | ||
116 | argument = argv[iResult]; | |
117 | ||
118 | if(argument.IsNull()) return -EINVAL; | |
119 | ||
120 | if( argument.CompareTo("-enable-analysis") == 0 ){ | |
121 | HLTInfo( "Analysis before shipping data to FXS enabled." ); | |
122 | fEnableAnalysis = kTRUE; | |
123 | } | |
124 | else { | |
125 | iResult = -EINVAL; | |
126 | } | |
127 | ||
128 | return iResult; | |
129 | } | |
130 | ||
131 | Int_t AliHLTTPCCalibTimeGainComponent::InitCalibration() { | |
132 | // see header file for class documentation | |
133 | ||
134 | if(fCalibTimeGain) return EINPROGRESS; | |
1151db47 | 135 | //fCalibTimeGain = new AliTPCcalibTimeGain(); |
136 | fCalibTimeGain = new AliTPCcalibTimeGain("calibTimeGain","time dependent gain calibration",-2, 2, 1); | |
33a4976d | 137 | return 0; |
138 | } | |
139 | ||
140 | Int_t AliHLTTPCCalibTimeGainComponent::DeinitCalibration() { | |
141 | // see header file for class documentation | |
142 | ||
1151db47 | 143 | if(fCalibTimeGain) delete fCalibTimeGain; fCalibTimeGain = NULL; |
33a4976d | 144 | |
145 | return 0; | |
146 | } | |
147 | ||
148 | Int_t AliHLTTPCCalibTimeGainComponent::ProcessCalibration( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ){ | |
149 | // see header file for class documentation | |
150 | ||
151 | if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0; | |
152 | ||
1151db47 | 153 | TObject *iter = NULL; |
8677d183 | 154 | |
1151db47 | 155 | //--------------- loop over the TObjArray output of AliTPCseed objects (output of TPCSeedMaker) -------------------// |
8677d183 | 156 | |
1151db47 | 157 | for(iter = (TObject*)GetFirstInputObject(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC); iter != NULL; iter = (TObject*)GetNextInputObject()){ |
158 | ||
159 | if(GetDataType(iter) != (kAliHLTDataTypeTObjArray | kAliHLTDataOriginTPC)) continue; | |
160 | fSeedArray = dynamic_cast<TObjArray*>(iter); | |
161 | } | |
162 | ||
163 | //----------- loop over output of global esd converter ----------------// | |
164 | ||
165 | for(iter = (TObject*)GetFirstInputObject(kAliHLTDataTypeESDObject | kAliHLTDataOriginOut); iter != NULL; iter = (TObject*)GetNextInputObject()){ | |
166 | ||
167 | if(GetDataType(iter) != (kAliHLTDataTypeESDObject | kAliHLTDataOriginOut)) continue; | |
8677d183 | 168 | |
1151db47 | 169 | AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(iter)); |
170 | AliHLTUInt8_t partition = AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(iter)); | |
33a4976d | 171 | |
172 | if( partition < fMinPartition ) fMinPartition = partition; | |
173 | if( partition > fMaxPartition ) fMaxPartition = partition; | |
174 | if( slice < fMinSlice ) fMinSlice = slice; | |
175 | if( slice > fMaxSlice ) fMaxSlice = slice; | |
8677d183 | 176 | |
1151db47 | 177 | fESDEvent = dynamic_cast<AliESDEvent*>(iter); |
8677d183 | 178 | fESDEvent->CreateStdContent(); |
1151db47 | 179 | |
180 | HLTDebug("# Seeds: %i\n", fSeedArray->GetEntriesFast()); | |
181 | ||
182 | for(Int_t i=0; i<fSeedArray->GetEntriesFast(); i++){ | |
183 | ||
184 | AliTPCseed *seed = (AliTPCseed*)fSeedArray->UncheckedAt(i); | |
185 | if(!seed) continue; | |
186 | AliESDtrack *esd = fESDEvent->GetTrack(i); | |
187 | AliTPCseed *seedCopy = new AliTPCseed(*seed, kTRUE); | |
188 | esd->AddCalibObject(seedCopy); | |
189 | } | |
33a4976d | 190 | } |
1151db47 | 191 | |
8677d183 | 192 | fCalibTimeGain->Process(fESDEvent); |
193 | ||
33a4976d | 194 | fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( fMinSlice, fMaxSlice, fMinPartition, fMaxPartition ); |
37250d7e | 195 | PushBack( (TObject*) fCalibTimeGain, AliHLTTPCDefinitions::CalibCEDataType()| kAliHLTDataOriginOut, fSpecification); |
33a4976d | 196 | |
197 | return 0; | |
198 | } | |
199 | ||
200 | Int_t AliHLTTPCCalibTimeGainComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ){ | |
201 | // see header file for class documentation | |
202 | ||
8677d183 | 203 | if(fEnableAnalysis) fCalibTimeGain->Analyze(); |
8d53dca2 | 204 | static AliHLTReadoutList rdList(AliHLTReadoutList::kTPC); |
89413559 | 205 | PushToFXS( (TObject*) fCalibTimeGain, "TPC", "TimeGain", &rdList ) ; |
33a4976d | 206 | |
207 | return 0; | |
208 | } | |
209 | ||
210 |