]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/util/AliHLTMonitoringRelay.h
ce15d97dd52cb3fd34553148348ede34fe27dd27
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTMonitoringRelay.h
1 // -*- Mode: C++ -*-
2 // $Id$
3
4 #ifndef ALIHLTMONITORINGRELAY_H
5 #define ALIHLTMONITORINGRELAY_H
6 //* This file is property of and copyright by the ALICE HLT Project        * 
7 //* ALICE Experiment at CERN, All rights reserved.                         *
8 //* See cxx source for full Copyright notice                               *
9
10 /** @file   AliHLTMonitoringRelay.h
11     @author Matthias Richter
12     @date   2009-11-11
13     @brief  Relay components for monitoring objects.
14 */
15
16 #include "AliHLTProcessor.h"
17 #include "TString.h"
18
19 class TArrayC;
20 class TObject;
21
22 /**
23  * @class AliHLTMonitoringRelay
24  * A relay component for monitoring data objects.
25  * It keeps a copy of the last block of every parent and forwards all
26  * the blocks together. By that, the output of histograms (rarely to
27  * be published but for every event filled.
28  *
29  * Input data blocks must be uniquely identified by the combination of
30  * - data type (id and origin)
31  * - block specification
32  * - object name
33  * - object title
34  *
35  * <h2>General properties:</h2>
36  *
37  * Component ID: \b MonitoringRelay                                         <br>
38  * Library: \b libAliHLTUtil.so                                         <br>
39  * Input Data Types: kAliHLTAnyDataType                                 <br>
40  * Output Data Types: according to input blocks         <br>
41  *
42  * <h2>Mandatory arguments:</h2>
43  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
44  *      
45  * <h2>Optional arguments:</h2>
46  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
47  * \li -verbose                                                         <br>
48  *      print out some more info messages, mainly for the sake of tutorials
49  *
50  * <h2>Configuration:</h2>
51  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
52  * Configuration by component arguments.
53  *
54  * <h2>Default CDB entries:</h2>
55  * The component loads no CDB entries.
56  *
57  * <h2>Performance:</h2>
58  * Low profile: input objects are unpacked and binary copied, no streaming
59  * of obejcts.
60  *
61  * <h2>Memory consnumption:</h2>
62  * The component allocates memory of the maximum size for every input
63  * object.
64  *
65  * <h2>Output size:</h2>
66  * 
67  * @ingroup alihlt_util_components
68  */
69 class AliHLTMonitoringRelay : public AliHLTProcessor
70 {
71  public:
72   /// standard constructor
73   AliHLTMonitoringRelay();
74   /// destructor
75   virtual ~AliHLTMonitoringRelay();
76
77   /// inherited from AliHLTComponent, get component id
78   virtual const char* GetComponentID() {return "MonitoringRelay";};
79
80   /// inherited from AliHLTComponent, get the input data type
81   void GetInputDataTypes( AliHLTComponentDataTypeList& );
82
83   /// inherited from AliHLTComponent, get the output data type
84   AliHLTComponentDataType GetOutputDataType();
85
86   /// inherited from AliHLTComponent, get the output data size estimator
87   void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
88
89   /// inherited from AliHLTComponent, create a component
90   virtual AliHLTComponent* Spawn() {return new AliHLTMonitoringRelay;}
91
92   /// descriptor of monitoring items
93   class AliHLTMonitoringItem {
94   public:
95     // standard constructor
96     AliHLTMonitoringItem();
97     // constructor
98     AliHLTMonitoringItem(const AliHLTComponentBlockData* pBlock, const TObject* pObject);
99     // destructor
100     ~AliHLTMonitoringItem();
101
102     /// copy data from buffer
103     int SetData(void* pBuffer, int size);
104
105     /// get buffer pointer of the current data
106     void* GetBuffer() const;
107     /// get size of the current data
108     unsigned GetSize() const;
109     /// get data type
110     const AliHLTComponentDataType& GetDataType() const;
111     /// get specification
112     AliHLTUInt32_t GetSpecification() const;
113
114     bool operator==(const AliHLTComponentBlockData& bd) const;
115     bool operator!=(const AliHLTComponentBlockData& bd) const;
116     bool operator==(const TObject& object) const;
117     bool operator!=(const TObject& object) const;
118
119   protected:
120   private:
121     /// copy constructor prohibited
122     AliHLTMonitoringItem(const AliHLTMonitoringItem&);
123     /// assignment operator prohibited
124     AliHLTMonitoringItem& operator=(const AliHLTMonitoringItem&);
125     
126     AliHLTComponentDataType fDt;                //! transient
127     AliHLTUInt32_t          fSpecification;     //! transient
128     TString                 fName;              //! transient
129     TString                 fTitle;             //! transient
130     TArrayC*                fData;              //! transient
131     int                     fDataSize;          //! transient
132   };
133   typedef vector<AliHLTMonitoringItem*>  AliHLTMonitoringItemPList;
134  protected:
135
136   /// inherited from AliHLTProcessor, data processing
137   int DoEvent( const AliHLTComponentEventData& evtData,
138                AliHLTComponentTriggerData& trigData );
139   
140   using AliHLTProcessor::DoEvent;
141
142   /// inherited from AliHLTComponent, component initialisation
143   int DoInit( int argc, const char** argv );
144
145   /// inherited from AliHLTComponent, scan argument
146   int ScanConfigurationArgument(int argc, const char** argv);
147
148   /// inherited from AliHLTComponent, component cleanup.
149   int DoDeinit();
150
151  private:
152   /// copy constructor prohibited
153   AliHLTMonitoringRelay(const AliHLTMonitoringRelay&);
154   /// assignment operator prohibited
155   AliHLTMonitoringRelay& operator=(const AliHLTMonitoringRelay&);
156
157   /// find a block of data type and specificaton
158   AliHLTMonitoringItem* FindItem(const AliHLTComponentBlockData* pBlock, const TObject* pObject) const;
159
160   /// the list of items
161   AliHLTMonitoringItemPList  fItems; //! transient
162   /// actual size of the data sample
163   unsigned fOutputSize; //! transient
164
165   ClassDef(AliHLTMonitoringRelay, 0)
166 };
167 #endif