Converting phasespace to .root file

Original dataset, not similar to your output (Your output has a newly created class, which fails the software.)

=== [waterphantom.root] ===
version: 61804
streamer-infos:
 StreamerInfo for "TTree" version=20 title=""
  BASE              TNamed                 offset=  0 type= 67 size=  0  The basis for a named object (name, title)
.....
StreamerInfo for "TBranch" version=13 title=""
  BASE              TNamed          offset=  0 type= 67 size=  0  The basis for a named object (name, title)

....
 StreamerInfo for "TLeafF" version=1 title=""
  BASE  TLeaf    offset=  0 type=  0 size=  0  Leaf: description of a Branch data type
  float fMinimum offset=  0 type=  5 size=  4  Minimum value if leaf range is specified
  float fMaximum offset=  0 type=  5 size=  4  Maximum value if leaf range is specified
 StreamerInfo for "TLeaf" version=2 title=""
  BASE   TNamed      offset=  0 type= 67 size=  0  The basis for a named object (name, title)
  int    fLen        offset=  0 type=  3 size=  4  Number of fixed length elements in the leaf's data.
  int    fLenType    offset=  0 type=  3 size=  4  Number of bytes for this data type
  ...
 StreamerInfo for "TLeafI" version=1 title=""
  BASE  TLeaf    offset=  0 type=  0 size=  0  Leaf: description of a Branch data type
  int   fMinimum offset=  0 type=  3 size=  4  Minimum value if leaf range is specified
  int   fMaximum offset=  0 type=  3 size=  4  Maximum value if leaf range is specified

PhaseSpaceStructur.root has no streamer info, however it does work.

=== [PhaseSpaceStructur.root] ===
version: 62406
streamer-infos:
---

Strange things happening under the hood in defining the variable containers?

Randy

ah, sorry, could you repost with root-ls -t -sinfos ./waterphantom.root ?

