]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/EMCAL/AliHLTEMCALAgent.h
cashing of EMCALMapper instances to avoid unnecessary allocations; removing global...
[u/mrichter/AliRoot.git] / HLT / EMCAL / AliHLTEMCALAgent.h
1
2 #ifndef ALIHLTEMCALAGENT_H
3 #define ALIHLTEMCALAGENT_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 /** @file   AliHLTEMCALAgent.h
8     @author Federico Ronchetti
9     @date   
10     @brief  Agent of the libAliHLTEMCAL library
11 */
12
13 #include "AliHLTModuleAgent.h"
14 #include "AliHLTOUTHandlerEquId.h"
15 #include <map>
16
17 class AliHLTOUTHandlerChain;
18 class AliHLTEMCALMapper;
19
20 /**
21  * @class AliHLTEMCALAgent
22  * This is the agent for the AliHLTEMCAL library.
23  *
24  * @ingroup alihlt_system
25  */
26 class AliHLTEMCALAgent : public AliHLTModuleAgent {
27  public:
28   /**
29    * standard constructor. The agent is automatically registered in the
30    * global agent manager
31    */
32   AliHLTEMCALAgent();
33   /** destructor */
34   virtual ~AliHLTEMCALAgent();
35
36   /**
37    * Register all configurations belonging to this module with the
38    * AliHLTConfigurationHandler. The agent can adapt the configurations
39    * to be registered to the current AliRoot setup by checking the
40    * runloader.
41    * @param handler      the configuration handler
42    * @param rawReader    AliRawReader instance
43    * @param runloader    AliRoot runloader
44    * @return neg. error code if failed
45    */
46   int CreateConfigurations(AliHLTConfigurationHandler* handler,
47                            AliRawReader* rawReader=NULL,
48                            AliRunLoader* runloader=NULL) const;
49
50   /**
51    * Get the top configurations belonging to this module.
52    * A top configuration describes a processing chain. It can simply be
53    * described by the last configuration(s) in the chain. 
54    * The agent can adapt the configurations to be registered to the current
55    * AliRoot setup by checking the runloader.
56    * @param rawReader    AliRawReader instance
57    * @param runloader    AliRoot runloader
58    * @return number of configurations, neg. error code if failed
59    */
60   const char* GetReconstructionChains(AliRawReader* rawReader=NULL,
61                                       AliRunLoader* runloader=NULL) const;
62
63   /**
64    * Component libraries which the configurations of this agent depend on.
65    * @return list of component libraries as a blank-separated string.
66    */
67   const char* GetRequiredComponentLibraries() const;
68
69   /**
70    * Register components for the AliHLTEMCAL library.
71    * @param pHandler  [in] instance of the component handler          
72    */
73   int RegisterComponents(AliHLTComponentHandler* pHandler) const;
74
75   /**
76    * Get handler decription for EMCAL data in the HLTOUT data stream.
77    * @param dt        [in] data type of the block
78    * @param spec      [in] specification of the block
79    * @param desc      [out] handler description
80    * @return 1 if the agent can provide a handler, 0 if not
81    */
82   int GetHandlerDescription(AliHLTComponentDataType dt,
83                             AliHLTUInt32_t spec,
84                             AliHLTOUTHandlerDesc& desc) const;
85
86   /**
87    * Get specific handler for EMCAL data in the HLTOUT data stream.
88    * @param dt        [in] data type of the block
89    * @param spec      [in] specification of the block
90    * @return pointer to handler
91    */
92   AliHLTOUTHandler* GetOutputHandler(AliHLTComponentDataType dt,
93                                      AliHLTUInt32_t spec);
94
95   /**
96    * Delete an HLTOUT handler.
97    * @param pInstance      pointer to handler
98    */
99   int DeleteOutputHandler(AliHLTOUTHandler* pInstance);
100
101   /**
102    * The handler for EMCAL RAW data in the HLTOUT stream.
103    */
104   class AliHLTEMCALRawDataHandler : public AliHLTOUTHandlerEquId {
105   public:
106     /** constructor */
107     AliHLTEMCALRawDataHandler(AliHLTEMCALAgent* pAgent=NULL);
108     /** destructor */
109     ~AliHLTEMCALRawDataHandler();
110
111     /**
112      * Process a data block.
113      * Decode specification and return equipment id of the data block.
114      * The data itsself i untouched.
115      * @return equipment id the block should be used for.
116      */
117     int ProcessData(AliHLTOUT* pData);
118
119   private:
120     /// copy constructor prohibited
121     AliHLTEMCALRawDataHandler(const AliHLTEMCALRawDataHandler&);
122     /// assignment operator prohibited
123     AliHLTEMCALRawDataHandler& operator=(const AliHLTEMCALRawDataHandler&);
124
125     AliHLTEMCALAgent* fpAgent; //! agent instance to retrieve mapper
126
127   };
128
129  protected:
130
131  private:
132   /** copy constructor prohibited */
133   AliHLTEMCALAgent(const AliHLTEMCALAgent&);
134   /** assignment operator prohibited */
135   AliHLTEMCALAgent& operator=(const AliHLTEMCALAgent&);
136
137   /// get mapper for a specification
138   AliHLTEMCALMapper* GetMapper(AliHLTUInt32_t spec) const;
139
140   /** handler for EMCAL raw data in the HLTOUT stream */
141   AliHLTEMCALRawDataHandler* fRawDataHandler; //!transient
142
143   // mappers for different specifications
144   std::map<AliHLTUInt32_t, AliHLTEMCALMapper*> fMappers; //! transient
145
146   ClassDef(AliHLTEMCALAgent, 0);
147 };
148
149 #endif