#include "TROOT.h" #include "TSystem.h" #include "TStyle.h" #include "TPad.h" #include "TString.h" #include "TFile.h" #include "TSystem.h" #include "TImage.h" #include "TCanvas.h" #include "ROOT/TSeq.hxx" #include "ROOT/RDataFrame.hxx" #include #include #include #include #include "Riostream.h" #include "TF1.h" #include "TH1.h" #include "TH2D.h" #include "TH2I.h" #include "TH3I.h" #include "TTree.h" #include "TLatex.h" #include "TLegend.h" #include "TProfile.h" #include "TGraphErrors.h" #include "TLatex.h" #include #include "TChain.h" using namespace std; static const int Nchan = 65; class HitClass : public TObject { public: double lead; double tot; int ch; ClassDef(HitClass,1); }; class EvClass : public TObject { public: double xpos; double ypos; double reftime; double abstime; int noev; ULong64_t evnumtot; vector fHitArray; ClassDef(EvClass,1); }; ClassImp(HitClass) ClassImp(EvClass) double * getLeadsArray(EvClass *fEvent) { vector leads; for (uint hit = 0; hit < fEvent->fHitArray.size(); hit++) { leads.push_back(fEvent->fHitArray[hit].lead); } double* a = &leads[0]; return a; } void xyplotrdf(){ TChain chain("E"); chain.Add("scanxy.root"); ROOT::RDataFrame df(chain); auto getChannelArray = [&](EvClass *fEvent) { vector channels; for (uint hit = 0; hit < fEvent->fHitArray.size(); hit++) { channels.push_back(fEvent->fHitArray[hit].ch); } return channels[0]; }; auto h1 = df.Define("channels", getChannelArray, {"fEvent"}) // .Define("leads", getLeadsArray, {"fEvent"}) .Histo1D({"fig", "fig", 64, 0, 64}, "channels"); h1->DrawCopy(""); }