4 #ifndef ALIHLTTTREEPROCESSOR_H
5 #define ALIHLTTTREEPROCESSOR_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 *
10 /// @file AliHLTTTreeProcessor.h
11 /// @author Timur Pocheptsov, Matthias Richter
13 /// @brief Generic component for data collection in a TTree
19 #include "AliHLTProcessor.h"
25 * @class AliHLTTTreeProcessor
26 * Generic component for data collection in a TTree, or as a special case
27 * in a TNtuple (which is a tree with only float branches). Child components
28 * implement the creation and filling of the tree, which is dependent on the
31 * Child components have to implement the basic component property methods
32 * like GetComponentID(), GetInputDataTypes(), and Spawn(). Default
33 * implementations of GetOutputDataSize() and GetOutputDataType() are already
34 * provided by the base class.
36 * The base class keeps a circular TTree of a specific event count. Histograms
37 * are periodically generated by applying a table of selections and cuts. The
38 * table can be configured and changed at run-time and the data sample in the
41 * @ingroup alihlt_base
43 class AliHLTTTreeProcessor : public AliHLTProcessor {
51 /// default constructor
52 AliHLTTTreeProcessor();
54 virtual ~AliHLTTTreeProcessor();
56 /// inherited from AliHLTComponent, get the output data type
57 virtual AliHLTComponentDataType GetOutputDataType();
59 /// inherited from AliHLTComponent, get the output data size estimator
60 virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
63 /// initialization, overloaded from AliHLTComponent
64 int DoInit(int argc, const char** argv);
65 /// deinitialization, overloaded from AliHLTComponent
67 /// inherited from AliHLTProcessor, data processing
68 int DoEvent(const AliHLTComponentEventData& evtData,
69 AliHLTComponentTriggerData& trigData);
70 using AliHLTProcessor::DoEvent;
72 class AliHLTHistogramDefinition {
74 AliHLTHistogramDefinition()
75 : fName(), fSize(0), fExpr(), fCut(), fOpt()
79 const TString& GetName()const{return fName;}
80 void SetName(const TString& name){fName = name;}
82 int GetSize()const{return fSize;}
83 void SetSize(int size){fSize = size;}
85 const TString& GetExpression()const{return fExpr;}
86 void SetExpression(const TString& expr){fExpr = expr;}
88 const TString& GetCut()const{return fCut;}
89 void SetCut(const TString& cut){fCut = cut;}
91 const TString& GetDrawOption()const{return fOpt;}
92 void SetDrawOption(const TString& opt){fOpt = opt;}
103 std::list<AliHLTHistogramDefinition> fDefinitions;
104 typedef std::list<AliHLTHistogramDefinition>::iterator list_iterator;
105 typedef std::list<AliHLTHistogramDefinition>::const_iterator list_const_iterator;
109 /// inherited from AliHLTComponent, scan argument
110 int ScanConfigurationArgument(int argc, const char** argv);
111 /// create the tree instance and all branches
112 virtual TTree* CreateTree(int argc, const char** argv) = 0;
113 /// process input blocks and fill tree
114 virtual int FillTree(TTree* pTree, const AliHLTComponentEventData& evtData,
115 AliHLTComponentTriggerData& trigData ) = 0;
116 /// dtOrigin for PushBack.
117 virtual AliHLTComponentDataType GetOriginDataType()const = 0;
118 /// spec for PushBack
119 virtual AliHLTUInt32_t GetDataSpec()const = 0;
120 /// default histogram definitions.
121 virtual void FillHistogramDefinitions() = 0;
123 /// create a histogram from the tree
124 TH1* CreateHistogram(const AliHLTHistogramDefinition& def);
125 /// parse arguments, containing histogram definition.
126 int ParseHistogramDefinition(int argc, const char** argv, int pos, AliHLTHistogramDefinition& dst)const;
129 TTree* fTree; //! the tree instance
131 int fMaxEntries; //! maximum number of entries in the circular tree
132 /// publish interval in s
133 unsigned fPublishInterval; //! publish interval in s
134 /// time stamp - publish or not.
135 unsigned fLastTime; //! last time the histogramms were published
137 /// copy constructor prohibited
138 AliHLTTTreeProcessor(const AliHLTTTreeProcessor&);
139 /// assignment operator prohibited
140 AliHLTTTreeProcessor& operator = (const AliHLTTTreeProcessor&);
142 ClassDef(AliHLTTTreeProcessor, 0)