예제 #1
0
logger = logger.get_logger(args.logLevel, logFile=None)

# Check that we have an even number of arguments
if not len(args.couplings) % 2 == 0:
    logger.error(
        "Need an even number of coupling arguments of the format coupling1, value1, coupling2, value2, ... . Got %r",
        args.couplings)

# Interpret coupling argument list
coupling_names = args.couplings[::2]
coupling_values = map(float, args.couplings[1::2])

modified_couplings = {c: v for c, v in zip(coupling_names, coupling_values)}

# Let's not leave the user in the dark
logger.info("Model:        %s", args.model)
logger.info("Process:      %s", args.process)
logger.info("Couplings:    %s",
            ", ".join(["%s=%5.4f" % c for c in modified_couplings.items()]))

# Create configuration class
config = Configuration(model_name=args.model)

p = Process(process=args.process, nEvents=1, config=config)
xsec_val = p.diagrams(plot_dir=os.path.join(plot_directory, "diagrams"),
                      modified_couplings=modified_couplings)

config.cleanup()

logger.info("Done! Calculated xsec: %s ", repr(xsec_val))
예제 #2
0
        sample.scale /= sample.normalization

weight_ = lambda event, sample: event.weight
tr = TriggerSelector(args.year, None)

# Use some defaults (set defaults before you create/import list of Plots!!)
Plot.setDefaults(stack=stack,
                 weight=staticmethod(weight_),
                 selectionString=cutInterpreter.cutString(args.selection),
                 addOverFlowBin='upper')

# Import plots list (AFTER setDefaults!!)
plotListFile = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                            'plotLists', args.plotFile + '.py')
if not os.path.isfile(plotListFile):
    logger.info("Plot file not found: %s", plotListFile)
    sys.exit(1)

plotModule = imp.load_source("plotLists", os.path.expandvars(plotListFile))
if args.noData: from plotLists import plotListDataMC as plotList
else: from plotLists import plotListData as plotList

# Loop over channels
yields = {}
allPlots = {}
allModes = ['mu', 'e']

for index, mode in enumerate(allModes):
    logger.info("Computing plots for mode %s", mode)

    yields[mode] = {}
예제 #3
0
파일: run.py 프로젝트: schoef/TTGammaEFT
    param_points = recurse(coupling_list) if len(coupling_list) > 0 else [[]]

else:
    logger.error(
        "Need an even number of coupling arguments of the format coupling1, value1, value2, ... , coupling2, value3, ... . Got %r",
        args.couplings)
    raise ValueError

# Create configuration class
config = Configuration(model_name=args.model)

# Process all the coupling points
for i_param_point, param_point in enumerate(param_points):

    logger.info("Processing parameter point %i/%i", i_param_point + 1,
                len(param_points))

    # Interpret coupling argument list
    names = param_point[::2]
    values = map(float, param_point[1::2])

    modification_dict = {c: v for c, v in zip(names, values)}

    # Let's not leave the user in the dark
    logger.info("Model:        %s", args.model)
    logger.info("Process:      %s", args.process)
    logger.info("Couplings:    %s",
                ", ".join(["%s=%5.4f" % c for c in modification_dict.items()]))

    # make process
    p = Process(process=args.process,