#include "TCanvas.h" #include "TROOT.h" #include "TGraphErrors.h" #include "TH1.h" #include "TLegend.h" #include "TArrow.h" #include "TLatex.h" #include "TMath.h" #include #include #include #include #include //using RDataFrame to cut and analyse PionTtrr using namespace std; using namespace ROOT::VecOps; //function for comparing strings //EndProcess, primary particle etc //*********************** //Main Function int snap(){ ROOT::RDataFrame frame("myTree", "snap_pionana.root"); TFile *output = new TFile("output.root", "RECREATE"); //Lambda for Mean of the primary Particle dEdX (of type vector), that works well auto meanPrimarydEdX = [](const ROOT::RVec &dEdX){return Mean(dEdX);}; //This one will cause problems auto meanDaughterdEdX = [](const ROOT::RVec &reco_daughter_dEdX){return Mean(reco_daughter_dEdX);}; //Histos //This one Works: auto primarydEdX = frame.Define("primMean_dEdX", meanPrimarydEdX, {"dEdX"}).Histo1D("primMean_dEdX"); //This doesn't auto allDaughterdEdX = frame.Define("allDaughterMean_dEdX",meanDaughterdEdX,{"reco_daughter_dEdX"}).Histo1D("allDaughterMean_dEdX"); primarydEdX->Draw(); primarydEdX->Write(); allDaughterdEdX->Draw(); allDaughterdEdX->Write(); return 0; }