Skip to content
Snippets Groups Projects

Dev2

Merged Alkaid Cheng requested to merge dev2 into master
Files
11
@@ -63,6 +63,7 @@ class NTupleProcessTool(ConfigurableObject):
def __init__(self, sample_config:Union[Dict, str], outdir:str='output',
processor_config:Optional[str]=None,
processor_flags:Optional[List[str]]=None,
cache:bool=True,
use_template:bool=False,
multithread:bool=True,
disable_config_message:bool=False,
@@ -81,6 +82,7 @@ class NTupleProcessTool(ConfigurableObject):
self.processor = None
if processor_config is not None:
self.load_processor_config(processor_config,
cache=cache,
use_template=use_template,
multithread=multithread)
@@ -99,6 +101,11 @@ class NTupleProcessTool(ConfigurableObject):
self.path_manager.set_file("sample_config", config_path)
self.load_config(config_source)
if 'systematic_samples' not in self.config:
self.config['systematic_samples'] = {}
if 'systematics' not in self.config:
self.config['systematics'] = {}
if 'Nominal' in self.sample_config['systematic_samples']:
raise ValueError('Nominal samples should be placed in the "samples" key '
'(instead of "systematic_samples")')
@@ -174,13 +181,15 @@ class NTupleProcessTool(ConfigurableObject):
import pandas as pd
index_list = ['syst_theme', 'sample', 'syst_name', 'sample_type', 'syst_var']
attribute_df = pd.DataFrame(attribute_data).set_index(index_list)
return attribute_df
return attribute_df
def load_processor_config(self, config_path:str,
cache:bool=True,
multithread:bool=True,
use_template:bool=False):
from quickstats.components.processors import RooProcessor
self.processor = RooProcessor(config_path,
cache=cache,
use_template=use_template,
multithread=multithread,
verbosity=self.stdout.verbosity)
Loading