Hello all,
I have come across this problem in other places on ~the internet~, but haven’t seen a solution that works.
My problem is simple… I want to access the variable ADCs in the following TTree:
file:
ttree: rawdigit_daq_tree;
tbranch: rawdigit_daq_branch
tbranch: vectorlarlite::rawdigit
leaf: ADCs()
and the code I am using is:
[code]
#include “TTree.h”
#include “TFile.h”
#include “TRandom.h”
#include “TTree.h”
#include “TCanvas.h”
#include “TStyle.h”
#include “TMath.h”
#include
#include “TH1.h”
#include “TChain.h”
using namespace std;
void waveforms(){
TChain* wirecal = new TChain(“wire_caldata_tree”);
wirecal->Add(“file.root”);
TH1D *wf = new TH1D(“wf”,“waveform”,9000,0,9000);
int _ADCs;
THIS IS WHERE I AM LOST***
wirecal->SetBranchAddress(“ttree::rawdigit_daq_tree::rawdigit_daq_branch::vectorlarlite::rawdigit::ADCs()”, &_ADCs);
//I know that the :: isn’t working as a separator to go from branch to sub-branch, but I don’t know what to do
Long64_t nentries = wirecal->GetEntries();
Long64_t nb = 0, cb = 0 , cbytes = 0, nbytes = 0 ;
for (Long64_t i=0; i<nentries ; i++) {
Long64_t entry = wirecal->LoadTree(i);
if (entry <0 ) break;
nb = wirecal->GetEntry(i); nbytes += nb;
//wf->Fill(_ADCs);
}
TCanvas *cans = new TCanvas(“cans”,“gobble gobble gobble”,750,200);
cans->cd(1);
wf->SetXTitle(“waveform”);
wf->Draw();
}[/code]
Any advice is appreciated.
Thank you!