def parseParticle(self,line): """ This function takes in a space delimited line representing a particle, and instantiates a new instance of the gampParticle class from it then returns it. """ dataList=line.split(" ") particle=gampParticle(particleID=dataList[0], particleCharge=dataList[1], particleXMomentum=dataList[2], particleYMomentum=dataList[3], particleZMomentum=dataList[4], particleE=dataList[5]) return particle
def parseParticle(self, line): """ This function takes in a space delimited line representing a particle, and instantiates a new instance of the gampParticle class from it then returns it. Args: line (string): A single line representing a gamp particle. Returns: A gampParticle, of type pythonPWA.dataTypes.gampParticle, instantiated from the argument. """ dataList = line.split(" ") particle = gampParticle(particleID=dataList[0], particleCharge=dataList[1], particleXMomentum=dataList[2], particleYMomentum=dataList[3], particleZMomentum=dataList[4], particleE=dataList[5]) return particle
def parseParticle(self,line): """ This function takes in a space delimited line representing a particle, and instantiates a new instance of the gampParticle class from it then returns it. Args: line (string): A single line representing a gamp particle. Returns: A gampParticle, of type pythonPWA.dataTypes.gampParticle, instantiated from the argument. """ dataList=line.split(" ") particle=gampParticle(particleID=dataList[0], particleCharge=dataList[1], particleXMomentum=dataList[2], particleYMomentum=dataList[3], particleZMomentum=dataList[4], particleE=dataList[5]) return particle
def writeEvent(self, dataSlice): """ This function takes a slice of the events array ([n,:,:]) and returns the pythonPWA gampEvent object of that slice. Args: dataSlice (numpy ndarray): The 2 densional array of a single event fron the events 3D array. Returns: gampEvent """ nPart = dataSlice[0, 0] event = [] for i in range(int(nPart)): dataList = dataSlice[i + 1, :] particle = gampParticle(particleID=dataList[0], particleCharge=dataList[1], particleXMomentum=dataList[2], particleYMomentum=dataList[3], particleZMomentum=dataList[4], particleE=dataList[5]) event.append(particle) return gampEvent(particles=event)
def writeEvent(self,dataSlice): """ This function takes a slice of the events array ([n,:,:]) and returns the pythonPWA gampEvent object of that slice. Args: dataSlice (numpy ndarray): The 2 densional array of a single event fron the events 3D array. Returns: gampEvent """ nPart = dataSlice[0,0] event = [] for i in range(int(nPart)): dataList = dataSlice[i+1,:] particle=gampParticle(particleID=dataList[0], particleCharge=dataList[1], particleXMomentum=dataList[2], particleYMomentum=dataList[3], particleZMomentum=dataList[4], particleE=dataList[5]) event.append(particle) return gampEvent(particles=event)