Esempio n. 1
0
def prepare_singleQuad_xml_files(type_name, type_setting, modules=modulelist):
    for module in modules:
        xmlfilename = os.path.join(
            xmlfolder, 'CMSIT_singleQuad_%s_%s.xml' % (module, type_name))
        xmlobject = XMLInfo(xmlfilename)
        for setting in daqsettings_per_xmltype[type_setting]:
            xmlobject.set_daq_settings(
                setting, daqsettings_per_xmltype[type_setting][setting])
        for chip in chiplist:
            xmlobject.set_chip_attribute_by_moduleid(1, chip, 'Lane', str(
                chip))  # the lane corresponds to the chip ID on the single AB
            xmlobject.set_chip_attribute_by_moduleid(
                1, chip, 'configfile',
                'CMSIT_RD53_%s_chip%i_default.txt' % (module, chip))

        chip_settings_thismodule = chip_settings[module]
        keepchips = []
        for chip in chip_settings_thismodule:
            settings = chip_settings_thismodule[chip]
            for setting in settings:
                xmlobject.set_chip_setting_by_modulename(
                    module, chip, setting, settings[setting])
        xmlobject.keep_only_chips_by_modulename(
            module, chip_settings_thismodule.keys())
        xmlobject.save_xml_as(xmlfilename)
Esempio n. 2
0
def reset_and_prepare_Ring_xml_file(type_name, type_setting,
                                    ids_and_chips_per_module, ring):

    xmlobject = XMLInfo(xmlfile_blueprint)

    for setting in daqsettings_per_xmltype[type_setting]:
        xmlobject.set_daq_settings(
            setting, daqsettings_per_xmltype[type_setting][setting])

    # set up all modules
    moduleids = []
    for mod in ids_and_chips_per_module:
        moduleids.append(ids_and_chips_per_module[mod][0])
    for id in moduleids:
        if not id == 0: xmlobject.copy_module_by_moduleid(0, id)
        xmlobject.set_txtfilepath_by_moduleid(id, txtfolder)

    xmlobject.keep_only_modules_by_moduleid(moduleids)

    # set up chips per module
    for module in ids_and_chips_per_module:
        id = ids_and_chips_per_module[module][0]
        chips = ids_and_chips_per_module[module][1]

        # first create all chips, then delete the unwanted ones
        for chip in [0, 1, 2, 3]:
            if not chip == 0:
                xmlobject.copy_chip_by_moduleid(id, 0, chip)
            if ring == 'R1':
                xmlobject.set_chip_attribute_by_moduleid(
                    id, chip, 'Lane', str(chip))
            elif ring == 'R3':
                xmlobject.set_chip_attribute_by_moduleid(
                    id, chip, 'Lane', str(0))
            else:
                raise AttributeError('invalid ring specified: %s' %
                                     (str(ring)))
            xmlobject.set_chip_attribute_by_moduleid(
                id, chip, 'configfile',
                'CMSIT_RD53_%s_chip%i_default.txt' % (module, chip))
            chip_settings = get_chipsettings_from_json()
            if str(chip) in chip_settings[module]:
                settings = chip_settings[module][str(chip)]
                for setting in settings:
                    xmlobject.set_chip_setting_by_modulename(
                        module, chip, setting, settings[setting])
        xmlobject.keep_only_chips_by_moduleid(id, chips)

    targetname = os.path.join(xmlfolder,
                              'CMSIT_disk%s_%s.xml' % (str(ring), type_name))
    xmlobject.save_xml_as(targetname)