def configure(self, options):
        # call the base class method
        # this is not 'pure virtual' in the parlance of our times
        OptionSuite.configure(self, options)

        if self.options['other'] is None:
            self.options['other'] = []
 def configure(self, options):
     # call the base class method
     # this is not 'pure virtual' in the parlance of our times
     OptionSuite.configure(self, options)
     if options['geometry'] == 'flat':
         # this conforms to the behavior of the old simprod code
         options['length'] = None
         options['radius'] = None
         options['detcfg'] = None
     else:
         options['detcfg'] = options['length'] / (2. * options['radius'])
    def configure(self, options):
        # call the base class method
        # this is not 'pure virtual' in the parlance of our times
        OptionSuite.configure(self, options)

        deprecated = []
        if not self.options['runnum'] is None:
            deprecated.append('runnum')
            self.options['runnr'] = self.options['runnum']
        if not self.options['crtype'] is None:
            deprecated.append('crtype')
            self.options['prmpar'] = self.options['crtype']
        if not self.options['model'] is None:
            deprecated.append('model')
            self.options['he_model'] = self.options['model']
        if not self.options['lemodel'] is None:
            deprecated.append('lemodel')
            self.options['le_model'] = self.options['lemodel']
        if not self.options['nevents'] is None:
            deprecated.append('nevents')
            self.options['nshow'] = self.options['nevents']
        if not self.options['flat_detector'] is None:
            deprecated.append('flat_detector')
            self.options['geometry'] = 'flat'
        if not self.options['usepipe'] is None:
            deprecated.append('usepipe')
            self.options['pipe'] = self.options['usepipe']
        if not self.options['topdir'] is None:
            deprecated.append('topdir')
            self.options['outdir'] = self.options['topdir']
        if not self.options['URL'] is None:
            deprecated.append('URL')
            self.options['url'] = self.options['URL']
        if deprecated:
            import logging
            logging.getLogger('Corsika').warning(
                'Update your configuration. The following deprecated options are being used:\n  %s'
                % ('\n  '.join(deprecated)))
Exemple #4
0
    def configure(self, options):
        # call the base class method
        # this is not 'pure virtual' in the parlance of our times
        OptionSuite.configure(self, options)

        if not 'thin' in self.options['other']:
            return

        deprecated = [k for k in ['thinem_e', 'thinem_wmax', 'thinh_e', 'thinh_wmax'] if not self.options[k] is None]
        if deprecated:
            logging.getLogger('Corsika').warning('Update your configuration. The following deprecated thinning options are being used:\n  %s'%('\n  '.join(deprecated)))

        if not self.options['thinem_e'] is None:
            if self.options['thin_fraction'] is None:
                self.options['thin_fraction'] = self.options['thinem_e']
            else:
                logging.getLogger('Corsika').warning('Ignoring deprecated option thinem_e. Using thin-fraction instead.')

        if not self.options['thinh_e'] is None or not self.options['thinem_e'] is None:
            self.options['thin_thinrat'] = self.options['thinh_e']/self.options['thinem_e']
        if not self.options['thinh_wmax'] is None or not self.options['thinem_wmax'] is None:
            self.options['thin_weitrat'] = self.options['thinh_wmax']/self.options['thinem_wmax']

        if str(self.options['thin_method']) == 'none':
            self.options['efrcthn'] = self.options['thin_fraction']
            self.options['wmax'] = self.options['thin_wmax']
            self.options['rmax'] = self.options['thin_rmax']
            self.options['thinrat'] = self.options['thin_thinrat']
            self.options['weitrat'] = self.options['thin_weitrat']
        elif self.options['thin_method'] == '2009':
            self.options['efrcthn'] = 1.0E-6
            self.options['wmax'] = self.options['emin']*self.options['efrcthn'] # Calculate optimum weight from Alessio
            if self.options['wmax'] < 1.0: self.options['wmax'] = 1.0        # Ensure max weight is at least 1
            self.options['rmax'] = 0.0
            self.options['thinrat'] = 10.0/self.options['efrcthn']           # Just to be safe
            self.options['weitrat'] = 1.0/self.options['wmax']
        elif self.options['thin_method'] == '2010':
            # No in-ice muon thinning
            self.options['efrcthn'] = 1.0E-6
            # this is ~ E/(efrcthn * 10^8.4). Thinning is then 'absolute' with Eth=273 GeV if E>10**8.4 GeV
            if self.options['emin'] > pow(10, 8.4): self.options['efrcthn'] = 273.0/self.options['emin']
            self.options['wmax'] = self.options['emin']*self.options['efrcthn']
            if self.options['wmax'] < 1.0: self.options['wmax'] = 1.0  # Ensure max weight is at least 1
            self.options['rmax'] = 0.0
            self.options['thinrat'] = 10.0/self.options['efrcthn']     # Just to be safe, ethem/ethhad
            self.options['weitrat'] = 1.0/self.options['wmax']         # wmaxem/wmaxhad
        elif self.options['thin_method'] == 'auger-optimum':
            # M. Kobal (P. Auger Collaboration), Astropart. Phys. 15 (2001) 259
            # WMAX = EFRCTHN * Eo/GeV, WMAX >= 1
            self.options['efrcthn'] = self.options['thin_fraction']
            self.options['wmax'] = self.options['emin']*self.options['efrcthn']
            if self.options['wmax'] < 1.0: self.options['wmax'] = 1.0  # Ensure max weight is at least 1
            self.options['rmax'] = self.options['thin_rmax']
            self.options['thinrat'] = self.options['thin_thinrat']
            if self.options['thin_weitrat'] is None:
                self.options['weitrat'] = 1./100.
            else:
                self.options['weitrat'] = self.options['thin_weitrat']
        elif self.options['thin_method'] == 'icecube-optimum':
            # M. Kobal (P. Auger Collaboration), Astropart. Phys. 15 (2001) 259
            # WMAX = EFRCTHN * Eo/GeV, WMAX >= 1 and hadronic part is not thinned
            # WEITRAT = WMAX (with this, one can still get weights like 1.01 or so)
            # THINRAT > EFRCTHN * Eo / Ecut, where Ecut is low enough so muons/pions are never thinned. We take the ectual cut used.
            ecut = min(self.options['ecuts1'], self.options['ecuts2'])
            self.options['efrcthn'] = self.options['thin_fraction']
            self.options['wmax'] = self.options['emin']*self.options['efrcthn']
            if self.options['wmax'] < 1.0: self.options['wmax'] = 1.0
            self.options['rmax'] = self.options['thin_rmax']
            self.options['thinrat'] = (self.options['emin']*self.options['efrcthn'])/ecut
            self.options['weitrat'] = (self.options['wmax']) # should not be needed, actually
        else:
            logging.critical('Specified thinning method not supported')