A++ » INC » AtlHistFactoryTask

class AtlHistFactoryTask: public AtlTask


 Class for managing tasks associated with HistFactory

 Currently thre functions are implemented:

 - CreateTemplates()
   Used for creating all templates for fitting and for shape tests,
   respectively. All templates are saved in a file, one file
   per channel.
   For the fit templates, the channel discriminant will be used and the
   corresponding histograms are saved.
   For shape analysis, the DiscrimantRef and DiscriminantShape will be
   used. These have to be set defined for each channel separatly.

 - PerformShapeTests()
   Runs Chi2 and KS tests and save results in a dedicated file, one
   file per channel.

 - CreateWorkSpace()
   Creates the histfactory workspace and saves it to disk.

 A detailed example for the configuration can be found in
 $LIBSINGLETOP/tasks/task_sChannelAnalysis_HistFactory.C


 Author: Soeren Stamm <mailto: stamm@physik.hu-berlin.de>
 Update: $Id: AtlHistFactoryTask.cxx,v 1.31 2017/06/28 15:27:23 kaphle Exp $
 Copyright: 2015 (C) Soeren Stamm

Function Members (Methods)

public:
virtual~AtlHistFactoryTask()
virtual voidTTask::Abort()MENU
voidTObject::AbstractMethod(const char* method) const
virtual voidTTask::Add(TTask* task)
voidAtlTask::AddInputEntryLists(const char* InputFile)
voidAtlTask::AddInputFiles(const char* InputFiles)
virtual voidTObject::AppendPad(Option_t* option = "")
AtlHistFactoryTask(const AtlHistFactoryTask&)
AtlHistFactoryTask(const char* name, const char* title)
virtual voidTTask::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTTask::CleanTasks()
virtual voidTTask::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTTask::Continue()MENU
virtual voidTNamed::Copy(TObject& named) const
static voidAtlTask::CopyFolder(TDirectory* SrcDir, TDirectory* DestDir, Float_t scale)
virtual voidCreateGridRunScript()
virtual voidAtlTask::CreateJobHome()
voidAtlTask::CreateLogFilePath()
virtual voidCreateNAFBatchRunScript()
voidAtlTask::CreateOutFilePath()
virtual voidCreateRunScript(Option_t* option = "")
voidAtlTask::CreateRunScriptPath()
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidAtlTask::Exec(Option_t* option = "")
virtual Bool_tExecBatchJob(Option_t* option)
virtual voidExecGridJob(Option_t* option)
virtual voidExecInteractiveJob(Option_t* option)
virtual voidExecNAFBatchJob(Option_t* option)
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidAtlTask::ExecuteTask(Option_t* option = "")MENU
virtual voidTTask::ExecuteTasks(Option_t* option)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
Bool_tAtlTask::GetBatchJob()
Bool_tAtlTask::GetBatchNodeAll()
Bool_tAtlTask::GetBatchNodeAutomatic()
Char_tAtlTask::GetBatchNodeFromPath(const char* path)
Int_tTTask::GetBreakin() const
Int_tTTask::GetBreakout() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
Bool_tAtlTask::GetGridJob()
virtual const char*TObject::GetIconName() const
Bool_tAtlTask::GetInteractiveJob()
TList*TTask::GetListOfTasks() const
Bool_tAtlTask::GetLogFile()
Bool_tAtlTask::GetNAFBatchJob()
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidInitialize()
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
Bool_tTTask::IsActive() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTTask::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTTask::ls(Option_t* option = "*") constMENU
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
AtlHistFactoryTask&operator=(const AtlHistFactoryTask&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTTask::SetActive(Bool_t active = kTRUE)TOGGLE
virtual voidAtlTask::SetBatchJob(Bool_t BatchJob)TOGGLE
voidAtlTask::SetBatchNode(const char* BatchNode)MENU
voidAtlTask::SetBatchNodeAll(Bool_t BatchNodeAll)TOGGLE
voidAtlTask::SetBatchNodeAutomatic(Bool_t BatchNodeAutomatic)TOGGLE
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidTTask::SetBreakin(Int_t breakin = 1)TOGGLE
voidTTask::SetBreakout(Int_t breakout = 1)TOGGLE
voidAtlTask::SetDebug(Int_t level)
voidAtlTask::SetDebugBuild(Int_t level)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidAtlTask::SetFirstEntry(Int_t FirstEntry)MENU
voidAtlTask::SetGridCmtVersion(const char* CmtVersion)MENU
virtual voidAtlTask::SetGridJob(Bool_t GridJob)TOGGLE
voidAtlTask::SetGridRootVersion(const char* RootVersion)MENU
voidAtlTask::SetGridSuffix(const char* suffix)MENU
voidAtlTask::SetGridUserName(const char* UserName)MENU
virtual voidAtlTask::SetInteractiveJob(Bool_t InteractiveJob)TOGGLE
voidAtlTask::SetJobHome(const char* JobHome)MENU
voidAtlTask::SetLogFile(Bool_t LogFile)TOGGLE
voidSetMeasurement(AtlHistFactoryMeasurement* meas)
virtual voidAtlTask::SetNAFBatchJob(Bool_t NAFBatchJob)TOGGLE
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
voidAtlTask::SetNEvents(Int_t NEvents)MENU
static voidTObject::SetObjectStat(Bool_t stat)
voidAtlTask::SetOutputFile(const char* OutputFile)
voidAtlTask::SetOutputTree(const char* name, const char* title)MENU
voidSetRunMode(AtlHistFactoryTask::ERunMode mode)
voidAtlTask::SetTempOutputFile(const char* OutputFile)
voidAtlTask::SetTempOutputPath(const char* OutputPath)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp) const
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual Bool_tAtlTask::SubmitBatchJob()
virtual voidAtlTask::SubmitGridJob()
virtual voidAtlTask::SubmitNAFBatchJob()
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
virtual Bool_tAtlTask::WriteEnvSetup(ofstream& out) const
protected:
voidCreatePullPlots(const char* ws_filename, const char* ws_name, const char* data_name)
voidCreateTemplates()
voidCreateWorkspace()
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidExportPullPlots(const char* outfile, TH1* h_pulls, TH1* h_pulls_err_up, TH1* h_pulls_err_down, TH1* h_prefit_impact_up, TH1* h_prefit_impact_down, TH1* h_postfit_impact_up, TH1* h_postfit_impact_down)
voidExportRateUncertainties()
voidFitModel()
TString*GetDirectoryName(const char* name)
Double_tGetGammaUncertainty(const char* name, RooWorkspace* wSpace)
voidGetImpactOnPOI(RooWorkspace* wSpace, const char* data_name, const char* snapshot, RooRealVar* par, const char* poi_name, Double_t variation, TH1F* hresult, const char* logdir)
Double_tGetNormUncertainty(const char* name)
voidGetShapeTemplatesFileName(const char* channel, TString& filename)
TString*GetSystematicName(const char* par_name)
voidGetTemplatesFileName(const char* channel, TString& filename)
Bool_tIsNormParameter(const char* name)
voidTObject::MakeZombie()
TList*MergeListOfSystematics(TList* ch_systs, TList* sample_systs)
voidPerformShapeTests()
voidRunFit(const char* ws_filename, const char* ws_name, const char* data_name)
voidRunLimit()

