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 AliHLTTPCCalibTimeComponent.cxx
19 @author Kalliopi Kanaki
21 @brief A calibration component for interfacing the offline calculation of TPC drift velocity correction
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 "AliHLTTPCCalibTimeComponent.h"
36 #include "AliHLTTPCDefinitions.h"
37 #include "AliTPCcalibTime.h"
38 #include "AliESDEvent.h"
40 #include "TObjArray.h"
47 ClassImp(AliHLTTPCCalibTimeComponent) // ROOT macro for the implementation of ROOT specific class methods
49 AliHLTTPCCalibTimeComponent::AliHLTTPCCalibTimeComponent()
59 fEnableAnalysis(kTRUE)
61 // see header file for class documentation
63 // refer to README to build package
65 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
68 AliHLTTPCCalibTimeComponent::~AliHLTTPCCalibTimeComponent() {
69 // see header file for class documentation
73 const char* AliHLTTPCCalibTimeComponent::GetComponentID() {
74 // see header file for class documentation
76 return "TPCCalibTime";
79 void AliHLTTPCCalibTimeComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
80 // see header file for class documentation
83 list.push_back( kAliHLTDataTypeTObjArray ); // output of TPCCalibSeedMaker
84 list.push_back( kAliHLTDataTypeESDObject ); // output of TPCEsdConverter
87 AliHLTComponentDataType AliHLTTPCCalibTimeComponent::GetOutputDataType() {
88 // see header file for class documentation
90 return AliHLTTPCDefinitions::fgkCalibCEDataType;
93 void AliHLTTPCCalibTimeComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) {
94 // see header file for class documentation
97 inputMultiplier = (2.0); // to be estimated
100 AliHLTComponent* AliHLTTPCCalibTimeComponent::Spawn() {
101 // see header file for class documentation
103 return new AliHLTTPCCalibTimeComponent();
107 Int_t AliHLTTPCCalibTimeComponent::ScanArgument( Int_t argc, const char** argv ) {
108 // see header file for class documentation
111 TString argument = "";
112 TString parameter = "";
114 if(!argc) return -EINVAL;
116 argument = argv[iResult];
118 if(argument.IsNull()) return -EINVAL;
120 if( argument.CompareTo("-enable-analysis") == 0 ){
121 HLTInfo( "Analysis before shipping data to FXS enabled." );
122 fEnableAnalysis = kTRUE;
130 Int_t AliHLTTPCCalibTimeComponent::InitCalibration() {
131 // see header file for class documentation
133 if(fCalibTime) return EINPROGRESS;
134 //fCalibTime = new AliTPCcalibTime();
136 fCalibTime = new AliTPCcalibTime("cosmicTime","cosmicTime",0, 1213.9e+06, 1213.96e+06);
137 //AliTPCcalibTime::AliTPCcalibTime(const Text_t *name, const Text_t *title, UInt_t StartTime, UInt_t EndTime, Int_t deltaIntegrationTimeVdrift)
142 Int_t AliHLTTPCCalibTimeComponent::DeinitCalibration() {
143 // see header file for class documentation
145 if(fCalibTime) delete fCalibTime;
151 Int_t AliHLTTPCCalibTimeComponent::ProcessCalibration( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ){
152 // see header file for class documentation
154 if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0;
156 TObject *iterESD, *iterSEED = NULL;
158 //----------- loop over output of TPCEsdConverter ----------------//
160 for(iterESD = (TObject*)GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC); iterESD != NULL; iterESD = (TObject*)GetNextInputObject()){
162 if(GetDataType(iterSEED) != (kAliHLTDataTypeESDObject | kAliHLTDataOriginTPC)) continue;
164 AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(iterESD));
165 AliHLTUInt8_t partition = AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(iterESD));
167 if( partition < fMinPartition ) fMinPartition = partition;
168 if( partition > fMaxPartition ) fMaxPartition = partition;
169 if( slice < fMinSlice ) fMinSlice = slice;
170 if( slice > fMaxSlice ) fMaxSlice = slice;
172 fESDEvent = dynamic_cast<AliESDEvent*>(iterESD);
173 fESDEvent->CreateStdContent();
177 //--------------- output over TObjArray of AliTPCseed objects (output of TPCSeedMaker) -------------------//
179 for(iterSEED = (TObject*)GetFirstInputObject(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC); iterSEED != NULL; iterSEED = (TObject*)GetNextInputObject()){
181 if(GetDataType(iterSEED) != (kAliHLTDataTypeTObjArray | kAliHLTDataOriginTPC)) continue;
183 fSeedArray = dynamic_cast<TObjArray*>(iterSEED);
186 fCalibTime->Process(fESDEvent);
190 fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( fMinSlice, fMaxSlice, fMinPartition, fMaxPartition );
191 PushBack( (TObject*)fCalibTime, AliHLTTPCDefinitions::fgkCalibCEDataType, fSpecification);
196 Int_t AliHLTTPCCalibTimeComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ){
197 // see header file for class documentation
199 if(fEnableAnalysis) fCalibTime->Analyze();
200 PushToFXS( (TObject*)fCalibTime, "TPC", "Time" ) ;