Belle II Software  release-08-01-10
ECLChargedPid.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 """
13 <header>
14  <input>PartGunChargedStableGenSim.root</input>
15  <contact>Marco Milesi, marco.milesi@unimelb.edu.au</contact>
16  <description> This steering script fully reconstructs particle gun events for a set of charged stable particles,
17 and dumps ECL PID validation info in an ntuple and a set of histograms (one file for each pdgId).</description>
18 </header>
19 """
20 
21 import basf2
22 from reconstruction import add_reconstruction
23 from ROOT import Belle2
24 
25 # Pdg code of the charged stable particles & antiparticles.
26 chargedStableList = []
27 for idx in range(len(Belle2.Const.chargedStableSet)):
28  particle = Belle2.Const.chargedStableSet.at(idx)
29  # Skip deuteron for now...
30  if particle == Belle2.Const.deuteron:
31  continue
32  pdgId = particle.getPDGCode()
33  chargedStableList.extend([pdgId, -pdgId])
34 
35 
36 # Merge particles and antiparticles in the same plots for these hypotheses.
37 mergeChargeOfPdgIds = [
38  Belle2.Const.pion.getPDGCode(),
39  Belle2.Const.kaon.getPDGCode(),
40  Belle2.Const.proton.getPDGCode()
41 ]
42 
43 # Create path.
44 main = basf2.create_path()
45 
46 # Read input.
47 inputFileName = "../PartGunChargedStableGenSim.root"
48 main.add_module("RootInput", inputFileName=inputFileName)
49 
50 # Load parameters.
51 main.add_module("Gearbox")
52 # Create geometry.
53 main.add_module("Geometry")
54 
55 # Reconstruct events.
56 add_reconstruction(main)
57 
58 # Dump validation plots.
59 main.add_module(
60  "ECLChargedPIDDataAnalysisValidation",
61  outputFileName="ECLChargedPid",
62  inputPdgIdList=chargedStableList,
63  mergeChargeOfPdgIds=mergeChargeOfPdgIds)
64 
65 # Show progress of processing.
66 main.add_module("ProgressBar")
67 
68 basf2.print_path(main)
69 
70 main.add_module('Progress')
71 basf2.process(main)
72 print(basf2.statistics)