Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
Common.cxx
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Authors:
4 * Jonas Rembser, CERN 01/2022
5 *
6 * Copyright (c) 2022, CERN
7 *
8 * Redistribution and use in source and binary forms,
9 * with or without modification, are permitted according to the terms
10 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
11 */
12
13#include <RooFit/Common.h>
14
15#include <TSystem.h>
16
17namespace RooFit {
18
19////////////////////////////////////////////////////////////////////////////////
20/// Returns the path to the directory that should be used for temporary RooFit
21/// files (e.g. for testing). The returned path includes the trailing
22/// backslash. The first time this function is called, it will check if the
23/// directory exists and create it if it doesn't.
24std::string const &tmpPath()
25{
26 static const std::string dir{"/tmp/roofit/"};
27
28 // The first time this function is used, we will attempt to create the
29 // directory if it doesn't exist yet.
30 static bool isFirstCall = true;
31 if (isFirstCall) {
32 gSystem->Exec((std::string("mkdir -p ") + dir).c_str());
33 isFirstCall = false;
34 }
35
36 return dir;
37}
38
39} // namespace RooFit
R__EXTERN TSystem * gSystem
Definition TSystem.h:560
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition TSystem.cxx:656
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition Common.h:18
std::string const & tmpPath()
Returns the path to the directory that should be used for temporary RooFit files (e....
Definition Common.cxx:24