]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTTTreeProcessor.h
change systematic and resolution plots
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTTTreeProcessor.h
CommitLineData
4731a36c 1//-*- Mode: C++ -*-
2// $Id$
3
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 *
9
10/// @file AliHLTTTreeProcessor.h
9bed6a67 11/// @author Timur Pocheptsov, Matthias Richter
4731a36c 12/// @date 05.07.2010
13/// @brief Generic component for data collection in a TTree
14
9bed6a67 15#include <list>
16
17#include <TString.h>
18
4731a36c 19#include "AliHLTProcessor.h"
20
21class TTree;
22class TH1;
23
24/**
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
29 * data itself.
30 *
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.
35 *
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
39 * tree can be reset.
40 *
41 * @ingroup alihlt_base
42 */
43class AliHLTTTreeProcessor : public AliHLTProcessor {
9bed6a67 44private:
45 enum EDefaults {
46 kMaxEntries = 1000,
47 kInterval = 5
48 };
49public:
50 /// default constructor
4731a36c 51 AliHLTTTreeProcessor();
52 /// destructor
53 virtual ~AliHLTTTreeProcessor();
54
55 /// inherited from AliHLTComponent, get the output data type
56 virtual AliHLTComponentDataType GetOutputDataType();
57
58 /// inherited from AliHLTComponent, get the output data size estimator
9bed6a67 59 virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
4731a36c 60
9bed6a67 61protected:
4731a36c 62 /// initialization, overloaded from AliHLTComponent
9bed6a67 63 int DoInit(int argc, const char** argv);
64 /// deinitialization, overloaded from AliHLTComponent
4731a36c 65 int DoDeinit();
66 /// inherited from AliHLTProcessor, data processing
9bed6a67 67 int DoEvent(const AliHLTComponentEventData& evtData,
68 AliHLTComponentTriggerData& trigData);
4731a36c 69 using AliHLTProcessor::DoEvent;
9bed6a67 70
71 class AliHLTHistogramDefinition {
72 public:
73 AliHLTHistogramDefinition()
74 : fName(), fSize(0), fExpr(), fCut(), fOpt()
75 {
76 }
77
78 const TString& GetName()const{return fName;}
79 void SetName(const TString& name){fName = name;}
80
81 int GetSize()const{return fSize;}
82 void SetSize(int size){fSize = size;}
83
84 const TString& GetExpression()const{return fExpr;}
85 void SetExpression(const TString& expr){fExpr = expr;}
86
87 const TString& GetCut()const{return fCut;}
88 void SetCut(const TString& cut){fCut = cut;}
89
90 const TString& GetDrawOption()const{return fOpt;}
91 void SetDrawOption(const TString& opt){fOpt = opt;}
92
93 private:
94
95 TString fName;
96 int fSize;
97 TString fExpr;
98 TString fCut;
99 TString fOpt;
100 };
101
102 std::list<AliHLTHistogramDefinition> fDefinitions;
103 typedef std::list<AliHLTHistogramDefinition>::iterator list_iterator;
104 typedef std::list<AliHLTHistogramDefinition>::const_iterator list_const_iterator;
105
106
107private:
4731a36c 108 /// inherited from AliHLTComponent, scan argument
109 int ScanConfigurationArgument(int argc, const char** argv);
4731a36c 110 /// create the tree instance and all branches
111 virtual TTree* CreateTree(int argc, const char** argv) = 0;
4731a36c 112 /// process input blocks and fill tree
9bed6a67 113 virtual int FillTree(TTree* pTree, const AliHLTComponentEventData& evtData,
114 AliHLTComponentTriggerData& trigData ) = 0;
115 /// dtOrigin for PushBack.
116 virtual AliHLTComponentDataType GetOriginDataType()const = 0;
117 /// spec for PushBack
118 virtual AliHLTUInt32_t GetDataSpec()const = 0;
119 /// default histogram definitions.
120 virtual void FillHistogramDefinitions() = 0;
4731a36c 121
122 /// create a histogram from the tree
9bed6a67 123 TH1* CreateHistogram(const AliHLTHistogramDefinition& def);
124 /// parse arguments, containing histogram definition.
125 int ParseHistogramDefinition(int argc, const char** argv, int pos, AliHLTHistogramDefinition& dst)const;
4731a36c 126
127 /// the TTree
128 TTree* fTree; //! the tree instance
129 /// max entries
130 int fMaxEntries; //! maximum number of entries in the circular tree
131 /// publish interval in s
9bed6a67 132 unsigned fPublishInterval; //! publish interval in s
133 /// time stamp - publish or not.
134 unsigned fLastTime; //! last time the histogramms were published
135
136 /// copy constructor prohibited
137 AliHLTTTreeProcessor(const AliHLTTTreeProcessor&);
138 /// assignment operator prohibited
139 AliHLTTTreeProcessor& operator = (const AliHLTTTreeProcessor&);
4731a36c 140
141 ClassDef(AliHLTTTreeProcessor, 0)
142};
143#endif