Import Geant4 10.5.0 source tree
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
// -------------------------------------------------------------------
|
||||
// $Id: plot.C 70323 2013-05-29 07:57:44Z gcosmo $
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
// *********************************************************************
|
||||
@@ -7,23 +6,33 @@
|
||||
// 1 - launch ROOT (usually type 'root' at your machine's prompt)
|
||||
// 2 - type '.X plot.C' at the ROOT session prompt
|
||||
// *********************************************************************
|
||||
|
||||
void SetLeafAddress(TNtuple* ntuple, const char* name, void* address);
|
||||
|
||||
void plot()
|
||||
{
|
||||
gROOT->Reset();
|
||||
gStyle->SetPalette(1);
|
||||
gROOT->SetStyle("Plain");
|
||||
|
||||
c1 = new TCanvas ("c1","",20,20,1500,500);
|
||||
c1->Divide(3,1);
|
||||
|
||||
system ("rm -rf dna.root");
|
||||
system ("hadd dna.root dna_*.root");
|
||||
|
||||
TFile f("dna.root");
|
||||
|
||||
TNtuple* ntuple;
|
||||
ntuple = (TNtuple*)f.Get("dna");
|
||||
|
||||
c1->cd(1);
|
||||
gROOT->Reset();
|
||||
gStyle->SetPalette(1);
|
||||
gROOT->SetStyle("Plain");
|
||||
|
||||
TCanvas* c1 = new TCanvas ("c1","",20,20,1500,500);
|
||||
c1->Divide(3,1);
|
||||
|
||||
// Uncomment if merging should be done
|
||||
//system ("rm -rf dna.root");
|
||||
//system ("hadd dna.root dna_*.root");
|
||||
|
||||
TFile* f = new TFile("dna.root");
|
||||
|
||||
TNtuple* ntuple;
|
||||
ntuple = (TNtuple*)f->Get("dna");
|
||||
bool rowWise = true;
|
||||
TBranch* eventBranch = ntuple->FindBranch("row_wise_branch");
|
||||
if ( ! eventBranch ) rowWise = false;
|
||||
// std::cout << "rowWise: " << rowWise << std::endl;
|
||||
|
||||
// canvas tab 1
|
||||
c1->cd(1);
|
||||
gStyle->SetOptStat(000000);
|
||||
|
||||
// All
|
||||
@@ -58,7 +67,8 @@ c1->cd(1);
|
||||
|
||||
gPad->SetLogy();
|
||||
|
||||
c1->cd(2);
|
||||
// canvas tab 2
|
||||
c1->cd(2);
|
||||
|
||||
ntuple->SetMarkerColor(2);
|
||||
|
||||
@@ -68,7 +78,8 @@ c1->cd(2);
|
||||
//ntuple->SetMarkerSize(4);
|
||||
//ntuple->Draw("x:y:z/1000","flagParticle==4 || flagParticle==5 || flagParticle==6","same");
|
||||
|
||||
c1->cd(3);
|
||||
// canvas tab 3
|
||||
c1->cd(3);
|
||||
|
||||
Double_t flagParticle;
|
||||
Double_t flagProcess;
|
||||
@@ -85,20 +96,38 @@ c1->cd(3);
|
||||
Int_t parentID;
|
||||
Double_t angle;
|
||||
|
||||
ntuple->SetBranchAddress("flagParticle",&flagParticle);
|
||||
ntuple->SetBranchAddress("flagProcess",&flagProcess);
|
||||
ntuple->SetBranchAddress("x",&x);
|
||||
ntuple->SetBranchAddress("y",&y);
|
||||
ntuple->SetBranchAddress("z",&z);
|
||||
ntuple->SetBranchAddress("totalEnergyDeposit",&totalEnergyDeposit);
|
||||
ntuple->SetBranchAddress("stepLength",&stepLength);
|
||||
ntuple->SetBranchAddress("kineticEnergyDifference",&kineticEnergyDifference);
|
||||
ntuple->SetBranchAddress("kineticEnergy",&kineticEnergy);
|
||||
ntuple->SetBranchAddress("cosTheta",&angle);
|
||||
ntuple->SetBranchAddress("eventID",&eventID);
|
||||
ntuple->SetBranchAddress("trackID",&trackID);
|
||||
ntuple->SetBranchAddress("parentID",&parentID);
|
||||
ntuple->SetBranchAddress("stepID",&stepID);
|
||||
if ( ! rowWise ) {
|
||||
ntuple->SetBranchAddress("flagParticle",&flagParticle);
|
||||
ntuple->SetBranchAddress("flagProcess",&flagProcess);
|
||||
ntuple->SetBranchAddress("x",&x);
|
||||
ntuple->SetBranchAddress("y",&y);
|
||||
ntuple->SetBranchAddress("z",&z);
|
||||
ntuple->SetBranchAddress("totalEnergyDeposit",&totalEnergyDeposit);
|
||||
ntuple->SetBranchAddress("stepLength",&stepLength);
|
||||
ntuple->SetBranchAddress("kineticEnergyDifference",&kineticEnergyDifference);
|
||||
ntuple->SetBranchAddress("kineticEnergy",&kineticEnergy);
|
||||
ntuple->SetBranchAddress("cosTheta",&angle);
|
||||
ntuple->SetBranchAddress("eventID",&eventID);
|
||||
ntuple->SetBranchAddress("trackID",&trackID);
|
||||
ntuple->SetBranchAddress("parentID",&parentID);
|
||||
ntuple->SetBranchAddress("stepID",&stepID);
|
||||
}
|
||||
else {
|
||||
SetLeafAddress(ntuple, "flagParticle",&flagParticle);
|
||||
SetLeafAddress(ntuple, "flagProcess",&flagProcess);
|
||||
SetLeafAddress(ntuple, "x",&x);
|
||||
SetLeafAddress(ntuple, "y",&y);
|
||||
SetLeafAddress(ntuple, "z",&z);
|
||||
SetLeafAddress(ntuple, "totalEnergyDeposit",&totalEnergyDeposit);
|
||||
SetLeafAddress(ntuple, "stepLength",&stepLength);
|
||||
SetLeafAddress(ntuple, "kineticEnergyDifference",&kineticEnergyDifference);
|
||||
SetLeafAddress(ntuple, "kineticEnergy",&kineticEnergy);
|
||||
SetLeafAddress(ntuple, "cosTheta",&angle);
|
||||
SetLeafAddress(ntuple, "eventID",&eventID);
|
||||
SetLeafAddress(ntuple, "trackID",&trackID);
|
||||
SetLeafAddress(ntuple, "parentID",&parentID);
|
||||
SetLeafAddress(ntuple, "stepID",&stepID);
|
||||
}
|
||||
|
||||
TH1F* hsolvE = new TH1F ("hsolvE","solvE",100,0,2000);
|
||||
TH1F* helastE = new TH1F ("helastE","elastE",100,0,2000);
|
||||
@@ -109,7 +138,6 @@ c1->cd(3);
|
||||
|
||||
for (Int_t j=0;j<ntuple->GetEntries(); j++)
|
||||
{
|
||||
|
||||
ntuple->GetEntry(j);
|
||||
if (flagProcess==10) hsolvE->Fill(x);
|
||||
if (flagProcess==11) helastE->Fill(x);
|
||||
@@ -137,7 +165,13 @@ c1->cd(3);
|
||||
hattE->Draw("SAME");
|
||||
hvibE->Draw("SAME");
|
||||
hsolvE->Draw("SAME");
|
||||
|
||||
|
||||
end:
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user