Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
Measurement.cxx
Go to the documentation of this file.
1// @(#)root/roostats:$Id$
2// Author: Kyle Cranmer, George Lewis
3/*************************************************************************
4 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11/** \class RooStats::HistFactory::Measurement
12 * \ingroup HistFactory
13The RooStats::HistFactory::Measurement class can be used to construct a model
14by combining multiple RooStats::HistFactory::Channel objects. It also allows
15to set some general properties like the integrated luminosity, its relative
16uncertainty or the functional form of constraints on nuisance parameters.
17*/
18
19
22
23#include "HFMsgService.h"
24
25#include <TFile.h>
26#include <TSystem.h>
27#include <TTimeStamp.h>
28
29#include <ctime>
30#include <iostream>
31#include <algorithm>
32#include <sys/stat.h>
33
34
35using namespace std;
36
38
39/// Standard constructor
41 fPOI(), fLumi( 1.0 ), fLumiRelErr( .10 ),
42 fBinLow( 0 ), fBinHigh( 1 ), fExportOnly( false )
43{
44
45}
46
47/*
48RooStats::HistFactory::Measurement::Measurement(const Measurement& other) :
49 POI( other.POI ), Lumi( other.Lumi ), LumiRelErr( other.LumiRelErr ),
50 BinLow( other.BinLow ), BinHigh( other.BinHigh ), ExportOnly( other.ExportOnly ),
51 channels( other.channels ), OutputFilePrefix( other.outputFilePrefix ),
52 constantParams( other.constantParams ), { ; }
53*/
54
55/// Standard constructor specifying name and title of measurement
56RooStats::HistFactory::Measurement::Measurement(const char* Name, const char* Title) :
57 TNamed( Name, Title ),
58 fPOI(), fLumi( 1.0 ), fLumiRelErr( .10 ),
59 fBinLow( 0 ), fBinHigh( 1 ), fExportOnly( false )
60{
61
62}
63
64
65/// Set a parameter in the model to be constant.
66/// the parameter does not have to exist yet, the information will be used when
67/// the model is actually created.
68///
69/// Also checks if the parameter is already set constant.
70/// We don't need to set it constant twice,
71/// and we issue a warning in case this is a hint
72/// of a possible bug
74{
75
76
77 if( std::find(fConstantParams.begin(), fConstantParams.end(), param) != fConstantParams.end() ) {
78 cxcoutWHF << "Warning: Setting parameter: " << param
79 << " to constant, but it is already listed as constant. "
80 << "You may ignore this warning."
81 << std::endl;
82 return;
83 }
84
85 fConstantParams.push_back( param );
86
87}
88
89
90/// Set parameter of the model to given value
91void RooStats::HistFactory::Measurement::SetParamValue( const std::string& param, double value )
92{
93 // Check if this parameter is already set to a value
94 // If so, issue a warning
95 // (Not sure if we want to throw an exception here, or
96 // issue a warning and move along. Thoughts?)
97 if( fParamValues.find(param) != fParamValues.end() ) {
98 cxcoutWHF << "Warning: Chainging parameter: " << param
99 << " value from: " << fParamValues[param]
100 << " to: " << value
101 << std::endl;
102 }
103
104 // Store the parameter and its value
105 cxcoutIHF << "Setting parameter: " << param
106 << " value to " << value
107 << std::endl;
108
109 fParamValues[param] = value;
110
111}
112
113
114/// Add a preprocessed function by giving the function a name,
115/// a functional expression, and a string with a bracketed list of dependencies (eg "SigXsecOverSM[0,3]")
116void RooStats::HistFactory::Measurement::AddPreprocessFunction( std::string name, std::string expression, std::string dependencies )
117{
118
119
120 PreprocessFunction func(name, expression, dependencies);
121 AddFunctionObject(func);
122
123}
124
125/// Returns a list of defined preprocess function expressions
127{
128
129
130 std::vector<std::string> PreprocessFunctionExpressions;
131 for( unsigned int i = 0; i < fFunctionObjects.size(); ++i ) {
132 std::string expression = fFunctionObjects.at(i).GetCommand();
133 PreprocessFunctionExpressions.push_back( expression );
134 }
135 return PreprocessFunctionExpressions;
136}
137
138/// Set constraint term for given systematic to Gamma distribution
139void RooStats::HistFactory::Measurement::AddGammaSyst(std::string syst, double uncert)
140{
141 fGammaSyst[syst] = uncert;
142}
143
144/// Set constraint term for given systematic to LogNormal distribution
145void RooStats::HistFactory::Measurement::AddLogNormSyst(std::string syst, double uncert)
146{
147 fLogNormSyst[syst] = uncert;
148}
149
150/// Set constraint term for given systematic to uniform distribution
152{
153 fUniformSyst[syst] = 1.0; // Is this parameter simply a dummy?
154}
155
156/// Define given systematics to have no external constraint
158{
159 fNoSyst[syst] = 1.0; // dummy value
160}
161
162/// Check if the given channel is part of this measurement
164{
165
166
167 for( unsigned int i = 0; i < fChannels.size(); ++i ) {
168
169 Channel& chan = fChannels.at(i);
170 if( chan.GetName() == ChanName ) {
171 return true;
172 }
173
174 }
175
176 return false;
177
178}
179
180
181/// Get channel with given name from this measurement
182/// throws an exception in case the channel is not found
184{
185 for( unsigned int i = 0; i < fChannels.size(); ++i ) {
186
187 Channel& chan = fChannels.at(i);
188 if( chan.GetName() == ChanName ) {
189 return chan;
190 }
191
192 }
193
194 // If we get here, we didn't find the channel
195
196 cxcoutEHF << "Error: Did not find channel: " << ChanName
197 << " in measurement: " << GetName() << std::endl;
198 throw hf_exc();
199
200 // No Need to return after throwing exception
201 // return RooStats::HistFactory::BadChannel;
202
203
204}
205
206/*
207 void RooStats::HistFactory::Measurement::Print( Option_t* option ) const {
208 RooStats::HistFactory::Measurement::Print( std::cout );
209 return;
210 }
211*/
212
213/// Print information about measurement object in tree-like structure to given stream
215{
216
217
218 stream << "Measurement Name: " << GetName()
219 << "\t OutputFilePrefix: " << fOutputFilePrefix
220 << "\t POI: ";
221 for(unsigned int i = 0; i < fPOI.size(); ++i) {
222 stream << fPOI.at(i);
223 }
224 stream << "\t Lumi: " << fLumi
225 << "\t LumiRelErr: " << fLumiRelErr
226 << "\t BinLow: " << fBinLow
227 << "\t BinHigh: " << fBinHigh
228 << "\t ExportOnly: " << fExportOnly
229 << std::endl;
230
231
232 if( !fConstantParams.empty() ) {
233 stream << "Constant Params: ";
234 for( unsigned int i = 0; i < fConstantParams.size(); ++i ) {
235 stream << " " << fConstantParams.at(i);
236 }
237 stream << std::endl;
238 }
239
240 if( !fFunctionObjects.empty() ) {
241 stream << "Preprocess Functions: ";
242 for( unsigned int i = 0; i < fFunctionObjects.size(); ++i ) {
243 stream << " " << fFunctionObjects.at(i).GetCommand();
244 }
245 stream << std::endl;
246 }
247
248 if( !fChannels.empty() ) {
249 stream << "Channels:" << std::endl;
250 for( unsigned int i = 0; i < fChannels.size(); ++i ) {
251 fChannels.at(i).Print( stream );
252 }
253 }
254
255 cxcoutIHF << "End Measurement: " << GetName() << std::endl;
256
257}
258
259
260/// Create XML files for this measurement in the given directory.
261/// XML files can be configured with a different output prefix
262/// Create an XML file for this measurement
263/// First, create the XML driver
264/// Then, create xml files for each channel
265void RooStats::HistFactory::Measurement::PrintXML( std::string directory, std::string newOutputPrefix )
266{
267 // First, check that the directory exists:
268 auto testExists = [](const std::string& theDirectory) {
269 void* dir = gSystem->OpenDirectory(theDirectory.c_str());
270 bool exists = dir != nullptr;
271 if (exists)
273
274 return exists;
275 };
276
277 if ( !directory.empty() && !testExists(directory) ) {
278 int success = gSystem->MakeDirectory(directory.c_str() );
279 if( success != 0 ) {
280 cxcoutEHF << "Error: Failed to make directory: " << directory << std::endl;
281 throw hf_exc();
282 }
283 }
284
285 // If supplied new Prefix, use that one:
286
287 cxcoutPHF << "Printing XML Files for measurement: " << GetName() << std::endl;
288
289 std::string XMLName = std::string(GetName()) + ".xml";
290 if( directory != "" ) XMLName = directory + "/" + XMLName;
291
292 ofstream xml( XMLName.c_str() );
293
294 if( ! xml.is_open() ) {
295 cxcoutEHF << "Error opening xml file: " << XMLName << std::endl;
296 throw hf_exc();
297 }
298
299
300 // Add the time
301 xml << "<!--" << std::endl;
302 xml << "This xml file created automatically on: " << std::endl;
303/*
304 time_t t = time(0); // get time now
305 struct tm * now = localtime( &t );
306 xml << (now->tm_year + 1900) << '-'
307 << (now->tm_mon + 1) << '-'
308 << now->tm_mday
309 << std::endl;
310*/
311 // LM: use TTimeStamp
312 TTimeStamp t;
313 UInt_t year = 0;
314 UInt_t month = 0;
315 UInt_t day = 0;
316 t.GetDate(true, 0, &year, &month, &day);
317 xml << year << '-'
318 << month << '-'
319 << day
320 << std::endl;
321
322 xml << "-->" << std::endl;
323
324 // Add the doctype
325 xml << "<!DOCTYPE Combination SYSTEM 'HistFactorySchema.dtd'>" << std::endl << std::endl;
326
327 // Add the combination name
328 if (newOutputPrefix.empty() ) newOutputPrefix = fOutputFilePrefix;
329 xml << "<Combination OutputFilePrefix=\"" << newOutputPrefix /*OutputFilePrefix*/ << "\" >" << std::endl << std::endl;
330
331 // Add the Preprocessed Functions
332 for( unsigned int i = 0; i < fFunctionObjects.size(); ++i ) {
333 RooStats::HistFactory::PreprocessFunction func = fFunctionObjects.at(i);
334 func.PrintXML(xml);
335 /*
336 xml << "<Function Name=\"" << func.GetName() << "\" "
337 << "Expression=\"" << func.GetExpression() << "\" "
338 << "Dependents=\"" << func.GetDependents() << "\" "
339 << "/>" << std::endl;
340 */
341 }
342
343 xml << std::endl;
344
345 // Add the list of channels
346 for( unsigned int i = 0; i < fChannels.size(); ++i ) {
347 xml << " <Input>" << "./";
348 if (!directory.empty() ) xml << directory << "/";
349 xml << GetName() << "_" << fChannels.at(i).GetName() << ".xml" << "</Input>" << std::endl;
350 }
351
352 xml << std::endl;
353
354 // Open the Measurement, Set Lumi
355 xml << " <Measurement Name=\"" << GetName() << "\" "
356 << "Lumi=\"" << fLumi << "\" "
357 << "LumiRelErr=\"" << fLumiRelErr << "\" "
358 //<< "BinLow=\"" << fBinLow << "\" "
359 // << "BinHigh=\"" << fBinHigh << "\" "
360 << "ExportOnly=\"" << (fExportOnly ? std::string("True") : std::string("False")) << "\" "
361 << " >" << std::endl;
362
363
364 // Set the POI
365 xml << " <POI>" ;
366 for(unsigned int i = 0; i < fPOI.size(); ++i) {
367 if(i==0) xml << fPOI.at(i);
368 else xml << " " << fPOI.at(i);
369 }
370 xml << "</POI> " << std::endl;
371
372 // Set the Constant Parameters
373 if(fConstantParams.size()) {
374 xml << " <ParamSetting Const=\"True\">";
375 for( unsigned int i = 0; i < fConstantParams.size(); ++i ) {
376 if (i==0) xml << fConstantParams.at(i);
377 else xml << " " << fConstantParams.at(i);;
378 }
379 xml << "</ParamSetting>" << std::endl;
380 }
381
382 // Set the Parameters with new Constraint Terms
383 std::map<std::string, double>::iterator ConstrItr;
384
385 // Gamma
386 for( ConstrItr = fGammaSyst.begin(); ConstrItr != fGammaSyst.end(); ++ConstrItr ) {
387 xml << "<ConstraintTerm Type=\"Gamma\" RelativeUncertainty=\""
388 << ConstrItr->second << "\">" << ConstrItr->first
389 << "</ConstraintTerm>" << std::endl;
390 }
391 // Uniform
392 for( ConstrItr = fUniformSyst.begin(); ConstrItr != fUniformSyst.end(); ++ConstrItr ) {
393 xml << "<ConstraintTerm Type=\"Uniform\" RelativeUncertainty=\""
394 << ConstrItr->second << "\">" << ConstrItr->first
395 << "</ConstraintTerm>" << std::endl;
396 }
397 // LogNormal
398 for( ConstrItr = fLogNormSyst.begin(); ConstrItr != fLogNormSyst.end(); ++ConstrItr ) {
399 xml << "<ConstraintTerm Type=\"LogNormal\" RelativeUncertainty=\""
400 << ConstrItr->second << "\">" << ConstrItr->first
401 << "</ConstraintTerm>" << std::endl;
402 }
403 // NoSyst
404 for( ConstrItr = fNoSyst.begin(); ConstrItr != fNoSyst.end(); ++ConstrItr ) {
405 xml << "<ConstraintTerm Type=\"NoSyst\" RelativeUncertainty=\""
406 << ConstrItr->second << "\">" << ConstrItr->first
407 << "</ConstraintTerm>" << std::endl;
408 }
409
410
411 // Close the Measurement
412 xml << " </Measurement> " << std::endl << std::endl;
413
414 // Close the combination
415 xml << "</Combination>" << std::endl;
416
417 xml.close();
418
419 // Now, make the xml files
420 // for the individual channels:
421
422 std::string prefix = std::string(GetName()) + "_";
423
424 for( unsigned int i = 0; i < fChannels.size(); ++i ) {
425 fChannels.at(i).PrintXML( directory, prefix );
426 }
427
428
429 cxcoutPHF << "Finished printing XML files" << std::endl;
430
431}
432
433
434/// A measurement, once fully configured, can be saved into a ROOT
435/// file. This will persitify the Measurement object, along with any
436/// channels and samples that have been added to it. It can then be
437/// loaded, potentially modified, and used to create new models.
438///
439/// Write every histogram to the file.
440/// Edit the measurement to point to this file
441/// and to point to each histogram in this file
442/// Then write the measurement itself.
444{
445
446 // Create a tempory measurement
447 // (This is the one that is actually written)
448 RooStats::HistFactory::Measurement outMeas( *this );
449
450 std::string OutputFileName = file->GetName();
451
452 // Collect all histograms from file:
453 // HistCollector collector;
454
455
456 for( unsigned int chanItr = 0; chanItr < outMeas.fChannels.size(); ++chanItr ) {
457
458 // Go to the main directory
459 // in the file
460 file->cd();
461 file->Flush();
462
463 // Get the name of the channel:
464 RooStats::HistFactory::Channel& channel = outMeas.fChannels.at( chanItr );
465 std::string chanName = channel.GetName();
466
467
468 if( ! channel.CheckHistograms() ) {
469 cxcoutEHF << "Measurement.writeToFile(): Channel: " << chanName
470 << " has uninitialized histogram pointers" << std::endl;
471 throw hf_exc();
472 return;
473 }
474
475 // Get and cache the histograms for this channel:
476 //collector.CollectHistograms( channel );
477 // Do I need this...?
478 // channel.CollectHistograms();
479
480 // Make a directory to store the histograms
481 // for this channel
482
483 TDirectory* chanDir = file->mkdir( (chanName + "_hists").c_str() );
484 if( chanDir == nullptr ) {
485 cxcoutEHF << "Error: Cannot create channel " << (chanName + "_hists")
486 << std::endl;
487 throw hf_exc();
488 }
489 chanDir->cd();
490
491 // Save the data:
492 TDirectory* dataDir = chanDir->mkdir( "data" );
493 if( dataDir == nullptr ) {
494 cxcoutEHF << "Error: Cannot make directory " << chanDir << std::endl;
495 throw hf_exc();
496 }
497 dataDir->cd();
498
499 channel.fData.writeToFile( OutputFileName, GetDirPath(dataDir) );
500
501 /*
502 // Write the data file to this directory
503 TH1* hData = channel.data.GetHisto();
504 hData->Write();
505
506 // Set the location of the data
507 // in the output measurement
508
509 channel.data.InputFile = OutputFileName;
510 channel.data.HistoName = hData->GetName();
511 channel.data.HistoPath = GetDirPath( dataDir );
512 */
513
514 // Loop over samples:
515
516 for( unsigned int sampItr = 0; sampItr < channel.GetSamples().size(); ++sampItr ) {
517
518 RooStats::HistFactory::Sample& sample = channel.GetSamples().at( sampItr );
519 std::string sampName = sample.GetName();
520
521 cxcoutPHF << "Writing sample: " << sampName << std::endl;
522
523 file->cd();
524 chanDir->cd();
525 TDirectory* sampleDir = chanDir->mkdir( sampName.c_str() );
526 if( sampleDir == nullptr ) {
527 cxcoutEHF << "Error: Directory " << sampName << " not created properly" << std::endl;
528 throw hf_exc();
529 }
530 std::string sampleDirPath = GetDirPath( sampleDir );
531
532 if( ! sampleDir ) {
533 cxcoutEHF << "Error making directory: " << sampName
534 << " in directory: " << chanName
535 << std::endl;
536 throw hf_exc();
537 }
538
539 // Write the data file to this directory
540 sampleDir->cd();
541
542 sample.writeToFile( OutputFileName, sampleDirPath );
543 /*
544 TH1* hSample = sample.GetHisto();
545 if( ! hSample ) {
546 std::cout << "Error getting histogram for sample: "
547 << sampName << std::endl;
548 throw -1;
549 }
550 sampleDir->cd();
551 hSample->Write();
552
553 sample.InputFile = OutputFileName;
554 sample.HistoName = hSample->GetName();
555 sample.HistoPath = sampleDirPath;
556 */
557
558 // Write the histograms associated with
559 // systematics
560
561 /* THIS IS WHAT I"M COMMENTING
562 sample.GetStatError().writeToFile( OutputFileName, sampleDirPath );
563
564 // Must write all systematics that contain internal histograms
565 // (This is not all systematics)
566
567 for( unsigned int i = 0; i < sample.GetHistoSysList().size(); ++i ) {
568 sample.GetHistoSysList().at(i).writeToFile( OutputFileName, sampleDirPath );
569 }
570 for( unsigned int i = 0; i < sample.GetHistoFactorList().size(); ++i ) {
571 sample.GetHistoFactorList().at(i).writeToFile( OutputFileName, sampleDirPath );
572 }
573 for( unsigned int i = 0; i < sample.GetShapeSysList().size(); ++i ) {
574 sample.GetShapeSysList().at(i).writeToFile( OutputFileName, sampleDirPath );
575 }
576 END COMMENT */
577 /*
578 sample.statError.writeToFile( OutputFileName, sampleDirPath );
579
580 // Now, get the Stat config histograms
581 if( sample.statError.HistoName != "" ) {
582 TH1* hStatError = sample.statError.GetErrorHist();
583 if( ! hStatError ) {
584 std::cout << "Error getting stat error histogram for sample: "
585 << sampName << std::endl;
586 throw -1;
587 }
588 hStatError->Write();
589
590 sample.statError.InputFile = OutputFileName;
591 sample.statError.HistoName = hStatError->GetName();
592 sample.statError.HistoPath = sampleDirPath;
593
594 }
595 */
596
597 }
598
599 }
600
601
602 // Finally, write the measurement itself:
603
604 cxcoutPHF << "Saved all histograms" << std::endl;
605
606 file->cd();
607 outMeas.Write();
608
609 cxcoutPHF << "Saved Measurement" << std::endl;
610
611}
612
613/// Return the directory's path,
614/// stripped of unnecessary prefixes
616{
617
618
619 std::string path = dir->GetPath();
620
621 if( path.find(":") != std::string::npos ) {
622 size_t index = path.find(":");
623 path.replace( 0, index+1, "" );
624 }
625
626 path = path + "/";
627
628 return path;
629
630 /*
631 if( path.find(":") != std::string::npos ) {
632 size_t index = path.find(":");
633 SampleName.replace( 0, index, "" );
634 }
635
636 // Remove the file:
637 */
638
639}
640
641
642/// The most common way to add histograms to channels is to have them
643/// stored in ROOT files and to give HistFactory the location of these
644/// files. This means providing the path to the ROOT file and the path
645/// and name of the histogram within that file. When providing these
646/// in a script, HistFactory doesn't load the histogram from the file
647/// right away. Instead, once all such histograms have been supplied,
648/// one should run this method to open all ROOT files and to copy and
649/// save all necessary histograms.
651
652
653 for( unsigned int chanItr = 0; chanItr < fChannels.size(); ++chanItr) {
654
655 RooStats::HistFactory::Channel& chan = fChannels.at( chanItr );
656
657 chan.CollectHistograms();
658
659 }
660
661}
662
663
664
#define cxcoutPHF
#define cxcoutIHF
#define cxcoutWHF
#define cxcoutEHF
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define ClassImp(name)
Definition Rtypes.h:377
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition TGX11.cxx:110
R__EXTERN TSystem * gSystem
Definition TSystem.h:560
This class encapsulates all information for the statistical interpretation of one experiment.
Definition Channel.h:30
HistFactory::Data fData
Definition Channel.h:92
std::vector< RooStats::HistFactory::Sample > & GetSamples()
get vector of samples for this channel
Definition Channel.h:77
std::string GetName() const
get name of channel
Definition Channel.h:43
void writeToFile(std::string FileName, std::string DirName)
Definition Data.cxx:44
The RooStats::HistFactory::Measurement class can be used to construct a model by combining multiple R...
Definition Measurement.h:31
void writeToFile(TFile *file)
A measurement, once fully configured, can be saved into a ROOT file.
void AddGammaSyst(std::string syst, double uncert)
Set constraint term for given systematic to Gamma distribution.
std::string GetDirPath(TDirectory *dir)
Return the directory's path, stripped of unnecessary prefixes.
void AddLogNormSyst(std::string syst, double uncert)
Set constraint term for given systematic to LogNormal distribution.
void PrintXML(std::string Directory="", std::string NewOutputPrefix="")
Print to a stream.
RooStats::HistFactory::Channel & GetChannel(std::string)
Get channel with given name from this measurement throws an exception in case the channel is not foun...
void SetParamValue(const std::string &param, double value)
Set a parameter to a specific value (And optionally fix it)
void CollectHistograms()
The most common way to add histograms to channels is to have them stored in ROOT files and to give Hi...
bool HasChannel(std::string)
Check if the given channel is part of this measurement.
void AddUniformSyst(std::string syst)
Set constraint term for given systematic to uniform distribution.
void PrintTree(std::ostream &=std::cout)
Print information about measurement object in tree-like structure to given stream.
Measurement()
Standard constructor.
void AddNoSyst(std::string syst)
Define given systematics to have no external constraint.
void AddConstantParam(const std::string &param)
Add a parameter to be set as constant (Similar to ParamSetting method below)
void AddPreprocessFunction(std::string name, std::string expression, std::string dependencies)
Add a preprocessed function by giving the function a name, a functional expression,...
std::vector< std::string > GetPreprocessFunctions() const
Returns a list of defined preprocess function expressions.
std::vector< RooStats::HistFactory::Channel > fChannels
Channels that make up this measurement.
std::string GetName() const
get name of sample
Definition Sample.h:82
void writeToFile(std::string FileName, std::string DirName)
Definition Sample.cxx:94
Describe directory structure in memory.
Definition TDirectory.h:45
virtual const char * GetPath() const
Returns the full path of the directory.
virtual Bool_t cd()
Change current directory to "this" directory.
virtual TDirectory * mkdir(const char *name, const char *title="", Bool_t returnExistingDirectory=kFALSE)
Create a sub-directory "a" or a hierarchy of sub-directories "a/b/c/...".
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition TFile.h:51
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition TObject.cxx:874
virtual void FreeDirectory(void *dirp)
Free a directory.
Definition TSystem.cxx:848
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
Definition TSystem.cxx:839
virtual int MakeDirectory(const char *name)
Make a directory.
Definition TSystem.cxx:830
The TTimeStamp encapsulates seconds and ns since EPOCH.
Definition TTimeStamp.h:45
UInt_t GetDate(Bool_t inUTC=kTRUE, Int_t secOffset=0, UInt_t *year=nullptr, UInt_t *month=nullptr, UInt_t *day=nullptr) const
Return date in form of 19971224 (i.e.
Definition file.py:1