def testDataMcGiven(self): puweight = pileupWeight(data="2012D", mc="Summer12_S10") self.assertEqual(puweight.enabled, True) self.assertEqual( puweight.data, os.path.join(aux.higgsAnalysisPath(), _pileupHistogramPath, "PileupHistogramData2012D.root")) self.assertEqual( puweight.mc, os.path.join(aux.higgsAnalysisPath(), _pileupHistogramPath, "PileupHistogramMCSummer12_S10.root"))
def testConstruct(self): f = File("NtupleAnalysis/python/main.py") self.assertEqual( f, os.path.join(aux.higgsAnalysisPath(), "NtupleAnalysis/python/main.py")) self.assertRaises(Exception, File, "NtupleFoo")
def getFiles(datasetName): basedir = os.path.join(aux.higgsAnalysisPath(), "NtupleAnalysis") name = _aliases.get(datasetName, datasetName) path = os.path.join(basedir, "data", name+".txt") if not os.path.exists(path): raise Exception("No files for dataset %s (i.e. file %s not found)" % (name, path)) def strip(line): ret = line.rstrip() if "#" in ret: ret = ret[0:ret.index("#")] return ret with open(path) as f: return filter(lambda l: len(l) > 0, map(strip, f.readlines()))
def getFiles(datasetName): basedir = os.path.join(aux.higgsAnalysisPath(), "NtupleAnalysis") name = _aliases.get(datasetName, datasetName) path = os.path.join(basedir, "data", name + ".txt") if not os.path.exists(path): raise Exception("No files for dataset %s (i.e. file %s not found)" % (name, path)) def strip(line): ret = line.rstrip() if "#" in ret: ret = ret[0:ret.index("#")] return ret with open(path) as f: return filter(lambda l: len(l) > 0, map(strip, f.readlines()))
def testSerialize(self): a = PSet(foo=File("NtupleAnalysis/python/main.py")) self.assertEqual( a.serialize_(), """{ "foo": "%s/NtupleAnalysis/python/main.py" }""" % aux.higgsAnalysisPath())
def File(fname): fullpath = os.path.join(aux.higgsAnalysisPath(), fname) if not os.path.exists(fullpath): raise Exception("The file %s does not exist" % self._fullpath) return fullpath
def File(fname): fullpath = os.path.join(aux.higgsAnalysisPath(), fname) if not os.path.exists(fullpath): raise Exception("The file %s does not exist" % self._fullpath) return fullpath
def testSerialize(self): a = PSet(foo=File("NtupleAnalysis/python/main.py")) self.assertEqual(a.serialize_(), """{ "foo": "%s/NtupleAnalysis/python/main.py" }""" % aux.higgsAnalysisPath())
def testConstruct(self): f = File("NtupleAnalysis/python/main.py") self.assertEqual(f, os.path.join(aux.higgsAnalysisPath(), "NtupleAnalysis/python/main.py")) self.assertRaises(Exception, File, "NtupleFoo")
# Example of adding a dataset which has its files defined in data/<dataset_name>.txt file #process.addDatasets(["TTbar_HBWB_HToTauNu_M_160_13TeV_pythia6"]) # Example of adding datasets from a multicrab directory import sys if len(sys.argv) != 2: print "Usage: ./exampleAnalysis.py <path-to-multicrab-directory>" sys.exit(0) #print sys.argv[1] process.addDatasetsFromMulticrab(sys.argv[1]) import HiggsAnalysis.NtupleAnalysis.tools.aux as aux PileupHistogramPath = os.path.join(aux.higgsAnalysisPath(), "NtupleAnalysis", "data", "PUWeights") process.addAnalyzer("generatorComparison", Analyzer("GeneratorComparison", histogramAmbientLevel = "Informative", tauPtCut = 41.0, tauEtaCut = 2.1, bjetEtCut = 30.0, bjetEtaCut = 2.4, lumi = 7274, runMin = 202807, runMax = 208686, ), #includeOnlyTasks="TauPlusX_\S+_2012D_Jan22" )
def testDataMcGiven(self): puweight = pileupWeight(data="2012D", mc="Summer12_S10") self.assertEqual(puweight.enabled, True) self.assertEqual(puweight.data, os.path.join(aux.higgsAnalysisPath(), _pileupHistogramPath, "PileupHistogramData2012D.root")) self.assertEqual(puweight.mc, os.path.join(aux.higgsAnalysisPath(), _pileupHistogramPath, "PileupHistogramMCSummer12_S10.root"))