productionAmplitudes.append(numpy.complex(realPart,imaginaryPart)) if sys.argv[3] == "s": nTrueList = [ntrue(productionAmplitudes,waves,normint)] for wave in waves: nTrueList.append(wave.filename.rstrip(".bamp")) nTrueList.append(ntrueforwave(productionAmplitudes[waves.index(wave)],waves,wave,normint).real) numpy.save(os.path.join(dataDir,"flat","nTrueListV.npy"),nTrueList) elif os.path.isfile(os.path.join(topDir,"scripts","resonances.txt")): resonances=[] res = open(os.path.join(topDir,"scripts","resonances.txt")) rez = res.readlines() for re in rez: if re[0] != "#" and re[0] != " " and re[0] != "\n": rev = re.split() wRx = [(float(x)) for x in rev[1].split(",")] resonances.append(resonance(cR=float(rev[0])*maxNumberOfEvents,wR=wRx,w0=float(rev[2]),r0=float(rev[3]),phase=float(rev[4]))) if sys.argv[3] == "s": nTrueList = [ntrue(resonances,waves,testMass,normint)] for wave in waves: nTrueList.append(wave.filename.rstrip(".bamp")) nTrueList.append(ntrueforwave(resonances,waves,wave,testMass,normint)) numpy.save(os.path.join(dataDir,"flat","nTrueListR.npy"),nTrueList) if len(resonances) == 0: exit("There are no resonances in resonances.txt, modify it in /scripts and try again.") else: exit("There is neither a resonance.txt file, or a Vvalues.npy file consult the documentation and try again.") if sys.argv[3] == "i": rAA = rhoAA(waves=waves,alphaList=alphaList,beamPolarization=float(Control[1])) rhoAA = rAA.calc() numpy.save(os.path.join(dataDir,"flat","rhoAA.npy"),rhoAA)
from pythonPWA.fileHandlers.gampReader import gampReader #from pythonPWA.utilities.dataSimulator import dataSimulator from DataSimulatorFarm import dataSimulator dataDir = os.path.join("/volatile", "halld", "pippimpi0", "data", sys.argv[1] + "_MeV", "set_" + sys.argv[2]) alphaList = numpy.loadtxt(os.path.join(dataDir, "alphaevents.txt")) maxNumberOfEvents = float(len(alphaList)) testMass = 1025. #resonances=[resonance(cR=maxNumberOfEvents,wR=[1.],w0=1320.,r0=100000.)] resonances = [ resonance(cR=2. * maxNumberOfEvents / 3., wR=[0., 1.], w0=1320., r0=107.), resonance(cR=maxNumberOfEvents / 3., wR=[1., 0.], w0=1895., r0=235.) ] waves = getwaves(dataDir) rInt = normInt(waves=waves, alphaList=alphaList) rInt.execute() rInt.save(dataDir) normint = numpy.load(os.path.join(dataDir, "normint.npy")) dSimulator = dataSimulator(mass=testMass, waves=waves, resonances=resonances, normint=normint, alphaList=alphaList)
print "beggining run on all mass bins" for massBin in massBins: print "="*10 dataDir=os.path.join(topDataDir,massBin) print"working with dataDir=",dataDir ###SAME ALPHA FILE FOR ALL BINS? WHY ARE THERE NO ALPHA FILES IN ANY OTHER BIN BUT 1000_MeV? alphaList=numpy.loadtxt(os.path.join(dataDir,"alpha.txt")) print"loaded alphaFile",os.path.join(dataDir,"alpha.txt"),"with",len(alphaList),"events" maxNumberOfEvents=float(len(alphaList)) testMass=bisectedMasses[massBins.index(massBin)] print"using testMass=",testMass resonances=[resonance(cR=2.*maxNumberOfEvents/3.,wR=[1.,0.],w0=1320.,r0=107.),resonance(cR=maxNumberOfEvents/3.,wR=[0.,1.],w0=1895.,r0=235.)] print"loaded",len(resonances),"resonances" waves=getwaves(dataDir) print"loaded",len(waves),"waves" #normint.npy check print"checking normalization integral existance..." if os.path.exists(os.path.join(dataDir,"normint.npy"))==False: print"normalization integral not found, instantiating new normalization integrator" rInt=normInt(waves=waves,alphaList=alphaList) print"executing normalization integration, this may take some time" rInt.execute() print"finished, saving normalization integral" rInt.save(dataDir) if os.path.exists(os.path.join(dataDir,"normint.npy"))==True:
productionAmplitudes.append(numpy.complex(realPart,imaginaryPart)) if sys.argv[3] == "s": nTrueList = [ntrue(productionAmplitudes,waves,normint)] for wave in waves: nTrueList.append(wave.filename.rstrip(".bamp")) nTrueList.append(ntrueforwave(productionAmplitudes[waves.index(wave)],waves,wave,normint).real) numpy.save(os.path.join(dataDir,"flat","nTrueListV.npy"),nTrueList) elif os.path.isfile(os.path.join(topDir,"scripts","resonances.txt")): resonances=[] res = open(os.path.join(topDir,"scripts","resonances.txt")) rez = res.readlines() for re in rez: if re[0] != "#" and re[0] != " " and re[0] != "\n": rev = re.split() wRx = [(float(x)) for x in rev[1].split(",")] resonances.append(resonance(cR=float(rev[0])*maxNumberOfEvents,wR=wRx,w0=float(rev[2]),r0=float(rev[3]),phase=float(rev[4]))) if sys.argv[3] == "s": nTrueList = [ntrue(resonances,waves,testMass,normint)] for wave in waves: nTrueList.append(wave.filename.rstrip(".bamp")) nTrueList.append(ntrueforwave(resonances,waves,wave,testMass,normint)) numpy.save(os.path.join(dataDir,"flat","nTrueListR.npy"),nTrueList) if len(resonances) == 0: exit("There are no resonances in resonances.txt, modify it in /scripts and try again.") else: exit("There is neither a resonance.txt file, or a Vvalues.npy file consult the documentation and try again.") if sys.argv[3] == "i": rAA = rhoAA(waves=waves,alphaList=alphaList,beamPolarization=float(Control[1])) rhoAA = rAA.calc() numpy.save(os.path.join(dataDir,"flat","rhoAA.npy"),rhoAA)