2 /**************************************************************************
3 * This file is property of and copyright by the ALICE HLT Project *
4 * ALICE Experiment at CERN, All rights reserved. *
6 * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
7 * for The ALICE HLT Project. *
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 **************************************************************************/
18 /** @file AliHLTTPCCalibTimeGainComponent.cxx
19 @author Kalliopi Kanaki
21 @brief A calibration component for the TPC gain variation vs. time.
24 // see header file for class documentation
26 // refer to README to build package
28 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
34 #include "AliHLTTPCCalibTimeGainComponent.h"
35 #include "AliHLTTPCDefinitions.h"
36 #include "AliHLTReadoutList.h"
38 #include "AliESDEvent.h"
39 #include "AliESDtrack.h"
41 #include "AliTPCcalibTimeGain.h"
42 #include "AliTPCseed.h"
44 #include "TObjArray.h"
51 ClassImp(AliHLTTPCCalibTimeGainComponent) // ROOT macro for the implementation of ROOT specific class methods
53 AliHLTTPCCalibTimeGainComponent::AliHLTTPCCalibTimeGainComponent()
63 fEnableAnalysis(kTRUE)
65 // see header file for class documentation
67 // refer to README to build package
69 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
72 AliHLTTPCCalibTimeGainComponent::~AliHLTTPCCalibTimeGainComponent() {
73 // see header file for class documentation
76 const char* AliHLTTPCCalibTimeGainComponent::GetComponentID() {
77 // see header file for class documentation
79 return "TPCCalibTimeGain";
82 void AliHLTTPCCalibTimeGainComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
83 // see header file for class documentation
86 list.push_back( kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC ); // output of TPCCalibSeedMaker
87 list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginOut ); // output of global esd converter
90 AliHLTComponentDataType AliHLTTPCCalibTimeGainComponent::GetOutputDataType() {
91 // see header file for class documentation
93 return AliHLTTPCDefinitions::fgkCalibCEDataType|kAliHLTDataOriginOut;
96 void AliHLTTPCCalibTimeGainComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) {
97 // see header file for class documentation
100 inputMultiplier = (2.0); // to be estimated
103 AliHLTComponent* AliHLTTPCCalibTimeGainComponent::Spawn() {
104 // see header file for class documentation
106 return new AliHLTTPCCalibTimeGainComponent();
110 Int_t AliHLTTPCCalibTimeGainComponent::ScanArgument( Int_t argc, const char** argv ) {
111 // see header file for class documentation
114 TString argument = "";
115 TString parameter = "";
117 if(!argc) return -EINVAL;
119 argument = argv[iResult];
121 if(argument.IsNull()) return -EINVAL;
123 if( argument.CompareTo("-enable-analysis") == 0 ){
124 HLTInfo( "Analysis before shipping data to FXS enabled." );
125 fEnableAnalysis = kTRUE;
134 Int_t AliHLTTPCCalibTimeGainComponent::InitCalibration() {
135 // see header file for class documentation
137 if(fCalibTimeGain) return EINPROGRESS;
138 //fCalibTimeGain = new AliTPCcalibTimeGain();
139 fCalibTimeGain = new AliTPCcalibTimeGain("calibTimeGain","time dependent gain calibration",-2, 2, 1);
143 Int_t AliHLTTPCCalibTimeGainComponent::DeinitCalibration() {
144 // see header file for class documentation
146 if(fCalibTimeGain) delete fCalibTimeGain; fCalibTimeGain = NULL;
151 Int_t AliHLTTPCCalibTimeGainComponent::ProcessCalibration( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ){
152 // see header file for class documentation
154 if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0;
156 TObject *iter = NULL;
158 //--------------- loop over the TObjArray output of AliTPCseed objects (output of TPCSeedMaker) -------------------//
160 for(iter = (TObject*)GetFirstInputObject(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC); iter != NULL; iter = (TObject*)GetNextInputObject()){
162 if(GetDataType(iter) != (kAliHLTDataTypeTObjArray | kAliHLTDataOriginTPC)) continue;
163 fSeedArray = dynamic_cast<TObjArray*>(iter);
166 //----------- loop over output of global esd converter ----------------//
168 for(iter = (TObject*)GetFirstInputObject(kAliHLTDataTypeESDObject | kAliHLTDataOriginOut); iter != NULL; iter = (TObject*)GetNextInputObject()){
170 if(GetDataType(iter) != (kAliHLTDataTypeESDObject | kAliHLTDataOriginOut)) continue;
172 AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(iter));
173 AliHLTUInt8_t partition = AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(iter));
175 if( partition < fMinPartition ) fMinPartition = partition;
176 if( partition > fMaxPartition ) fMaxPartition = partition;
177 if( slice < fMinSlice ) fMinSlice = slice;
178 if( slice > fMaxSlice ) fMaxSlice = slice;
180 fESDEvent = dynamic_cast<AliESDEvent*>(iter);
181 fESDEvent->CreateStdContent();
183 HLTDebug("# Seeds: %i\n", fSeedArray->GetEntriesFast());
185 for(Int_t i=0; i<fSeedArray->GetEntriesFast(); i++){
187 AliTPCseed *seed = (AliTPCseed*)fSeedArray->UncheckedAt(i);
189 AliESDtrack *esd = fESDEvent->GetTrack(i);
190 AliTPCseed *seedCopy = new AliTPCseed(*seed, kTRUE);
191 esd->AddCalibObject(seedCopy);
195 fCalibTimeGain->Process(fESDEvent);
197 fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( fMinSlice, fMaxSlice, fMinPartition, fMaxPartition );
198 PushBack( (TObject*) fCalibTimeGain, AliHLTTPCDefinitions::fgkCalibCEDataType| kAliHLTDataOriginOut, fSpecification);
203 Int_t AliHLTTPCCalibTimeGainComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ){
204 // see header file for class documentation
206 if(fEnableAnalysis) fCalibTimeGain->Analyze();
207 static AliHLTReadoutList rdList(AliHLTReadoutList::kTPC);
208 PushToFXS( (TObject*) fCalibTimeGain, "TPC", "TimeGain", &rdList ) ;