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