argParser.add_argument('--nJetMax', action='store', default=0, nargs='?', help="How many jets to match?") argParser.add_argument('--genSampleDir',action='store', default='/afs/hephy.at/data/rschoefbeck01/TopEFT/genSamples/', nargs='?', help="Where to store the genSample") argParser.add_argument('--overwrite', action='store_true', help="Overwrite?") argParser.add_argument('--overwriteGenFile', action='store_true', help="OverwriteGenFile?") argParser.add_argument('--keepGenSample',action='store_true', help="keep the intermediate gen sample?") argParser.add_argument('--outDir', action='store', default='v2', nargs='?', help="Where are the gridpacks?") argParser.add_argument('--cfg', action='store', default='$CMSSW_BASE/src/TopEFT/Generation/production/cfg/GEN.py', help="Which cfg?") argParser.add_argument('--logLevel', action='store', nargs='?', choices=['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'TRACE', 'NOTSET'], default='INFO', help="Log level for logging" ) args = argParser.parse_args() logger = logger.get_logger(args.logLevel, logFile = None) # Check if the gridpack exists if not os.path.exists( args.gridpack ): logger.error( "Gridpack %s not found. Exit", args.gridpack ) sys.exit(0) gp = os.path.basename(args.gridpack).rstrip('.tar.xz') # Check if the output is there out_file = os.path.join( skim_output_directory, 'gen', args.outDir, gp, gp+'.root') if os.path.exists( out_file ) and checkRootFile( out_file, checkForObjects=["Events"] ): logger.info( "Found output file %s.", out_file ) if args.overwrite: os.remove( out_file ) logger.info( "Deleted, because I overwrite." ) else: sys.exit(0) else: logger.info( "Did not find output file %s. Look for gen sample. ", out_file )
nargs='?', choices=[ 'CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'TRACE', 'NOTSET' ], default='INFO', help="Log level for logging") args = argParser.parse_args() 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
logger_rt = logger_rt.get_logger(args.logLevel, logFile=None) # load histos gDir = ROOT.gDirectory rFile = ROOT.TFile.Open(args.input) if rFile: # first & only TObject in file is the canvas try: canvas = rFile.Get(rFile.GetListOfKeys().At(0).GetName()) histos = [ canvas.GetListOfPrimitives().At(i) for i in range(canvas.GetListOfPrimitives().GetSize()) ] histos = filter(lambda h: type(h) == ROOT.TH1F, histos) except: logger.error("Could not load input file %s", args.input) sys.exit(-1) else: logger.error("Could not load input file %s", args.input) sys.exit(-1) # nicer name histos[0].SetName("signal") for i_histo, histo in enumerate(histos[1:]): histo.SetName("bkg_%i" % i_histo) # signal is first, the last histo is a copy logger.info("Loaded %i histos from file %s", len(histos), args.input) histos = histos[:-1] # un-stack for i_histo, histo in enumerate(histos[:-1]):