]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/global/AliHLTGlobalHistoComponent.h
- added information about track and event properties, e.g. vertex coordinates, track...
[u/mrichter/AliRoot.git] / HLT / global / AliHLTGlobalHistoComponent.h
1 // -*- Mode: C++ -*-
2 // $Id$
3
4 #ifndef ALIHLTGLOBALHISTOCOMPONENT_H
5 #define ALIHLTGLOBALHISTOCOMPONENT_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   AliHLTGlobalHistoComponent.h
11 /// @author Matthias Richter
12 /// @date   2010-09-16
13 /// @brief  A histogramming component for global ESD properties based
14 ///         on the AliHLTTTreeProcessor
15
16 #include "AliHLTTTreeProcessor.h"
17 #include <string>
18 #include <map>
19 #include <vector>
20
21 /**
22  * @class AliHLTGlobalHistoComponent
23  *
24  * <h2>General properties:</h2>
25  *
26  * Component ID: \b GlobalHisto                                         <br>
27  * Library: \b libAliHLTGlobal.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  *
37  * <h2>Configuration:</h2>
38  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
39  * Configuration by component arguments.
40  *
41  * <h2>Default CDB entries:</h2>
42  * The component loads no CDB entries.
43  *
44  * <h2>Performance:</h2>
45  * The component does not process any event data.
46  *
47  * <h2>Memory consumption:</h2>
48  * The component does not process any event data.
49  *
50  * <h2>Output size:</h2>
51  * Depending on the mode.
52  *
53  * @ingroup alihlt_util_components
54  */
55 class AliHLTGlobalHistoComponent : public AliHLTTTreeProcessor
56 {
57  public:
58   /// standard constructor
59   AliHLTGlobalHistoComponent();
60   /// destructor
61   virtual ~AliHLTGlobalHistoComponent();
62
63   /// inherited from AliHLTComponent: return id of the component.
64   virtual const char* GetComponentID() {return "GlobalHisto";};
65   /// inherited from AliHLTComponent: input data types
66   virtual void GetInputDataTypes(AliHLTComponentDataTypeList&);
67
68   /// inherited from AliHLTComponent: spawn function, create an instance.
69   virtual AliHLTComponent* Spawn() {return new AliHLTGlobalHistoComponent;}
70
71   void FillHistogramDefinitions();
72
73   /// @class AliHLTGlobalHistoVariables
74   /// container for the tree branch variables
75   class AliHLTGlobalHistoVariables {
76   public:
77     AliHLTGlobalHistoVariables();
78     AliHLTGlobalHistoVariables(int capacity, const char* names);
79     ~AliHLTGlobalHistoVariables();
80
81     /// init the arrays
82     int Init(int capacity, const char* names);
83
84     /// capacity for every key
85     int Capacity() const {return fCapacity;}
86     /// number of variables
87     int Variables() const {return fArrays.size();}
88
89     /// fill variable at index
90     int Fill(unsigned index, float value);
91     /// fill variable at key
92     int Fill(const char* key, float value);
93     /// get array at key
94     float* GetArray(const char* key);
95     /// get the key of an array
96     const char* GetKey(int index) const;
97
98     /// reset and cleanup arrays
99     int Reset();
100
101     /// reset the fill counts
102     int ResetCount();
103
104   private:
105     int FindKey(const char* key) const;
106
107     /// capacity of all arrays
108     int fCapacity; //!
109     /// pointers of arrays
110     vector<float*> fArrays; //!
111     /// fill count for arrays
112     vector<int> fCount; //!
113     /// map of keys
114     map<string,int> fKeys; //!
115   };
116
117  protected:
118   /// inherited from AliHLTTTreeProcessor: create the tree instance and all branches
119   TTree* CreateTree(int argc, const char** argv);
120   /// inherited from AliHLTTTreeProcessor: process input blocks and fill tree
121   int FillTree(TTree* pTree, const AliHLTComponentEventData& evtData, 
122                        AliHLTComponentTriggerData& trigData );
123   /// dtOrigin for PushBack.
124   AliHLTComponentDataType GetOriginDataType() const;
125   /// spec for PushBack
126   AliHLTUInt32_t GetDataSpec() const {return 0;}
127
128   int ResetVariables();
129   
130 private:
131   /// copy constructor prohibited
132   AliHLTGlobalHistoComponent(const AliHLTGlobalHistoComponent&);
133   /// assignment operator prohibited
134   AliHLTGlobalHistoComponent& operator=(const AliHLTGlobalHistoComponent&);
135
136   /// the event number, tree filling variable
137   int fEvent; //!
138   /// track count, tree filling variable
139   int fNofTracks; //!
140   /// x coordinate of vertex
141   float fVertexX; //!
142   /// y coordinate of vertex
143   float fVertexY; //!
144   /// z coordinate of vertex
145   float fVertexZ; //!
146  
147   /// filling arrays for track parameters
148   AliHLTGlobalHistoComponent::AliHLTGlobalHistoVariables fTrackVariables; //!
149   
150   ClassDef(AliHLTGlobalHistoComponent, 0) // HLT Global Histogram component
151 };
152 #endif