4 #ifndef ALIRAWREADERHLT_H
5 #define ALIRAWREADERHLT_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 *
10 /** @file AliRawReaderHLT.h
11 @author Matthias Richter
13 @brief AliRawReader implementation which replaces original input of
14 detectors with the appropriate HLT output. */
16 // see below for class documentation
18 // refer to README to build package
20 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
22 #include "AliHLTDataTypes.h"
23 #include "AliRawReader.h" // RAW, base class
24 #include "AliHLTReconstructorBase.h"
29 class AliHLTOUTHandler;
32 * @class AliRawReaderHLT
33 * Handler of HLTOUT data for AliRawReader input.
35 class AliRawReaderHLT : public AliRawReader, public AliHLTReconstructorBase {
38 AliRawReaderHLT(AliRawReader* pParentReader, const char* options=NULL);
40 virtual ~AliRawReaderHLT();
42 // interface methods of AliRawReader
43 void Select(Int_t detectorID,
44 Int_t minDDLID = -1, Int_t maxDDLID = -1);
45 // void Select(const char *detectorName,
46 // Int_t minDDLID = -1, Int_t maxDDLID = -1);
48 using AliRawReader::Select;
50 void SelectEquipment(Int_t equipmentType,
51 Int_t minEquipmentId = -1,
52 Int_t maxEquipmentId = -1);
53 void SkipInvalid(Bool_t skip = kTRUE);
54 void SelectEvents(Int_t type);
56 UInt_t GetType() const;
57 UInt_t GetRunNumber() const;
58 const UInt_t* GetEventId() const;
59 const UInt_t* GetTriggerPattern() const;
60 const UInt_t* GetDetectorPattern() const;
61 const UInt_t* GetAttributes() const;
62 const UInt_t* GetSubEventAttributes() const;
63 UInt_t GetLDCId() const;
64 UInt_t GetGDCId() const;
65 UInt_t GetTimestamp() const;
67 const UInt_t* GetEquipmentAttributes() const;
68 Int_t GetEquipmentElementSize() const;
69 Int_t GetEquipmentHeaderSize() const;
71 Int_t GetEquipmentSize() const;
72 Int_t GetEquipmentType() const;
73 Int_t GetEquipmentId() const;
75 Bool_t ReadNextData(UChar_t*& data);
76 Bool_t ReadNextInt(UInt_t& data);
77 Bool_t ReadNextShort(UShort_t& data);
78 Bool_t ReadNextChar(UChar_t& data);
79 Bool_t ReadNext(UChar_t* data, Int_t size);
84 Bool_t RewindEvents();
89 /** standard constructor prohibited */
91 /** copy constructor prohibited */
92 AliRawReaderHLT(const AliRawReaderHLT&);
93 /** assignment operator prohibited */
94 AliRawReaderHLT& operator=(const AliRawReaderHLT&);
98 * Set the ids for the specified detectors in the detector
99 * list. Currently, no other options are available.
101 int ScanOptions(const char* options);
104 * Read the next data block from the HLT stream
106 Bool_t ReadNextHLTData();
109 * Check if a ddlid is part of the ones which are selected for
112 Bool_t IsHLTInput(int ddlid);
115 * Check if redirection is enabled for at least one detector in the
117 * Set the fbHaveHLTData variable
118 * @return true if data has to be read from the HLT stream.
120 Bool_t EvaluateSelection();
123 * Release the current HLT data.
124 * Releases the current buffer of either the active HLTOUT data
125 * block handler or the HLTOUT instance. The latter implies a
126 * reset of the reader concerning the HLT data blocks.
127 * @param bReleaseHLTOUT release HLTOUT instance if \em true
128 * only current data buffer if \em false
129 * @return neg. error code if failed
131 int ReleaseHLTData(bool bReleaseHLTOUT=true);
134 AliRawReader* fpParentReader; //!transient
137 TString fOptions; //!transient
139 /** system options = options w/o detector strings */
140 TString fSystemOptions; //!transient
142 /** current data set, either extracted from the HLT stream or parent raw reader */
143 const AliHLTUInt8_t* fpData; // !transient
145 /** size of the current data set */
146 int fDataSize; // !transient
148 /** current stream offset in the data set */
149 int fOffset; // !transient
151 /** current stream position for the ReadNextData function */
152 int fPosition; // !transient
154 /** equipment id of the current data set, >0 indicates data set from HLT stream */
155 int fEquipmentId; // !transient
157 /** indicates the availibility of data from the HLT stream */
158 bool fbHaveHLTData; // !transient
160 /** list of detectors for which data will be taken from HLT stream */
161 vector<int> fDetectors; // !transient
163 /** instance of the HLTOUT handler */
164 AliHLTOUT* fpHLTOUT; // !transient
166 /** instance of the data handler providing the current data buffer */
167 AliHLTOUTHandler* fpDataHandler; // !transient
169 ClassDef(AliRawReaderHLT, 3)
172 #define ALIHLTREC_LIBRARY "libHLTrec.so"
173 #define ALIHLTREC_LIBRARY_VERSION 0
174 #define ALIRAWREADERHLT_CREATE_INSTANCE "AliRawReaderHLTCreateInstance"
179 typedef AliRawReader* (*AliRawReaderHLTCreateInstance_t)(AliRawReader* pParentReader, const char* options);
182 * Create an instance of the AliRawReader class
184 AliRawReader* AliRawReaderHLTCreateInstance(AliRawReader* pParentReader, const char* options);