Line data Source code
1 : //-*- Mode: C++ -*-
2 : // $Id$
3 :
4 : #ifndef ALIHLTOUTHOMERCOLLECTION_H
5 : #define ALIHLTOUTHOMERCOLLECTION_H
6 : //* This file is property of and copyright by the *
7 : //* ALICE Experiment at CERN, All rights reserved. *
8 : //* See cxx source for full Copyright notice *
9 :
10 : /// @file AliHLTOUTHomerCollection.h
11 : /// @author Matthias Richter
12 : /// @date
13 : /// @brief General collection for HLTOUT data in DDL format.
14 : ///
15 : #include "AliHLTOUTHomerBuffer.h"
16 : #include "AliHLTCDHWrapper.h"
17 :
18 : class AliHLTHOMERReader;
19 : class AliHLTEsdManager;
20 :
21 : /**
22 : * @class AliHLTOUTHomerCollection
23 : * Handler of HLTOUT data in DDL format, base class for specific
24 : * handlers for RawReader or Digit data.
25 : *
26 : * The class expects the data to be in the DDL data format.
27 : * In contrast to the AliHLTOUTHomerBuffer, it also takes the
28 : * additional CDH and HLT headers and optional HLT decision into
29 : * account when opening the HOMER reader (see OpenReader()).
30 : *
31 : * The data access must be provided by the child class, the
32 : * interface is pretty much like the AliRawReader interface.
33 : */
34 : class AliHLTOUTHomerCollection : public AliHLTOUTHomerBuffer {
35 : public:
36 : /** constructor */
37 : AliHLTOUTHomerCollection(int event=-1, AliHLTEsdManager* pEsdManager=NULL);
38 : /** destructor */
39 : virtual ~AliHLTOUTHomerCollection();
40 :
41 : protected:
42 : /**
43 : * Read next data form the data source.
44 : */
45 : virtual Bool_t ReadNextData(UChar_t*& data)=0;
46 :
47 : /**
48 : * Reset data stream position.
49 : * Reeading of data starts with the first data block.
50 : */
51 : virtual int Reset()=0;
52 :
53 : /**
54 : * Get size of the current data block.
55 : */
56 : virtual int GetDataSize()=0;
57 :
58 : /**
59 : * Get the header of the current data block
60 : */
61 : virtual AliHLTCDHWrapper GetDataHeader()=0;
62 :
63 : /**
64 : * Select equipment for data readout.
65 : */
66 : virtual void SelectEquipment(int equipmentType,
67 : int minEquipmentId = -1,
68 : int maxEquipmentId = -1)=0;
69 :
70 : /**
71 : * Get equipment id of the current data block.
72 : */
73 : virtual int GetEquipmentId()=0;
74 :
75 : /**
76 : * Get the current event no.
77 : * The event no is set during creation of the HLTOUT object.
78 : * For the reconstruction it is taken from the ESD provided by the
79 : * AliReconstruction framework AliESDEvent::GetEventNumberInFile
80 : * @return event no or -1 if not set
81 : */
82 8 : int GetCurrentEventNo() const {return fEvent;}
83 :
84 : // interface function of AliHLTOUT
85 : int WriteESD(const AliHLTUInt8_t* pBuffer, AliHLTUInt32_t size, AliHLTComponentDataType dt, AliESDEvent* tgtesd=NULL) const;
86 :
87 : /** current event no */
88 : int fEvent; //!transient
89 :
90 : private:
91 :
92 : private:
93 : /** copy constructor prohibited */
94 : AliHLTOUTHomerCollection(const AliHLTOUTHomerCollection&);
95 : /** assignment operator prohibited */
96 : AliHLTOUTHomerCollection& operator=(const AliHLTOUTHomerCollection&);
97 :
98 : /**
99 : * Generate the index of the HLTOUT data from the data buffer.
100 : */
101 : int GenerateIndex();
102 :
103 : /**
104 : * Get the data buffer
105 : * Overloaded from AliHLTOUT
106 : * @param [in] index index of the block
107 : * @param [out] pBuffer buffer of the selected data block
108 : * @param [out] size size of the selected data block
109 : */
110 : int GetDataBuffer(AliHLTUInt32_t index, const AliHLTUInt8_t* &pBuffer,
111 : AliHLTUInt32_t& size);
112 :
113 : /**
114 : * Open HOMER reader for the data buffer.
115 : * The function expects the data buffer including all headers (CDH
116 : * and HLTOUT header). The offset for the HLT payload is determined from
117 : * the headers and the optional HLT decision data.
118 : * @param pSrc data buffer
119 : * @param size size of the buffer in byte
120 : * @return instance of HOMER reader
121 : */
122 : AliHLTHOMERReader* OpenReader(UChar_t* pSrc, unsigned int size);
123 :
124 : /** current instance of the HOMER reader */
125 : AliHLTHOMERReader* fpCurrent; //!transient
126 :
127 : /** instance of the ESD manager for writing and merging */
128 : AliHLTEsdManager* fpEsdManager; //!transient
129 :
130 : /** DDL id offset shift for index
131 : * bit 16-31: DDL id, bit 0-15 block no
132 : */
133 : static const int fgkIdShift; //!transient
134 :
135 6 : ClassDef(AliHLTOUTHomerCollection, 0)
136 : };
137 : #endif
|