Using TMath (Stefan Rossegger)
[u/mrichter/AliRoot.git] / HLT / rec / AliRawReaderHLT.h
CommitLineData
9c7b5023 1//-*- Mode: C++ -*-
7e914051 2// $Id$
9c7b5023 3
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 *
9
10/** @file AliRawReaderHLT.h
11 @author Matthias Richter
12 @date
13 @brief AliRawReader implementation which replaces original input of
14 detectors with the appropriate HLT output. */
15
16// see below for class documentation
17// or
18// refer to README to build package
19// or
20// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
21
13b78f4c 22#include "AliHLTDataTypes.h"
23#include "AliRawReader.h" // RAW, base class
9c7b5023 24#include "TString.h"
13b78f4c 25#include <vector>
9c7b5023 26
13b78f4c 27class AliHLTOUT;
626bfcc1 28class AliHLTOUTHandler;
29
9c7b5023 30/**
31 * @class AliRawReaderHLT
32 * Handler of HLTOUT data for AliRawReader input.
33 */
34class AliRawReaderHLT : public AliRawReader {
35 public:
36 /** constructor */
37 AliRawReaderHLT(AliRawReader* pParentReader, const char* options=NULL);
38 /** destructor */
39 virtual ~AliRawReaderHLT();
40
41 // interface methods of AliRawReader
e3917543 42 void Select(Int_t detectorID,
43 Int_t minDDLID = -1, Int_t maxDDLID = -1);
44// void Select(const char *detectorName,
45// Int_t minDDLID = -1, Int_t maxDDLID = -1);
46 void SelectEquipment(Int_t equipmentType,
47 Int_t minEquipmentId = -1,
48 Int_t maxEquipmentId = -1);
49 void SkipInvalid(Bool_t skip = kTRUE);
50 void SelectEvents(Int_t type);
51
9c7b5023 52 UInt_t GetType() const;
53 UInt_t GetRunNumber() const;
54 const UInt_t* GetEventId() const;
55 const UInt_t* GetTriggerPattern() const;
56 const UInt_t* GetDetectorPattern() const;
57 const UInt_t* GetAttributes() const;
58 const UInt_t* GetSubEventAttributes() const;
59 UInt_t GetLDCId() const;
60 UInt_t GetGDCId() const;
61 UInt_t GetTimestamp() const;
62
63 const UInt_t* GetEquipmentAttributes() const;
64 Int_t GetEquipmentElementSize() const;
65 Int_t GetEquipmentHeaderSize() const;
66
67 Int_t GetEquipmentSize() const;
68 Int_t GetEquipmentType() const;
69 Int_t GetEquipmentId() const;
70 Bool_t ReadHeader();
71 Bool_t ReadNextData(UChar_t*& data);
72 Bool_t ReadNextInt(UInt_t& data);
73 Bool_t ReadNextShort(UShort_t& data);
74 Bool_t ReadNextChar(UChar_t& data);
75 Bool_t ReadNext(UChar_t* data, Int_t size);
76
77 Bool_t Reset();
78
79 Bool_t NextEvent();
80 Bool_t RewindEvents();
81
82 protected:
83
84 private:
85 /** standard constructor prohibited */
86 AliRawReaderHLT();
87 /** copy constructor prohibited */
88 AliRawReaderHLT(const AliRawReaderHLT&);
89 /** assignment operator prohibited */
90 AliRawReaderHLT& operator=(const AliRawReaderHLT&);
91
13b78f4c 92 /**
93 * Scan the options.
94 * Set the ids for the specified detectors in the detector
95 * list. Currently, no other options are available.
96 */
97 int ScanOptions(const char* options);
98
99 /**
100 * Read the next data block from the HLT stream
101 */
102 Bool_t ReadNextHLTData();
103
104 /**
105 * Check if a ddlid is part of the ones which are selected for
106 * input replacement.
107 */
108 Bool_t IsHLTInput(int ddlid);
109
9c7b5023 110 /** the rawreader */
111 AliRawReader* fpParentReader; //!transient
112
113 /** options */
114 TString fOptions; //!transient
13b78f4c 115
116 /** current data set, either extracted from the HLT stream or parent raw reader */
117 const AliHLTUInt8_t* fpData; // !transient
118
119 /** size of the current data set */
120 int fDataSize; // !transient
121
122 /** current stream offset in the data set */
123 int fOffset; // !transient
124
125 /** equipment id of the current data set, >0 indicates data set from HLT stream */
126 int fEquipmentId; // !transient
127
128 /** indicates the availibility of data from the HLT stream */
129 bool fbHaveHLTData; // !transient
130
131 /** list of detectors for which data will be taken from HLT stream */
132 vector<int> fDetectors; // !transient
133
134 /** instance of the HLTOUT handler */
135 AliHLTOUT* fpHLTOUT; // !transient
136
626bfcc1 137 /** instance of the data handler providing the current data buffer */
138 AliHLTOUTHandler* fpDataHandler; // !transient
139
140 ClassDef(AliRawReaderHLT, 2)
9c7b5023 141};
142
143#define ALIHLTREC_LIBRARY "libHLTrec.so"
144#define ALIHLTREC_LIBRARY_VERSION 0
145#define ALIRAWREADERHLT_CREATE_INSTANCE "AliRawReaderHLTCreateInstance"
146
147#ifdef __cplusplus
148extern "C" {
149#endif
150 typedef AliRawReader* (*AliRawReaderHLTCreateInstance_t)(AliRawReader* pParentReader, const char* options);
151
152 /**
153 * Create an instance of the AliRawReader class
154 */
155 AliRawReader* AliRawReaderHLTCreateInstance(AliRawReader* pParentReader, const char* options);
156#ifdef __cplusplus
157}
158#endif
159#endif