]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTOUTHandlerEsdBranch.h
Increasing histo clu. lay.1 upper lim.
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTOUTHandlerEsdBranch.h
1 //-*- Mode: C++ -*-
2 // $Id$
3
4 #ifndef ALIHLTOUTHANDLERESDBRANCH_H
5 #define ALIHLTOUTHANDLERESDBRANCH_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   AliHLTOUTHandlerEsdBranch.h
11 /// @author Matthias Richter
12 /// @date   01.07.2010
13 /// @brief  HLTOUT handler of type kEsd to merge objects into the hltEsd.
14
15 #include "AliHLTOUTHandler.h"
16 #include "TString.h"
17
18 class TArrayC;
19 class TObject;
20 class AliHLTEsdManager;
21
22 /**
23  * @class AliHLTOUTHandlerEsdBranch
24  * An HLTOUT handler of type kEsd to add objects to hltEsd branches.
25  *
26  * The handler extracts objects from HLTOUT data blocks or converts
27  * data to objects to be added to hltEsd branches. The default implementation
28  * covers the first case right away, the class can be used directly for single
29  * objects streamed to the HLTOUT.
30  *
31  * <h2>Object conversion</h2>
32  * The method ExtractAndAddObjects() has to loop over all input blocks and
33  * provide an appropriate conversion. If the data block simply contains a
34  * streamed object it just needs to be extracted and added to the ESD using
35  * the function Add(). Thhis case is covered by the default implementation.
36  * Child classes can overload ExtractAndAddObjects() if there is further
37  * conversion/formatting required.
38  *
39  * <h2>Usage example:</h2>
40  * An agent implementation must announce to ability to process a certain
41  * data block by implementing AliHLTModuleAgent::GetHandlerDescription()
42  * and AliHLTModuleAgent::GetOutputHandler(). See AliHLTModuleAgent for
43  * more details.
44  * <pre>
45  *  int AliHLTMyAgent::GetHandlerDescription(AliHLTComponentDataType dt,
46  *                                           AliHLTUInt32_t spec,
47  *                                           AliHLTOUTHandlerDesc& desc) const
48  *  {
49  *    // add TObject data blocks of type {ROOTTOBJ:SMPL} to ESD
50  *    if (dt==(kAliHLTDataTypeTObject|kAliHLTDataOriginSample)) {
51  *        desc=AliHLTOUTHandlerDesc(kEsd, dt, GetModuleId());
52  *        return 1;
53  *    }
54  *  
55  *    return 0;
56  *  }
57  *
58  *  AliHLTOUTHandler* AliHLTMyAgent::GetOutputHandler(AliHLTComponentDataType dt,
59  *                                                    AliHLTUInt32_t spec)
60  *  {
61  *   // merge my objects into the hltEsd
62  *   if (dt==(kAliHLTDataTypeTObject|kAliHLTDataOriginSample)) {
63  *     static AliHLTOUTHandlerEsdBranch handler;
64  *     return &handler;
65  *   }
66  *
67  *   return NULL;
68  *  }
69  * </pre>
70  *
71  * <h2>Data output</h2>
72  * The handler produces a partial ESD containing the data objects. The framework
73  * merges all the different partial ESDs in the AliHLTEsdManager, respectively the
74  * specific implementation AliHLTEsdManagerImplementation.
75  *
76  * HLTOUT processing sequence:
77  * - first handlers of type kChain
78  * - handlers of type kEsd
79  * - handlers of type kProprietary
80  *
81  * @ingroup alihlt_aliroot_reconstruction
82  */
83 class AliHLTOUTHandlerEsdBranch : public AliHLTOUTHandler {
84  public:
85   /** constructor */
86   AliHLTOUTHandlerEsdBranch(const char* branchname=NULL);
87   /** standard destructor */
88   virtual ~AliHLTOUTHandlerEsdBranch();
89
90   /**
91    * Process a data block.
92    * @return 
93    */
94   int ProcessData(AliHLTOUT* pData);
95
96   int GetProcessedData(const AliHLTUInt8_t* &pData);
97   int ReleaseProcessedData(const AliHLTUInt8_t* pData, int size);
98
99  protected:
100   /**
101    * Extract and add objects
102    * Loop over input blocks and extract/format the objects. Child class
103    * can implement specific conversion. The default implementation just
104    * extracts and adds objects.
105    */
106   virtual int ExtractAndAddObjects(AliHLTOUT* pData);
107
108  private:
109   /** copy constructor prohibited */
110   AliHLTOUTHandlerEsdBranch(const AliHLTOUTHandlerEsdBranch&);
111   /** assignment operator prohibited */
112   AliHLTOUTHandlerEsdBranch& operator=(const AliHLTOUTHandlerEsdBranch&);
113
114   TString fBranch; //! transient
115   TObject* fESD; //! transient
116   TArrayC* fpData;  //! transient
117   int fSize; //! transient
118   AliHLTEsdManager* fManager; //! transient
119
120   ClassDef(AliHLTOUTHandlerEsdBranch, 0)
121 };
122 #endif