Data Members

public:
static TObject::(anonymous)TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static AtlHistFactoryTask::ERunModekCreateFitTemplates
static AtlHistFactoryTask::ERunModekCreateShapeTemplates
static AtlHistFactoryTask::ERunModekCreateWorkspace
static AtlHistFactoryTask::ERunModekFitModel
static TObject::EStatusBitsTObject::kHasUUID
static AtlHistFactoryTask::ERunModekHypoTestLimit
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::(anonymous)TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::(anonymous)TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::(anonymous)TObject::kOverwrite
static AtlHistFactoryTask::ERunModekPerformShapeTests
static AtlHistFactoryTask::ERunModekRateTable
static TObject::(anonymous)TObject::kSingleKey
static AtlHistFactoryTask::ERunModekUnknown
static TObject::(anonymous)TObject::kWriteDelete
static TObject::(anonymous)TObject::kZombie
protected:
Bool_tTTask::fActivetrue if task is active
Bool_tAtlTask::fBatchJobBatch job execution
TStringAtlTask::fBatchNodeNode on which to run the job
Bool_tAtlTask::fBatchNodeAllSubmit batch job to all nodes
Bool_tAtlTask::fBatchNodeAutomaticSubmit batch job to node automatically set
Int_tTTask::fBreakin=1 if a break point set at task extry
Int_tTTask::fBreakout=1 if a break point set at task exit
Int_tAtlTask::fDebugDebug flag for derived tasks
Int_tAtlTask::fDebugBuildDebug flag for derived tasks (during build)
Long64_tAtlTask::fFirstEntrySkip FirstEntry-1 events
TString*AtlTask::fGridCmtVersionCmt version for Grid submission
Bool_tAtlTask::fGridJobGrid job execution
TString*AtlTask::fGridRootVersionRoot version for Grid submission
TString*AtlTask::fGridSuffixSuffix for grid dataset names
TString*AtlTask::fGridUserNameGrid user name
Bool_tTTask::fHasExecutedTrue if task has executed
TString*fHistFactoryDir
TList*AtlTask::fInputEntryListsInput entry lists file names
TList*AtlTask::fInputFilesInput file names
Bool_tAtlTask::fInteractiveJobInteractive job execution
Bool_tAtlTask::fIsTestIs test job ?
TString*AtlTask::fJobHomeJob working directory
Bool_tAtlTask::fLogFileWrite output to logfile
TString*AtlTask::fLogFilePathLogfile path
AtlHistFactoryMeasurement*fMeasurement
Bool_tAtlTask::fNAFBatchJobNAF Batch job execution
Long64_tAtlTask::fNEventsNo. of events to process
Int_tfNPullsPerPadMax. number of pulls per pad
TStringTNamed::fNameobject identifier
Char_tAtlTask::fNodeNode on which to run the jpb
TStringTTask::fOptionOption specified in ExecuteTask
TString*AtlTask::fOutputFileNameName of the output file
TNamed*AtlTask::fOutputTreeNameName and title of the output tree (if any)
Double_tfPullScaleFactorScale factor between pull x-axis and impact on poi x-axis
AtlHistFactoryTask::ERunModefRunMode
TString*AtlTask::fRunScriptRunscript path
TString*fSchemeName of plotting scheme
TList*TTask::fTasksList of Tasks
TString*AtlTask::fTempLogFilePathTemporarily logfile path
TString*AtlTask::fTempOutputFileNameTemporarily output file name
TString*AtlTask::fTempOutputPathTemporarily output path (must start with "/")
TString*fTemplateDir
TStringTNamed::fTitleobject title
static TTask*TTask::fgBeginTaskpointer to task initiator
static TTask*TTask::fgBreakPointpointer to current break point

