// @(#)root/roostats:$Id: cranmer $ // Author: Kyle Cranmer, Akira Shibata /************************************************************************* * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOSTATS_HISTOTOWORKSPACEFACTORYFAST #define ROOSTATS_HISTOTOWORKSPACEFACTORYFAST #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "RooStats/HistFactory/Systematics.h" class ParamHistFunc; namespace RooStats{ namespace HistFactory{ // Forward Declarations FTW class Measurement; class Channel; class Sample; class HistoToWorkspaceFactoryFast: public TObject { public: HistoToWorkspaceFactoryFast(); HistoToWorkspaceFactoryFast( RooStats::HistFactory::Measurement& Meas ); virtual ~HistoToWorkspaceFactoryFast(); static void ConfigureWorkspaceForMeasurement( const std::string& ModelName, RooWorkspace* ws_single, Measurement& measurement ); RooWorkspace* MakeSingleChannelModel( Measurement& measurement, Channel& channel ); RooWorkspace* MakeCombinedModel(std::vector, std::vector); static RooWorkspace* MakeCombinedModel( Measurement& measurement ); static void PrintCovarianceMatrix(RooFitResult* result, RooArgSet* params, std::string filename); void SetFunctionsToPreprocess(std::vector lines) { fPreprocessFunctions=lines; } protected: void AddEfficiencyTerms(RooWorkspace* proto, std::string prefix, std::string interpName, std::vector& systList, std::vector& likelihoodTermNames, std::vector& totSystTermNames); std::string AddNormFactor(RooWorkspace* proto, std::string& channel, std::string& sigmaEpsilon, Sample& sample, bool doRatio); void AddMultiVarGaussConstraint(RooWorkspace* proto, std::string prefix, int lowBin, int highBin, std::vector& likelihoodTermNames); void AddPoissonTerms(RooWorkspace* proto, std::string prefix, std::string obsPrefix, std::string expPrefix, int lowBin, int highBin, std::vector& likelihoodTermNames); static void EditSyst(RooWorkspace* proto, const char* pdfNameChar, std::map gammaSyst, std::map uniformSyst, std::map logNormSyst, std::map noSyst); void LinInterpWithConstraint(RooWorkspace* proto, TH1* nominal, std::vector, std::string prefix, std::string productPrefix, std::string systTerm, std::vector& likelihoodTermNames); RooWorkspace* MakeSingleChannelWorkspace(Measurement& measurement, Channel& channel); void MakeTotalExpected(RooWorkspace* proto, std::string totName, std::vector& syst_x_expectedPrefixNames, std::vector& normByNames); RooDataSet* MergeDataSets(RooWorkspace* combined, std::vector wspace_vec, std::vector channel_names, std::string dataSetName, RooArgList obsList, RooCategory* channelCat); void ProcessExpectedHisto(TH1* hist, RooWorkspace* proto, std::string prefix, std::string productPrefix, std::string systTerm ); void SetObsToExpected(RooWorkspace* proto, std::string obsPrefix, std::string expPrefix, int lowBin, int highBin); TH1* MakeScaledUncertaintyHist(const std::string& Name, std::vector< std::pair > HistVec ); TH1* MakeAbsolUncertaintyHist( const std::string& Name, const TH1* Hist ); RooArgList createStatConstraintTerms( RooWorkspace* proto, std::vector& constraintTerms, ParamHistFunc& paramHist, TH1* uncertHist, Constraint::Type type, Double_t minSigma ); void ConfigureHistFactoryDataset(RooDataSet* obsData, TH1* nominal, RooWorkspace* proto, std::vector obsNameVec); std::vector fSystToFix; std::map fParamValues; double fNomLumi; double fLumiError; int fLowBin; int fHighBin; private: void GuessObsNameVec(TH1* hist); std::vector fObsNameVec; std::string fObsName; std::vector fPreprocessFunctions; ClassDef(RooStats::HistFactory::HistoToWorkspaceFactoryFast,3) }; } } #endif