Пример #1
0
    def initialize(self):

        if self.is_initialized: return
        from pyWIMP.DMModels.base_model import BaseVariables
        from pyWIMP.DMModels.flat_model import FlatModel
        from pyWIMP.DMModels.oscillation_model import OscillationModel
        self.basevars = BaseVariables(time_beginning=0,
            time_in_years=self.total_time,
            energy_threshold=self.threshold,
            energy_max=self.energy_max)

        self.oscClass = OscillationModel(self.basevars)

        self.flatClass = FlatModel(self.basevars)


        self.calculation_class = \
            osc.OscillationSensitivityCalculation(self.exit_manager)

        self.variables = ROOT.RooArgSet()
        self.variables.add(self.basevars.get_time())

        self.basevars.get_energy().setVal(0)
        self.basevars.get_energy().setConstant(True)

        # This is where we define our models
        self.background =  self.flatClass.get_model()
        self.model = self.oscClass.get_model()
        self.norm = 1 
        self.is_initialized = True

        
        if self.model_amplitude > 1: self.model_amplitude = 1
        elif self.model_amplitude < 0: self.model_amplitude = 0
        self.signal_percentage = ROOT.RooRealVar("signal_percentage", 
                                            "signal_percentage", 
                                            self.model_amplitude)
        self.background_model = ROOT.RooAddPdf(
                                "background",
                                "Data Model",
                                self.model,
                                self.background,
                                self.signal_percentage)

        self.model_normal = ROOT.RooRealVar("model_normal", 
                                            "model_normal", 
                                            self.model_amplitude, 
                                            0, 1)

        self.total_fit_counts = ROOT.RooRealVar("total_fit_counts", 
                                            "total_fit_counts", 
                                            self.total_counts, 
                                            0, 3*self.total_counts)
        self.added_pdf = ROOT.RooAddPdf(
                                "added_pdf",
                                "Fit Model",
                                self.model,
                                self.background,
                                self.model_normal)

        self.model_extend = ROOT.RooExtendPdf("model_extend",
                                              "Signal + Background",
                                              self.added_pdf,
                                              self.total_fit_counts)

        self.test_variable = self.model_normal
        self.data_set_model = self.background_model
        self.fitting_model = self.model_extend 
Пример #2
0
class OscillationSignalDetection(WIMPModel):
    def get_requested_values(cls):
        adict = WIMPModel.get_requested_values()
        del adict['constant_energy']
        del adict['constant_time']
        del adict['wimp_mass']
        del adict['variable_quenching']
        adict['model_amplitude'] = ('Initial model amplitude', 0.1)
        return adict
    get_requested_values = classmethod(get_requested_values)

    # overload this function for derived classes.
    def initialize(self):

        if self.is_initialized: return
        from pyWIMP.DMModels.base_model import BaseVariables
        from pyWIMP.DMModels.flat_model import FlatModel
        from pyWIMP.DMModels.oscillation_model import OscillationModel
        self.basevars = BaseVariables(time_beginning=0,
            time_in_years=self.total_time,
            energy_threshold=self.threshold,
            energy_max=self.energy_max)

        self.oscClass = OscillationModel(self.basevars)

        self.flatClass = FlatModel(self.basevars)


        self.calculation_class = \
            osc.OscillationSensitivityCalculation(self.exit_manager)

        self.variables = ROOT.RooArgSet()
        self.variables.add(self.basevars.get_time())

        self.basevars.get_energy().setVal(0)
        self.basevars.get_energy().setConstant(True)

        # This is where we define our models
        self.background =  self.flatClass.get_model()
        self.model = self.oscClass.get_model()
        self.norm = 1 
        self.is_initialized = True

        
        if self.model_amplitude > 1: self.model_amplitude = 1
        elif self.model_amplitude < 0: self.model_amplitude = 0
        self.signal_percentage = ROOT.RooRealVar("signal_percentage", 
                                            "signal_percentage", 
                                            self.model_amplitude)
        self.background_model = ROOT.RooAddPdf(
                                "background",
                                "Data Model",
                                self.model,
                                self.background,
                                self.signal_percentage)

        self.model_normal = ROOT.RooRealVar("model_normal", 
                                            "model_normal", 
                                            self.model_amplitude, 
                                            0, 1)

        self.total_fit_counts = ROOT.RooRealVar("total_fit_counts", 
                                            "total_fit_counts", 
                                            self.total_counts, 
                                            0, 3*self.total_counts)
        self.added_pdf = ROOT.RooAddPdf(
                                "added_pdf",
                                "Fit Model",
                                self.model,
                                self.background,
                                self.model_normal)

        self.model_extend = ROOT.RooExtendPdf("model_extend",
                                              "Signal + Background",
                                              self.added_pdf,
                                              self.total_fit_counts)

        self.test_variable = self.model_normal
        self.data_set_model = self.background_model
        self.fitting_model = self.model_extend