@author: MarvinPfaff
based on nuSTORMPrdStrght class
"""

import pandas as pnds
import numpy as np
from copy import deepcopy
import PionConst as PionConst
import MuonConst as MuonConst
import PionDecay as PionDecay
import PionEventInstance as PionEventInstance
import particle as particle
import Simulation as Simu
import eventHistory as eventHistory

piCnst = PionConst.PionConst()
muCnst = MuonConst.MuonConst()


class nuSTORMTrfLine(object):
    __instance = None
    __pimass = piCnst.mass() / 1000.
    __mumass = muCnst.mass() / 1000.
    __piPDG = piCnst.pdgCode()
    __muPDG = muCnst.pdgCode()
    __piLifetime = piCnst.lifetime()
    __sol = muCnst.SoL()

    #--------  "Built-in methods":
    def __new__(cls, filename):
        if cls.__instance is None:
import MuonConst as muCnst
import PionConst as piCnst
import PionEventInstance as piEvtInst
import nuSTORMPrdStrght as nuPrdStrt
import nuSTORMTrfLineCmplx as nuTrfLineCmplx
import particle as particle
import eventHistory
import RandomGenerator as Rndm
import numpy as np
import matplotlib.pyplot as plt
import Simulation as Simu
import sys, os

mc = muCnst.MuonConst()
pc = piCnst.PionConst()
nuStrt = nuPrdStrt.nuSTORMPrdStrght('11-Parameters/nuSTORM-PrdStrght-Params-v1.0.csv')
nuSIMPATH = os.getenv('nuSIMPATH')
trfCmplxFile = os.path.join(nuSIMPATH, '11-Parameters/nuSTORM-TrfLineCmplx-Params-v1.0.csv')
nuTrLnCmplx = nuTrfLineCmplx.nuSTORMTrfLineCmplx(trfCmplxFile)

##! Start:
print("========  PionEventInstance: tests start  ========")

n_events = 5000

##! Create instance, test built-in methods:
PionEventInstanceTest = 1
print()
print("PionEventInstanceTest:", PionEventInstanceTest, " Test built-in methods.")
piMomentum = 5.
Beispiel #3
0
    psFlag = ctrlInst.psFlag()
    lstFlag = ctrlInst.lstFlag()
    muDcyFlag = ctrlInst.muDcyFlag()
    FlshAtDetFlg = ctrlInst.flashAtDetector()
    PSMuonsFlag = ctrlInst.PSMuons()
    ringMuonsFlag = ctrlInst.ringMuons()
    tEqualsZeroFlag = ctrlInst.tEqualsZero()

    print (f"Processing flags -- tlflag: {tlFlag} / psFlag: {psFlag} / lstFlag: {lstFlag} / muDcyFlag: {muDcyFlag} / FlshAtDetFlg: \
        {FlshAtDetFlg} / PSMuonsFlag: {PSMuonsFlag} / ringMuonsFlag {ringMuonsFlag}")
    logging.info("Processing flags -- tlflag: %s,  psFlag: %s,  lstFlag: %s,  muDcyFlag: %s, FlshAtDetFlg: %s, PSMuonsFlag: %s, ringMuonsFlag: %s", \
        tlFlag, psFlag, lstFlag, muDcyFlag, FlshAtDetFlg, PSMuonsFlag, ringMuonsFlag)
    logging.info("     tEqualsZero: %s", tEqualsZeroFlag)

# get constants
    piCnst  = PC.PionConst()
    c = piCnst.SoL()
    piMass = piCnst.mass()/1000.0

# initialise run number, number of events to generate, central pion momentum, and event weight
    printLimit = ctrlInst.printLimit()
    pionMom = ctrlInst.EPi()
    crossSection = 50
    nEvents = ctrlInst.nEvents()
    eventWeight = crossSection
    logging.info("Run Number: %s,  nEvents: %s,  pion central momentum: %s", runNumber, nEvents, pionMom)

# Get the nuSIM path name and use it to set names for the inputfile and the outputFile
    nuSIMPATH = os.getenv('nuSIMPATH')
    filename  = os.path.join(nuSIMPATH, '11-Parameters/nuSTORM-PrdStrght-Params-v1.0.csv')
    print ("filename " , filename)
Beispiel #4
0
 2.0: 24Sep21: Unify all the particles and just distinguish with a pdg code
 1.1: 21Sep21: Add a constructor with the momentum vector
 1.0: 29Aug21: A straight copy of the pion class

@author: PaulKyberd
"""

import math, sys
import numpy as np
from copy import deepcopy
import traceSpace
import MuonConst as mC
import PionConst as piC

muCnst = mC.MuonConst()
piCnst = piC.PionConst()


class particle:
    __Debug = False

    #--------  "Built-in methods":
    #  Constructor with elementary variables
    #    def __init__(self, runNum, eventNum, s, x, y, z, px, py, pz, t, eventWeight, particleType):
    def __init__(self, *args):

        if (len(args) == 12):
            # Uunpack args
            runNum = args[0]
            eventNum = args[1]
            s = args[2]
Beispiel #5
0
  PionConst.py -- set "relative" path to code

"""

import PionConst as pc
import sys, os

testFails = 0
##! Start:
print("========  PionConst: tests start  ========")

##! Test singleton class feature:
PionConstTest = 1
print()
print("PionConstTest:", PionConstTest, " check if class is a singleton.")
piCnst = pc.PionConst()
piCnst1 = pc.PionConst()
print("    piCnst singleton test:", id(piCnst), id(piCnst1),
      id(piCnst) - id(piCnst1))
if piCnst != piCnst1:
    raise Exception("PionConst is not a singleton class!")

##! Check built-in methods:
PionConstTest = 2
print()
print("PionConstTest:", PionConstTest, " check built-in methods.")

#  redirect standard out to a file
restoreOut = sys.stdout
sys.stdout = open("Scratch/pionTst.out", "w")
print(piCnst)