Ejemplo n.º 1
0
submission_parser.add_argument('--flavor', type=int, default=0,  help='flavor of lepton under consideration. 0 = electron, 1 = muon', choices = [0, 1])
submission_parser.add_argument('--includeReco',   action='store_true', default=True, 
    help='look at the efficiency for a gen tau to be both reconstructed and identified. Currently just fills the efficiency for isolation')
submission_parser.add_argument('--onlyReco',   action='store_true', default=False,  help='look at the efficiency for a gen tau to be reconstructed. Currently just fills the efficiency for isolation')
submission_parser.add_argument('--isTest',   action='store_true', default=False,  help='Run a small test')

argParser.add_argument('--bkgr', required=True,     action='store',      default=None,   help='Select bkgr')
argParser.add_argument('--wp',     action='store',      default='tight',   help='only have reco efficiency')
args = argParser.parse_args()


from HNL.Samples.sampleManager import SampleManager
sample_manager = SampleManager(args.year, 'noskim', 'compareTauIdList_'+str(args.year))
jobs = []
for sample_name in sample_manager.sample_names:
    sample = sample_manager.getSample(sample_name)
    for njob in xrange(sample.split_jobs):
        jobs += [(sample.name, str(njob))]

#Merges subfiles if needed
if args.isTest:
    input_file_path = os.getcwd()+'/data/testArea/compareTauID/includeReco/'
else:
    input_file_path = os.getcwd()+'/data/compareTauID/includeReco/'
if args.onlyReco:
    input_file_path += 'onlyReco/'

merge_files = glob.glob(input_file_path + '*')
for mf in merge_files:
    if "Results" in mf: merge_files.pop(merge_files.index(mf))
    if not args.onlyReco and 'onlyReco' in mf: merge_files.pop(merge_files.index(mf))
Ejemplo n.º 2
0
        elif self.sample.is_data:
            return 1.
        else:
            #the _weight is needed because otherwise the hcounter might be wrong for the denominator
            self.lumi_weight = self.sample.chain._weight*(self.sample.xsec*LUMINOSITY_MAP[self.sample.chain.year])/self.total_hcount
            return self.lumi_weight 

if __name__ == '__main__':
    from HNL.Samples.sampleManager import SampleManager
    from HNL.Tools.logger import getLogger, closeLogger
    log = getLogger('INFO')

    sm = SampleManager(2016, 'noskim', 'fulllist_2016')

    # s = sm.getSample('ZZTo4L')
    s = sm.getSample('HNL-tau-m800')
    # s = sm.getSample('DYJetsToLL-M-50')

    chain = s.initTree()
    lw = LumiWeight(s, sm)
    chain.GetEntry(5)
    chain.year = 2016
    print s.name
    print lw.getLumiWeight() 
    print 'chain._weight: ', chain._weight, 'expected -41444.199'
    print 'xsec ', s.xsec, lw.sample.xsec, 'expected 18610'
    print 'luminosity ', LUMINOSITY_MAP[chain.year], 'expected 35546.'
    print 'hCount ', s.hcount, lw.total_hcount, 'more than 2.05023673303e+12'

    closeLogger(log)
Ejemplo n.º 3
0
elif args.flavor == 'tau':
    sublist = 'BackgroundEstimation/TauFakes'
elif args.flavor == 'mu':
    sublist = 'BackgroundEstimation/MuonFakes'
elif args.flavor == 'e':
    sublist = 'BackgroundEstimation/ElectronFakes'

sample_manager = SampleManager(args.year, skim_str, sublist)

#
# Define job list
#
jobs = []
for sample_name in sample_manager.sample_names:
    if args.sample and args.sample not in sample_name: continue
    sample = sample_manager.getSample(sample_name)
    for njob in xrange(sample.returnSplitJobs()):
        jobs += [(sample.name, str(njob))]

from HNL.BackgroundEstimation.fakerateArray import createFakeRatesWithJetBins
region_to_select = args.tauRegion if args.flavor == 'tau' else 'LightLeptonFakes'
#
# Define output name
#
subjobAppendix = 'subJob' + args.subJob if args.subJob else ''
data_str = 'DATA' if args.inData else 'MC'


def getOutputBase(region):
    if not args.isTest:
        output_name = os.path.join(os.getcwd(), 'data',
Ejemplo n.º 4
0
    def getTotalWeight(self, sideband=False):
        tot_weight = 1.
        tot_weight *= self.getLumiWeight()
        tot_weight *= self.getPUWeight()
        if sideband:
            tot_weight *= self.getFakeRateWeight()
        return tot_weight


if __name__ == '__main__':
    from HNL.Samples.sampleManager import SampleManager
    from HNL.Tools.logger import getLogger, closeLogger
    log = getLogger('INFO')

    sm = SampleManager(2016, 'noskim', 'fulllist_2016')

    s = sm.getSample('ZZTo4L')

    chain = s.initTree()
    chain.GetEntry(5)
    chain.year = 2016
    reweighter = Reweighter(s, sm)

    print s.name
    print reweighter.getLumiWeight()
    print reweighter.getPUWeight()
    print reweighter.getTotalWeight()

    print chain._nTrueInt

    closeLogger(log)