64 fDirectory(),
fFirst(0), fNum(0), fMsd(),
65 fTDSetOffset(0), fEntryList(0), fValid(
kFALSE),
66 fEntries(0), fFriends(0), fDataSet(), fAssocObjList(0),
82 const char *msd,
const char *dataset)
86 Warning(
"TDSetElement",
"first must be >= 0, %lld is not allowed - setting to 0",
first);
92 Warning(
"TDSetElement",
"num must be >= -1, %lld is not allowed - setting to -1", num);
121 :
TNamed(elem.GetFileName(), elem.GetObjName())
185 if (!elem)
return -1;
208 }
else if (
fFirst == lastelem + 1) {
213 lastref = (lastelem > last) ? lastelem : last;
215 }
else if (fFirst < lastelem + 1 && fFirst >= elem->
GetFirst()) {
217 lastref = (lastelem > last) ? lastelem : last;
236 Printf(
"entries: %lld (%lld)", entries,
fNum);
237 if (!strcmp(
type,
"TTree")) {
263 if (opt && opt[0] ==
'a') {
264 Printf(
"%s file=\"%s\" dir=\"%s\" obj=\"%s\" first=%lld num=%lld msd=\"%s\"",
278 if (entries < 0)
return;
287 Error(
"Validate",
"TDSetElement has only %lld entries starting"
288 " with entry %lld, while %lld were requested",
293 Error(
"Validate",
"TDSetElement has only %lld entries with"
294 " first entry requested as %lld", entries,
fFirst);
315 Error(
"Validate",
"TDSetElement to validate against is not valid");
321 if ((
name == elemname) &&
333 Error(
"Validate",
"TDSetElement requests %lld entries starting"
334 " with entry %lld, while TDSetElement to validate against"
335 " has only %lld entries",
fNum,
fFirst, entries);
339 Error(
"Validate",
"TDSetElement to validate against has only %lld"
340 " entries, but this TDSetElement requested %lld as its first"
341 " entry", entries,
fFirst);
344 Error(
"Validate",
"TDSetElements do not refer to same objects");
353 if (
this == obj)
return 0;
378 if (!friendElement) {
379 Error(
"AddFriend",
"The friend TDSetElement is null!");
387 if (alias && strlen(alias) > 0) {
453 "cannot open file %s (type: %d, pfx: %s)",
GetName(), typ, pfx.Data());
488 while ((k = (
TKey *) nxk())) {
495 }
else if (kn != on) {
497 "additional tree found in the file: %s", kn.
Data());
507 Error(
"GetEntries",
"cannot find tree \"%s\" in %s",
536 static Int_t xNetPluginOK = -1;
557 if (xNetPluginOK == -1) {
560 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name)) &&
561 !strcmp(
h->GetClass(),
"TXNetFile") &&
h->LoadPlugin() == 0)
572 Error(
"Lookup",
"TFileStager instance cannot be instantiated");
586 Error(
"Lookup",
"couldn't lookup %s",
name.Data());
613 Error(
"SetEntryList",
"type of input object must be either TEntryList "
614 "or TEventList (found: '%s' - do nothing", aList->
ClassName());
622 for (; num > 0; num--,
first++)
666 if (!(
s.IsDigit()))
return o;
722 gROOT->GetListOfDataSets()->Add(
this);
742 const char *objname,
const char *dir,
const char *
type)
775 if (strlen(
type) > 0)
779 }
else if (
type && strlen(
type) > 0) {
802 gROOT->GetListOfDataSets()->Add(
this);
876 while (chainsQueue.
GetSize() > 0) {
879 TIter friendsIter(
c->GetListOfFriends());
889 Error(
"TDSet",
"Only TChains supported. Found illegal tree %s",
890 fe->GetTree()->GetName());
909 gROOT->GetListOfDataSets()->Remove(
this);
923 Error(
"Process",
"not a correctly initialized TDSet");
933 Error(
"Process",
"no active PROOF session");
948 Error(
"Process",
"not a correctly initialized TDSet");
958 Error(
"Process",
"no active PROOF session");
971 Error(
"AddInput",
"No PROOF session active");
1010 const char *clnm = (IsA()) ? IsA()->GetName() :
"TDSet";
1011 Printf(
"OBJ: %s\ttype %s\t%s\tin %s\telements %d", clnm,
GetName(),
1014 if (opt && opt[0] ==
'a') {
1017 while ((obj = next())) {
1033 e->SetTitle(objname);
1056 Error(
"Add",
"file name must be specified");
1081 msg.
Form(
"duplication detected: %40s is already in dataset - ignored", fn.
Data());
1084 msg.
Insert(0,
"WARNING: ");
1106 Error(
"Add",
"cannot add a set with a different type");
1116 if (el == last)
break;
1139 TIter next(filelist);
1140 while ((o = next())) {
1142 if (cn ==
"TFileInfo") {
1144 if (!availableOnly ||
1151 }
else if (badlist) {
1155 }
else if (cn ==
"TUrl") {
1157 }
else if (cn ==
"TObjString") {
1160 Warning(
"Add",
"found object fo unexpected type %s - ignoring", cn.
Data());
1188 Error(
"Add",
"TFileInfo object name must be specified");
1204 msg.
Form(
"duplication detected: %40s is already in dataset - ignored",
file);
1207 msg.
Insert(0,
"WARNING: ");
1217 if (!meta || strlen(meta) <= 0 || !strcmp(meta,
"/")) {
1220 msg.
Form(
"\n Object name unspecified and several objects available.\n");
1221 msg +=
" Please choose one from the list below:\n";
1225 if (
nm.BeginsWith(
"/"))
nm.Remove(0,1);
1226 msg +=
Form(
" %s -> TProof::Process(\"%s#%s\",...)\n",
1241 const char *objname = 0;
1242 const char *dir = 0;
1249 objname = (
m->GetObject() && strlen(
m->GetObject())) ?
m->GetObject() :
GetObjName();
1250 dir = (
m->GetDirectory() && strlen(
m->GetDirectory())) ?
m->GetDirectory() :
GetDirectory();
1252 num =
m->GetEntries();
1254 const char *dataset = 0;
1284 Bool_t force = (opt[0] ==
'F' || opt[0] ==
'f');
1290 Info(
"ExportFileList",
"error removing dataset file: %s", fpath);
1317 Info(
"ExportFileList",
"error creating dataset file: %s", fpath);
1338 Error(
"AddFriend",
"The friend TDSet is null!");
1343 Error(
"AddFriend",
"a friend set can only be added to a TTree TDSet");
1349 Error(
"AddFriend",
"the friend dataset has %d elements while the main one has %d",
1353 TIter next(thisList);
1354 TIter next2(friendsList);
1356 if (friendsList->
GetSize() == 1)
1360 e->AddFriend(friendElem, alias);
1404 "cannot open file %s (type: %d, pfx: %s)", filename, typ, pfx.Data());
1409 if (!
file->cd(path)) {
1410 ::Error(
"TDSet::GetEntries",
"cannot cd to %s", path);
1437 while ((k = (
TKey *) nxk())) {
1444 }
else if (kn != on) {
1446 "additional tree found in the file: %s", kn.
Data());
1456 ::Error(
"TDSet::GetEntries",
"cannot find tree \"%s\" in %s",
1457 objname.
Data(), filename);
1467 entries =
tree->GetEntries();
1471 objname = (fillname) ? on : objname;
1505 Error(
"Draw",
"not a correctly initialized TDSet");
1513 Error(
"Draw",
"no active PROOF session");
1522 if (
gROOT->IsBatch()) {
1523 Warning(
"StartViewer",
"viewer cannot run in batch mode");
1528 Error(
"StartViewer",
"no PROOF found");
1532 Error(
"StartViewer",
"TDSet contents should be of type TTree (or subtype)");
1538 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TVirtualTreeViewer"))) {
1539 if (
h->LoadPlugin() == -1)
1565 if (!elem->GetValid()) {
1594 if (!elem->GetValid())
1595 elem->Validate(
IsTree());
1614 TString msg(
"Looking up for exact location of files");
1622 if (elem->GetNum() != 0) {
1624 if (!elem->GetValid())
1625 if (elem->Lookup(
kFALSE))
1626 if (removeMissing) {
1628 Error(
"Lookup",
"Error removing a missing file");
1629 if (listOfMissingFiles)
1630 (*listOfMissingFiles)->Add(elem->GetFileInfo(
fType));
1635 if (
gProof && (
n > 0 && !(
n % n2)))
1644 msg =
Form(
"Files with entries to be processed: %d (out of %d)\n", ng, tot);
1662 elem->SetLookedUp();
1677 if (!elem->GetValid())
continue;
1678 TString dir_file_obj = elem->GetDirectory();
1679 dir_file_obj +=
"_";
1681 dir_file_obj +=
"_";
1682 dir_file_obj += elem->GetObjName();
1688 if (entries<elem->GetFirst()+elem->GetNum()) {
1695 TNamed* named =
new TNamed(dir_file_obj, dir_file_obj);
1696 namedHolder.
Add(named);
1697 bestElements.
Add(
new TPair(named, elem));
1703 if (!elem->GetValid()) {
1704 TString dir_file_obj = elem->GetDirectory();
1705 dir_file_obj +=
"_";
1707 dir_file_obj +=
"_";
1708 dir_file_obj += elem->GetObjName();
1723void TDSetElement::Streamer(
TBuffer &R__b)
1735 TNamed::Streamer(R__b);
1739 TObject::Streamer(R__b);
1741 R__b >>
name >> title;
1763 for (FriendsList_t::iterator i = friends->begin();
1764 i != friends->end(); ++i) {
1778 TObject::Streamer(R__b);
1795 while ((p = (
TPair *)nxf()))
1814void TDSet::Streamer(
TBuffer &R__b)
1825 TNamed::Streamer(R__b);
1830 elems.Streamer(R__b);
1849 TNamed::Streamer(R__b);
1863 elems.Streamer(R__b);
1915 while ((ds = (
TDSet *) nxds()))
1926 Error(
"SetEntryList",
"type of input object must be either TEntryList "
1927 "or TEventList (found: '%s' - do nothing", aList->
ClassName());
1948 while ((ds = (
TDSet *) nxds()))
1956 Info(
"SplitEntryList",
"no entry- (or event-) list to split - do nothing");
1996 while (currPos < evl->GetN() && evl->
GetEntry(currPos) < low) {
1997 Error(
"SplitEntryList",
1998 "TEventList: event outside of the range of any of the TDSetElements");
2003 while (currPos < evl->GetN() && evl->
GetEntry((
Int_t)currPos) < high) {
2027 while ((ds = (
TDSet *) nxds()))
const Long64_t kMaxLong64
R__EXTERN Int_t gErrorIgnoreLevel
R__EXTERN TProofServ * gProofServ
R__EXTERN TProof * gProof
char * Form(const char *fmt,...)
void Printf(const char *fmt,...)
R__EXTERN TSystem * gSystem
static struct mg_connection * fc(struct mg_context *ctx)
Buffer base class used for serializing objects.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
A TChainElement describes a component of a TChain.
virtual Long64_t GetEntries() const
virtual Bool_t HasBeenLookedUp()
A chain is a collection of files containing TTree objects.
TObjArray * GetListOfFiles() const
TClassRef is used to implement a permanent reference to a TClass object.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Version_t GetClassVersion() const
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Collection abstract base class.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual void Add(TObject *obj)=0
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write all objects in this collection.
A specialized string object used for TTree selections.
Manages an element of a TDSet.
TFileInfo * GetFileInfo(const char *type="TTree")
Return the content of this element in the form of a TFileInfo.
void Print(Option_t *options="") const
Print a TDSetElement. When option="a" print full data.
void SetEntries(Long64_t ent)
Long64_t GetEntries(Bool_t istree=kTRUE, Bool_t openfile=kTRUE)
Returns number of entries in tree or objects in file.
const char * GetObjName() const
void Validate(Bool_t isTree)
Validate by opening the file.
Bool_t HasBeenLookedUp() const
std::list< std::pair< TDSetElement *, TString > > FriendsList_t
virtual ~TDSetElement()
Clean up the element.
void Reset()
Reset TDSet element.
void SetNum(Long64_t num)
const char * GetDirectory() const
Return directory where to look for object.
virtual void DeleteFriends()
Deletes the list of friends and all the friends on the list.
void SetEntryList(TObject *aList, Long64_t first=-1, Long64_t num=-1)
Set entry (or event) list for this element.
void AddAssocObj(TObject *assocobj)
Add an associated object to the list.
Long64_t GetTDSetOffset() const
Int_t Lookup(Bool_t force=kFALSE)
Resolve end-point URL for this element Return 0 on success and -1 otherwise.
virtual void AddFriend(TDSetElement *friendElement, const char *alias)
Add friend TDSetElement to this set. The friend element will be copied to this object.
const char * GetMsd() const
const char * GetFileName() const
TDSetElement()
Default constructor.
TObject * GetAssocObj(Long64_t i, Bool_t isentry=kFALSE)
Get i-th associated object.
Int_t Compare(const TObject *obj) const
Compare elements by filename (and the fFirst).
Long64_t GetFirst() const
Int_t MergeElement(TDSetElement *elem)
Check if 'elem' is overlapping or subsequent and, if the case, return a merged element.
This class implements a data set to be used for PROOF processing.
void SplitEntryList()
for browsing purposes
TIter * fSrvMapsIter
list for mapping server coordinates for files
virtual TDSetElement * Next(Long64_t totalEntries=-1)
Returns next TDSetElement.
virtual void StartViewer()
Start the TTreeViewer on this TTree.
virtual void SetEntryList(TObject *aList)
Set entry (or event) list for this data set.
Int_t Remove(TDSetElement *elem, Bool_t deleteElem=kTRUE)
Remove TDSetElement 'elem' from the list.
void AddInput(TObject *obj)
Add objects that might be needed during the processing of the selector (see Process()).
TProofChain * fProofChain
entry (or event) list for processing
void SetLookedUp()
Flag all the elements as looked-up, so to avoid opening the files if the functionality is not support...
virtual Bool_t Add(const char *file, const char *objname=0, const char *dir=0, Long64_t first=0, Long64_t num=-1, const char *msd=0)
Add file to list of files to be analyzed.
virtual void Reset()
Reset or initialize access to the elements.
Bool_t ElementsValid()
Check if all elements are valid.
TList * fSrvMaps
current element
static Long64_t GetEntries(Bool_t isTree, const char *filename, const char *path, TString &objname)
Returns number of entries in tree or objects in file.
Int_t GetNumOfFiles()
Return the number of files in the dataset.
void Lookup(Bool_t removeMissing=kFALSE, TList **missingFiles=0)
Resolve the end-point URL for the current elements of this data set If the removeMissing option is se...
void Print(Option_t *option="") const
Print TDSet basic or full data. When option="a" print full data.
Int_t ExportFileList(const char *filepath, Option_t *opt="")
Export TDSetElements files as list of TFileInfo objects in file 'fpath'.
virtual TTree * GetTreeHeader(TProof *proof)
Returns a tree header containing the branches' structure of the dataset.
virtual void AddFriend(TDSet *friendset, const char *alias)
Add friend dataset to this set.
virtual Long64_t Draw(const char *varexp, const char *selection, Option_t *option="", Long64_t nentries=-1, Long64_t firstentry=0)
Draw expression varexp for specified entries.
void SetSrvMaps(TList *srvmaps=0)
Set (or unset) the list for mapping servers coordinate for files.
TObject * GetOutput(const char *name)
Get specified object that has been produced during the processing (see Process()).
TDSetElement * fCurrent
iterator on fElements
void Validate()
Validate the TDSet by opening files.
const char * GetType() const
TList * GetOutputList()
Get list with all object created during processing (see Process()).
void SetWriteV3(Bool_t on=kTRUE)
Set/Reset the 'OldStreamer' bit in this instance and its elements.
TList * GetListOfElements() const
void SetDirectory(const char *dir)
Set/change directory.
void SetObjName(const char *objname)
Set/change object name.
const char * GetDirectory() const
virtual Long64_t Process(TSelector *selector, Option_t *option="", Long64_t nentries=-1, Long64_t firstentry=0, TObject *enl=0)
Process TDSet on currently active PROOF session.
TDSet()
iterator on fSrvMaps
const char * GetObjName() const
void ClearInput()
Clear input object list.
static Bool_t CheckDataSetSrvMaps(TUrl *furl, TString &fn, TList *srvmaplist=0)
Check if the dataset server mappings apply to the url defined by 'furl'.
Describe directory structure in memory.
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
virtual TKey * GetKey(const char *, Short_t=9999) const
virtual TList * GetListOfKeys() const
A List of entry numbers in a TTree or TChain.
virtual TEntryList * GetEntryList(const char *treename, const char *filename, Option_t *opt="")
Return the entry list, corresponding to treename and filename By default, the filename is first tried...
virtual void SetEntriesToProcess(Long64_t nen)
virtual Long64_t GetN() const
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
A TEventList object is a list of selected events (entries) in a TTree.
virtual Long64_t GetEntry(Int_t index) const
Return value of entry at index in the list.
virtual Int_t GetN() const
virtual void Enter(Long64_t entry)
Enter element entry into the list.
Class describing a generic file including meta information.
Bool_t AddMetaData(TObject *meta)
Add's a meta data object to the file info object.
TUrl * GetFirstUrl() const
TList * GetMetaDataList() const
TFileInfoMeta * GetMetaData(const char *meta=0) const
Get meta data object with specified name.
virtual Bool_t Matches(const char *s)
static TFileStager * Open(const char *stager)
Open a stager, after having loaded the relevant plug-in.
virtual Int_t Locate(const char *u, TString &f)
Just check if the file exists locally.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
static EFileType GetType(const char *name, Option_t *option="", TString *prefix=0)
Resolve the file type as a function of the protocol field in 'name'.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseGeneralPurpose, Int_t netopt=0)
Create / open a file.
A TFriendElement TF describes a TTree object TF in a file.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
TObject * FindObject(const char *name) const
Find object using its name.
TObject * Remove(TObject *obj)
Remove object from the list.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual const char * GetClassName() const
virtual TObject * ReadObj()
To read a TObject* from the file.
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual void AddFirst(TObject *obj)
Add object at the beginning of the list.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
The TNamed class is the base class for all named ROOT classes.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual const char * GetName() const
Returns name of object.
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Collectable string class.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void SysError(const char *method, const char *msgfmt,...) const
Issue system error message.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
@ kSingleKey
write collection with single key
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Class used by TMap to store (key,value) pairs.
void SendAsynMessage(const char *msg, Bool_t lf=kTRUE)
Send an asychronous message to the master / client .
This class controls a Parallel ROOT Facility, PROOF, cluster.
virtual Long64_t DrawSelect(TDSet *dset, const char *varexp, const char *selection="", Option_t *option="", Long64_t nentries=-1, Long64_t firstentry=0)
Execute the specified drawing action on a data set (TDSet).
void SendDataSetStatus(const char *msg, UInt_t n, UInt_t tot, Bool_t st)
Send or notify data set status.
ERunStatus GetRunStatus() const
TList * GetOutputList()
Get list with all object created during processing (see Process()).
TObject * GetOutput(const char *name)
Get specified object that has been produced during the processing (see Process()).
virtual TTree * GetTreeHeader(TDSet *tdset)
Creates a tree header (a tree with nonexisting files) object for the DataSet.
virtual Long64_t Process(TDSet *dset, const char *selector, Option_t *option="", Long64_t nentries=-1, Long64_t firstentry=0)
Process a data set (TDSet) using the specified selector (.C) file or Tselector object Entry- or event...
void ClearInput()
Clear input object list.
void AddInput(TObject *obj)
Add objects that might be needed during the processing of the selector (see Process()).
Regular expression class.
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
TString & Insert(Ssiz_t pos, const char *s)
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TString & Remove(Ssiz_t pos)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
virtual const char * WorkingDirectory()
Return working directory.
virtual int Unlink(const char *name)
Unlink, i.e.
The TTimeStamp encapsulates seconds and ns since EPOCH.
A TTree represents a columnar dataset.
static constexpr Long64_t kMaxEntries
This class represents a WWW compatible URL.
const char * GetAnchor() const
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
void SetAnchor(const char *anchor)
const char * GetFileAndOptions() const
Return the file and its options (the string specified behind the ?).
void SetUrl(const char *url, Bool_t defaultIsFile=kFALSE)
Parse url character string and split in its different subcomponents.
void SetOptions(const char *opt)
const char * GetOptions() const
const char * GetProtocol() const
static constexpr double nm
static constexpr double s