-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add example script for analysis_toolkit
- Loading branch information
1 parent
6d9d3ed
commit 7d891d6
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python | ||
"""Example script for usage of the analysis_toolkit for signal selection .""" | ||
|
||
import analysis_toolkit | ||
import ROOT | ||
|
||
geo_file = "geofile_full.conical.Pythia8-TGeant4.root" | ||
input_file = "ship.conical.Pythia8-TGeant4_rec.root" | ||
|
||
f = ROOT.TFile.Open(input_file) | ||
tree = f.cbmsim | ||
|
||
selection = analysis_toolkit.selection_check(geo_file) | ||
|
||
for event_nr, event in enumerate(tree): | ||
if event_nr > 200: | ||
break | ||
|
||
selection.access_event(event) | ||
|
||
if len(event.Particles) == 0: | ||
continue | ||
|
||
for candidate_id_in_event, signal in enumerate(tree.Particles): | ||
print(f"Event:{event_nr} Candidate_index: {candidate_id_in_event}") | ||
|
||
print(f"\t vertex time: {selection.define_candidate_time(signal)} ns") | ||
print(f"\t Impact Parameter: {selection.impact_parameter(signal)} cm") | ||
print(f"\t is within Fiducial volume: {selection.is_in_fiducial(signal)}") | ||
print(f"\t\tDist2InnerWall: {selection.dist_to_innerwall(signal)} cm") | ||
print(f"\t\tDist2EntranceLid: {selection.dist_to_entrance_vessel(signal)} cm") | ||
print(f"\t Daughter momentum>1 GeV: {selection.daughtermomentum(signal)} GeV") | ||
print(f"\t Invariant mass: {selection.invariant_mass(signal)} GeV") | ||
print(f"\t Degrees of Freedom ([d1,d2],Cut(>25)): {selection.nDOF(signal)}") | ||
print(f"\t Reduced Chi^2 ([d1,d2],Cut(<5): {selection.chi2nDOF(signal)}") | ||
print(f"\t DOCA: {selection.DOCA(signal)} cm") | ||
|
||
print( | ||
f"\t Preselection Cut passed:{selection.preselection_cut(signal,IP_cut=250)}" | ||
) | ||
print("------------------------------------------------------------") |