'%s/%s_%s.altSigFit.root' % (outputDirectory, sample.name, args.flag)) setattr( sample, 'altBkgFit', '%s/%s_%s.altBkgFit.root' % (outputDirectory, sample.name, args.flag)) ### change the sample to fit is mc fit if args.mcSig: sampleToFit = tnpConf.samplesDef['mcNom'] if args.doFit: sampleToFit.dump() for ib in range(len(tnpBins['bins'])): if (args.binNumber >= 0 and ib == args.binNumber) or args.binNumber < 0: if args.altSig: tnpRoot.histFitterAltSig(sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParAltSigFit) elif args.altBkg: tnpRoot.histFitterAltBkg(sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParAltBkgFit) else: tnpRoot.histFitterNominal(sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParNomFit) args.doPlot = True #################################################################### ##### dumping plots #################################################################### if args.doPlot: fileName = sampleToFit.nominalFit fitType = 'nominalFit'
setattr( sample, 'nominalFit', '%s/%s_%s.nominalFit.root' % ( outputDirectory , sample.name, args.flag ) ) setattr( sample, 'altSigFit' , '%s/%s_%s.altSigFit.root' % ( outputDirectory , sample.name, args.flag ) ) setattr( sample, 'altBkgFit' , '%s/%s_%s.altBkgFit.root' % ( outputDirectory , sample.name, args.flag ) ) ### change the sample to fit is mc fit if args.mcSig : sampleToFit = tnpConf.samplesDef['mcNom'] if args.doFit: sampleToFit.dump() for ib in range(len(tnpBins['bins'])): if (args.binNumber >= 0 and ib == args.binNumber) or args.binNumber < 0: if args.altSig: tnpRoot.histFitterAltSig( sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParAltSigFit ) elif args.altBkg: tnpRoot.histFitterAltBkg( sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParAltBkgFit ) else: tnpRoot.histFitterNominal( sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParNomFit ) args.doPlot = True #################################################################### ##### dumping plots #################################################################### if args.doPlot: fileName = sampleToFit.nominalFit fitType = 'nominalFit' if args.altSig : fileName = sampleToFit.altSigFit
sampleToFit = tnpConf.samplesDef['mcNom'] if args.doFit: sampleToFit.dump() for ib in range(len(tnpBins['bins'])): if (args.binNumber >= 0 and ib == args.binNumber) or args.binNumber < 0: # Get setting file name head, tail = os.path.split(args.settings) print 'etc/config/fitPars/' + (tail).replace( '.py', '_' + args.flag + '_fitPars.py') if not os.path.isfile('etc/config/fitPars/' + ( tail).replace('.py', '_' + args.flag + '_fitPars.py')): print "\n===> Using default fit parameters as given in ", args.settings, "file." if args.altSig and not args.addGaus: tnpRoot.histFitterAltSig(sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParAltSigFit) elif args.altSig and args.addGaus: tnpRoot.histFitterAltSig(sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParAltSigFit_addGaus, 1) elif args.altBkg: tnpRoot.histFitterAltBkg(sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParAltBkgFit) else: tnpRoot.histFitterNominal(sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParNomFit) else: # Add fitPars directory to the path, so that we can import the dictionary sys.path.append(os.path.abspath("etc/config/fitPars")) # Below line import fit parameter dictionary # fit parameters file format should be like: <setting-conf-file>_<flag>_fitPars.py