katilp / sandbox

My trials
0 stars 0 forks source link

notes - simple root plotting script without event loop #60

Open katilp opened 1 year ago

katilp commented 1 year ago

For a file with an Events tree with variables nPFCands and PFCands_pdgId :

{

// Open the input file
TFile* infile = new TFile("pfnanooutput.root");

// Declare a TCanvas
TCanvas *c1 = new TCanvas("c1", "Number of packed candidates", 800, 400);
TCanvas *c2 = new TCanvas("c2", "Type of packed candidates", 800, 400);

c1->cd(0);
Events->Draw("nPFCands");
c1->SaveAs("h_num_cands.png");

c2->cd(0);
Events->Draw("PFCands_pdgId");
c2->SaveAs("h_pdgid_cands.png");

}