]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTConsumerDescriptor.cxx
bugfix: suppress points without associated track point in residual calculation
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTConsumerDescriptor.cxx
CommitLineData
6235cd38 1// $Id$
2
3/**************************************************************************
9be2600f 4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
6235cd38 6 * *
9be2600f 7 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 * for The ALICE HLT Project. *
6235cd38 9 * *
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 **************************************************************************/
18
19/** @file AliHLTConsumerDescriptor.cxx
20 @author Matthias Richter
21 @date
22 @brief Helper class to describe a consumer component.
23*/
24
25#if __GNUC__>= 3
26using namespace std;
27#endif
28
29#include "AliHLTConsumerDescriptor.h"
30
31/** ROOT macro for the implementation of ROOT specific class methods */
32ClassImp(AliHLTConsumerDescriptor)
33
34AliHLTConsumerDescriptor::AliHLTConsumerDescriptor()
35 :
36 fpConsumer(NULL),
37 fSegments()
38{
39 // see header file for class documentation
40 // or
41 // refer to README to build package
42 // or
43 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
44 fSegments.clear();
45}
46
47AliHLTConsumerDescriptor::AliHLTConsumerDescriptor(AliHLTComponent* pConsumer)
48 :
49 fpConsumer(pConsumer),
50 fSegments()
51{
52 // see header file for function documentation
53 fSegments.clear();
54}
55
6235cd38 56AliHLTConsumerDescriptor::~AliHLTConsumerDescriptor()
57{
58 // see header file for function documentation
59 if (fSegments.size()>0) {
60 //HLTWarning("unreleased data segments found");
61 }
62}
63
b46ca65e 64int AliHLTConsumerDescriptor::SetActiveDataSegment(AliHLTDataBuffer::AliHLTDataSegment segment)
6235cd38 65{
66 // see header file for function documentation
67 int iResult=0;
6235cd38 68 fSegments.push_back(segment);
69 //HLTDebug("set active segment (%d:%d) for consumer %p", offset, size, this);
70 return iResult;
71}
72
b46ca65e 73int AliHLTConsumerDescriptor::CheckActiveDataSegment(AliHLTDataBuffer::AliHLTDataSegment segment)
6235cd38 74{
75 // see header file for function documentation
76 int iResult=0;
77 if (fSegments.size()>0) {
b46ca65e 78 vector<AliHLTDataBuffer::AliHLTDataSegment>::iterator element=fSegments.begin();
79 while (element!=fSegments.end()) {
80 if ((iResult=(segment==(*element)))>0) {
6235cd38 81 break;
82 }
b46ca65e 83 element++;
6235cd38 84 }
85 } else {
86 //HLTWarning("no data segment active for consumer %p", this);
87 iResult=-ENODATA;
88 }
89 return iResult;
90}
91
b46ca65e 92int AliHLTConsumerDescriptor::ReleaseActiveDataSegment(AliHLTDataBuffer::AliHLTDataSegment segment)
6235cd38 93{
94 // see header file for function documentation
95 int iResult=0;
96 if (fSegments.size()>0) {
b46ca65e 97 vector<AliHLTDataBuffer::AliHLTDataSegment>::iterator element=fSegments.begin();
98 while (element!=fSegments.end()) {
99 if ((iResult=(segment==(*element)))>0) {
100 fSegments.erase(element);
6235cd38 101 break;
102 }
b46ca65e 103 element++;
6235cd38 104 }
105 if (iResult==0) {
106 //HLTWarning("no data segment (%d:%d) active for consumer %p", offset, size, this);
107 iResult=-ENOENT;
108 }
109 } else {
110 //HLTWarning("no data segment active for consumer %p", this);
111 iResult=-ENODATA;
112 }
113 return iResult;
114}
12c8715e 115
116void AliHLTConsumerDescriptor::Print(const char* /*option*/) const
117{
118 // print info about this descriptor
119 cout << "AliHLTConsumerDescriptor " << this
120 << " component ID " << (fpConsumer?fpConsumer->GetComponentID():"NULL")
121 //<< " chain ID " << (fpConsumer?fpConsumer->GetChainId():"NULL")
122 << endl;
123 for (unsigned i=0; i<fSegments.size(); i++) {
124 cout << " ";
125 fSegments[i].Print("");
126 }
127}