3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 //* for The ALICE HLT Project. *
10 //* Permission to use, copy, modify and distribute this software and its *
11 //* documentation strictly for non-commercial purposes is hereby granted *
12 //* without fee, provided that the above copyright notice appears in all *
13 //* copies and that both the copyright notice and this permission notice *
14 //* appear in the supporting documentation. The authors make no claims *
15 //* about the suitability of this software for any purpose. It is *
16 //* provided "as is" without express or implied warranty. *
17 //**************************************************************************
19 /** @file AliHLTControlTask.cxx
20 @author Matthias Richter
22 @brief Special task to produce the control events.
25 #include "AliHLTControlTask.h"
26 #include "AliHLTComponentHandler.h"
29 /** ROOT macro for the implementation of ROOT specific class methods */
30 ClassImp(AliHLTControlTask)
32 AliHLTControlTask::AliHLTControlTask()
34 fEvent(kAliHLTVoidDataType),
35 fSpecification(kAliHLTVoidDataSpec),
39 // see header file for class documentation
41 // refer to README to build package
43 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
46 AliHLTControlTask::~AliHLTControlTask()
48 // see header file for class documentation
51 int AliHLTControlTask::CreateComponent(AliHLTConfiguration* /*pConf*/, AliHLTComponentHandler* pCH, AliHLTComponent*& pComponent) const
53 // see header file for class documentation
55 if ((pComponent=new AliHLTControlEventComponent(this))) {
56 const AliHLTAnalysisEnvironment* pEnv=pCH->GetEnvironment();
57 if ((iResult=pComponent->Init(pEnv, NULL, 0, NULL))>=0) {
58 //HLTDebug("component %s (%p) created", pComponent->GetComponentID(), pComponent);
60 HLTError("Initialization of component \"%s\" failed with error %d", pComponent->GetComponentID(), iResult);
67 AliHLTControlTask::AliHLTControlEventComponent::AliHLTControlEventComponent(const AliHLTControlTask* pParent)
71 // see header file for class documentation
75 AliHLTControlTask::AliHLTControlEventComponent::~AliHLTControlEventComponent()
77 // see header file for class documentation
80 AliHLTComponentDataType AliHLTControlTask::AliHLTControlEventComponent::GetOutputDataType()
82 // see header file for class documentation
83 return kAliHLTMultipleDataType;
86 int AliHLTControlTask::AliHLTControlEventComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
88 // see header file for class documentation
90 tgtList.push_back(kAliHLTDataTypeSOR);
91 tgtList.push_back(kAliHLTDataTypeEOR);
92 return tgtList.size();
95 void AliHLTControlTask::AliHLTControlEventComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
97 // see header file for class documentation
98 if (fpParent && fpParent->fSize>0) constBase=fpParent->fSize;
99 else constBase=sizeof(AliHLTRunDesc);
103 int AliHLTControlTask::AliHLTControlEventComponent::GetEvent(const AliHLTComponentEventData& /*evtData*/,
104 AliHLTComponentTriggerData& /*trigData*/,
105 AliHLTUInt8_t* outputPtr,
106 AliHLTUInt32_t& size,
107 vector<AliHLTComponentBlockData>& outputBlocks )
109 // see header file for class documentation
110 if (!fpParent) return -ENODEV;
111 const AliHLTControlTask* pParent=fpParent;
112 if (size<pParent->fSize) {
116 if (pParent->fpData && pParent->fSize) {
117 memcpy(outputPtr, pParent->fpData, pParent->fSize);
120 // return if no event has been set
121 if (pParent->fEvent==kAliHLTVoidDataType) {
122 //HLTInfo("no control event to send");
126 HLTDebug("publishing control event %s", DataType2Text(pParent->fEvent).c_str());
127 AliHLTComponentBlockData bd;
130 bd.fSize=pParent->fSize;
131 bd.fDataType=pParent->fEvent;
132 bd.fSpecification=pParent->fSpecification;
133 outputBlocks.push_back( bd );