54 """Read ntuple from the Geant4 simulation and calculate FCal sampling
57 Returns (E_init, samp_frac, samp_frac_err)
60 print(
"Reading tree '{}' from file '{}'...".
format(tree_name, args.infile))
62 aan_chain = root.TChain(tree_name)
63 aan_chain.Add(args.infile)
65 n_event = aan_chain.GetEntries()
68 for event
in aan_chain:
69 E_init =
round(event.E, 2) / 1000
76 print(
"Event Active E [MeV] Total E [MeV]")
79 for event
in aan_chain:
80 if args.module.lower() ==
"fcal1":
81 totalE = event.Calib_FCal1Active + event.Calib_FCal1Inactive
82 activeE = event.FCal1_E
83 elif args.module.lower() ==
"fcal2":
84 totalE = event.Calib_FCal2Active + event.Calib_FCal2Inactive
85 activeE = event.FCal2_E
86 elif args.module.lower() ==
"fcal3":
87 totalE = event.Calib_FCal3Active + event.Calib_FCal3Inactive
88 activeE = event.FCal3_E
90 samp_frac += activeE / totalE
91 samp_frac_sq += (activeE / totalE)**2
94 print(
"{:<6} {:<15g} {:<15g}".
format(event.Event, activeE, totalE))
101 samp_frac_sq /= n_event
104 samp_frac_err = math.sqrt(samp_frac_sq - samp_frac**2) / math.sqrt(n_event)
106 print(
"{} sampling fraction (E = {:g} GeV): {:g} +/- {:g}".
format(args.module, E_init, samp_frac, samp_frac_err))
108 return E_init, samp_frac, samp_frac_err