Import Geant4 10.5.0 source tree

This commit is contained in:
Gabriele Cosmo
2018-12-07 15:15:39 +01:00
parent 6aa23be517
commit db49709b53
11370 changed files with 187480 additions and 160142 deletions
+28 -4
View File
@@ -4,6 +4,10 @@
// 2 - type '.X plot.C' at the ROOT session prompt
// This macro needs the output ROOT file
// *********************************************************************
void SetLeafAddress(TNtuple* ntuple, const char* name, void* address);
void plot()
{
gROOT->Reset();
gStyle->SetPalette(1);
@@ -11,14 +15,25 @@
TCanvas* c1 = new TCanvas ("c1","",20,20,1000,500);
TFile f("ICSD.root");
f.ls();
TFile* f = new TFile("ICSD.root");
f->ls();
TH1D* hist1 = new TH1D("histo","ICSD", 30, 0.0, 30);
Double_t ion = 0.0;
TNtuple* ntuple1 = (TNtuple*)f.Get("ntuple_1");
ntuple1->SetBranchAddress("ionisations", &ion);
TNtuple* ntuple1 = (TNtuple*)f->Get("ntuple_1");
bool rowWise = true;
TBranch* eventBranch = ntuple1->FindBranch("row_wise_branch");
if ( ! eventBranch ) rowWise = false;
std::cout << "rowWise: " << rowWise << std::endl;
if ( ! rowWise ) {
ntuple1->SetBranchAddress("ionisations", &ion);
} else {
SetLeafAddress(ntuple1, "ionisations",&ion);
}
Int_t nentries = ntuple1->GetEntries();
for (Int_t i=0; i<nentries; i++)
@@ -42,3 +57,12 @@
c1->SaveAs("ICSD.tiff");
}
void SetLeafAddress(TNtuple* ntuple, const char* name, void* address) {
TLeaf* leaf = ntuple->FindLeaf(name);
if ( ! leaf ) {
std::cerr << "Error in <SetLeafAddress>: unknown leaf --> " << name << std::endl;
return;
}
leaf->SetAddress(address);
}