def nTrueForWave(resonances,waves,wave,mass,normint): """ Returns the number of events for all resonances, for a specified wave out of the set of all waves, for the specified mass, and for the nomalization integral. """ ret=0. for resonance1 in resonances: for resonance2 in resonances: v1=complexV(resonance1,wave,waves,normint,mass) v2=numpy.conjugate(complexV(resonance2,wave,waves,normint,mass)) psi=normint[wave.epsilon,wave.epsilon,waves.index(wave),waves.index(wave)] term=v1*v2*psi ret+=term return ret.real
def nTrue(resonances,waves,mass,normint): """ Returns the number of events for all resonances and waves for the specified mass and normalization integral. """ ret=0. for resonance1 in resonances: for resonance2 in resonances: for wave1 in waves: for wave2 in waves: v1=complexV(resonance1,wave1,waves,normint,mass) v2=numpy.conjugate(complexV(resonance2,wave2,waves,normint,mass)) psi=normint[wave1.epsilon,wave2.epsilon,waves.index(wave1),waves.index(wave2)] term=v1*v2*psi ret+=term return ret.real
def calculate(self,mass,eventNumber): ret=numpy.complex(0.,0.) self.testValues=[] for resonance1 in self.resonances: for resonance2 in self.resonances: for wave1 in self.waves: for wave2 in self.waves: if len(self.productionAmplitudes)==0: ret+=complexV(resonance1,wave1,self.waves,self.normint,mass)*numpy.conjugate(complexV(resonance2,wave2,self.waves,self.normint,mass))*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon] if self.testWriting==1: if [self.waves.index(wave1),self.waves.index(wave2),self.resonances.index(resonance1),self.resonances.index(resonance2),complexV(resonance1,wave1,self.waves,self.normint,mass),complexV(resonance2,wave2,self.waves,self.normint,mass),complexV(resonance1,wave1,self.waves,self.normint,mass)*numpy.conjugate(complexV(resonance2,wave2,self.waves,self.normint,mass))*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon],wave1.complexamplitudes[eventNumber],wave2.complexamplitudes[eventNumber]] not in self.testValues: self.testValues.append([self.waves.index(wave1),self.waves.index(wave2),self.resonances.index(resonance1),self.resonances.index(resonance2),complexV(resonance1,wave1,self.waves,self.normint,mass),complexV(resonance2,wave2,self.waves,self.normint,mass),complexV(resonance1,wave1,self.waves,self.normint,mass)*numpy.conjugate(complexV(resonance2,wave2,self.waves,self.normint,mass))*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon],wave1.complexamplitudes[eventNumber],wave2.complexamplitudes[eventNumber]]) if self.testWriting==1: for items in self.testValues: print"="*10 print"wave1",items[0] print"wave2",items[1] print"resonance1:",items[2] print"resonance2:",items[3] print"v1:",items[4] print"v2:",items[5] print"amplitude1:",items[7] print"amplitude2:",items[8] print"term:",items[6] return ret
def nTrue(resonances,waves,mass,normint): """ Returns the number of events for all resonances and waves for the specified mass and normalization integral. """ ret=0. for resonance1 in resonances: #print"resonance1=",resonance1.r0 for resonance2 in resonances: #print"resonance2=",resonance2.r0 for wave1 in waves: for wave2 in waves: v1=complexV(resonance1,wave1,waves,normint,mass) v2=numpy.conjugate(complexV(resonance2,wave2,waves,normint,mass)) psi=normint[wave1.epsilon,wave2.epsilon,waves.index(wave1),waves.index(wave2)] term=v1*v2*psi ret+=term return ret.real
def calcRez(self, mass, wave1, wave2): """ Calculate the value of omega for each index in the matrix, returns the value of omega for specified mass and waves. Args: mass (float): wave1 (pythonPWA.dataTypes.wave): wave2 (pythonPWA.dataTypes.wave): Returns: The value of the omega[i,i] as a numpy.complex type. """ rez = numpy.complex(0., 0.) for resonance1 in self.resonances: for resonance2 in self.resonances: rez += complexV(resonance1, wave1, self.waves, self.normint, mass) * numpy.conjugate( complexV(resonance2, wave2, self.waves, self.normint, mass)) return rez
def calcIntRes(self,resonances,testMass): """ Calculates the list of intensities for a mass bin. Returns: iList (numpy array) """ a0 = 0. for resonance1 in resonances: for resonance2 in resonances: for wave1 in self.waves: for wave2 in self.waves: VV = complexV(resonance1,wave1,self.waves,self.normint,testMass) * np.conjugate(complexV(resonance2,wave2,self.waves,self.normint,testMass)) a0 = a0 + (VV * self.rhoAA[self.waves.index(wave1),self.waves.index(wave2),:]).real return self.Q*a0
def calcRez(self,mass,wave1,wave2): """ Calculate the value of omega for each index in the matrix, returns the value of omega for specified mass and waves. Args: mass (float): wave1 (pythonPWA.dataTypes.wave): wave2 (pythonPWA.dataTypes.wave): Returns: The value of the omega[i,i] as a numpy.complex type. """ rez = numpy.complex(0.,0.) for resonance1 in self.resonances: for resonance2 in self.resonances: rez += complexV(resonance1,wave1,self.waves,self.normint,mass)*numpy.conjugate(complexV(resonance2,wave2,self.waves,self.normint,mass)) return rez
def calculate(self,mass,eventNumber): """ Calculate function for the instensity class, returns the value for the instensity for specified mass and event number. Args: mass (float): eventNumber (int): Returns: The value of the intensity function as a numpy.complex type. """ ret=numpy.complex(0.,0.) self.testValues=[] for resonance1 in self.resonances: #print"resonance1=",resonance1.r0 for resonance2 in self.resonances: #print"resonance2=",resonance2.r0 for wave1 in self.waves: for wave2 in self.waves: if len(self.productionAmplitudes)==0: ret+=complexV(resonance1,wave1,self.waves,self.normint,mass)*numpy.conjugate(complexV(resonance2,wave2,self.waves,self.normint,mass))*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon] if len(self.productionAmplitudes)!=0: ret+=self.productionAmplitudes[self.waves.index(wave1)]*numpy.conjugate(self.productionAmplitudes[self.waves.index(wave2)])*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon] if self.testWriting==1: if [self.waves.index(wave1),self.waves.index(wave2),self.resonances.index(resonance1),self.resonances.index(resonance2),complexV(resonance1,wave1,self.waves,self.normint,mass),complexV(resonance2,wave2,self.waves,self.normint,mass),complexV(resonance1,wave1,self.waves,self.normint,mass)*numpy.conjugate(complexV(resonance2,wave2,self.waves,self.normint,mass))*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon],wave1.complexamplitudes[eventNumber],wave2.complexamplitudes[eventNumber]] not in self.testValues: self.testValues.append([self.waves.index(wave1),self.waves.index(wave2),self.resonances.index(resonance1),self.resonances.index(resonance2),complexV(resonance1,wave1,self.waves,self.normint,mass),complexV(resonance2,wave2,self.waves,self.normint,mass),complexV(resonance1,wave1,self.waves,self.normint,mass)*numpy.conjugate(complexV(resonance2,wave2,self.waves,self.normint,mass))*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon],wave1.complexamplitudes[eventNumber],wave2.complexamplitudes[eventNumber]]) if self.testWriting==1: for items in self.testValues: print"="*10 print"wave1",items[0] print"wave2",items[1] print"resonance1:",items[2] print"resonance2:",items[3] print"v1:",items[4] print"v2:",items[5] print"amplitude1:",items[7] print"amplitude2:",items[8] print"term:",items[6] return ret
def calculate(self, mass, eventNumber): """ Calculate function for the instensity class, returns the value for the instensity for specified mass and event number. Args: mass (float): eventNumber (int): Returns: The value of the intensity function as a numpy.complex type. """ ret = numpy.complex(0., 0.) self.testValues = [] for resonance1 in self.resonances: #print"resonance1=",resonance1.r0 for resonance2 in self.resonances: #print"resonance2=",resonance2.r0 for wave1 in self.waves: for wave2 in self.waves: if len(self.productionAmplitudes) == 0: ret += complexV( resonance1, wave1, self.waves, self.normint, mass) * numpy.conjugate( complexV(resonance2, wave2, self.waves, self.normint, mass) ) * wave1.complexamplitudes[ eventNumber] * numpy.conjugate( wave2.complexamplitudes[eventNumber] ) * spinDensity( self.beamPolarization, self.alphaList[eventNumber])[ wave1.epsilon, wave2.epsilon] if len(self.productionAmplitudes) != 0: ret += self.productionAmplitudes[self.waves.index( wave1)] * numpy.conjugate( self.productionAmplitudes[self.waves.index( wave2)] ) * wave1.complexamplitudes[ eventNumber] * numpy.conjugate( wave2.complexamplitudes[eventNumber] ) * spinDensity( self.beamPolarization, self.alphaList[eventNumber])[ wave1.epsilon, wave2.epsilon] if self.testWriting == 1: if [ self.waves.index(wave1), self.waves.index(wave2), self.resonances.index(resonance1), self.resonances.index(resonance2), complexV(resonance1, wave1, self.waves, self.normint, mass), complexV(resonance2, wave2, self.waves, self.normint, mass), complexV(resonance1, wave1, self.waves, self.normint, mass) * numpy.conjugate( complexV(resonance2, wave2, self.waves, self.normint, mass)) * wave1.complexamplitudes[eventNumber] * numpy.conjugate( wave2. complexamplitudes[eventNumber]) * spinDensity( self.beamPolarization, self.alphaList[eventNumber])[ wave1.epsilon, wave2.epsilon], wave1.complexamplitudes[eventNumber], wave2.complexamplitudes[eventNumber] ] not in self.testValues: self.testValues.append([ self.waves.index(wave1), self.waves.index(wave2), self.resonances.index(resonance1), self.resonances.index(resonance2), complexV(resonance1, wave1, self.waves, self.normint, mass), complexV(resonance2, wave2, self.waves, self.normint, mass), complexV(resonance1, wave1, self.waves, self.normint, mass) * numpy.conjugate( complexV(resonance2, wave2, self.waves, self.normint, mass)) * wave1.complexamplitudes[eventNumber] * numpy.conjugate( wave2. complexamplitudes[eventNumber]) * spinDensity( self.beamPolarization, self.alphaList[eventNumber])[ wave1.epsilon, wave2.epsilon], wave1.complexamplitudes[eventNumber], wave2.complexamplitudes[eventNumber] ]) if self.testWriting == 1: for items in self.testValues: print "=" * 10 print "wave1", items[0] print "wave2", items[1] print "resonance1:", items[2] print "resonance2:", items[3] print "v1:", items[4] print "v2:", items[5] print "amplitude1:", items[7] print "amplitude2:", items[8] print "term:", items[6] return ret