Class Charts

Inheritance Chart:
TObject
TNamed
TTask
AtlTask
AtlHistFactoryTask
AtlHistFactoryBreakdownEntry
AtlHistFactoryPlotterTask
AtlHistFactoryYieldTableTask

Function documentation

AtlHistFactoryTask(const char* name, const char* title)
 Default constructor

~AtlHistFactoryTask()
 Default destructor

void ExecInteractiveJob(Option_t* option)
 Exec interactive job

void ExecGridJob(Option_t* option)
 Exec grid job

Bool_t ExecBatchJob(Option_t* option)
 Exec batch job

void CreateRunScript(Option_t* option = "")
 Create Run Script

void ExecNAFBatchJob(Option_t* option)
 Exec NAF batch job

void CreateNAFBatchRunScript()
 Create NAF Batch Run Script

void CreateGridRunScript()
 Create Grid Run Script

void Initialize()
 Initialize HistFactory Task
 - check if measurement is set
 - set directories used by AtlTask

void CreateTemplates()
 Create templates for given measurement

void SetRunMode(AtlHistFactoryTask::ERunMode mode)
 Turn on/off creation of templates

void PerformShapeTests()
 Create templates for given measurement

void CreateWorkspace()
 Create RooStats workspace using HistFactory

void FitModel()
 Fit Model

void RunFit(const char* ws_filename, const char* ws_name, const char* data_name)
 Fit model saved in workspace

 Create log directory
void CreatePullPlots(const char* ws_filename, const char* ws_name, const char* data_name)
 Create pull plots for given workspace

 Create log directory
void GetImpactOnPOI(RooWorkspace* wSpace, const char* data_name, const char* snapshot, RooRealVar* par, const char* poi_name, Double_t variation, TH1F* hresult, const char* logdir)
 Get Impact on POI for given NP and store the result in the
 given histogram.

 ToDo:
 - Load snapshot beforehand and just provide pdf and parameter?
   maybe model?
 - Asymmetric errors
void GetTemplatesFileName(const char* channel, TString& filename)
 Get the name of the file holding all templates for this channel

void GetShapeTemplatesFileName(const char* channel, TString& filename)
 The name of the file holding all shape templates for this channel

TList* MergeListOfSystematics(TList* ch_systs, TList* sample_systs)
 Helper function to merge channel and sample systematics

 First create a new list from the ch_systs.
 If two systematics with the same name exist in both lists:
 - remove the systematic from the newly created list
 - then append all systematics from the second list to the newly
   created list

 The user has to take care of deleting the new list.

void ExportRateUncertainties()
 Export latex table with list of all rate uncertainties

Double_t GetNormUncertainty(const char* name)
 Get the normalization uncertainty associated to this parameter

TString* GetSystematicName(const char* par_name)
 Get the systematic name for the given parameter name

void ExportPullPlots(const char* outfile, TH1* h_pulls, TH1* h_pulls_err_up, TH1* h_pulls_err_down, TH1* h_prefit_impact_up, TH1* h_prefit_impact_down, TH1* h_postfit_impact_up, TH1* h_postfit_impact_down)
 Export pull plots to pdf

 Compute number of Pads needed for all pulls
void RunLimit()
 Run Hypothesis Test:
  - Signal Hypothesis vs. Background only Hypothesis

 Modified version of $ROOTSYS/tutorials/roostats/StandardHypoTestDemo.C

Double_t GetGammaUncertainty(const char* name, RooWorkspace* wSpace)
 Get the uncertainty associated to this parameter

 Assuming gamma has a gaussian constraint
 That's a nasty way of getting the sigma parameter
 of the gamma parameters, is there any other way?
TString* GetDirectoryName(const char* name)
 Return the name to a directory within the common output
 directory.
 If a directory with this name does not yet exist, it will
 be created.

 The user is responsible for deleting the returned pointer.

Bool_t IsNormParameter(const char* name)
 Is norm parameter

AtlHistFactoryTask(const char* name, const char* title)
void SetMeasurement(AtlHistFactoryMeasurement* meas)
{ fMeasurement = meas; }