def scaleFiles(inFileName, lumi): """docstring for scaleQCD""" if os.path.exists(inFileName + '_Scaled.root'): os.remove(inFileName + '_Scaled.root') outfile = TFile(inFileName + '_Scaled.root', "RECREATE") else: outfile = TFile(inFileName + '_Scaled.root', "RECREATE") infile = TFile(inFileName + '.root', "READ") scale = lumi * scaleFactor(inFileName) listDir = [] for k in infile.GetListOfKeys(): name = k.GetName() listDir.append(name) for j in listDir: if not 'RUNATree' in j: outfile.mkdir(j) outfile.cd(j) dir = infile.GetDirectory(j) for q in dir.GetListOfKeys(): name = q.GetName() h = infile.Get(j + '/' + name) try: hOut = h.Clone() #hOut.Scale( scale ) if not isinstance(h, TTree): hOut.Scale(scale) hOut.Write() except AttributeError: pass outfile.cd('/') outfile.Write() outfile.Close() infile.Close()
def scaleFiles( inFileName, lumi ): """docstring for scaleQCD""" if os.path.exists(inFileName+'_Scaled.root'): os.remove(inFileName+'_Scaled.root') outfile = TFile( inFileName+'_Scaled.root', "RECREATE") else: outfile = TFile( inFileName+'_Scaled.root', "RECREATE") infile = TFile( inFileName+'.root', "READ") scale = lumi * scaleFactor(inFileName) listDir = [] for k in infile.GetListOfKeys(): name = k.GetName() listDir.append( name ) for j in listDir: if not 'RUNATree' in j: outfile.mkdir(j) outfile.cd(j) dir = infile.GetDirectory(j) for q in dir.GetListOfKeys(): name = q.GetName() h = infile.Get( j+'/'+name) try: hOut = h.Clone() #hOut.Scale( scale ) if not isinstance(h,TTree): hOut.Scale( scale ) hOut.Write() except AttributeError: pass outfile.cd('/') outfile.Write() outfile.Close() infile.Close()
'/store/user/algomez/QCD_Pt_800to1000_TuneCUETP8M1_13TeV_pythia8/RunIISpring15DR74_RUNA_Asympt25ns_v03/150911_073406/0000/RUNtuples_102.root', #'/store/user/algomez/RPVSt100tojj_13TeV_pythia8/RunIISpring15DR74_RUNA_Asympt25ns__v02/150719_102556/0000/RUNtuples_11.root' #'/store/user/algomez/RPVSt100tojj_13TeV_pythia8/RunIISpring15DR74_RUNA_Asympt25ns__v02/150719_170508/0000/RUNtuples_101.root', #'file:RUNtuple_1.root' ) ) #process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32 (options.maxEvents) ) if 'bj' in NAME: bjsample = True else: bjsample = False Lumi = 15.47 from RUNA.RUNAnalysis.scaleFactors import scaleFactor SF = scaleFactor(NAME) if 'JetHT' in NAME: sf = 1 HTtrigger = 'HLT_PFHT900' else: sf = SF*Lumi HTtrigger = 'HLT_PFHT800' process.TFileService=cms.Service("TFileService",fileName=cms.string( 'RUNFullAnalysis_'+NAME+'.root' ) ) process.AnalysisPlots = cms.EDAnalyzer('RUNAnalysis', scale = cms.double( sf ), cutHT = cms.double( options.HT ), cutMassRes = cms.double( options.MassRes ), cutDelta = cms.double( options.Delta ),
#'/store/user/jkarancs/SusyAnalysis/B2GEdmNtuple/QCD_HT1000to1500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/B2GAnaFW_76X_V1p1_RunIIFall15MiniAODv2-PU25nsData2015v1_76X_mcRun2_asymptotic_v12-v1/160401_100723/0000/B2GEDMNtuple_1.root', )) process.maxEvents = cms.untracked.PSet( input=cms.untracked.int32(options.maxEvents)) from RUNA.RUNAnalysis.scaleFactors import scaleFactor bjsample = True if 'bj' in NAME else False if 'JetHT' in NAME: SF = 1 isData = True options.systematics = False else: isData = False SF = scaleFactor(NAME) process.ResolvedAnalysisPlots = cms.EDAnalyzer( 'RUNAnalysis', cutMassAsym=cms.double(options.MassRes), cutDelta=cms.double(options.Delta), cutDeltaR=cms.double(options.DeltaR), cutCosThetaStar=cms.double(options.ResolvedCosThetaStar), cutDEta=cms.double(options.EtaBand), triggerPass=cms.vstring(['HLT_PFHT800', 'HLT_PFHT750_4JetPt']), bjSample=cms.bool(bjsample), scale=cms.double(SF), dataPUFile=cms.string(options.namePUFile), jecVersion=cms.string(options.jecVersion), isData=cms.bool(isData), ### temporary