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"
36 #include "AliHLTTPCDefinitions.h"
37 #include "AliTPCcalibTimeGain.h"
38 #include "AliESDEvent.h"
42 #include "TObjArray.h"
44 ClassImp(AliHLTTPCCalibTimeGainComponent) // ROOT macro for the implementation of ROOT specific class methods
46 AliHLTTPCCalibTimeGainComponent::AliHLTTPCCalibTimeGainComponent()
56 fEnableAnalysis(kTRUE)
58 // see header file for class documentation
60 // refer to README to build package
62 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
65 AliHLTTPCCalibTimeGainComponent::~AliHLTTPCCalibTimeGainComponent() {
66 // see header file for class documentation
69 const char* AliHLTTPCCalibTimeGainComponent::GetComponentID() {
70 // see header file for class documentation
72 return "TPCCalibTimeGain";
75 void AliHLTTPCCalibTimeGainComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
76 // see header file for class documentation
79 list.push_back( kAliHLTDataTypeTObjArray ); // output of TPCCalibSeedMaker
80 list.push_back( kAliHLTDataTypeESDObject ); // output of TPCEsdConverter
83 AliHLTComponentDataType AliHLTTPCCalibTimeGainComponent::GetOutputDataType() {
84 // see header file for class documentation
86 return AliHLTTPCDefinitions::fgkCalibCEDataType;
89 void AliHLTTPCCalibTimeGainComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) {
90 // see header file for class documentation
93 inputMultiplier = (2.0); // to be estimated
96 AliHLTComponent* AliHLTTPCCalibTimeGainComponent::Spawn() {
97 // see header file for class documentation
99 return new AliHLTTPCCalibTimeGainComponent();
103 Int_t AliHLTTPCCalibTimeGainComponent::ScanArgument( Int_t argc, const char** argv ) {
104 // see header file for class documentation
107 TString argument = "";
108 TString parameter = "";
110 if(!argc) return -EINVAL;
112 argument = argv[iResult];
114 if(argument.IsNull()) return -EINVAL;
116 if( argument.CompareTo("-enable-analysis") == 0 ){
117 HLTInfo( "Analysis before shipping data to FXS enabled." );
118 fEnableAnalysis = kTRUE;
127 Int_t AliHLTTPCCalibTimeGainComponent::InitCalibration() {
128 // see header file for class documentation
130 if(fCalibTimeGain) return EINPROGRESS;
131 fCalibTimeGain = new AliTPCcalibTimeGain();
132 //AliTPCcalibTimeGain::AliTPCcalibTimeGain(const Text_t *name, const Text_t *title, UInt_t StartTime, UInt_t EndTime, Int_t deltaIntegrationTimeGain)
136 Int_t AliHLTTPCCalibTimeGainComponent::DeinitCalibration() {
137 // see header file for class documentation
139 if(fCalibTimeGain) delete fCalibTimeGain;
140 fCalibTimeGain = NULL;
145 Int_t AliHLTTPCCalibTimeGainComponent::ProcessCalibration( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ){
146 // see header file for class documentation
148 if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0;
150 TObject *iterESD, *iterSEED = NULL;
152 //----------- loop over output of TPCEsdConverter ----------------//
154 for(iterESD = (TObject*)GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC); iterESD != NULL; iterESD = (TObject*)GetNextInputObject()){
156 if(GetDataType(iterSEED) != (kAliHLTDataTypeESDObject | kAliHLTDataOriginTPC)) continue;
158 AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(iterESD));
159 AliHLTUInt8_t partition = AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(iterESD));
161 if( partition < fMinPartition ) fMinPartition = partition;
162 if( partition > fMaxPartition ) fMaxPartition = partition;
163 if( slice < fMinSlice ) fMinSlice = slice;
164 if( slice > fMaxSlice ) fMaxSlice = slice;
166 fESDEvent = dynamic_cast<AliESDEvent*>(iterESD);
167 fESDEvent->CreateStdContent();
171 //--------------- output over TObjArray of AliTPCseed objects (output of TPCSeedMaker) -------------------//
173 for(iterSEED = (TObject*)GetFirstInputObject(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC); iterSEED != NULL; iterSEED = (TObject*)GetNextInputObject()){
175 if(GetDataType(iterSEED) != (kAliHLTDataTypeTObjArray | kAliHLTDataOriginTPC)) continue;
177 fSeedArray = dynamic_cast<TObjArray*>(iterSEED);
180 fCalibTimeGain->Process(fESDEvent);
182 fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( fMinSlice, fMaxSlice, fMinPartition, fMaxPartition );
183 PushBack( (TObject*) fCalibTimeGain, AliHLTTPCDefinitions::fgkCalibCEDataType, fSpecification);
188 Int_t AliHLTTPCCalibTimeGainComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ){
189 // see header file for class documentation
191 if(fEnableAnalysis) fCalibTimeGain->Analyze();
192 PushToFXS( (TObject*) fCalibTimeGain, "TPC", "TimeGain" ) ;