getDDneutronEnergy)
from utilities.ionStopping import ionStopping

argParser = argparse.ArgumentParser()
argParser.add_argument('-run', choices=[0, 1, 2, 3], default=0, type=int)
parsedArgs = argParser.parse_args()
runNumber = parsedArgs.run
standoff = {
    0: distances.tunlSSA_CsI.standoffMid,
    1: distances.tunlSSA_CsI.standoffClose,
    2: distances.tunlSSA_CsI.standoffClose,
    3: distances.tunlSSA_CsI.standoffFar
}
standoffName = {0: 'mid', 1: 'close', 2: 'close', 3: 'far'}

tofWindowSettings = tofWindows()
##############
# vars for binning of TOF
# this range covers each of the 4 multi-standoff runs
#tof_nBins = 120
#tof_minRange = 130.0
#tof_maxRange = 250.0
tof_nBins = tofWindowSettings.nBins[standoffName[runNumber]]
tof_minRange = tofWindowSettings.minRange[standoffName[runNumber]]
tof_maxRange = tofWindowSettings.maxRange[standoffName[runNumber]]
tof_range = (tof_minRange, tof_maxRange)

eD_bins = 150
eD_minRange = 200.0
eD_maxRange = 1700.0
eD_range = (eD_minRange, eD_maxRange)
Beispiel #2
0
    def __init__(self,
                 chainFilename,
                 nSamplesFromTOF,
                 nBins_eD=100,
                 nBins_x=20,
                 nRuns=4):
        """Create a PPC tools object - reads in chain from file"""
        self.chain, self.probs, self.nParams, self.nWalkers, self.nSteps = readChainFromFile(
            chainFilename)

        self.nRuns = nRuns

        self.eD_bins = nBins_eD
        self.eD_minRange = 200.0
        self.eD_maxRange = 1200.0
        self.eD_range = (self.eD_minRange, self.eD_maxRange)
        self.eD_binSize = (self.eD_maxRange - self.eD_minRange) / self.eD_bins
        self.eD_binCenters = np.linspace(
            self.eD_minRange + self.eD_binSize / 2,
            self.eD_maxRange - self.eD_binSize / 2, self.eD_bins)
        self.eD_binMax = self.eD_bins - 1

        self.x_bins = nBins_x
        self.x_minRange = 0.0
        self.x_maxRange = distances.tunlSSA_CsI.cellLength
        self.x_range = (self.x_minRange, self.x_maxRange)
        self.x_binSize = (self.x_maxRange - self.x_minRange) / self.x_bins
        self.x_binCenters = np.linspace(self.x_minRange + self.x_binSize / 2,
                                        self.x_maxRange - self.x_binSize / 2,
                                        self.x_bins)

        # parameters for making the fake data...
        self.nEvPerLoop = nSamplesFromTOF
        self.nSamplesFromTOF = nSamplesFromTOF
        self.data_x = np.repeat(self.x_binCenters, self.nEvPerLoop)

        self.ddnXSinstance = ddnXSinterpolator()
        self.beamTiming = beamTimingShape()
        self.zeroDegTimeSpreader = zeroDegreeTimingSpread()

        # stopping power model and parameters
        stoppingMedia_Z = 1
        stoppingMedia_A = 2
        stoppingMedia_rho = 8.565e-5  # from red notebook, p 157
        incidentIon_charge = 1
        stoppingMedia_meanExcitation = 19.2 * 1e-3
        dgas_materialDef = [
            stoppingMedia_Z, stoppingMedia_A, stoppingMedia_rho,
            stoppingMedia_meanExcitation
        ]
        #stoppingModel = ionStopping.simpleBethe( stoppingModelParams )
        self.stoppingModel = ionStopping.simpleBethe([incidentIon_charge])
        self.stoppingModel.addMaterial(dgas_materialDef)

        self.eN_binCenters = getDDneutronEnergy(self.eD_binCenters)

        tofWindowSettings = tofWindows()
        tof_nBins = tofWindowSettings.nBins
        self.tof_minRange = [
            tofWindowSettings.minRange['mid'],
            tofWindowSettings.minRange['close'],
            tofWindowSettings.minRange['close'],
            tofWindowSettings.minRange['far'],
            tofWindowSettings.minRange['production']
        ]
        self.tof_maxRange = [
            tofWindowSettings.maxRange['mid'],
            tofWindowSettings.maxRange['close'],
            tofWindowSettings.maxRange['close'],
            tofWindowSettings.maxRange['far'],
            tofWindowSettings.maxRange['production']
        ]
        self.tof_range = []
        for minR, maxR in zip(self.tof_minRange, self.tof_maxRange):
            self.tof_range.append((minR, maxR))
        self.tofRunBins = [
            tof_nBins['mid'], tof_nBins['close'], tof_nBins['close'],
            tof_nBins['far'], tof_nBins['production']
        ]

        self.standoffs = [
            distances.tunlSSA_CsI.standoffMid,
            distances.tunlSSA_CsI.standoffClose,
            distances.tunlSSA_CsI.standoffClose,
            distances.tunlSSA_CsI.standoffFar,
            distances.tunlSSA_CsI.standoff_TUNLruns
        ]

        self.tofData = None
        self.neutronSpectra = None

        self.paramNames = [
            '$E_0$', '$f_1$', '$f_2$', '$f_3$', '$N_1$', '$N_2$', '$N_3$',
            '$N_4$', '$N_5$'
        ]