diff --git a/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/AsgAnalysisInterfacesDict.h b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/AsgAnalysisInterfacesDict.h new file mode 100644 index 0000000000000000000000000000000000000000..8d8e1e1952dc2480ffdf963460c7fdd93c346c5e --- /dev/null +++ b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/AsgAnalysisInterfacesDict.h @@ -0,0 +1,13 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ASGANALYSISINTERFACESDICT_H +#define ASGANALYSISINTERFACESDICT_H + +#include "AsgAnalysisInterfaces/IPileupReweightingTool.h" +#include "AsgAnalysisInterfaces/IGoodRunsListSelectionTool.h" +#include "AsgAnalysisInterfaces/IObservableTool.h" + + +#endif diff --git a/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/IGoodRunsListSelectionTool.h b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/IGoodRunsListSelectionTool.h new file mode 100644 index 0000000000000000000000000000000000000000..ec39cc4f9db1d9e4d10bea5c3b4953c7c7e4d8e0 --- /dev/null +++ b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/IGoodRunsListSelectionTool.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GoodRunsLists_IGoodRunsListSelectionTool_H +#define GoodRunsLists_IGoodRunsListSelectionTool_H + +// System include(s): +#include <vector> +#include <string> + +// Framework include(s): +#include "AsgTools/IAsgTool.h" + +// EDM include(s): +#include "xAODEventInfo/EventInfo.h" + +// Forward declaration(s): +namespace Root { + class TGRLCollection; +} + +///Main tools implementing this interface: +/// GoodRunsListSelectionTool (source code: DataQuality/GoodRunsLists) + +class IGoodRunsListSelectionTool : virtual public asg::IAsgTool { + + ASG_TOOL_INTERFACE( IGoodRunsListSelectionTool ) + +public: + /// Check if the current event passes the selection + virtual bool passRunLB( const std::vector< std::string >& grlnameVec = + std::vector< std::string >(), + const std::vector< std::string >& brlnameVec = + std::vector< std::string >() ) const = 0; + + /// Check if the event specified passes the selection + virtual bool passRunLB( const xAOD::EventInfo& event, + const std::vector< std::string >& grlnameVec = + std::vector< std::string >(), + const std::vector< std::string >& brlnameVec = + std::vector< std::string >() ) const = 0; + + /// Check if the event specified passes the selection + virtual bool passRunLB( int runNumber, int lumiBlockNr, + const std::vector< std::string >& grlnameVec = + std::vector< std::string >(), + const std::vector< std::string >& brlnameVec = + std::vector< std::string >() ) const = 0; + + /// Get the good runs list used by the tool + virtual const Root::TGRLCollection& getGRLCollection() const = 0; + + /// Get the bad runs list used by the tool + virtual const Root::TGRLCollection& getBRLCollection() const = 0; + +}; // class IGoodRunsListSelectionTool + +#endif // GoodRunsLists_IGoodRunsListSelectionTool_H diff --git a/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/IObservableTool.h b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/IObservableTool.h new file mode 100644 index 0000000000000000000000000000000000000000..413f7711f170aa45462b2c2ef02c3ab95192c28f --- /dev/null +++ b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/IObservableTool.h @@ -0,0 +1,49 @@ +// Dear emacs, this is -*- c++ -*- + +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: IObservableTool.h 782989 2016-11-08 14:27:55Z will $ +#ifndef ASGANALYSISINTERFACES_IOBSERVABLETOOL_H +#define ASGANALYSISINTERFACES_IOBSERVABLETOOL_H + +// System include(s): + +// Framework include(s): +#include "AsgTools/IAsgTool.h" + +// Forward declaration +namespace xAOD{ + class IParticle; +} + + +/// Interface for tools that want to calculate a quantity +/// from an xAOD::IParticle +/// @author Karsten Koeneke <karsten.koeneke@cern.ch> +/// + + +///Main tools implementing this interface: +/// GenericParticleScaleFactorTool (source code: PhysicsAnalysis/AnalysisCommon/ReweightUtils) +/// McEventWeight (source code: PhysicsAnalysis/AnalysisCommon/ReweightUtils) + +class IObservableTool : public virtual asg::IAsgTool { + + /// Declare the interface that this class provides + ASG_TOOL_INTERFACE( IObservableTool ) + + public: + + /// Virtual destructor + virtual ~IObservableTool(){}; + + /// returns: the value that was calculated from the xAOD::IParticle + virtual double + evaluate( const xAOD::IParticle* ) const = 0; + + }; // class IObservableTool + + +#endif // PATINTERFACES_IOBSERVABLETOOL_H diff --git a/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/IPileupReweightingTool.h b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/IPileupReweightingTool.h new file mode 100644 index 0000000000000000000000000000000000000000..fefb6d3510ddde997200a37fa12ea4505b5dd3da --- /dev/null +++ b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/IPileupReweightingTool.h @@ -0,0 +1,125 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + + +///ASG PileupReweightingTool interface +///author: will@cern.ch +#ifndef PILEUPREWEIGHTING_IPILEUPREWEIGHTINGTOOL_H +#define PILEUPREWEIGHTING_IPILEUPREWEIGHTINGTOOL_H + +#include "AsgTools/IAsgTool.h" +#include "TString.h" +#include "xAODEventInfo/EventInfo.h" + +#include "PATInterfaces/ISystematicsTool.h" +#include "AsgAnalysisInterfaces/IGoodRunsListSelectionTool.h" + +///Main tools implementing this interface: +/// CP::PileupReweightingTool (source code: PhysicsAnalysis/AnalysisCommon/PileupReweighting) + + + +class TH1; + +namespace CP { +class TPileupReweighting; + + class IPileupReweightingTool : virtual public CP::ISystematicsTool +{ + + ASG_TOOL_INTERFACE( CP::IPileupReweightingTool ) + + public: + + + /// Return combined pileup weight + virtual float getCombinedWeight( const xAOD::EventInfo& eventInfo ) = 0; + + /// Same as above, but for a 'custom weight' variable + virtual float getCombinedWeight( const xAOD::EventInfo& eventInfo,Double_t x, Double_t y=0. ) = 0; + + /// get combined weight (i.e. pileup weight) but with a 1./dataWeight factor applied, this if used for 'prescaling' MC + virtual float getCombinedWeight( const xAOD::EventInfo& eventInfo , const TString& trigger, bool mu_dependent=true ) = 0; + + /// When using UnrepresentedDataAction=2, you may want to apply this additional weight to ensure sum of weights are preserved + virtual float getUnrepresentedDataWeight( const xAOD::EventInfo& eventInfo ) = 0; + + /// Get the dataWeight used to 'unprescale' data collected from a given trigger combination. mu_dependency is recommended to be true + virtual float getDataWeight( const xAOD::EventInfo& eventInfo, const TString& trigger, bool mu_dependent=true ) = 0; + + /// Get a random run number for this MC event, mu_dependency is recommended ... jetetmiss seem to like it muchly + virtual int getRandomRunNumber( const xAOD::EventInfo& eventInfo , bool mu_dependent=true) = 0; + + /// Get the corrected average mu of a lumiblock ... (averaging is over all filled BCID in the fill) + /// The additional flag indicates if the returned value should include the data scale factor or not. + /// Note: if the lumiblock is not present in the input lumicalc file, then -1.0 will be returned + /// This method will soon be deprecated in favour of the new naming: getCorrectedAverageInteractionsPerCrossing + virtual float getCorrectedMu( const xAOD::EventInfo& eventInfo, bool includedDataScaleFactor=false ) { + return getCorrectedAverageInteractionsPerCrossing( eventInfo, includedDataScaleFactor ); + } + virtual float getCorrectedAverageInteractionsPerCrossing( const xAOD::EventInfo& eventInfo, bool includedDataScaleFactor=false ) = 0; + + /// Get the actual mu of a lumiblock ... (BCID-specific mu) + /// The additional flag indicates if the returned value should include the data scale factor or not. + /// Note: if the lumiblock is not present in the input lumicalc file, then -1.0 will be returned + virtual float getCorrectedActualInteractionsPerCrossing( const xAOD::EventInfo& eventInfo, bool includedDataScaleFactor=false ) = 0; + + /// Get the integrated lumi of a lumiblock (in pb-1) + virtual double getLumiBlockIntegratedLumi( const xAOD::EventInfo& eventInfo ) = 0; + + /// Decorates with: + /// MC: PileupWeight (CombinedWeight[*UnrepresentedDataWeight if action=2]), RandomRunNumber, RandomLumiBlockNumber, PRWHash + /// Data: corrected_averageInteractionsPerCrossing + /// mu_dependent says if the mu_dependency should be used for random run numbers or the data weights. You will get random run numbers of 0 for events with zero pileup weight + virtual StatusCode apply ( const xAOD::EventInfo& eventInfo, bool mu_dependent=true ) = 0; + + + /// return the prw hash used for fast updates of weights at the post-processing level ... see the share/makeWeightTree.C script for usage + virtual ULong64_t getPRWHash( const xAOD::EventInfo& eventInfo ) = 0; + + // methods that go straight to the underlying pileup tool + + /// Get a random lumiblock number for the given run number + virtual UInt_t GetRandomLumiBlockNumber(UInt_t runNumber) = 0; + + /// possible alternative to using the EventBookkeepers info ... assuming you made your PRW Config file!! + virtual Double_t GetSumOfEventWeights(Int_t channel) = 0; + virtual Double_t GetNumberOfEvents(Int_t channel) = 0; + + /// Get the integrated luminosity (in pb-1) between start and end run (inclusive) + virtual Double_t GetIntegratedLumi(UInt_t start, UInt_t end) = 0; + /// Total lumi (in pb-1) for a given trigger combination .. leave blank for the unprescaled + virtual Double_t GetIntegratedLumi(const TString& trigger="") = 0; + /** similar to above, but for only the given mcRunNumber/periodNumber */ + virtual Double_t GetIntegratedLumi(Int_t periodNumber, UInt_t start, UInt_t end) = 0; + /** return fraction of lumi assigned to periodNumber (or mcRunNumber) that is between start and end data run numbers*/ + virtual Double_t GetIntegratedLumiFraction(Int_t periodNumber, UInt_t start, UInt_t end) = 0; + /** return fraction of lumi assigned to periodNumber (or mcRunNumber) with given mu, that is between start and end data run numbers*/ + virtual Double_t GetIntegratedLumiFraction(Int_t periodNumber, Double_t mu, UInt_t start, UInt_t end) = 0; + + + /// use these methods when generating config files + virtual Int_t AddPeriod(Int_t periodNumber, UInt_t start, UInt_t end) = 0; + virtual Int_t SetBinning(Int_t nbinsx, Double_t* xbins, Int_t nbinsy=0, Double_t* ybins=0) = 0; + virtual Int_t SetUniformBinning(Int_t nbinsx, Double_t xlow, Double_t xup, Int_t nbinsy=0, Double_t ylow=0, Double_t yup=0) = 0; + virtual Int_t SetBinning(TH1* hist) = 0; + + /// Call this method once per event when in config file generating mode and you want standard mu reweighting + virtual int fill( const xAOD::EventInfo& eventInfo ) = 0; + + /// Use this method if you want to do a generic reweighting instead + virtual int fill( const xAOD::EventInfo& eventInfo, Double_t x, Double_t y=0.) = 0; + + + /// Get pointer to the underlying tool - expert use only: Will require #include "PileupReweighting/TPileupReweighting.h" + virtual CP::TPileupReweighting* expert() = 0; + + + }; + +} + + + +#endif diff --git a/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/selection.xml b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..62841f8bb07062370ef28e800472c671837aff5e --- /dev/null +++ b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/AsgAnalysisInterfaces/selection.xml @@ -0,0 +1,6 @@ +<lcgdict> + <namespace name="CP"/> + <class name="CP::IPileupReweightingTool" /> + <class name="IGoodRunsListSelectionTool" /> + <class name="IObservableTool" /> +</lcgdict> diff --git a/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/CMakeLists.txt b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..350dc8a1edff06e373409d499e93bc8ba14678e7 --- /dev/null +++ b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/CMakeLists.txt @@ -0,0 +1,28 @@ +# $Id: CMakeLists.txt 782748 2016-11-07 13:28:06Z will $ + +# The name of the package: +atlas_subdir( AsgAnalysisInterfaces ) + +# The dependencies of the package: +atlas_depends_on_subdirs( + PUBLIC + Control/AthToolSupport/AsgTools + Event/xAOD/xAODEventInfo + PhysicsAnalysis/AnalysisCommon/PATInterfaces ) + +# External(s): +find_package( ROOT COMPONENTS Core ) + +# Component(s) in the package: +atlas_add_library( AsgAnalysisInterfaces + AsgAnalysisInterfaces/*.h + INTERFACE + PUBLIC_HEADERS AsgAnalysisInterfaces + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODEventInfo PATInterfaces ) + +atlas_add_dictionary( AsgAnalysisInterfacesDict + AsgAnalysisInterfaces/AsgAnalysisInterfacesDict.h + AsgAnalysisInterfaces/selection.xml + LINK_LIBRARIES AsgAnalysisInterfaces ) + diff --git a/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/cmt/Makefile.RootCore b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/cmt/Makefile.RootCore new file mode 100644 index 0000000000000000000000000000000000000000..2aa2283a49c118c30aea9ad0ec69cb56c3e639aa --- /dev/null +++ b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/cmt/Makefile.RootCore @@ -0,0 +1,10 @@ +PACKAGE = AsgAnalysisInterfaces +PACKAGE_CXXFLAGS = +PACKAGE_LDFLAGS = +PACKAGE_PRELOAD = Hist +PACKAGE_DEP = AsgTools PATInterfaces xAODEventInfo +PACKAGE_REFLEX = 1 +PACKAGE_PEDANTIC = 1 +PACKAGE_NOCC = 1 + +include $(ROOTCOREDIR)/Makefile-common diff --git a/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/cmt/requirements b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/cmt/requirements new file mode 100644 index 0000000000000000000000000000000000000000..8c81617010f96ff07d633196f722511d55dc3cc2 --- /dev/null +++ b/PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces/cmt/requirements @@ -0,0 +1,19 @@ +package AsgAnalysisInterfaces + +author NLAA + +use AtlasPolicy AtlasPolicy-* + + +use AtlasROOT AtlasROOT-* External + + +use AsgTools AsgTools-* Control/AthToolSupport +use PATInterfaces PATInterfaces-* PhysicsAnalysis/AnalysisCommon +use xAODEventInfo xAODEventInfo-* Event/xAOD + +branches AsgAnalysisInterfaces + +use AtlasReflex AtlasReflex-* External +apply_pattern lcgdict dict=AsgAnalysisInterfaces selectionfile=selection.xml headerfiles="../AsgAnalysisInterfaces/AsgAnalysisInterfacesDict.h" +