コード例 #1
0
    print("len(Dan_only)={0:d}".format(len(Dan_only)))

    print("FSA_only={0} Dan_only={1}".format(args.unique == 'FSA_only',
                                             args.unique == 'Dan_only'))

inFileName = args.inFileName
print("Opening {0:s} as input.".format(inFileName))
inFile = TFile.Open(inFileName)
inFile.cd()
inTree = inFile.Get("Events")
nentries = inTree.GetEntries()
nMax = nentries
print("nentries={0:d} nMax={1:d}".format(nentries, nMax))
if args.nEvents > 0: nMax = min(args.nEvents, nentries)

outFileName = GF.getOutFileName(args).replace(".root", ".ntup")
print("Opening {0:s} as output.".format(outFileName))
outTuple = outTuple.outTuple(outFileName)

channel = args.channel
goodEventCounter = 0
tStart = time.time()
for count, entry in enumerate(inTree):
    cutCounter.count('All')
    if count % 1000 == 0: print("Count={0:d}".format(count))
    if count > nMax: break

    if channel == 'tt':
        tauList = tauFun.getTauList(channel, entry)
        if len(tauList) < 2: continue
        cutCounter.count('TwoTaus')
コード例 #2
0
                        default=2017,
                        type=int,
                        help="Year for data.")
    return parser.parse_args()


args = getArgs()

inFileName = args.inFileName
print("Opening {0:s} as input.".format(inFileName))
inFile = TFile.Open(inFileName)
inFile.cd()
inTree = inFile.Get("Events")
nentries = inTree.GetEntries()

outFileName = GF.getOutFileName(args)
print("Opening {0:s} as output.".format(outFileName))
fOut = TFile(outFileName, 'recreate')

tStart = time.time()
fData = TFile('data_pileup_{0:d}.root'.format(args.year))
hData = fData.Get('pileup')
print("hData={0:s}".format(str(hData)))
binWidth = hData.GetBinWidth(1)
xMin = hData.GetBinLowEdge(1)
nBins = hData.GetNbinsX()
xMax = xMin + nBins * binWidth
bins = np.linspace(xMin + 0.5 * binWidth, xMax - 0.5 * binWidth, nBins)
print("nBins={0:d} binWidth={1:f} xMin={2:f} xMax={3:f}".format(
    nBins, binWidth, xMin, xMax))