also, could you use root-split -n 10 -o small.root ./waterphantom.root to split out the big file into smaller ones (and post one of these here)?
(root-split can be fetch from the same place: https://go-hep.org/dist/latest/)

With root-ls -t -sinfos waterphantom.root, can see the clear leaflist description/variable types in the title of the branch.

=== [waterphantom.root] ===
version: 61804
streamer-infos:
 StreamerInfo for "TTree" version=20 title=""
  BASE              TNamed                 offset=  0 type= 67 size=  0  The basis for a named object (name, title)
  BASE              TAttLine               offset=  0 type=  0 size=  0  Line attributes
  BASE              TAttFill               offset=  0 type=  0 size=  0  Fill area attributes
  BASE              TAttMarker             offset=  0 type=  0 size=  0  Marker attributes
  Long64_t          fEntries               offset=  0 type= 16 size=  8  Number of entries
  Long64_t          fTotBytes              offset=  0 type= 16 size=  8  Total number of bytes in all branches before compression
  Long64_t          fZipBytes              offset=  0 type= 16 size=  8  Total number of bytes in all branches after compression
  Long64_t          fSavedBytes            offset=  0 type= 16 size=  8  Number of autosaved bytes
  Long64_t          fFlushedBytes          offset=  0 type= 16 size=  8  Number of auto-flushed bytes
  double            fWeight                offset=  0 type=  8 size=  8  Tree weight (see TTree::SetWeight)
  int               fTimerInterval         offset=  0 type=  3 size=  4  Timer interval in milliseconds
  int               fScanField             offset=  0 type=  3 size=  4  Number of runs before prompting in Scan
  int               fUpdate                offset=  0 type=  3 size=  4  Update frequency for EntryLoop
  int               fDefaultEntryOffsetLen offset=  0 type=  3 size=  4  Initial Length of fEntryOffset table in the basket buffers
  int               fNClusterRange         offset=  0 type=  6 size=  4  Number of Cluster range in addition to the one defined by 'AutoFlush'
  Long64_t          fMaxEntries            offset=  0 type= 16 size=  8  Maximum number of entries in case of circular buffers
  Long64_t          fMaxEntryLoop          offset=  0 type= 16 size=  8  Maximum number of entries to process
  Long64_t          fMaxVirtualSize        offset=  0 type= 16 size=  8  Maximum total size of buffers kept in memory
  Long64_t          fAutoSave              offset=  0 type= 16 size=  8  Autosave tree when fAutoSave entries written or -fAutoSave (compressed) bytes produced
  Long64_t          fAutoFlush             offset=  0 type= 16 size=  8  Auto-flush tree when fAutoFlush entries written or -fAutoFlush (compressed) bytes produced
  Long64_t          fEstimate              offset=  0 type= 16 size=  8  Number of entries to estimate histogram limits
  Long64_t*         fClusterRangeEnd       offset=  0 type= 56 size=  8  [fNClusterRange] Last entry of a cluster range.
  Long64_t*         fClusterSize           offset=  0 type= 56 size=  8  [fNClusterRange] Number of entries in each cluster for a given range.
  ROOT::TIOFeatures fIOFeatures            offset=  0 type= 62 size=  1  IO features to define for newly-written baskets and branches.
  TObjArray         fBranches              offset=  0 type= 61 size= 64  List of Branches
  TObjArray         fLeaves                offset=  0 type= 61 size= 64  Direct pointers to individual branch leaves
  TList*            fAliases               offset=  0 type= 64 size=  8  List of aliases for expressions based on the tree branches.
  TArrayD           fIndexValues           offset=  0 type= 62 size= 24  Sorted index values
  TArrayI           fIndex                 offset=  0 type= 62 size= 24  Index of sorted values
  TVirtualIndex*    fTreeIndex             offset=  0 type= 64 size=  8  Pointer to the tree Index (if any)
  TList*            fFriends               offset=  0 type= 64 size=  8  pointer to list of friend elements
  TList*            fUserInfo              offset=  0 type= 64 size=  8  pointer to a list of user objects associated to this Tree
  TBranchRef*       fBranchRef             offset=  0 type= 64 size=  8  Branch supporting the TRefTable (if any)
 StreamerInfo for "TNamed" version=1 title=""
  BASE    TObject offset=  0 type= 66 size=  0  Basic ROOT object
  TString fName   offset=  0 type= 65 size= 24  object identifier
  TString fTitle  offset=  0 type= 65 size= 24  object title
 StreamerInfo for "TObject" version=1 title=""
  unsigned int fUniqueID offset=  0 type= 13 size=  4  object unique identifier
  unsigned int fBits     offset=  0 type= 15 size=  4  bit field status word
 StreamerInfo for "TAttLine" version=2 title=""
  short fLineColor offset=  0 type=  2 size=  2  Line color
  short fLineStyle offset=  0 type=  2 size=  2  Line style
  short fLineWidth offset=  0 type=  2 size=  2  Line width
 StreamerInfo for "TAttFill" version=2 title=""
  short fFillColor offset=  0 type=  2 size=  2  Fill area color
  short fFillStyle offset=  0 type=  2 size=  2  Fill area style
 StreamerInfo for "TAttMarker" version=2 title=""
  short fMarkerColor offset=  0 type=  2 size=  2  Marker color
  short fMarkerStyle offset=  0 type=  2 size=  2  Marker style
  float fMarkerSize  offset=  0 type=  5 size=  4  Marker size
 StreamerInfo for "ROOT::TIOFeatures" version=1 title=""
  unsigned char fIOBits offset=  0 type= 11 size=  1
 StreamerInfo for "TBranch" version=13 title=""
  BASE              TNamed          offset=  0 type= 67 size=  0  The basis for a named object (name, title)
  BASE              TAttFill        offset=  0 type=  0 size=  0  Fill area attributes
  int               fCompress       offset=  0 type=  3 size=  4  Compression level and algorithm
  int               fBasketSize     offset=  0 type=  3 size=  4  Initial Size of  Basket Buffer
  int               fEntryOffsetLen offset=  0 type=  3 size=  4  Initial Length of fEntryOffset table in the basket buffers
  int               fWriteBasket    offset=  0 type=  3 size=  4  Last basket number written
  Long64_t          fEntryNumber    offset=  0 type= 16 size=  8  Current entry number (last one filled in this branch)
  ROOT::TIOFeatures fIOFeatures     offset=  0 type= 62 size=  1  IO features for newly-created baskets.
  int               fOffset         offset=  0 type=  3 size=  4  Offset of this branch
  int               fMaxBaskets     offset=  0 type=  6 size=  4  Maximum number of Baskets so far
  int               fSplitLevel     offset=  0 type=  3 size=  4  Branch split level
  Long64_t          fEntries        offset=  0 type= 16 size=  8  Number of entries
  Long64_t          fFirstEntry     offset=  0 type= 16 size=  8  Number of the first entry in this branch
  Long64_t          fTotBytes       offset=  0 type= 16 size=  8  Total number of bytes in all leaves before compression
  Long64_t          fZipBytes       offset=  0 type= 16 size=  8  Total number of bytes in all leaves after compression
  TObjArray         fBranches       offset=  0 type= 61 size= 64  -> List of Branches of this branch
  TObjArray         fLeaves         offset=  0 type= 61 size= 64  -> List of leaves of this branch
  TObjArray         fBaskets        offset=  0 type= 61 size= 64  -> List of baskets of this branch
  int*              fBasketBytes    offset=  0 type= 43 size=  4  [fMaxBaskets] Length of baskets on file
  Long64_t*         fBasketEntry    offset=  0 type= 56 size=  8  [fMaxBaskets] Table of first entry in each basket
  Long64_t*         fBasketSeek     offset=  0 type= 56 size=  8  [fMaxBaskets] Addresses of baskets on file
  TString           fFileName       offset=  0 type= 65 size= 24  Name of file where buffers are stored ("" if in same file as Tree header)
 StreamerInfo for "TLeafF" version=1 title=""
  BASE  TLeaf    offset=  0 type=  0 size=  0  Leaf: description of a Branch data type
  float fMinimum offset=  0 type=  5 size=  4  Minimum value if leaf range is specified
  float fMaximum offset=  0 type=  5 size=  4  Maximum value if leaf range is specified
 StreamerInfo for "TLeaf" version=2 title=""
  BASE   TNamed      offset=  0 type= 67 size=  0  The basis for a named object (name, title)
  int    fLen        offset=  0 type=  3 size=  4  Number of fixed length elements in the leaf's data.
  int    fLenType    offset=  0 type=  3 size=  4  Number of bytes for this data type
  int    fOffset     offset=  0 type=  3 size=  4  Offset in ClonesArray object (if one)
  bool   fIsRange    offset=  0 type= 18 size=  1  (=kTRUE if leaf has a range, kFALSE otherwise)
  bool   fIsUnsigned offset=  0 type= 18 size=  1  (=kTRUE if unsigned, kFALSE otherwise)
  TLeaf* fLeafCount  offset=  0 type= 64 size=  8  Pointer to Leaf count if variable length (we do not own the counter)
 StreamerInfo for "TLeafI" version=1 title=""
  BASE  TLeaf    offset=  0 type=  0 size=  0  Leaf: description of a Branch data type
  int   fMinimum offset=  0 type=  3 size=  4  Minimum value if leaf range is specified
  int   fMaximum offset=  0 type=  3 size=  4  Maximum value if leaf range is specified
 StreamerInfo for "TList" version=5 title=""
  BASE  TSeqCollection offset=  0 type=  0 size=  0  Sequenceable collection ABC
 StreamerInfo for "TSeqCollection" version=0 title=""
  BASE  TCollection offset=  0 type=  0 size=  0  Collection abstract base class
 StreamerInfo for "TCollection" version=3 title=""
  BASE    TObject offset=  0 type= 66 size=  0  Basic ROOT object
  TString fName   offset=  0 type= 65 size= 24  name of the collection
  int     fSize   offset=  0 type=  3 size=  4  number of elements in collection
 StreamerInfo for "TString" version=2 title=""
 StreamerInfo for "TBranchRef" version=1 title=""
  BASE       TBranch   offset=  0 type=  0 size=  0  Branch descriptor
  TRefTable* fRefTable offset=  0 type= 64 size=  8  pointer to the TRefTable
 StreamerInfo for "TRefTable" version=3 title=""
  BASE           TObject       offset=  0 type= 66 size=  0  Basic ROOT object
  int            fSize         offset=  0 type=  3 size=  4  dummy for backward compatibility
  TObjArray*     fParents      offset=  0 type= 64 size=  8  array of Parent objects  (eg TTree branch) holding the referenced objects
  TObject*       fOwner        offset=  0 type= 64 size=  8  Object owning this TRefTable
  vector<string> fProcessGUIDs offset=  0 type=500 size= 24  UUIDs of TProcessIDs used in fParentIDs
 StreamerInfo for "TObjArray" version=3 title=""
  BASE  TSeqCollection offset=  0 type=  0 size=  0  Sequenceable collection ABC
  int   fLowerBound    offset=  0 type=  3 size=  4  Lower bound of the array
  int   fLast          offset=  0 type=  3 size=  4  Last element in array containing an object
---
  TTree              PhaseSpaceTree                                       PhaseSpace tree (entries=3992444)
    PhaseSpaceBranch "x/F:y/F:z/F:px/F:py/F:pz/F:Ekin/F:wepl/F:pdgI[...]" TBranch
  TTree              PhaseSpaceTree                                       PhaseSpace tree (entries=3499944)
    PhaseSpaceBranch "x/F:y/F:z/F:px/F:py/F:pz/F:Ekin/F:wepl/F:pdgI[...]" TBranch

Getting errors when running the split with ```root-split -n 10 -o small.root -t PhaseSpaceTree waterphantom.root, see attached

goroutine 1 [running]:
go-hep.org/x/hep/groot/rtree.rleafFrom({0x0, 0x0}, {{0xc0001e6c60, 0x10}, {0xc0001e6c60, 0x10}, {0x135e680, 0xc0001e6d7c}, {0x0, 0x0}, ...}, ...)
        /home/binet/work/gonum/src/go-hep.org/x/hep/groot/rtree/rleaf.go:165 +0x130e
go-hep.org/x/hep/groot/rtree.newRTree(0xc000128300, {0xc000081400, 0xc, 0xc}, 0xc, 0x1a78d80, 0xc000157810)
        /home/binet/work/gonum/src/go-hep.org/x/hep/groot/rtree/reader.go:310 +0x4c5
go-hep.org/x/hep/groot/rtree.newReader({0x165df60, 0xc000128300}, {0xc000081400, 0xc, 0xc}, 0x13635c0, 0xc00019fa00, 0xcda452)
        /home/binet/work/gonum/src/go-hep.org/x/hep/groot/rtree/reader.go:255 +0x14a
go-hep.org/x/hep/groot/rtree.NewReader({0x165df60, 0xc000128300}, {0xc000081400, 0xc, 0xc}, {0xc00019fc28, 0x1, 0x1})
        /home/binet/work/gonum/src/go-hep.org/x/hep/groot/rtree/reader.go:66 +0x199
go-hep.org/x/hep/groot/rcmd.split({0xc0000aa0b0, 0xc000128300}, {0xc0000aa0f0, 0xe}, {0x165df60, 0xc000128300}, 0xe, 0x0, 0xa, 0x0)
        /home/binet/work/gonum/src/go-hep.org/x/hep/groot/rcmd/split.go:121 +0x905
go-hep.org/x/hep/groot/rcmd.Split({0xc0000aa0b0, 0xc0000d6010}, {0xc0000ae078, 0x11}, {0xc0000aa0f0, 0xe}, 0x18, 0xd9)
        /home/binet/work/gonum/src/go-hep.org/x/hep/groot/rcmd/split.go:48 +0x4b1
main.main()
        /home/binet/work/gonum/src/go-hep.org/x/hep/groot/cmd/root-split/main.go:68 +0x215

branch splitting this way isn’t something that’s (yet?) supported by groot, unfortunately. sorry.

does this PyROOT script work for you?

import numpy as np

dt = np.dtype([
    ('x', "f4"), ('y', "f4"), ("z", "f4"), 
    ("px", "f4"), ("py", "f4"), 
    ("Ekin", "f4"), ("wepl", "f4"), 
    ("pdgID", "<i4"), 
    ("flag", "<u2"), 
    ("tof", "f4"),
    ("runID","<i4"),
    ("evtID","<i4"),
    ("trkID","<i4"),
    ("parID","<i4")])

evts = np.fromfile("./PhaseSpace.phsp", dtype=dt)
evts = np.sort(evts, order="evtID")

import ROOT
f = ROOT.TFile.Open("out.root", "RECREATE")
t = ROOT.TTree("PhaseSpaceTree", "PhaseSpaceTree")

dt = np.dtype([
    ('x', "f4"), ('y', "f4"), ("z", "f4"), 
    ("px", "f4"), ("py", "f4"), ("pz", "f4"),
    ("Ekin", "f4"), ("wepl", "f4"), 
    ("pdgID", "<i4"), 
    ("event", "<i4"),
    ("trackID","<i4"),
    ("PB_ID","<i4")])

buf = np.array([
    0,0,0,
    0,0,0,
    0,0,
    0,0,0
    ], dtype=dt)

t.Branch("PhaseSpaceBranch", buf, "x/F:y/F:z/F:px/F:py/F:pz/F:Ekin/F:wepl/F:pdgID/I:event/I:trackID/I:PB_ID/I")
for v in evts:
    buf["x"] = v["x"]
    buf["y"] = v["y"]
    buf["z"] = v["z"]
    buf["px"] = v["px"]
    buf["py"] = v["py"]
    buf["pz"] = 1 - buf["px"]**2 - buf["py"]**2
    buf["Ekin"] = v["Ekin"]
    buf["wepl"] = v["wepl"]
    buf["pdgID"] = v["pdgID"]
    buf["event"] = v["evtID"]
    buf["trackID"] = v["trkID"]
    buf["PB_ID"] = v["parID"]
    t.Fill()
t.Write()
f.Close()

it creates the following ROOT TTree:

$> root-ls -t ./out.root 
=== [./out.root] ===
version: 62406
  TTree              PhaseSpaceTree                                       PhaseSpaceTree (entries=4122)
    PhaseSpaceBranch "x/F:y/F:z/F:px/F:py/F:pz/F:Ekin/F:wepl/F:pdgI[...]" TBranch

$> root-dump ./out.root |grep event | head
[000][PhaseSpaceBranch.event]: 0
[001][PhaseSpaceBranch.event]: 2
[002][PhaseSpaceBranch.event]: 3
[003][PhaseSpaceBranch.event]: 7
[004][PhaseSpaceBranch.event]: 8
[005][PhaseSpaceBranch.event]: 10
[006][PhaseSpaceBranch.event]: 11
[007][PhaseSpaceBranch.event]: 16
[008][PhaseSpaceBranch.event]: 17
[009][PhaseSpaceBranch.event]: 26

hth,
-s

Currently running it, but it’s nearly identical to a python script I’ve used in the past (That worked flawlessly, it’s just incredibly slow (>10x slower than your go code), which is why I wanted to use something other than python)

Randy

here is a C/C++ version:

#include <TTree.h>
#include <TFile.h>

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#include <algorithm> // for sort.

struct PhaseSpace {
    float x,y,z;
    float px,py,pz,Ekin;

    float wepl;
    int pdgID;

    int event, trackID, PB_ID;
};

void
read(const char *fname, std::vector<PhaseSpace> &evts);

int main(int argc, char **argv) {
	std::vector<PhaseSpace> evts;
	read(argv[1], evts);

	printf(">>> read %d events\n", evts.size());

	auto f = TFile::Open("./out.root", "RECREATE");
	auto t = new TTree("PhaseSpaceTree", "PhaseSpaceTree");

	const int BUFSZ = 8*4 + 4*4; 
	uint8_t buf[BUFSZ];
	t->Branch("PhaseSpaceBranch", buf, "x/F:y/F:z/F:px/F:py/F:pz/F:Ekin/F:wepl/F:pdgID/I:event/I:trackID/I:PB_ID/I");

	for (int i = 0; i < evts.size(); i++) {
		const PhaseSpace& evt = evts[i];
		*(float*)(&buf[0]) = evt.x;
		*(float*)(&buf[4]) = evt.y;
		*(float*)(&buf[8]) = evt.z;
		*(float*)(&buf[12]) = evt.px;
		*(float*)(&buf[16]) = evt.py;
		*(float*)(&buf[20]) = evt.pz;
		*(float*)(&buf[24]) = evt.Ekin;
		*(float*)(&buf[28]) = evt.wepl;
		*(int*)(&buf[32]) = evt.pdgID;
		*(int*)(&buf[36]) = evt.event;
		*(int*)(&buf[40]) = evt.trackID;
		*(int*)(&buf[44]) = evt.PB_ID;
		t->Fill();
	}

	t->Write();
	f->Close();

	return 0;
}

#define LE(buf, x) (int(buf[x]) | (int(buf[x+1])<<8) | (int(buf[x+2])<<16) | (int(buf[x+3])<<24))

bool sortEvts(PhaseSpace i, PhaseSpace j) {
	return i.event < j.event;
}

void
read(const char *fname, std::vector<PhaseSpace> &evts) {
	auto f = fopen(fname, "r");
	if (!f) {
		perror("could not open phasespace file");
		exit(EXIT_FAILURE);
	}
	const int BUFSZ = 54;
	uint8_t buf[BUFSZ];

	while (1) {
		int rc = fread(buf, 1, BUFSZ, f);
		if (rc != BUFSZ) {
			break;
		}
		PhaseSpace evt;
		evt.x = *(float*)(&buf[0]);
		evt.y = *(float*)(&buf[4]);
		evt.z = *(float*)(&buf[8]);
		evt.px = *(float*)(&buf[12]);
		evt.py = *(float*)(&buf[16]);
		evt.pz = 1 - evt.px*evt.px - evt.py*evt.py;
		evt.Ekin = *(float*)(&buf[20]);
		evt.wepl = *(float*)(&buf[24]);
		evt.pdgID =   LE(buf, 28);
		evt.event =   LE(buf, 42);
		evt.trackID = LE(buf, 46);
		evt.PB_ID =   LE(buf, 50);
		
		evts.push_back(evt);
	}

	std::sort(evts.begin(), evts.end(), sortEvts);
	return;
}

The C/C++ version would be perfect for what I’m looking for but;
Strangely I’m unable to run this, either in ROOT or after compilation (both windows & Linux). Your previous cxx code (read.cxx) is also unable to compile/run.

On your previous (simpler) code (ignore filename):

 $g++ -o read `root-config --libs --cfla
gs` ./sort2.cxx
/usr/bin/ld: /tmp/ccztkkZ3.o: in function `main':
sort2.cxx:(.text+0x23): undefined reference to `TInterpreter::Instance()'
/usr/bin/ld: sort2.cxx:(.text+0x61): undefined reference to `TFile::Open(char const*, char const*, char const*, int, int)'
/usr/bin/ld: /tmp/ccztkkZ3.o: in function `__static_initialization_and_destruction_0(int, int)':
sort2.cxx:(.text+0x16b): undefined reference to `TVersionCheck::TVersionCheck(int)'
/usr/bin/ld: /tmp/ccztkkZ3.o: in function `int TTree::SetBranchAddress<PhaseSpace>(char const*, PhaseSpace**, TBranch**)':
sort2.cxx:(.text._ZN5TTree16SetBranchAddressI10PhaseSpaceEEiPKcPPT_PP7TBranch[_ZN5TTree16SetBranchAddressI10PhaseSpaceEEiPKcPPT_PP7TBranch]+0x45): undefined reference to `TDataType::GetType(std::type_info const&)'
/usr/bin/ld: /tmp/ccztkkZ3.o: in function `ROOT::Internal::TClassGetClassHelper<PhaseSpace>::GetClass(bool, bool)':
sort2.cxx:(.text._ZN4ROOT8Internal20TClassGetClassHelperI10PhaseSpaceE8GetClassEbb[_ZN4ROOT8Internal20TClassGetClassHelperI10PhaseSpaceE8GetClassEbb]+0x33): undefined reference to `TClass::GetClass(std::type_info const&, bool, bool, unsigned long, unsigned long)'
collect2: error: ld returned 1 exit status

When calling root from terminal this is the header.

   ------------------------------------------------------------------
  | Welcome to ROOT 6.24/02                        https://root.cern |
  | (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Jun 28 2021, 09:28:51                 |
  | From tags/v6-24-02@v6-24-02                                      |
  | With                                                             |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

No mention of the compiler used.

Calling root -b -q ./sort.C Inputphasespace.root gives

$ root -b -q ./sort.C Inputphasespace.root
Warning in <TApplication::GetOptions>: file Inputphasespace.root not found
   ------------------------------------------------------------------
  | Welcome to ROOT 6.24/02                        https://root.cern |
  | (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Jun 28 2021, 09:28:51                 |
  | From tags/v6-24-02@v6-24-02                                      |
  | With                                                             |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------


Processing ./sort.C...
input_line_9:2:2: error: no matching function for call to 'sort'
 sort() /* '.x' tries to invoke a function with the same name as the macro */
 ^~~~
/usr/include/c++/9/bits/stl_algo.h:4857:5: note: candidate function template not viable: requires 2 arguments, but 0 were provided
    sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
    ^
/usr/include/c++/9/bits/stl_algo.h:4887:5: note: candidate function template not viable: requires 3 arguments, but 0 were provided
    sort(_RandomAccessIterator __first, _RandomAccessIterator __last,

Really at a lost now, sorry for the continued questions. I really appreciate your efforts!

I compiled it like so:

$> g++ -o write `root-config --libs --cflags` ./write.cxx
$> ldd ./write
	linux-vdso.so.1 (0x00007ffc8579a000)
	libCore.so => /usr/lib/root/libCore.so (0x00007fa48990e000)
	libImt.so => /usr/lib/root/libImt.so (0x00007fa4898fb000)
	libRIO.so => /usr/lib/root/libRIO.so (0x00007fa489510000)
	libNet.so => /usr/lib/root/libNet.so (0x00007fa489431000)
	libHist.so => /usr/lib/root/libHist.so (0x00007fa48900a000)
	libGraf.so => /usr/lib/root/libGraf.so (0x00007fa488ea1000)
	libGraf3d.so => /usr/lib/root/libGraf3d.so (0x00007fa488dea000)
	libGpad.so => /usr/lib/root/libGpad.so (0x00007fa488d0d000)
	libROOTVecOps.so => /usr/lib/root/libROOTVecOps.so (0x00007fa488c2e000)
	libTree.so => /usr/lib/root/libTree.so (0x00007fa488a9b000)
	libTreePlayer.so => /usr/lib/root/libTreePlayer.so (0x00007fa488901000)
	libRint.so => /usr/lib/root/libRint.so (0x00007fa4888d4000)
	libPostscript.so => /usr/lib/root/libPostscript.so (0x00007fa488852000)
	libMatrix.so => /usr/lib/root/libMatrix.so (0x00007fa4886d3000)
	libPhysics.so => /usr/lib/root/libPhysics.so (0x00007fa488683000)
	libMathCore.so => /usr/lib/root/libMathCore.so (0x00007fa488450000)
	libThread.so => /usr/lib/root/libThread.so (0x00007fa4883e9000)
	libMultiProc.so => /usr/lib/root/libMultiProc.so (0x00007fa4883da000)
	libROOTDataFrame.so => /usr/lib/root/libROOTDataFrame.so (0x00007fa4882fc000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fa4882f5000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fa4880df000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007fa487f9b000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fa487f80000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fa487f5f000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007fa487d91000)
	libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007fa487d1a000)
	liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007fa487cf1000)
	libxxhash.so.0 => /usr/lib/libxxhash.so.0 (0x00007fa487ce5000)
	liblz4.so.1 => /usr/lib/liblz4.so.1 (0x00007fa487cc2000)
	libz.so.1 => /usr/lib/libz.so.1 (0x00007fa487ca8000)
	libzstd.so.1 => /usr/lib/libzstd.so.1 (0x00007fa487b97000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fa489dc2000)
	libtbb.so.2 => /usr/lib/libtbb.so.2 (0x00007fa487b51000)
	libssl.so.1.1 => /usr/lib/libssl.so.1.1 (0x00007fa487abf000)
	libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007fa4877e0000)
	libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007fa487716000)
	libROOTNTuple.so => /usr/lib/root/libROOTNTuple.so (0x00007fa48767e000)
	libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0x00007fa487539000)
	librt.so.1 => /usr/lib/librt.so.1 (0x00007fa48752e000)
	libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007fa48751b000)
	libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007fa4874e2000)
	libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0x00007fa487409000)
	libbrotlidec.so.1 => /usr/lib/libbrotlidec.so.1 (0x00007fa4873fb000)
	libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0x00007fa4873d6000)
	libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007fa4872a0000)
	libbrotlicommon.so.1 => /usr/lib/libbrotlicommon.so.1 (0x00007fa48727b000)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.