]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/util/AliHLTRootSchemaEvolutionComponent.h
added option to write extracted StreamerInfo to file at EOR
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTRootSchemaEvolutionComponent.h
1 // -*- Mode: C++ -*-
2 // $Id$
3
4 #ifndef ALIHLTROOTSCHEMAEVOLUTIONCOMPONENT_H
5 #define ALIHLTROOTSCHEMAEVOLUTIONCOMPONENT_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   AliHLTRootSchemaEvolutionComponent.h
11     @author Matthias Richter
12     @date   2009-10-18
13     @brief  Handler component for ROOT schema evolution of streamed objects
14 */
15
16 #include "AliHLTProcessor.h"
17 #include "TString.h"
18
19 class TObjArray;
20
21 /**
22  * @class AliHLTRootSchemaEvolutionComponent
23  *
24  * <h2>General properties:</h2>
25  *
26  * Component ID: \b ROOTFileWriter                                      <br>
27  * Library: \b libAliHLTUtil.so                                         <br>
28  * Input Data Types: ::kAliHLTAnyDataType                               <br>
29  * Output Data Types: none                                              <br>
30  *
31  * <h2>Mandatory arguments:</h2>
32  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
33  *      
34  * <h2>Optional arguments:</h2>
35  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
36  * \li -fxs<=off> <br>
37  *      push streamer info to FXS, fetched by Shuttle and store in the entry
38  *      HLT/Calib/StreamerInfo
39  *      default off
40  * \li -hltout<=[all,first,eor,off]> <br>
41  *      push streamer info to output, the streamer info is stored in the
42  *      events in all, the first, and/or the EOR.
43  * \li -file=<filename> <br>
44  *      write to file at EOR
45  *
46  * <h2>Configuration:</h2>
47  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
48  * Configuration by component arguments.
49  *
50  * <h2>Default CDB entries:</h2>
51  * The component loads no CDB entries.
52  *
53  * <h2>Performance:</h2>
54  * The component does not process any event data.
55  *
56  * <h2>Memory consumption:</h2>
57  * The component does not process any event data.
58  *
59  * <h2>Output size:</h2>
60  * Depending on the mode.
61  *
62  * @ingroup alihlt_util_components
63  */
64 class AliHLTRootSchemaEvolutionComponent : public AliHLTProcessor
65 {
66  public:
67   /// standard constructor
68   AliHLTRootSchemaEvolutionComponent();
69   /// destructor
70   virtual ~AliHLTRootSchemaEvolutionComponent();
71
72   /// inherited from AliHLTComponent: return id of the component.
73   virtual const char* GetComponentID() {return "ROOTSchemaEvolutionComponent";};
74   /// inherited from AliHLTComponent: input data types
75   virtual void GetInputDataTypes(AliHLTComponentDataTypeList&);
76   /// inherited from AliHLTComponent: output data types
77   virtual AliHLTComponentDataType GetOutputDataType();
78   /// inherited from AliHLTComponent: output data size
79   virtual void GetOutputDataSize(unsigned long&, double&);
80
81   /// inherited from AliHLTComponent: spawn function, create an instance.
82   virtual AliHLTComponent* Spawn() {return new AliHLTRootSchemaEvolutionComponent;}
83
84   enum {
85     /// push streamer info to the HLTOUT for the first event
86     kHLTOUTatFirstEvent   = 0x1,
87     /// push streamer info to the HLTOUT for all events
88     kHLTOUTatAllEvents    = 0x2,
89     /// push streamer info to the HLTOUT at EOR, this has no relevance
90     /// for reconstruction as it is too late and just in one raw file,
91     /// but it allows archival at the end of the run
92     kHLTOUTatEOR          = 0x4,
93     /// push streamer info to FXS
94     kFXS                  = 0x100,
95   };
96
97   /// Update the array of known streamer infos from a list of infos
98   /// Checks whether the provided infos are already there in the present version
99   /// and adds if it is a new info. 
100   int UpdateStreamerInfos(const TList* list, TObjArray* infos) const;
101
102  protected:
103   /// inherited from AliHLTComponent: custom initialization
104   int DoInit( int argc, const char** argv );
105   /// inherited from AliHLTComponent: cleanup
106   int DoDeinit();
107
108   /// inherited from AliHLTProcessor processing
109   virtual int DoEvent( const AliHLTComponentEventData& evtData,
110                        AliHLTComponentTriggerData& trigData );
111   
112   using AliHLTProcessor::DoEvent;
113
114   /**
115    * Inherited from AliHLTComponent
116    * Scan one argument and adjacent parameters.
117    * @return number of scanned parameters, neg. error code if failed
118    */
119   virtual int ScanConfigurationArgument(int argc, const char** argv);
120
121   void SetBits(AliHLTUInt32_t b) {fFlags|=b;}
122   void ClearBits(AliHLTUInt32_t b) {fFlags&=~b;}
123   bool TestBits(AliHLTUInt32_t b) {return (fFlags&b) != 0;}
124   int WriteToFile(const char* filename, const TObjArray* infos) const;
125
126 private:
127   /** copy constructor prohibited */
128   AliHLTRootSchemaEvolutionComponent(const AliHLTRootSchemaEvolutionComponent&);
129   /** assignment operator prohibited */
130   AliHLTRootSchemaEvolutionComponent& operator=(const AliHLTRootSchemaEvolutionComponent&);
131
132   AliHLTUInt32_t fFlags; //! property flags
133
134   TObjArray* fpStreamerInfos; //! array of streamer infos
135
136   AliHLTUInt32_t fFXSPrescaler; //! prescalar for the publishing to FXS
137
138   TString fFileName; //! file name for dump at EOR
139
140   static const char* fgkConfigurationObject; //! configuration object
141
142   ClassDef(AliHLTRootSchemaEvolutionComponent, 2) // ROOT schema evolution component
143 };
144 #endif