Skip to content
Snippets Groups Projects
Commit 9dfa804e authored by Stewart Martin-Haugh's avatar Stewart Martin-Haugh
Browse files

Remove unused HistogramUtils

parent cc4c8b3c
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 1373 deletions
################################################################################
# Package: HistogramUtils
################################################################################
# Declare the package name:
atlas_subdir( HistogramUtils )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Trigger/TrigAnalysis/TrigDecisionTool
PRIVATE
Control/AthenaBaseComps
GaudiKernel
PhysicsAnalysis/AnalysisCommon/PATCore
PhysicsAnalysis/CommonTools/ExpressionEvaluation )
# External dependencies:
find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
# Component(s) in the package:
atlas_add_component( HistogramUtils
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} TrigDecisionToolLib AthenaBaseComps GaudiKernel PATCoreLib ExpressionEvaluationLib )
# Install files from the package:
atlas_install_headers( HistogramUtils )
atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/*.py )
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# @file: HistogramManager.py
# @purpose: A python class to manage histogram booking
# @author: Carsten Burgard <cburgard@cern.ch>
__doc__ = 'A python class to manage histogram booking'
__version__ = '$Revision: 1.0 $'
__author__ = 'Carsten Burgard <cburgard@cern.ch>'
import AthenaPython.PyAthena as PyAthena
from ROOT import TH1, TH2, TH3
from HistogramUtils.HistogramTool import HistogramTool
import HistogramUtils
from AthenaCommon.Logging import logging
from AthenaCommon.Configurable import ConfigurableAlgTool
histogramManagerLogger = logging.getLogger( 'histogramManagerLogger' )
class HistogramManager:
def __init__(self, Name, RootStreamName, RootDirName, OnlyAtCutStages = None, OutputLevel = 3, HistToolClasses = [HistogramUtils.HistogramUtilsConf.HistogramUtils__HistogramToolTH1, HistogramUtils.HistogramUtilsConf.HistogramUtils__HistogramToolTH2, HistogramUtils.HistogramUtilsConf.HistogramUtils__HistogramToolTH3]):
self.m_name = Name
self.m_rootStreamName = RootStreamName
self.m_rootDirName = RootDirName
self.m_onlyAtCutStages = OnlyAtCutStages
self.m_histogramTools = {}
self.m_outputLevel = OutputLevel
self.m_histogramToolClasses = HistToolClasses
def isAcceptedToolClass(self,obj):
"""return true if the type of this object is among the accepted tool classes, false otherwise"""
if type(obj) in self.m_histogramToolClasses:
return True
return False
def acceptToolClass(self,s):
"""add a type to the accepted tool classes"""
self.m_histogramToolClasses.append(s)
def rejectToolClass(self,s):
"""remove a type from the accepted tool classes"""
l = len(self.m_histogramToolClasses)
for i in range(0,l):
if self.m_histogramToolClasses[l-i-1] == s:
self.m_histogramToolClasses.remove(l-i-1)
def printToolClasses(self):
"""print the list of accepted tool classes"""
l = len(self.m_histogramToolClasses)
for i in range(0,l):
print(self.m_histogramToolClasses[i])
def __iadd__(self, other):
self.add(other)
return self
def add(self,other,arg1=None,arg2=None,arg3=None):
"""add a histogram tool to the list
this method will do it's very best to interpret your input in a sensible way
the most well-defined way of booking a histogram is manually constructing the tool, i.e.
myHistMgr.add( HistogramTool( TH*("name","title",...) , "expression" ) )
if something has been added, this function returns true, false otherwise.
"""
if self.isAcceptedToolClass(other):
# if this is a tool, add it to the list
if other.name() not in self.m_histogramTools.keys():
if self.m_outputLevel < 3: # 3 = INFO
histogramManagerLogger.verbose("adding histogram tool '{:s}' to the manager".format(other.name()))
self.m_histogramTools[other.name()] = other
return True
return False
elif isinstance(other,ConfigurableAlgTool):
histogramManagerLogger.warn("an instance of ConfigurableAlgTool named '{:s}' was passed to the HistogramManager, but its type is not listed as an accepted tool class. this HistogramManager will reject and ignore this instance. if you want this HistogramManager to accept this instance, you should add its type to the list of accepted tool classes by calling 'myHistogramManager.acceptToolClass(type(myToolObject))'.")
return False
elif isinstance(other, TH1):
# if this is a histogram, instantiate a tool and add it to the list
if other.GetName() not in self.m_histogramTools.keys():
if self.m_outputLevel < 3: # 3 = INFO
histogramManagerLogger.verbose("adding histogram '{:s}' to the manager".format(other.GetName()))
if isinstance(other,TH3):
self.m_histogramTools[other.GetName()] = HistogramTool(other,arg1,arg2,arg3,
OutputLevel = self.m_outputLevel,
RootDirName = self.m_rootDirName,
RootStreamName = self.m_rootStreamName
)
return True
elif isinstance(other,TH2):
self.m_histogramTools[other.GetName()] = HistogramTool(other,arg1,arg2,
OutputLevel = self.m_outputLevel,
RootDirName = self.m_rootDirName,
RootStreamName = self.m_rootStreamName
)
return True
else:
self.m_histogramTools[other.GetName()] = HistogramTool(other,arg1,
OutputLevel = self.m_outputLevel,
RootDirName = self.m_rootDirName,
RootStreamName = self.m_rootStreamName
)
return True
return False
else:
# if this is iterable, dispatch the items and recall the function
first = None
second = None
third = None
fourth = None
try:
iterator = iter(other)
first = iterator.next()
second = iterator.next()
third = iterator.next()
fourth = iterator.next()
raise StopIteration
except StopIteration:
self.add(first,second,third,fourth)
return True
except TypeError:
return False
def __isub__(self, other):
self.remove(other)
return self
def remove(self,other):
"""remove a histogram tool from the list - matching is done by name"""
if isinstance(other, HistTool):
if other.name() not in self.m_histogramTools.keys():
del self.m_histogramTools[other.name()]
return True
elif isinstance(other, TH1):
if other.GetName() not in self.m_histogramTools.keys():
del self.m_histogramTools[other.GetName()]
return True
elif isinstance(other,basestring):
if other not in self.m_histogramTools.keys():
del self.m_histogramTools[other]
return True
return False
def updateToolProperty(self,tool,key,value):
"""update a property of a tool, only setting it if it was undefined previously"""
if not key in tool.getProperties().keys() or tool.getProperties()[key] == "<no value>":
setattr(tool,key,value)
def updateTools(self):
"""update the properties of all tool according to the defaults"""
for tool in self.m_histogramTools.values():
self.updateToolProperty(tool,"RootStreamName", self.m_rootStreamName )
self.updateToolProperty(tool,"RootDirName", self.m_rootDirName )
self.updateToolProperty(tool,"OutputLevel", self.m_outputLevel )
self.updateToolProperty(tool,"OnlyAtCutStages",self.m_onlyAtCutStages)
def ToolList(self):
"""retrieve the list of histogram tools"""
self.updateTools()
return self.m_histogramTools.values()
def printToolList(self):
"""print the list of histogram tools"""
list = self.ToolList()
for tool in list:
print("{: <10} {: <20} >> {:s}:{: <20}".format(tool.ClassName,tool.name(),tool.getProperties()["RootStreamName"],tool.getProperties()["RootDirName"]))
def __str__(self):
return "HistogramManager '{:s}' with ROOT stream '{:s}' to directory '{:s}'".format(self.m_name,self.m_rootStreamName,self.m_rootDirName)
def __repr__(self):
print(self.__str__())
self.printToolList()
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# @file: HistogramTool.py
# @purpose: A python factory for histogram tools
# @author: Carsten Burgard <cburgard@cern.ch>
__doc__ = 'A python factory for histogram tools'
__version__ = '$Revision: 1.0 $'
__author__ = 'Carsten Burgard <cburgard@cern.ch>'
import HistogramUtils.HistogramUtilsConf as HistUtils
from ROOT import TH1, TH2, TH3
from AthenaCommon.Logging import logging
from AthenaCommon.AppMgr import ToolSvc
def extractBinning(axis):
bins = []
for i in range(1,axis.GetNbins()+1):
bins.append(axis.GetBinLowEdge(i))
bins.append(axis.GetBinUpEdge(axis.GetNbins()))
return bins
histogramToolLogger = logging.getLogger( 'histogramToolLogger' )
def HistogramTool(histogram, arg1, arg2=None, arg3=None, **kwargs ):
if isinstance(histogram,TH3) and arg2 and arg3:
if histogram.GetXaxis().IsVariableBinSize():
tool = HistUtils.HistogramUtils__HistogramToolTH3(
ClassName = histogram.ClassName(),
name = histogram.GetName(),
Title = histogram.GetTitle(),
NBinsX = histogram.GetNbinsX(),
MinX = histogram.GetXaxis().GetXmin(),
MaxX = histogram.GetXaxis().GetXmax(),
VarX = arg1,
BinBoundariesX = extractBinning(histogram.GetXaxis()),
NBinsY = histogram.GetNbinsY(),
MinY = histogram.GetYaxis().GetXmin(),
MaxY = histogram.GetYaxis().GetXmax(),
VarY = arg2,
BinBoundariesY = extractBinning(histogram.GetYaxis()),
NBinsZ = histogram.GetNbinsZ(),
MinZ = histogram.GetZaxis().GetXmin(),
MaxZ = histogram.GetZaxis().GetXmax(),
BinBoundariesZ = extractBinning(histogram.GetZaxis()),
VarZ = arg3
)
else:
tool = HistUtils.HistogramUtils__HistogramToolTH3(
ClassName = histogram.ClassName(),
name = histogram.GetName(),
Title = histogram.GetTitle(),
NBinsX = histogram.GetNbinsX(),
MinX = histogram.GetXaxis().GetXmin(),
MaxX = histogram.GetXaxis().GetXmax(),
VarX = arg1,
NBinsY = histogram.GetNbinsY(),
MinY = histogram.GetYaxis().GetXmin(),
MaxY = histogram.GetYaxis().GetXmax(),
VarY = arg2,
NBinsZ = histogram.GetNbinsZ(),
MinZ = histogram.GetZaxis().GetXmin(),
MaxZ = histogram.GetZaxis().GetXmax(),
VarZ = arg3
)
pass
elif isinstance(histogram,TH2) and arg2 and not arg3:
if histogram.GetXaxis().IsVariableBinSize():
tool = HistUtils.HistogramUtils__HistogramToolTH2(
ClassName = histogram.ClassName(),
name = histogram.GetName(),
Title = histogram.GetTitle(),
NBinsX = histogram.GetNbinsX(),
MinX = histogram.GetXaxis().GetXmin(),
MaxX = histogram.GetXaxis().GetXmax(),
VarX = arg1,
BinBoundariesX = extractBinning(histogram.GetXaxis()),
NBinsY = histogram.GetNbinsY(),
MinY = histogram.GetYaxis().GetXmin(),
MaxY = histogram.GetYaxis().GetXmax(),
BinBoundariesY = extractBinning(histogram.GetYaxis()),
VarY = arg2,
)
else:
tool = HistUtils.HistogramUtils__HistogramToolTH2(
ClassName = histogram.ClassName(),
name = histogram.GetName(),
Title = histogram.GetTitle(),
NBinsX = histogram.GetNbinsX(),
MinX = histogram.GetXaxis().GetXmin(),
MaxX = histogram.GetXaxis().GetXmax(),
VarX = arg1,
NBinsY = histogram.GetNbinsY(),
MinY = histogram.GetYaxis().GetXmin(),
MaxY = histogram.GetYaxis().GetXmax(),
VarY = arg2
)
pass
elif isinstance(histogram,TH1) and not arg2 and not arg3:
if histogram.GetXaxis().IsVariableBinSize():
tool = HistUtils.HistogramUtils__HistogramToolTH1(
ClassName = histogram.ClassName(),
name = histogram.GetName(),
Title = histogram.GetTitle(),
NBinsX = histogram.GetNbinsX(),
MinX = histogram.GetXaxis().GetXmin(),
MaxX = histogram.GetXaxis().GetXmax(),
BinBoundariesX = extractBinning(histogram.GetXaxis()),
VarX = arg1
)
else:
tool = HistUtils.HistogramUtils__HistogramToolTH1(
ClassName = histogram.ClassName(),
name = histogram.GetName(),
Title = histogram.GetTitle(),
NBinsX = histogram.GetNbinsX(),
MinX = histogram.GetXaxis().GetXmin(),
MaxX = histogram.GetXaxis().GetXmax(),
VarX = arg1
)
pass
else:
histogramToolLogger.fatal("number of arguments does not match object of type '"+type(someObject).__name__+"'!")
pass
for key, value in kwargs.iteritems():
setattr(tool,key,value)
pass
from AthenaCommon.AppMgr import ToolSvc
ToolSvc += tool
return tool
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
from ROOT import TH1F, TH2F
from AthenaCommon.AthenaCommonFlags import jobproperties as jp
import AthenaCommon.SystemOfUnits as Units
from HistogramUtils.HistogramManager import HistogramManager as HistMgr
from HistogramUtils.HistogramTool import HistogramTool as HistTool
from RecExConfig.RecFlags import rec
rec.doDPD = False
rec.doHist = False
rec.doWriteTAG = False
rec.doPerfMon = False
rec.doSemiDetailedPerfMon = False
rec.doDetailedPerfMon = False
rec.doFileMetaData = False
# Create the D3PD stream using MultipleStreamManager:
# the aruments are: stream name, file name, TTree name in file
myPath = "/afs/cern.ch/atlas/project/PAT/xAODs/r5534/valid2.117050.PowhegPythia_P2011C_ttbar.digit.AOD.e2657_s1933_s1964_r5534/AOD.01482225._000107.pool.root.1"
jp.AthenaCommonFlags.FilesInput = [myPath]
#from AthenaCommon.AlgSequence import AlgSequence
#topSequence = AlgSequence()
include ("RecExCommon/AnalysisCommon_topOptions.py")
streamName = "MyFirstHistoStream"
fileName = "myHistosAth.pool.root"
rootStreamName = streamName
rootDirName = "/Hists"
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
MyFirstHistoXAODStream = MSMgr.NewRootStream( streamName, fileName )
if not hasattr( ServiceMgr, 'THistSvc' ): print 'Ahhhhhhhh'
ServiceMgr.THistSvc.OutputLevel = VERBOSE
# ====================================================================
# Create a subsequence:
# Only when the first algorithm returns isEventAccepted,
# the rest of this sub-sequence is executed
# ====================================================================
from AthenaCommon.AlgSequence import AthSequencer
subSeqMyAthAnalysis = AthSequencer("MyFirstAnalysisSubSeq")
topSequence += subSeqMyAthAnalysis
myHistMgr = HistMgr("HistMgrHtoWWtoemu",
RootStreamName = rootStreamName,
RootDirName = rootDirName,
OutputLevel = VERBOSE
# OnlyAtCutStages = ["CutAlg2", "CutAlg3"]
)
myHistMgr += ( TH1F("ept", "p_{t}^{e}", 50, 0.0, 100.0), "ElectronCollection.pt / GeV ")
myHistMgr.add( TH1F("mupt", "p_{t}^{#mu}", 50, 0.0, 100.0), "Muons.pt / GeV ")
myHistMgr.add( [ TH1F("ept2", "p_{t}^{e}", 50, 0.0, 100.0), "ElectronCollection.pt / GeV " ] )
myHistMgr += TH2F("muptvselpt", "p_{t}^{#mu} vs. p_{t}^{e}", 50, 0.0, 100.0, 50, 0.0, 100.0), "Muons.pt / GeV", "ElectronCollection.pt / GeV"
myHistMgr += HistTool( TH2F("muptvselpt2", "p_{t}^{#mu} vs. p_{t}^{e}", 50, 0.0, 100.0, 50, 0.0, 100.0), "Muons.pt / GeV", "ElectronCollection.pt / GeV" )
print(myHistMgr)
#
# # example for custom hist tool
# # from MyCode.MyCodeConf import MetHistTool
# # myHistMgr += MetHistTool("MyMetHistTool")
#
# mySpecialHistToolInstance = HistTool( TH2F("muptvselpt2", "p_{t}^{#mu} vs. p_{t}^{e}", 50, 0.0, 1.0, 50, 0.0, 1.0), "muon.pt()", "electron.pt()",
# RootStreamName = rootStreamName,
# RootDirName = rootDirName,
# OnlyAtCutStages = ["CutAlg2", "CutAlg3"]
# )
#
#
# mySpecialHistToolInstance2 = HistTool( TH2F("muptvselpt3", "p_{t}^{#mu} vs. p_{t}^{e}", 50, 0.0, 1.0, 50, 0.0, 1.0), "muon.pt()", "electron.pt()" )
# mySpecialHistToolInstance2.RootStreamName = rootStreamName
# mySpecialHistToolInstance2.RootDirName = rootDirName
# mySpecialHistToolInstance2.OnlyAtCutStages = ["CutAlg2", "CutAlg3"]
#
#
# # http://acode-browser.usatlas.bnl.gov/lxr/source/atlas/Control/GaudiSequencer/src/AthSequencer.h
# #from AthenaCommon.AlgSequence import AthHistogramSequencer
# #htoWWtoemuSeq += Alg1("Alg1")
#
# htoWWtoemuSeq += CutAlg("CutAlg2", "count(ElectronContainer.pt() > 20 GeV) >=1")
#
# htoWWtoemuSeq += CutAlg("CutAlg3", "count(muons.pt() > 20 GeV) >= 1")
#
myHistToolInstance = HistTool( TH1F("my_mupt", "p_{t}^{#mu}", 50, 0.0, 100.0), " Muons.pt * 0.001 ",
RootStreamName=rootStreamName,
RootDirName=rootDirName,
OutputLevel = VERBOSE
)
# subSeqMyAthAnalysis += CfgMgr.CutAlg( "MuonPtCut",
# OutputLevel = VERBOSE,
# Cut = "count(Muons.pt > 10*GeV) >= 1" )
subSeqMyAthAnalysis += CfgMgr.HistAlg("myHistAlg",
OutputLevel = VERBOSE,
RootStreamName = streamName,
RootDirName = "/MyHists",
HistToolList = [ myHistToolInstance ] )
myHistMgr.printToolList()
htoWWtoemuSeq = CfgMgr.AthAnalysisSequencer( "HtoWWtoemuSeq", HistToolList = myHistMgr.ToolList() )
topSequence += htoWWtoemuSeq
#subSeqMyAthAnalysis += CfgMgr.HistAlg("myHistMgrAlg",
# HistToolList = myHistMgr.ToolList() )
///////////////////////// -*- C++ -*- /////////////////////////////
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// HistAlg.cxx
// Implementation file for class HistAlg
// Author: Carsten Burgard <cburgard@cern.ch>
///////////////////////////////////////////////////////////////////
// HistogramUtils includes
#include "HistAlg.h"
#include "HistogramTool.h"
// STL includes
#include <iostream>
// FrameWork includes
#include "GaudiKernel/Property.h"
#include "PATCore/IAthHistogramTool.h"
// ROOT includes
#include "TH1.h"
///////////////////////////////////////////////////////////////////
// Public methods:
///////////////////////////////////////////////////////////////////
// Constructors
////////////////
HistAlg::HistAlg( const std::string& name,
ISvcLocator* pSvcLocator ) :
::AthHistogramAlgorithm( name, pSvcLocator ),
m_histToolList(this)
{
//
// Property declaration
//
//declareProperty( "HistToolList", m_histToolList, "List of histogram tools to be employed by this algorithm" );
declareProperty( "HistToolList", m_histToolList, "Histogram tool list to be employed by this algorithm" );
}
// Destructor
///////////////
HistAlg::~HistAlg()
{}
// Athena Algorithm's Hooks
////////////////////////////
StatusCode HistAlg::initialize()
{
ATH_MSG_DEBUG ("Initializing " << name() << " and retrieving " << m_histToolList.size() << " tools...");
ATH_CHECK(m_histToolList.retrieve());
return StatusCode::SUCCESS;
}
StatusCode HistAlg::finalize()
{
ATH_MSG_DEBUG ("Finalizing " << name() << "...");
ATH_CHECK(m_histToolList.release());
return StatusCode::SUCCESS;
}
StatusCode HistAlg::execute()
{
ATH_MSG_DEBUG ("Executing " << name() << "...");
for(auto itr = this->m_histToolList.begin(); itr != this->m_histToolList.end(); itr++){
ATH_CHECK((*itr)->fill(1.));
}
return StatusCode::SUCCESS;
}
///////////////////////// -*- C++ -*- /////////////////////////////
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// HistAlg.h
// Header file for class HistAlg
// Author: S.Binet<binet@cern.ch>
///////////////////////////////////////////////////////////////////
#ifndef HISTOGRAMUTILS_HISTALG_H
#define HISTOGRAMUTILS_HISTALG_H 1
// STL includes
#include <string>
// FrameWork includes
#include "AthenaBaseComps/AthHistogramAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
class IAthHistogramTool;
class HistAlg
: public ::AthHistogramAlgorithm
{
///////////////////////////////////////////////////////////////////
// Public methods:
///////////////////////////////////////////////////////////////////
public:
// Copy constructor:
/// Constructor with parameters:
HistAlg( const std::string& name, ISvcLocator* pSvcLocator );
/// Destructor:
virtual ~HistAlg();
// Assignment operator:
//HistAlg &operator=(const HistAlg &alg);
// Athena algorithm's Hooks
virtual StatusCode initialize();
virtual StatusCode execute();
virtual StatusCode finalize();
///////////////////////////////////////////////////////////////////
// Const methods:
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
// Non-const methods:
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
// Private data:
///////////////////////////////////////////////////////////////////
private:
ToolHandleArray<IAthHistogramTool> m_histToolList;
/// Default constructor:
HistAlg();
/// Containers
};
// I/O operators
//////////////////////
///////////////////////////////////////////////////////////////////
// Inline methods:
///////////////////////////////////////////////////////////////////
#endif //> !HISTOGRAMUTILS_HISTALG_H
This diff is collapsed.
// This file's extension implies that it's C, but it's really -*- C++ -*-.
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: HistogramTool.h,v 1.0 2014-05-25 16:54 cburgard Exp $
/**
* @file HistogramTool.h
* @author carsten burgard <cburgarc@cern.ch>
* @date July, 2014
* @brief tool for booking histograms
*/
#ifndef HISTOGRAMUTILS_HISTOGRAMTOOL_H
#define HISTOGRAMUTILS_HISTOGRAMTOOL_H 1
#include "TH1.h"
#include "TH2.h"
#include "TH3.h"
#include <string>
#include "GaudiKernel/StatusCode.h"
#include "AthenaBaseComps/AthHistogramTool.h"
#include "PATCore/IAthHistogramTool.h"
#include "ExpressionEvaluation/ExpressionParser.h"
#ifndef XAOD_ANALYSIS
#include "TrigDecisionTool/TrigDecisionTool.h"
#endif
namespace HistogramUtils {
struct AxisDetails {
AxisDetails();
std::string m_title;
std::string m_variable;
unsigned int m_nBins;
std::vector<double> m_binBoundaries;
double m_min;
double m_max;
bool hasVariableBinning() const;
bool isValid() const;
bool isEmpty() const;
void print() const;
};
class HistogramToolTH1: public AthHistogramTool, virtual public IAthHistogramTool {
public:
TH1* m_histogram;
std::string m_histTitle;
std::string m_histClassName;
std::vector<std::string> m_cutStages;
AxisDetails m_axisX;
ExpressionParsing::ExpressionParser *m_parserX;
#ifndef XAOD_ANALYSIS
ToolHandle<Trig::TrigDecisionTool> m_trigDecisionTool;
#endif
public:
HistogramToolTH1(const std::string& type, const std::string& name, const IInterface* parent);
virtual StatusCode fill( const double weight = 1.0) override final;
virtual StatusCode initialize() final override;
virtual StatusCode finalize() final override;
};
class HistogramToolTH2: public AthHistogramTool, virtual public IAthHistogramTool {
protected:
TH2* m_histogram;
std::string m_histTitle;
std::string m_histClassName;
std::vector<std::string> m_cutStages;
AxisDetails m_axisX;
AxisDetails m_axisY;
ExpressionParsing::ExpressionParser *m_parserX;
ExpressionParsing::ExpressionParser *m_parserY;
#ifndef XAOD_ANALYSIS
ToolHandle<Trig::TrigDecisionTool> m_trigDecisionTool;
#endif
public:
HistogramToolTH2(const std::string& type, const std::string& name, const IInterface* parent);
virtual StatusCode fill( const double weight = 1.0) override final;
virtual StatusCode initialize() final override;
virtual StatusCode finalize() final override;
};
class HistogramToolTH3: public AthHistogramTool, virtual public IAthHistogramTool {
protected:
TH3* m_histogram;
std::string m_histTitle;
std::string m_histClassName;
std::vector<std::string> m_cutStages;
AxisDetails m_axisX;
AxisDetails m_axisY;
AxisDetails m_axisZ;
ExpressionParsing::ExpressionParser *m_parserX;
ExpressionParsing::ExpressionParser *m_parserY;
ExpressionParsing::ExpressionParser *m_parserZ;
#ifndef XAOD_ANALYSIS
ToolHandle<Trig::TrigDecisionTool> m_trigDecisionTool;
#endif
public:
HistogramToolTH3(const std::string& type, const std::string& name, const IInterface* parent);
virtual StatusCode fill( const double weight = 1.0) override final;
virtual StatusCode initialize() final override;
virtual StatusCode finalize() final override;
};
}
#endif // HISTOGRAMUTILS_HISTOGRAMTOOL_H
#include "../HistogramTool.h"
#include "../HistAlg.h"
using namespace HistogramUtils;
DECLARE_COMPONENT( HistogramToolTH1 )
DECLARE_COMPONENT( HistogramToolTH2 )
DECLARE_COMPONENT( HistogramToolTH3 )
DECLARE_COMPONENT( HistAlg )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment