Belle II Software development
Cosmics Class Reference
Inheritance diagram for Cosmics:
TrackingValidationRun BrowseTFileOnTerminateRunMixin ReadOrGenerateTrackedEventsRun PostProcessingRunMixin ReadOrGenerateEventsRun EmptyRun MinimalRun EmptyRun

Public Member Functions

 preparePathValidation (self, path)
 
 create_argument_parser (self, **kwds)
 
 create_path (self)
 
 postprocess (self)
 
 run (self, path)
 
 name (self)
 
 configure_and_execute_from_commandline (self)
 
 execute (self)
 
 configure_from_commandline (self)
 
 configure (self, arguments)
 
 adjust_path (self, path)
 

Static Public Attributes

 contact = TRACKING_MAILING_LIST
 Default contact email address for the validation results.
 
 root_output_file = None
 Optional file name as a destination of all event data which is discarded otherwise.
 
bool pulls = True
 Include the pull plots of the fit parameters in the validation.
 
bool resolution = False
 Include the residual plots of the fit parameters in the validation.
 
bool use_expert_folder = True
 Use the "expert" folder in the validation file as the destination of the pull and residual plots.
 
list exclude_profile_mc_parameter = []
 Exclude some of the perigee parameters from the mc side plots.
 
list exclude_profile_pr_parameter = []
 Exclude some of the perigee parameters from the pr side plots.
 
bool use_fit_information = False
 Do not fit the tracks but access the fit information for pulls etc.
 
bool extended = False
 Switch to use the extended harvesting validation instead.
 
bool saveFullTrees = False
 Only works in extended mode.
 
list non_expert_parameters = ['p_{t}']
 List of parameters which should be used as shifter plots (all plots with these x-labels)
 
 output_file_name = None
 There is no default for the name of the output TFile.
 
bool show_results = False
 By default, do not show the browsing results.
 
bool postprocess_only = False
 By default, browse the output TFile too.
 
str description = "Empty execution of basf2"
 Description of the run setup to be displayed on command line.
 
 finder_module = None
 Name of the finder module to be used - can be everything that is accepted by tracking.run.utilities.extend_path.
 
dict tracking_coverage
 States which detectors the finder module covers like as a dictionary like.
 
bool fit_tracks = False
 By default, do not add the track fitting to the execution.
 
bool mc_tracking = True
 By default, do MC track finding and track matching.
 
 generator_module = None
 By default, do not generate events.
 
str detector_setup = "Default"
 By default, use the default detector setup.
 
list bkg_files = []
 By default, no background overlay.
 
 components = None
 By default, do specific components.
 
bool disable_deltas = False
 By default, do not disable delta-ray generation.
 
 simulation_output = None
 By default, do no store the simulation output.
 
bool allow_input = True
 By default, this basf2 job can read events from an input ROOT TFile.
 
int n_events = 10000
 By default, process 10000 events.
 
 root_input_file = None
 By default, there is no input ROOT TFile.
 
 random_seed = None
 By default, the random-number seed is unassigned.
 
int n_processes = 0
 By default, no parallel processing.
 
int n_events_to_skip = 0
 By default, do not skip any events at the start of the input ROOT TFile.
 

Detailed Description

derived class that sets up the cosmics validation

Definition at line 30 of file cosmicsTrackingValidation.py.

Member Function Documentation

◆ adjust_path()

adjust_path ( self,
path )
inherited
Hook that gives the opportunity to check the path for consistency before processing it

Reimplemented in HarvestingRunMixin, VXDTF2TrackingValidation, and VXDTF2TrackingValidationBkg.

Definition at line 94 of file minimal.py.

94 def adjust_path(self, path):
95 """Hook that gives the opportunity to check the path for consistency before processing it"""
96
97# Minimal run stub defining some general parameters
98
99

◆ configure()

configure ( self,
arguments )
inherited
Save the command-line arguments as key-value pairs

Reimplemented in CDCDisplayRun, and ReadOrGenerateEventsRun.

Definition at line 73 of file minimal.py.

73 def configure(self, arguments):
74 """Save the command-line arguments as key-value pairs"""
75 # Simply translate the arguments that have
76 # the same name as valid instance arguments
77 for (key, value) in list(vars(arguments).items()):
78 if value is None:
79 continue
80 if hasattr(self, key):
81 get_logger().info("Setting %s to %s", key, value)
82 setattr(self, key, value)
83

◆ configure_and_execute_from_commandline()

configure_and_execute_from_commandline ( self)
inherited
Configure basf2 job script from command-line arguments then run it

Definition at line 45 of file minimal.py.

45 def configure_and_execute_from_commandline(self):
46 """Configure basf2 job script from command-line arguments then run it"""
47 self.configure_from_commandline()
48 self.execute()
49

◆ configure_from_commandline()

configure_from_commandline ( self)
inherited
Convert the command-line arguments to a basf2 job script

Definition at line 67 of file minimal.py.

67 def configure_from_commandline(self):
68 """Convert the command-line arguments to a basf2 job script"""
69 argument_parser = self.create_argument_parser()
70 arguments = argument_parser.parse_args()
71 self.configure(arguments)
72

◆ create_argument_parser()

create_argument_parser ( self,
** kwds )
inherited
Create command line argument parser

Reimplemented from BrowseTFileOnTerminateRunMixin.

Definition at line 102 of file run.py.

102 def create_argument_parser(self, **kwds):
103 """Create command line argument parser"""
104 argument_parser = super().create_argument_parser(**kwds)
105
106 # Left over from earlier parameter settings. Overwrites the more fundamental simulation_only parameter
107 argument_parser.add_argument(
108 '-o',
109 '--output',
110 dest='simulation_output',
111 default=argparse.SUPPRESS,
112 help='Output file to which the simulated events shall be written.'
113 )
114
115 argument_parser.add_argument(
116 '-e',
117 '--extended',
118 dest='extended',
119 action='store_true',
120 default=argparse.SUPPRESS,
121 help='Use the extended validation with more plots and whistles'
122 )
123
124 return argument_parser
125

◆ create_path()

create_path ( self)
inherited
Create path from parameters

Reimplemented from EmptyRun.

Definition at line 126 of file run.py.

126 def create_path(self):
127 """Create path from parameters"""
128 # Sets up a path that plays back pregenerated events or generates events
129 # based on the properties in the base class.
130 path = super().create_path()
131
132 # add the validation module to the path
133 self.preparePathValidation(path)
134
135 if self.root_output_file:
136 path.add_module("RootOutput", outputFileName=self.root_output_file)
137
138 return path
139
140

◆ execute()

execute ( self)
inherited
Create the basf2 path then run the job

Reimplemented in ReadOrGenerateEventsRun.

Definition at line 50 of file minimal.py.

50 def execute(self):
51 """Create the basf2 path then run the job"""
52 # Create path and run #
53
54 path = self.create_path()
55 self.adjust_path(path)
56 self.run(path)
57

◆ name()

name ( self)
inherited
provide name of this object

Definition at line 41 of file minimal.py.

41 def name(self):
42 """provide name of this object"""
43 return self.__class__.__name__
44

◆ postprocess()

postprocess ( self)
inherited
Browse the TFile interactively

Reimplemented from PostProcessingRunMixin.

Reimplemented in HarvestingRunMixin, and TrainingRunMixin.

Definition at line 84 of file mixins.py.

84 def postprocess(self):
85 """Browse the TFile interactively"""
86 if self.show_results and self.output_file_name:
87 with root_utils.root_open(self.output_file_name) as tfile:
88 root_utils.root_browse(tfile)
89 input("Close with return key.")
90
91 super().postprocess()
92
93

◆ preparePathValidation()

preparePathValidation ( self,
path )
inherited
The default way to add the validation module to the path. Derived classes can overload this method modify the validation module or add more than one validation steps.

Definition at line 64 of file run.py.

64 def preparePathValidation(self, path):
65 """The default way to add the validation module to the path.
66
67 Derived classes can overload this method modify the validation module
68 or add more than one validation steps.
69 """
70
71 if self.extended:
72 expert_level = None
73 if self.saveFullTrees:
74 expert_level = 200
75
76 trackingValidationModule = CombinedTrackingValidationModule(
77 name=self.name,
78 contact=self.contact,
79 output_file_name=self.output_file_name,
80 expert_level=expert_level
81 )
82 else:
83 # Validation module generating plots
84 trackingValidationModule = ExpertTrackingValidationModule(
85 self.name,
86 contact=self.contact,
87 fit=self.use_fit_information or self.fit_tracks,
88 pulls=self.pulls,
89 resolution=self.resolution,
90 output_file_name=self.output_file_name,
91 use_expert_folder=self.use_expert_folder,
92 exclude_profile_mc_parameter=self.exclude_profile_mc_parameter,
93 exclude_profile_pr_parameter=self.exclude_profile_pr_parameter
94 )
95 trackingValidationModule.trackCandidatesColumnName = "RecoTracks"
96
97 # tell the module which are the shifter (aka non-experts) plots
98 trackingValidationModule.non_expert_parameters = self.non_expert_parameters
99
100 path.add_module(trackingValidationModule)
101

◆ run()

run ( self,
path )
inherited
Post-process the basf2 job output

Reimplemented from EmptyRun.

Definition at line 45 of file mixins.py.

45 def run(self, path):
46 """Post-process the basf2 job output"""
47 if not self.postprocess_only:
48 super().run(path)
49
50 self.postprocess()
51

Member Data Documentation

◆ allow_input

bool allow_input = True
staticinherited

By default, this basf2 job can read events from an input ROOT TFile.

Definition at line 109 of file minimal.py.

◆ bkg_files

list bkg_files = []
staticinherited

By default, no background overlay.

Definition at line 47 of file event_generation.py.

◆ components

components = None
staticinherited

By default, do specific components.

Definition at line 49 of file event_generation.py.

◆ contact

contact = TRACKING_MAILING_LIST
staticinherited

Default contact email address for the validation results.

Definition at line 29 of file run.py.

◆ description

str description = "Empty execution of basf2"
staticinherited

Description of the run setup to be displayed on command line.

Definition at line 33 of file minimal.py.

◆ detector_setup

str detector_setup = "Default"
staticinherited

By default, use the default detector setup.

Definition at line 45 of file event_generation.py.

◆ disable_deltas

bool disable_deltas = False
staticinherited

By default, do not disable delta-ray generation.

Definition at line 51 of file event_generation.py.

◆ exclude_profile_mc_parameter

list exclude_profile_mc_parameter = []
staticinherited

Exclude some of the perigee parameters from the mc side plots.

Definition at line 47 of file run.py.

◆ exclude_profile_pr_parameter

list exclude_profile_pr_parameter = []
staticinherited

Exclude some of the perigee parameters from the pr side plots.

Definition at line 50 of file run.py.

◆ extended

bool extended = False
staticinherited

Switch to use the extended harvesting validation instead.

Definition at line 56 of file run.py.

◆ finder_module

◆ fit_tracks

bool fit_tracks = False
staticinherited

By default, do not add the track fitting to the execution.

Definition at line 47 of file tracked_event_generation.py.

◆ generator_module

generator_module = None
staticinherited

By default, do not generate events.

Definition at line 43 of file event_generation.py.

◆ mc_tracking

bool mc_tracking = True
staticinherited

By default, do MC track finding and track matching.

Definition at line 50 of file tracked_event_generation.py.

◆ n_events

n_events = 10000
staticinherited

By default, process 10000 events.

Definition at line 111 of file minimal.py.

◆ n_events_to_skip

int n_events_to_skip = 0
staticinherited

By default, do not skip any events at the start of the input ROOT TFile.

Definition at line 119 of file minimal.py.

◆ n_processes

n_processes = 0
staticinherited

By default, no parallel processing.

Definition at line 117 of file minimal.py.

◆ non_expert_parameters

list non_expert_parameters = ['p_{t}']
staticinherited

List of parameters which should be used as shifter plots (all plots with these x-labels)

Definition at line 62 of file run.py.

◆ output_file_name

output_file_name = None
staticinherited

There is no default for the name of the output TFile.

Reimplemented in ElossHarvestingRun, LegendreBinningValidationRun, SegmentFitValidationRun, and SegmentPairFitValidationRun.

Definition at line 60 of file mixins.py.

◆ postprocess_only

bool postprocess_only = False
staticinherited

By default, browse the output TFile too.

Post-process the basf2 job output

Definition at line 29 of file mixins.py.

◆ pulls

bool pulls = True
staticinherited

Include the pull plots of the fit parameters in the validation.

Definition at line 38 of file run.py.

◆ random_seed

random_seed = None
staticinherited

By default, the random-number seed is unassigned.

Definition at line 115 of file minimal.py.

◆ resolution

bool resolution = False
staticinherited

Include the residual plots of the fit parameters in the validation.

Definition at line 41 of file run.py.

◆ root_input_file

root_input_file = None
staticinherited

By default, there is no input ROOT TFile.

Definition at line 113 of file minimal.py.

◆ root_output_file

root_output_file = None
staticinherited

Optional file name as a destination of all event data which is discarded otherwise.

Definition at line 35 of file run.py.

◆ saveFullTrees

bool saveFullTrees = False
staticinherited

Only works in extended mode.

Definition at line 59 of file run.py.

◆ show_results

bool show_results = False
staticinherited

By default, do not show the browsing results.

Definition at line 62 of file mixins.py.

◆ simulation_output

simulation_output = None
staticinherited

By default, do no store the simulation output.

Definition at line 53 of file event_generation.py.

◆ tracking_coverage

dict tracking_coverage
staticinherited
Initial value:
= {
'UsePXDHits': True,
'UseSVDHits': True,
'UseCDCHits': True,
'UseOnlyAxialCDCHits': False,
'UseOnlyBeforeTOP': True,
'UseReassignedHits': True,
'UseNLoops': 1,
'WhichParticles': [],
}

States which detectors the finder module covers like as a dictionary like.

Definition at line 35 of file tracked_event_generation.py.

◆ use_expert_folder

bool use_expert_folder = True
staticinherited

Use the "expert" folder in the validation file as the destination of the pull and residual plots.

Definition at line 44 of file run.py.

◆ use_fit_information

bool use_fit_information = False
staticinherited

Do not fit the tracks but access the fit information for pulls etc.

Definition at line 53 of file run.py.


The documentation for this class was generated from the following file: