コード例 #1
0
ファイル: testClusterer.py プロジェクト: SModelS/smodels
    def testClusterer(self):
        """ test the mass clusterer """
        from smodels.theory import lheReader, lheDecomposer, crossSection
        from smodels.theory import clusterTools
        from smodels.experiment.txnameObj import TxName, TxNameData
        from smodels.experiment.infoObj import Info
        from smodels.tools.physicsUnits import GeV, pb, fb
        import copy
        
        data = [[ [[ 674.99*GeV, 199.999*GeV], [ 674.99*GeV, 199.999*GeV] ],.03*fb ], 
               [ [[ 725.0001*GeV,200.*GeV], [ 725.0001*GeV,200.*GeV] ], .06*fb ] ,
               [ [[ 750.*GeV,250.*GeV], [ 750.*GeV,250.*GeV] ], .03*fb ] ]
        info = Info(os.path.join("./database/8TeV/ATLAS/ATLAS-SUSY-2013-05/data/","dataInfo.txt"))
        globalInfo = Info(os.path.join("./database/8TeV/ATLAS/ATLAS-SUSY-2013-05/","globalInfo.txt"))
        txnameData=TxNameData(data, "efficiencyMap", Id=1)
        txname=TxName("./database/8TeV/ATLAS/ATLAS-SUSY-2013-05/data/T2bb.txt",globalInfo,info)
        txname.txnameData = txnameData

        filename = "./testFiles/lhe/simplyGluino.lhe"
        reader = lheReader.LheReader(filename)
        event = reader.next()
        reader.close()
        event_xsec=event.metainfo["totalxsec"]
        self.assertTrue ( abs ( event_xsec - 0.262 * pb ) < .1 *pb )
        xsecs = crossSection.getXsecFromLHEFile(filename)
        element = lheDecomposer.elementFromEvent(event, xsecs )
        element.txname=None
        e0=copy.deepcopy(element) ## has a gluino with mass of 675 GeV


        ## make a second element with a slightly different gluino mass
        e1=copy.deepcopy(element)
        e1.branches[0].masses[0]=725*GeV
        e1.branches[1].masses[0]=725*GeV
        e0.txname = txname
        e1.txname = txname

        # lets now cluster the two different gluino masses.
        newel=clusterTools.groupAll ( [e0,e1] )
        newmasses=newel.getAvgMass()
        self.assertTrue ( newmasses==None ) ## in the case of efficiency maps the avg mass is none
        ## since it makes no sense

        txname.txnameData.dataTag = 'upperLimits'
        newel=clusterTools.clusterElements ( [e0,e1], 5. )
        ## this example gives an avg cluster mass of 700 gev
        self.assertTrue ( newel[0].getAvgMass()[0][0] == 700. * GeV )
        
        newel=clusterTools.clusterElements ( [e0,e1], .5 )
        #in this example the distance is not in maxdist, so we dont cluster
        self.assertTrue ( len(newel)==2 )
コード例 #2
0
ファイル: testAsciiGraph.py プロジェクト: ismailturan/smodels
    def testGraph(self):
        """ draw ascii graph """
        from smodels.tools import asciiGraph
        from smodels.theory import lheReader, lheDecomposer, crossSection

        filename = "./testFiles/lhe/simplyGluino.lhe"
        reader = lheReader.LheReader(filename)
        event = reader.next()
        element = lheDecomposer.elementFromEvent(event,
                                             crossSection.XSectionList())
        d1=self.orig().split("\n")
        d2=asciiGraph.asciidraw ( element, border=True ).split("\n")
        #for (idx,line) in enumerate(d1):
        #        print "%d >>%s<< >>%s<<" % (idx,line, d2[idx] )
        #print d1==d2
        reader.close()
        self.assertEqual(d1,d2)
コード例 #3
0
ファイル: testLheReader.py プロジェクト: ismailturan/smodels
    def testReader(self):
        """ test the LheReader """
        from smodels.theory import lheReader, lheDecomposer, crossSection
        from smodels.tools.physicsUnits import GeV

        filename = "./testFiles/lhe/simplyGluino.lhe"
        reader = lheReader.LheReader(filename)
        event = reader.next()
        element = lheDecomposer.elementFromEvent(event,
                                             crossSection.XSectionList())
        s=str(element)
        assert ( s == "[[[q,q]],[[q,q]]]" )
        b0=element.branches[0]
        sb0=str(b0)
        assert ( sb0 == "[[q,q]]" )
        assert ( b0.masses[0]-675*GeV ) < .1*GeV
        assert ( b0.masses[1]-600*GeV ) < .1*GeV
コード例 #4
0
ファイル: asciiGraph.py プロジェクト: SModelS/smodels
    Draw a simple ASCII graph on the screen.
    
    """
    ret=""
    l = []
    for (ct, branch) in enumerate(element.branches):
        l.append(int(str(branch).count("[")))
    for (ct, branch) in enumerate(element.branches):
        ret+=_drawBranch(branch, upwards=(ct == 0), labels=labels, htmlFormat=html,
                    border=border, l=max(l))
    return ret


if __name__ == "__main__":
    argparser = argparse.ArgumentParser(description="simple tool that is "
                                        "meant to draw lessagraphs, as an "
                                        "ascii plot")
    argparser.add_argument('-l', '--lhe', help="LHE file name",
                           type=str, required=True )
    argparser.add_argument('-b', '--border', action='store_true',
                           help="draw a border around the graph")
    args = argparser.parse_args()

    filename = args.lhe

    reader = lheReader.LheReader(filename)
    event = reader.next()
    element = lheDecomposer.elementFromEvent(event,
                                             crossSection.XSectionList())
    print(asciidraw(element, border=args.border) )
コード例 #5
0
from smodels.installation import installDirectory
from smodels.tools import asciiGraph


# In[3]:

#Load an input file containing LHE events and start the LHE reader
filename="%s/inputFiles/lhe/gluino_squarks.lhe" % installDirectory()
reader = lheReader.LheReader ( filename )


# In[4]:

#Read the next event and generate the corresponding element
event=reader.next()
element=lheDecomposer.elementFromEvent (event)


# In[5]:

#Print the corresponding ASCII graph
print asciiGraph.asciidraw ( element )


# In[6]:

#Do the same for the next event:
event=reader.next()
element=lheDecomposer.elementFromEvent ( event )
print asciiGraph.asciidraw ( element )
コード例 #6
0
    argparser.add_argument('-T',
                           nargs='?',
                           help="Tx name, will look up lhe file in "
                           "../regression/Tx_1.lhe. Will be overriden by the "
                           "'--lhe' argument",
                           type=types.StringType,
                           default='T1')
    argparser.add_argument('-l',
                           '--lhe',
                           nargs='?',
                           help="LHE file name, supplied directly. Takes "
                           "precedence over '-T' argument.",
                           type=types.StringType,
                           default='')
    argparser.add_argument('-b',
                           '--border',
                           action='store_true',
                           help="draw a border around the graph")
    args = argparser.parse_args()

    path = os.path.join(installation.installDirectory(), "inputFiles/lhe/")
    filename = os.path.join(path, args.T + "_1.lhe")
    if args.lhe != "":
        filename = args.lhe

    reader = lheReader.LheReader(filename)
    event = reader.next()
    element = lheDecomposer.elementFromEvent(event,
                                             crossSection.XSectionList())
    print(asciidraw(element, border=args.border))
コード例 #7
0
    def testClusterer(self):
        """ test the mass clusterer """
        from smodels.theory import lheReader, lheDecomposer, crossSection
        from smodels.theory import clusterTools
        from smodels.experiment.txnameObj import TxName, TxNameData
        from smodels.experiment.infoObj import Info
        from smodels.tools.physicsUnits import GeV, pb, fb
        import copy

        data = [[[[674.99 * GeV, 199.999 * GeV], [674.99 * GeV,
                                                  199.999 * GeV]], .03 * fb],
                [[[725.0001 * GeV, 200. * GeV], [725.0001 * GeV, 200. * GeV]],
                 .06 * fb],
                [[[750. * GeV, 250. * GeV], [750. * GeV, 250. * GeV]],
                 .03 * fb]]
        info = Info(
            os.path.join("./database/8TeV/ATLAS/ATLAS-SUSY-2013-05/data/",
                         "dataInfo.txt"))
        globalInfo = Info(
            os.path.join("./database/8TeV/ATLAS/ATLAS-SUSY-2013-05/",
                         "globalInfo.txt"))
        txnameData = TxNameData(data, "efficiencyMap", Id=1)
        txname = TxName(
            "./database/8TeV/ATLAS/ATLAS-SUSY-2013-05/data/T2bb.txt",
            globalInfo, info)
        txname.txnameData = txnameData

        filename = "./testFiles/lhe/simplyGluino.lhe"
        reader = lheReader.LheReader(filename)
        event = reader.next()
        reader.close()
        event_xsec = event.metainfo["totalxsec"]
        self.assertTrue(abs(event_xsec - 0.262 * pb) < .1 * pb)
        xsecs = crossSection.getXsecFromLHEFile(filename)
        element = lheDecomposer.elementFromEvent(event, xsecs)
        element.txname = None
        e0 = copy.deepcopy(element)  ## has a gluino with mass of 675 GeV

        ## make a second element with a slightly different gluino mass
        e1 = copy.deepcopy(element)
        e1.branches[0].masses[0] = 725 * GeV
        e1.branches[1].masses[0] = 725 * GeV
        e0.txname = txname
        e1.txname = txname

        # lets now cluster the two different gluino masses.
        newel = clusterTools.groupAll([e0, e1])
        newmasses = newel.getAvgMass()
        self.assertTrue(
            newmasses ==
            None)  ## in the case of efficiency maps the avg mass is none
        ## since it makes no sense

        txname.txnameData.dataTag = 'upperLimits'
        newel = clusterTools.clusterElements([e0, e1], 5.)
        ## this example gives an avg cluster mass of 700 gev
        self.assertTrue(newel[0].getAvgMass()[0][0] == 700. * GeV)

        newel = clusterTools.clusterElements([e0, e1], .5)
        #in this example the distance is not in maxdist, so we dont cluster
        self.assertTrue(len(newel) == 2)
コード例 #8
0
from smodels.installation import installDirectory
from smodels.tools import asciiGraph


# In[3]:

#Load an input file containing LHE events and start the LHE reader
filename="%s/inputFiles/lhe/gluino_squarks.lhe" % installDirectory()
reader = lheReader.LheReader ( filename )


# In[4]:

#Read the next event and generate the corresponding element
event=reader.next()
element=lheDecomposer.elementFromEvent (event)


# In[5]:

#Print the corresponding ASCII graph
print asciiGraph.asciidraw ( element )


# In[6]:

#Do the same for the next event:
event=reader.next()
element=lheDecomposer.elementFromEvent ( event )
print asciiGraph.asciidraw ( element )