]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCDataCheckerComponent.h
correcting memory leaks on error conditions
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCDataCheckerComponent.h
1 //-*- Mode: C++ -*-
2 // $Id$
3 #ifndef ALIHLTTPCDATACHECKERCOMPONENT_H
4 #define ALIHLTTPCDATACHECKERCOMPONENT_H
5 /* This file is property of and copyright by the ALICE HLT Project        *
6  * ALICE Experiment at CERN, All rights reserved.                         *
7  * See cxx source for full Copyright notice                               */
8
9 /// \file   AliHLTTPCDataCheckerComponent.h
10 /// \author Artur Szostak <artursz@iafrica.com>
11 /// \date   9 Aug 2010
12 /// \brief  Declaration of the AliHLTTPCDataCheckerComponent component class.
13
14 #include "AliHLTProcessor.h"
15
16 class AliTPCRawStreamV3;
17 class AliRawReaderMemory;
18
19 /**
20  * \class AliHLTTPCDataCheckerComponent
21  * The TPC data checker component is used to validate the raw data entering the HLT
22  * from the TPC detector. Basic sanity and data integrity checks are performed.
23  * Any problems are logged with explanatory error messages. By default all data blocks
24  * are forwarded, but one can also optionally filter on the bad data blocks.
25  *
26  * <h2>General properties:</h2>
27  *
28  * Component ID: \b TPCDataChecker <br>
29  * Library: \b libAliHLTTPC.so   <br>
30  * Input Data Types:  ::kAliHLTAnyDataType | ::kAliHLTDataOriginTPC <br>
31  * Output Data Types: ::kAliHLTAnyDataType | ::kAliHLTDataOriginTPC <br>
32  *
33  * <h2>Mandatory arguments:</h2>
34  * None.
35  *
36  * <h2>Optional arguments:</h2>
37  * \li -filter <i>flag</i> <br>
38  *      If specified then all data blocks for which a problem was found are forwarded
39  *      and all others are dropped. If the optional <i>flag</i> is specified then it
40  *      can be one of:
41  *        forwardbad  - only the bad data blocks are forwarded (default option).
42  *        forwardgood - only the good data blocks are forwarded.
43  * \li -ignoretype <br>
44  *      If set then the check of the data type is not performed.
45  * \li -ignoreorigin <br>
46  *      If set then the check of the origin is not performed.
47  * \li -ignorespec <br>
48  *      If set then the check of the block specification is not performed.
49  * \li -handle-all-events <br>
50  *      If set then all events are handled and not just data events.
51  *
52  * <h2>Configuration:</h2>
53  * Can only be configured with the command line arguments.
54  *
55  * <h2>Default CDB entries:</h2>
56  * None.
57  *
58  * <h2>Performance:</h2>
59  * Can run over 3kHz in HLT online system.
60  *
61  * <h2>Memory consumption:</h2>
62  * Negligible.
63  *
64  * <h2>Output size:</h2>
65  * The same as the input data size.
66  *
67  * \ingroup alihlt_tpc_components
68  */
69 class AliHLTTPCDataCheckerComponent : public AliHLTProcessor
70 {
71 public:
72         
73         AliHLTTPCDataCheckerComponent();
74         virtual ~AliHLTTPCDataCheckerComponent();
75         
76         // Methods inherited from AliHLTComponent:
77         virtual const char* GetComponentID();
78         virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
79         virtual AliHLTComponentDataType GetOutputDataType();
80         virtual int GetOutputDataTypes(AliHLTComponentDataTypeList& list);
81         virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
82         virtual AliHLTComponent* Spawn();
83         virtual Int_t DoInit(int argc, const char** argv);
84         virtual Int_t DoDeinit();
85         
86 protected:
87         
88         // Method inherited from AliHLTProcessor:
89         virtual int DoEvent(
90                         const AliHLTComponentEventData& evtData,
91                         const AliHLTComponentBlockData* blocks, 
92                         AliHLTComponentTriggerData& trigData,
93                         AliHLTUInt8_t* outputPtr, 
94                         AliHLTUInt32_t& size,
95                         AliHLTComponentBlockDataList& outputBlocks
96                 );
97         
98         using AliHLTProcessor::DoEvent;
99         
100 private:
101         
102         // Do not allow copying of this class.
103         AliHLTTPCDataCheckerComponent(const AliHLTTPCDataCheckerComponent& obj);
104         AliHLTTPCDataCheckerComponent& operator = (const AliHLTTPCDataCheckerComponent& obj);
105         
106         /**
107          * Checks the structure of a TPC raw DDL data block.
108          * \param event  The event this data block was found in.
109          * \param index  The index number of the data block as found in the
110          *               DoEvent::blocks parameter.
111          * \param block  The data block to check. Must correspond to 'index'.
112          * \returns true if the raw data is OK and false otherwise.
113          */
114         bool CheckRawDataBlock(AliHLTEventID_t event, AliHLTUInt32_t index, const AliHLTComponentBlockData* block);
115         
116         AliTPCRawStreamV3* fRawStream;  /// Raw stream to read TPC data.
117         AliRawReaderMemory* fRawReader;  /// Raw reader object for the TPC stream.
118         bool fForwardBadBlocks;  /// Flag indicating if the bad blocks should be forwarded.
119         bool fForwardGoodBlocks;  /// Flag indicating if the good blocks should be forwarded.
120         bool fIgnoreType;     /// Indicates if the data block type should not be checked.
121         bool fIgnoreOrigin;   /// Indicates if the data block origin should not be checked.
122         bool fIgnoreSpec;     /// Indicates if the data block specification bits should not be checked.
123         bool fHandleAllEvents; /// Indicates if all event types are processed and not just data events.
124         
125         ClassDef(AliHLTTPCDataCheckerComponent, 0)  // Data sanity and integrity checker component for TPC data.
126 };
127
128 #endif // ALIHLTTPCDATACHECKERCOMPONENT_H