cmd.append('-f') else: logger.info("File %s already exists. Skipping.", targetFileName) cmd = None from subprocess import call if cmd is not None: call(cmd + [targetFileName] + job) if options.delete: isOK = checkRootFile( targetFileName, checkForObjects = [options.treeName]) \ if options.treeName is not None else checkRootFile( targetFileName ) if isOK: for f in job: os.remove(f) logger.debug("Deleted input %s", f) else: logger.warning( "File %s does not look OK. Checked for tree: %r. Did not delete input.", targetFileName, options.treeName) else: if not isOK: logger.warning("File %s does not look OK. Checked for tree: %r.", targetFileName, options.treeName) if options.really: logger.info("Done.") else: logger.info( "Done with nothing. Use --really to hadd and --delete to delete the input." )
if os.path.exists( targetFileName ): if options.overwrite: logger.info( "Found file %s. Overwriting.", targetFileName ) cmd.append( '-f' ) else: logger.info( "File %s already exists. Skipping.", targetFileName ) cmd = None from subprocess import call if cmd is not None: call(cmd + [targetFileName] + job) if options.delete: isOK = checkRootFile( targetFileName, checkForObjects = [options.treeName]) \ if options.treeName is not None else checkRootFile( targetFileName ) if isOK: for f in job: os.remove( f ) logger.debug( "Deleted input %s", f) else: logger.warning( "File %s does not look OK. Checked for tree: %r. Did not delete input.", targetFileName, options.treeName ) else: if not isOK: logger.warning( "File %s does not look OK. Checked for tree: %r.", targetFileName, options.treeName ) if options.really: logger.info("Done.") else: logger.info("Done with nothing. Use --really to hadd and --delete to delete the input.")
elif isSingleLep: skimConds.append( "Sum$(LepGood_pt>20&&abs(LepGood_eta)<2.5) + Sum$(LepOther_pt>20&&abs(LepOther_eta)<2.5)>=1" ) elif isJet250: skimConds.append( "Sum$(Jet_pt>250) + Sum$(DiscJet_pt>250) + Sum$(JetFailId_pt>250) + Sum$(gamma_pt>250) > 0" ) #Samples: Load samples maxN = 2 if options.runSmallSample else None if options.T2tt: from StopsDilepton.samples.cmgTuples_Signals_Spring15_mAODv2_25ns_0l import T2tt from StopsDilepton.samples.helpers import getT2ttSignalWeight samples = filter( lambda s:s.name in options.samples, T2tt) logger.info( "T2tt signal samples to be processed: %s", ",".join(s.name for s in samples) ) # FIXME I'm forcing ==1 signal sample because I don't have a good idea how to construct a sample name from the complicated T2tt_x_y_z_... names assert len(samples)==1, "Can only process one T2tt sample at a time." samples[0].files = samples[0].files[:maxN] logger.debug( "Fetching signal weights..." ) signalWeight = getT2ttSignalWeight( samples[0], lumi = targetLumi ) logger.debug("Done fetching signal weights.") elif options.TTDM: from StopsDilepton.samples.helpers import fromHeppySample samples = [ fromHeppySample(s, data_path = "/data/rschoefbeck/cmgTuples/TTBar_DM/", \ module = "CMGTools.StopsDilepton.TTbarDMJets_signals_RunIISpring15MiniAODv2", maxN = maxN)\ for s in options.samples ] else: from StopsDilepton.samples.helpers import fromHeppySample samples = [ fromHeppySample(s, data_path = options.dataDir, maxN = maxN) for s in options.samples ] isData = False not in [s.isData for s in samples] isMC = True not in [s.isData for s in samples] if options.T2tt:
skimConds.append( "Sum$(Jet_pt>250) + Sum$(DiscJet_pt>250) + Sum$(JetFailId_pt>250) + Sum$(gamma_pt>250) > 0" ) #Samples: Load samples maxN = 2 if options.runSmallSample else None if options.T2tt: from StopsDilepton.samples.cmgTuples_Signals_Spring15_mAODv2_25ns_0l import T2tt from StopsDilepton.samples.helpers import getT2ttSignalWeight samples = filter(lambda s: s.name in options.samples, T2tt) logger.info("T2tt signal samples to be processed: %s", ",".join(s.name for s in samples)) # FIXME I'm forcing ==1 signal sample because I don't have a good idea how to construct a sample name from the complicated T2tt_x_y_z_... names assert len(samples) == 1, "Can only process one T2tt sample at a time." samples[0].files = samples[0].files[:maxN] logger.debug("Fetching signal weights...") signalWeight = getT2ttSignalWeight(samples[0], lumi=targetLumi) logger.debug("Done fetching signal weights.") elif options.TTDM: from StopsDilepton.samples.helpers import fromHeppySample samples = [ fromHeppySample(s, data_path = "/data/rschoefbeck/cmgTuples/TTBar_DM/", \ module = "CMGTools.StopsDilepton.TTbarDMJets_signals_RunIISpring15MiniAODv2", maxN = maxN)\ for s in options.samples ] else: from StopsDilepton.samples.helpers import fromHeppySample samples = [ fromHeppySample(s, data_path=options.dataDir, maxN=maxN) for s in options.samples ] isData = False not in [s.isData for s in samples]