class SimulationTask(Basf2PathTask): n_events = luigi.IntParameter() event_type = luigi.EnumParameter(enum=SimulationType) def create_path(self): path = basf2.create_path() modularAnalysis.setupEventInfo(self.n_events, path) if self.event_type == SimulationType.y4s: dec_file = Belle2.FileSystem.findFile( 'analysis/examples/tutorials/B2A101-Y4SEventGeneration.dec') elif self.event_type == SimulationType.continuum: dec_file = Belle2.FileSystem.findFile( 'analysis/examples/simulations/B2A102-ccbarEventGeneration.dec' ) else: raise ValueError( f"Event type {self.event_type} is not valid. It should be either 'Y(4S)' or 'Continuum'!" ) generators.add_evtgen_generator(path, 'signal', dec_file) modularAnalysis.loadGearbox(path) simulation.add_simulation(path) path.add_module('RootOutput', outputFileName=self.get_output_file_name( 'simulation_full_output.root')) return path def output(self): yield self.add_to_output("simulation_full_output.root")
class DataTask(b2luigi.ExternalTask): data_mode = b2luigi.EnumParameter(enum=DataMode) experiment_number = b2luigi.IntParameter() run_number = b2luigi.IntParameter() prefix = b2luigi.Parameter() file_name = b2luigi.Parameter()