7 const char* in =
"DSTReader.root",
8 const char* out =
"hist.root"
11 gSystem->Load(
"libg4testbench");
13 TFile *outf = TFile::Open(out,
"recreate");
15 TFile *inf = TFile::Open(in,
"read");
16 TTree *T = (TTree*) inf->Get(
"T");
23 T->SetAlias(
"avg_x",
"G4HIT_Coil.get_avg_x()");
24 T->SetAlias(
"avg_y",
"G4HIT_Coil.get_avg_y()");
25 T->SetAlias(
"avg_z",
"G4HIT_Coil.get_avg_z()");
26 T->SetAlias(
"avg_r",
"sqrt(avg_x*avg_x+avg_z*avg_z)");
27 T->SetAlias(
"avg_phi",
"TMath::ATan2(-avg_x,avg_z)/TMath::Pi()*180");
28 T->SetAlias(
"edep",
"G4HIT_Coil.get_edep()");
30 TH2D *h2d_ezy =
new TH2D(
"h2d_ezy",
"edep [GeV]; avg_z [cm]; avg_y [cm]", 50, -25, 25, 50, -25, 25);
31 T->Project(
"h2d_ezy",
"avg_y:avg_z",
"edep");
35 TH2D *h2d_ezy_0 =
new TH2D(
"h2d_ezy_0",
"edep [GeV], |x|<0.5cm; Z [cm]; Y [cm]", 50, -25, 25, 50, -25, 25);
36 T->Project(
"h2d_ezy_0",
"avg_y:avg_z",
"edep*(abs(avg_x)<0.5)");
41 for(
int i=0;i<51;++i) ybin[i] = i - 25.;
44 for(
int i=0;i<50;++i) {
45 const char* hname = Form(
"h2d_ezx_%02d",i);
46 TH2D *h2d_ezx =
new TH2D(hname,
47 Form(
"edep [GeV], %02.0f<avg_y<%02.0f cm; avg_z [cm]; avg_x [cm]", ybin[i], ybin[i+1]),
48 50, -25, 25, 50, -25, 25);
49 T->Project(hname,
"avg_x:avg_z" , Form(
"edep*(avg_y>%f&&avg_y<%f)",ybin[i],ybin[i+1]));
54 TH2D *h2d_ephiy =
new TH2D(
"h2d_ephiy",
"edep [GeV]; #phi [deg.]; avg_y [cm]", 38, -180, 180, 50, -25, 25);
55 T->Project(
"h2d_ephiy",
"avg_y:avg_phi",
"edep*(avg_r<7)");