Пример #1
0
class ExtrapolationTest(unittest.TestCase):
    def __init__ ( self, *args, **kwargs ):
        super(ExtrapolationTest, self).__init__(*args, **kwargs)
        data = [ [ [[ 150.*GeV, 50.*GeV], [ 150.*GeV, 50.*GeV] ], 3.*fb ],
             [ [[ 200.*GeV,100.*GeV], [ 200.*GeV,100.*GeV] ],  5.*fb ],
             [ [[ 300.*GeV,200.*GeV], [ 300.*GeV,200.*GeV] ], 15.*fb ],
             [ [[ 400.*GeV,300.*GeV], [ 400.*GeV,300.*GeV] ], 17.*fb ] ]
        self.txnameData = TxNameData( data, "upperLimits",
                sys._getframe().f_code.co_name, .05 )

    def tryWith ( self, masses ):
        return self.txnameData.getValueFor( masses )

    def testWithDirectData(self):
        result=self.tryWith ([[ 275.*GeV,175.*GeV], [ 275.*GeV,175.*GeV] ])

        self.assertAlmostEqual( result.asNumber(pb),0.0125 )
        eps = 1 * keV
        result=self.tryWith([[ 275.*GeV,175.*GeV + eps],
                             [ 275.*GeV + eps ,175.*GeV] ])
        
        self.assertAlmostEqual( result.asNumber(pb),0.0125 )

        result=self.tryWith([[ 275.*GeV,185.*GeV], [ 275.*GeV,165.*GeV] ])
        self.assertTrue ( result == None )

    def show ( self ):
        #txnameObj.nonZeroEps = 1e+4
        #txnameObj.simplexTolerance = 1e-2
        for eps in numpy.arange ( 2, 9, .3 ):
            e = (10**eps) * eV
            masses = [[ 275.*GeV + e, 175.*GeV ], [ 275.*GeV,175.*GeV - e ]]
            print ( "%s: %s" % ( pprint ( e ), self.tryWith ( masses ) ))
Пример #2
0
    def testWithDirectData(self):
        data = [[[[1.5640E+02*GeV],[1.5640E+02*GeV]],3.1127E-03*pb],
                [[[1.9728E+02*GeV],[1.9728E+02*GeV]],1.6769E-03*pb],
                [[[2.4632E+02*GeV],[2.4632E+02*GeV]],9.2590E-04*pb],
                [[[3.0899E+02*GeV],[3.0899E+02*GeV]],8.4880E-04*pb],
                [[[4.9155E+02*GeV],[4.9155E+02*GeV]],6.3010E-04*pb],
                [[[5.5967E+02*GeV],[5.5967E+02*GeV]],5.9950E-04*pb],
                [[[6.5504E+02*GeV],[6.5504E+02*GeV]],5.6320E-04*pb],
                [[[7.4496E+02*GeV],[7.4496E+02*GeV]],5.2260E-04*pb],
                [[[8.6757E+02*GeV],[8.6757E+02*GeV]],5.1580E-04*pb],
                [[[1.0283E+03*GeV],[1.0283E+03*GeV]],5.0900E-04*pb],
                [[[1.2191E+03*GeV],[1.2191E+03*GeV]],4.8380E-04*pb],
                [[[1.4098E+03*GeV],[1.4098E+03*GeV]],5.1410E-04*pb],
                [[[1.6005E+03*GeV],[1.6005E+03*GeV]],5.8110E-04*pb]]
        
        txnameData=TxNameData ( data, "upperLimits",
                sys._getframe().f_code.co_name )

        self.assertEqual(txnameData.dimensionality,1)

        #Tranformation to "PCA frame"        
        dataShift = (data[0][0][0][0]+data[-1][0][0][0])/2.
        dataShift = dataShift.asNumber(GeV)
        
        #Check inside the grid:
        result=txnameData.getValueFor([[ 1100.*GeV]]*2)
        self.assertAlmostEqual( result.asNumber(pb),0.00049953) 
        #Check outside the grid:
        result=txnameData.getValueFor([[ 2000.*GeV]]*2)
        self.assertEqual( result,None)
        
        #Check class methods:
        isimplex = txnameData.tri.find_simplex(np.array([350.-dataShift]))
        self.assertEqual(isimplex,3)
        simplex = txnameData.tri.simplices[isimplex]
        self.assertEqual(min(simplex),3)
        self.assertEqual(max(simplex),4)
Пример #3
0
 def testEfficiencyMaps(self):
     data = [ [ [[ 150.*GeV, 50.*GeV], [ 150.*GeV, 50.*GeV] ],  .03 ], 
          [ [[ 200.*GeV,100.*GeV], [ 200.*GeV,100.*GeV] ], .05 ], 
          [ [[ 300.*GeV,100.*GeV], [ 300.*GeV,100.*GeV] ], .10 ], 
          [ [[ 300.*GeV,150.*GeV], [ 300.*GeV,150.*GeV] ], .13 ], 
          [ [[ 300.*GeV,200.*GeV], [ 300.*GeV,200.*GeV] ], .15 ], 
          [ [[ 300.*GeV,250.*GeV], [ 300.*GeV,250.*GeV] ], .20 ], 
          [ [[ 400.*GeV,100.*GeV], [ 400.*GeV,100.*GeV] ], .08 ], 
          [ [[ 400.*GeV,150.*GeV], [ 400.*GeV,150.*GeV] ], .10 ], 
          [ [[ 400.*GeV,200.*GeV], [ 400.*GeV,200.*GeV] ], .12 ], 
          [ [[ 400.*GeV,250.*GeV], [ 400.*GeV,250.*GeV] ], .15 ], 
          [ [[ 400.*GeV,300.*GeV], [ 400.*GeV,300.*GeV] ], .17 ], 
          [ [[ 400.*GeV,350.*GeV], [ 400.*GeV,350.*GeV] ], .19 ], ]
     txnameData=TxNameData ( data, "efficiencyMap" ,
             sys._getframe().f_code.co_name )
     result=txnameData.getValueFor([[ 300.*GeV,125.*GeV], [ 300.*GeV,125.*GeV] ])
     self.assertAlmostEqual( result,0.115 ) 
Пример #4
0
 def testWithDirectData(self):
     data = [ [ [[ 150.*GeV, 50.*GeV], [ 150.*GeV, 50.*GeV] ],  3.*fb ], 
          [ [[ 200.*GeV,100.*GeV], [ 200.*GeV,100.*GeV] ],  5.*fb ], 
          [ [[ 300.*GeV,100.*GeV], [ 300.*GeV,100.*GeV] ], 10.*fb ], 
          [ [[ 300.*GeV,150.*GeV], [ 300.*GeV,150.*GeV] ], 13.*fb ], 
          [ [[ 300.*GeV,200.*GeV], [ 300.*GeV,200.*GeV] ], 15.*fb ], 
          [ [[ 300.*GeV,250.*GeV], [ 300.*GeV,250.*GeV] ], 20.*fb ], 
          [ [[ 400.*GeV,100.*GeV], [ 400.*GeV,100.*GeV] ],  8.*fb ], 
          [ [[ 400.*GeV,150.*GeV], [ 400.*GeV,150.*GeV] ], 10.*fb ], 
          [ [[ 400.*GeV,200.*GeV], [ 400.*GeV,200.*GeV] ], 12.*fb ], 
          [ [[ 400.*GeV,250.*GeV], [ 400.*GeV,250.*GeV] ], 15.*fb ], 
          [ [[ 400.*GeV,300.*GeV], [ 400.*GeV,300.*GeV] ], 17.*fb ], 
          [ [[ 400.*GeV,350.*GeV], [ 400.*GeV,350.*GeV] ], 19.*fb ], ]
     txnameData=TxNameData ( data, "upperLimits",
             sys._getframe().f_code.co_name )
     result=txnameData.getValueFor([[ 300.*GeV,125.*GeV], [ 300.*GeV,125.*GeV] ])
     self.assertAlmostEqual( result.asNumber(pb),0.0115 ) 
Пример #5
0
 def testWithDirectData(self):
     data = [
         [[[150. * GeV, 50. * GeV], [150. * GeV, 50. * GeV]], 3. * fb],
         [[[200. * GeV, 100. * GeV], [200. * GeV, 100. * GeV]], 5. * fb],
         [[[300. * GeV, 100. * GeV], [300. * GeV, 100. * GeV]], 10. * fb],
         [[[300. * GeV, 150. * GeV], [300. * GeV, 150. * GeV]], 13. * fb],
         [[[300. * GeV, 200. * GeV], [300. * GeV, 200. * GeV]], 15. * fb],
         [[[300. * GeV, 250. * GeV], [300. * GeV, 250. * GeV]], 20. * fb],
         [[[400. * GeV, 100. * GeV], [400. * GeV, 100. * GeV]], 8. * fb],
         [[[400. * GeV, 150. * GeV], [400. * GeV, 150. * GeV]], 10. * fb],
         [[[400. * GeV, 200. * GeV], [400. * GeV, 200. * GeV]], 12. * fb],
         [[[400. * GeV, 250. * GeV], [400. * GeV, 250. * GeV]], 15. * fb],
         [[[400. * GeV, 300. * GeV], [400. * GeV, 300. * GeV]], 17. * fb],
         [[[400. * GeV, 350. * GeV], [400. * GeV, 350. * GeV]], 19. * fb],
     ]
     txnameData = TxNameData(data, "upperLimits",
                             sys._getframe().f_code.co_name)
     result = txnameData.getValueFor([[300. * GeV, 125. * GeV],
                                      [300. * GeV, 125. * GeV]])
     self.assertAlmostEqual(result.asNumber(pb), 0.0115)
Пример #6
0
 def testOutsideConvexHull2(self):
     data = [
         [[[150. * GeV, 50. * GeV], [150. * GeV, 50. * GeV]], .03],
         [[[200. * GeV, 100. * GeV], [200. * GeV, 100. * GeV]], .05],
         [[[300. * GeV, 100. * GeV], [300. * GeV, 100. * GeV]], .10],
         [[[300. * GeV, 150. * GeV], [300. * GeV, 150. * GeV]], .13],
         [[[300. * GeV, 200. * GeV], [300. * GeV, 200. * GeV]], .15],
         [[[300. * GeV, 250. * GeV], [300. * GeV, 250. * GeV]], .20],
         [[[400. * GeV, 100. * GeV], [400. * GeV, 100. * GeV]], .08],
         [[[400. * GeV, 150. * GeV], [400. * GeV, 150. * GeV]], .10],
         [[[400. * GeV, 200. * GeV], [400. * GeV, 200. * GeV]], .12],
         [[[400. * GeV, 250. * GeV], [400. * GeV, 250. * GeV]], .15],
         [[[400. * GeV, 300. * GeV], [400. * GeV, 300. * GeV]], .17],
         [[[400. * GeV, 350. * GeV], [400. * GeV, 350. * GeV]], .19],
     ]
     txnameData = TxNameData(data, "efficiencyMap",
                             sys._getframe().f_code.co_name)
     result = txnameData.getValueFor([[300. * GeV, 125. * GeV],
                                      [300. * GeV, 100. * GeV]])
     self.assertEqual(result, None)