5 This script loops over the particle hypotheses and feeds the NTuples
6 into the ROOT Selector for processing. Within this processing, histograms for EoP, etc.
7 are filled based on the reconstructed momentum and theta bins.
8 These histograms are later used as input for the PDF fitter.
11 __author__ =
"Caitlin MacQueen, Marco Milesi"
12 __email__ =
"cmq.centaurus@gmail.com, marco.milesi@unimelb.edu.au"
13 __date__ =
"June 2018"
19 parser = argparse.ArgumentParser(description=description)
21 parser.add_argument(
"inputpath",
24 help=
"Path to the directory where input NTuples are stored.")
31 default=os.path.abspath(
34 help=
"Path to the output directory with the histograms for each particle hypothesis. Default is current directory.")
36 args = parser.parse_args()
41 ROOT.gROOT.SetBatch(
True)
43 g_hypotheses = [11, 13, 211, 321, 2212]
45 if __name__ ==
"__main__":
47 print(
"Creating output directory for histograms:\n{0}".format(os.path.abspath(args.outputpath)))
48 if not os.path.exists(args.outputpath):
49 os.makedirs(args.outputpath)
51 print(
"Start selector...")
53 selector = ROOT.TSelector.GetSelector(
"eclChargedPidSelector.C+")
55 for hypo
in g_hypotheses:
57 print(
"Particle: {0}".format(hypo))
58 input_p = ROOT.TFile.Open(
"{0}/pdg{1}.root".format(args.inputpath, hypo),
"READ")
59 selector.SetOutputDir(args.outputpath)
60 tree_p = input_p.Get(
"n1_tree")
61 tree_p.Process(selector)
64 print(
"Antiparticle: {0}".format(hypo))
65 input_ap = ROOT.TFile.Open(
"{0}/pdganti{1}.root".format(args.inputpath, hypo),
"READ")
66 selector.SetOutputDir(args.outputpath)
67 tree_ap = input_ap.Get(
"n1_tree")
68 tree_ap.Process(selector)
72 for ext
in [
"_C.d",
"_C.so",
"_C_ACLiC_dict_rdict.pcm"]:
73 os.remove(
"{0}/eclChargedPidSelector{1}".format(os.path.abspath(os.path.curdir), ext))