Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TProofOutputFile.h
Go to the documentation of this file.
1// @(#)root/proof:$Id$
2// Author: Long Tran-Thanh 14/09/07
3
4/*************************************************************************
5 * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TProofOutputFile
13#define ROOT_TProofOutputFile
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TProofOutputFile //
19// //
20// Small class to steer the merging of files produced on workers //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TNamed.h"
25
26class TCollection;
27class TString;
28class TList;
29class TFile;
30class TFileCollection;
31class TFileMerger;
32
33class TProofOutputFile : public TNamed {
34
35friend class TProof;
36friend class TProofPlayer;
37friend class TProofPlayerRemote;
38
39public:
40 enum ERunType { kMerge = 1, // Type of run: merge or dataset creation
42 enum ETypeOpt { kRemote = 1, // Merge from original copies
43 kLocal = 2, // Make local copies before merging
44 kCreate = 4, // Create dataset
45 kRegister = 8, // Register dataset
46 kOverwrite = 16, // Force dataset replacement during registration
47 kVerify = 32}; // Verify the registered dataset
48
49private:
50 TProofOutputFile(const TProofOutputFile&); // Not implemented
51 TProofOutputFile& operator=(const TProofOutputFile&); // Not implemented
52
53 TString fDir; // name of the directory to be exported
54 TString fRawDir; // name of the local directory where to create the file
56 TString fOptionsAnchor; // options and anchor string including delimiters, e.g. "?myopts#myanchor"
59 TString fLocalHost; // Host where the file was created
60 Bool_t fIsLocal; // kTRUE if the file is in the sandbox
62 ERunType fRunType; // Type of run (see enum ERunType)
63 UInt_t fTypeOpt; // Option (see enum ETypeOpt)
64 Bool_t fMergeHistosOneGo; // If true merge histos in one go (argument to TFileMerger)
65
66 TFileCollection *fDataSet; // Instance of the file collection in 'dataset' mode
67 TFileMerger *fMerger; // Instance of the file merger in 'merge' mode
68
69 void Init(const char *path, const char *dsname);
70 void SetFileName(const char* name) { fFileName = name; }
71 void SetDir(const char* dir, Bool_t raw = kFALSE) { if (raw) { fRawDir = dir; } else { fDir = dir; } }
72 void SetMerged(Bool_t merged = kTRUE) { fMerged = merged; }
73 void SetWorkerOrdinal(const char* ordinal) { fWorkerOrdinal = ordinal; }
74
75 void AddFile(TFileMerger *merger, const char *path);
76 void NotifyError(const char *errmsg);
77 void Unlink(const char *path);
78
79protected:
80
81public:
84 kRetrieve = BIT(17), // If set, the file is copied to the final destination via the client
85 kSwapFile = BIT(18) // Set when the represented file is the result of the automatic
86 // save-to-file functionality
87 };
91 fDataSet(0), fMerger(0) { }
92 TProofOutputFile(const char *path, const char *option = "M", const char *dsname = 0);
93 TProofOutputFile(const char *path, ERunType type, UInt_t opt = kRemote, const char *dsname = 0);
94 ~TProofOutputFile() override;
95
96 const char *GetDir(Bool_t raw = kFALSE) const { return (raw) ? fRawDir : fDir; }
99 const char *GetFileName() const { return fFileName; }
100 const char *GetLocalHost() const { return fLocalHost; }
101 const char *GetOptionsAnchor() const { return fOptionsAnchor; }
102 const char *GetOutputFileName() const { return fOutputFileName; }
103 const char *GetWorkerOrdinal() const { return fWorkerOrdinal; }
104
105 ERunType GetRunType() const { return fRunType; }
106 UInt_t GetTypeOpt() const { return fTypeOpt; }
107 Bool_t IsMerge() const { return (fRunType == kMerge) ? kTRUE : kFALSE; }
108 Bool_t IsMerged() const { return fMerged; }
109 Bool_t IsRegister() const { return ((fTypeOpt & kRegister) || (fTypeOpt & kVerify)) ? kTRUE : kFALSE; }
110
114
115 Int_t AdoptFile(TFile *f); // Adopt a TFile already open
116 TFile* OpenFile(const char *opt); // Open a file with the specified name in fFileName1
118 void Print(Option_t *option = "") const override;
119 void SetOutputFileName(const char *name);
121
122 static Int_t AssertDir(const char *dirpath);
123
124 ClassDefOverride(TProofOutputFile,5) // Wrapper class to steer the merging of files produced on workers
125};
126
127#endif
#define f(i)
Definition RSha256.hxx:104
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
long long Long64_t
Definition RtypesCore.h:80
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define BIT(n)
Definition Rtypes.h:85
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
Collection abstract base class.
Definition TCollection.h:65
Class that contains a list of TFileInfo's and accumulated meta data information about its entries.
This class provides file copy and merging services.
Definition TFileMerger.h:30
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
Definition TFile.h:53
A doubly linked list.
Definition TList.h:38
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:201
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:780
void ResetBit(UInt_t f)
Definition TObject.h:200
Class to steer the merging of files produced on the workers.
TProofOutputFile & operator=(const TProofOutputFile &)
UInt_t GetTypeOpt() const
Bool_t IsMerge() const
void Unlink(const char *path)
Unlink path.
void Print(Option_t *option="") const override
Dump the class content.
const char * GetDir(Bool_t raw=kFALSE) const
const char * GetOutputFileName() const
static Int_t AssertDir(const char *dirpath)
Assert directory path 'dirpath', with the ownership of the last already existing subpath.
const char * GetLocalHost() const
Bool_t IsRegister() const
TProofOutputFile(const TProofOutputFile &)
TFile * OpenFile(const char *opt)
Open the file using the unique temporary name.
const char * GetFileName() const
Bool_t IsMerged() const
Bool_t IsRetrieve() const
void AddFile(TFileMerger *merger, const char *path)
Add file to merger, checking the result.
TFileCollection * GetFileCollection()
Get instance of the file collection to be used in 'dataset' mode.
TFileCollection * fDataSet
Long64_t Merge(TCollection *list)
Merge objects from the list into this object.
void Init(const char *path, const char *dsname)
Initializer. Called by all constructors.
void SetDir(const char *dir, Bool_t raw=kFALSE)
void SetMerged(Bool_t merged=kTRUE)
void SetOutputFileName(const char *name)
Set the name of the output file; in the form of an Url.
void SetFileName(const char *name)
TFileMerger * fMerger
void NotifyError(const char *errmsg)
Notify error message.
void SetWorkerOrdinal(const char *ordinal)
Int_t AdoptFile(TFile *f)
Adopt a file already open.
~TProofOutputFile() override
Main destructor.
TFileMerger * GetFileMerger(Bool_t local=kFALSE)
Get instance of the file merger to be used in 'merge' mode.
const char * GetOptionsAnchor() const
ERunType GetRunType() const
void SetRetrieve(Bool_t on=kTRUE)
const char * GetWorkerOrdinal() const
Internal class steering processing in PROOF.
This class controls a Parallel ROOT Facility, PROOF, cluster.
Definition TProof.h:316
Basic string class.
Definition TString.h:139