Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
#!/usr/bin/env python3
"""
_pp_

Test for Collision Scenario implementation

"""


import unittest
import FWCore.ParameterSet.Config as cms
from Configuration.DataProcessing.GetScenario import getScenario



def writePSetFile(name, process):
    """
    _writePSetFile_

    Util to dump the process to a file

    """
    handle = open(name, 'w')
    handle.write(process.dumpPython())
    handle.close()


class ppScenarioTest(unittest.TestCase):
    """
    unittest for pp collisions scenario

    """

    def testA(self):
        """get the scenario"""
        try:
            scenario = getScenario("pp")
        except Exception as ex:
            msg = "Failed to get pp scenario\n"
            msg += str(ex)
            self.fail(msg)


    def testPromptReco(self):
        """test promptReco method"""
        scenario = getScenario("pp")
        try:
            process = scenario.promptReco("FT_R_42_V10A::All",writeTiers = ['RECO', 'AOD', 'ALCARECO', 'DQM'])
            writePSetFile("testPromptReco.py", process)
        except Exception as ex:
            msg = "Failed to create Prompt Reco configuration\n"
            msg += "for pp Scenario\n"
            msg += str(ex)
            self.fail(msg)




if __name__ == '__main__':
    unittest.main()