Dear all,
I trying to get my feet wet with RDataFrame, and I ran (swam?) into a problem. I get the following running my code
Exp2292Analysis()
Error in TTreeReaderArrayBase::GetBranchContentDataType(): The branch SPIDERChannel was created using a leaf list and cannot be represented as a C++ type. Please access one of its siblings using a TTreeReaderArray:
Error in TTreeReaderArrayBase::GetBranchContentDataType(): SPIDERChannel.SPIDERChannelId
Error in TTreeReaderArrayBase::CreateContentProxy(): Cannot determine the type contained in the collection of branch SPIDERChannel. That’s weird - please report!
Error in TTreeReaderArrayBase::GetBranchContentDataType(): The branch SPIDERChannel was created using a leaf list and cannot be represented as a C++ type. Please access one of its siblings using a TTreeReaderArray:
A print of the tree gives
…
*Br 43 :SPIDERBoard : SPIDERBoardId[nbSPIDER]/s *
*Entries : 20016537 : Total Size= 100775196 bytes File Size = 22173620 *
*Baskets : 164 : Basket Size= 5178880 bytes Compression= 4.54 *
…
*Br 44 :SPIDERChannel : SPIDERChannelId[nbSPIDER]/s *
*Entries : 20016537 : Total Size= 100775532 bytes File Size = 25032452 *
*Baskets : 164 : Basket Size= 5179392 bytes Compression= 4.03 *
…
and the code I try to use is
#include "ROOT/RDataFrame.hxx"
#include "ROOT/RDFHelpers.hxx"
#include "ROOT/RVec.hxx"
#include "ROOT/RDF/RInterface.hxx"
#include "TCanvas.h"
#include "TH1D.h"
#include "TLatex.h"
#include "TLegend.h"
#include <Math/Vector4Dfwd.h>
#include <Math/GenVector/LorentzVector.h>
#include <Math/GenVector/PtEtaPhiM4D.h>
#include "TStyle.h"
#include "TChain.h"
#include <string>
using namespace ROOT::VecOps;
using RNode = ROOT::RDF::RNode;
using cRVecF = const ROOT::RVecF &;
using cRVecS = const ROOT::RVec<Short_t> &;
double Theta(cRVecF trackX1,cRVecF trackY1,
cRVecF trackZ1,cRVecS SPIDERChannel,
cRVecS SPIDERBoard)
{
return 90;
}
void Exp2292Analysis(std::string inputdir="")
{
// Enable multi-threading
ROOT::EnableImplicitMT();
TChain thechain("TreeMaster","TreeMaster");
thechain.Add((inputdir+"Tree_0000.root").c_str());
ROOT::RDataFrame df(thechain);
auto h = df.Define("Theta",Theta,{"trackX1","trackY1",
"trackZ1","SPIDERChannel","SPIDERBoard"}).
Histo2D({"trackETheta","trackETheta",181,-.5,180.5,
6000,-.25,2999.75},"Theta","trackE");
h->DrawClone("col");
}
Any ideas?
best regards
Joa
root-config --version
6.30.04
g++ --version
g++ (GCC) 12.3.1 20230508 (Red Hat 12.3.1-1)
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
g++ --version
g++ (GCC) 12.3.1 20230508 (Red Hat 12.3.1-1)
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.