Exemplo n.º 1
0
from P2VV.Load import P2VVLibrary
if runPeriod :
    from ROOT import addIntegerToTree
    print 'adding run period "%s" to n-tuple' % runPeriod
    addIntegerToTree( nTupleOut, runPeriod, 'runPeriod' )

if firstData :
    from ROOT import addCategoryToTree, std
    print 'adding "first data" flag to n-tuple for data with run number < %d' % firstData
    bounds = std.vector('Double_t')()
    inds   = std.vector('Int_t')()
    bounds.push_back( float(firstData) )
    inds.push_back(1)
    inds.push_back(0)
    addCategoryToTree( nTupleOut, 'runNumber', 'firstData', bounds, inds )

if prescaleBounds :
    from ROOT import addCategoryToTree, std
    print 'adding prescale category with indices "%s" and run-number boundaries "%s" to n-tuple' % ( prescaleInds, prescaleBounds )
    bounds = std.vector('Double_t')()
    inds   = std.vector('Int_t')()
    for bound in prescaleBounds : bounds.push_back(bound)
    for ind in prescaleInds : inds.push_back(ind)
    addCategoryToTree( nTupleOut, 'runNumber', 'hlt2_prescale', bounds, inds )

if KKMassBounds :
    from ROOT import addCategoryToTree, std
    print 'adding KK-mass category with indices "%s" and KK-mass boundaries "%s" to n-tuple' % ( KKMassInds, KKMassBounds )
    bounds = std.vector('Double_t')()
    inds   = std.vector('Int_t')()
Exemplo n.º 2
0
    addIntegerToTree(intermediateTree, int(runPeriod), 'runPeriod' )

if addKaonSignInfo:
    print 'P2VV - INFO: Adding kaon sign (%+i) info to ntuple'%kaonSign
    addIntegerToTree(intermediateTree, int(kaonSign), 'kaonSign' )

if calculateHelAngles: calculateHelicityAngles(intermediateTree)

if addKpiMassCategory: 
    from ROOT import addCategoryToTree, std
    print 'P2VV - INFO: Adding Kpi-mass category with indices "%s" and KK-mass boundaries "%s" to n-tuple' % ( KpiMassInds, KpiMassBinBounds )
    bounds = std.vector('Double_t')()
    inds   = std.vector('Int_t')()
    for bound in KpiMassBinBounds : bounds.push_back(bound)
    for ind in KpiMassInds : inds.push_back(ind)
    addCategoryToTree( intermediateTree, KpiMassBranchName, 'KpiMassCat', bounds, inds )

# copy-rename branches
from ROOT import copyFloatInTree
for oldBranchName, newBranchName in obsDict.iteritems():
    if oldBranchName != newBranchName[0]:
        print 'P2VV - INFO: Copying and renaming branch: %s --> %s'%(oldBranchName,newBranchName[0])
        copyFloatInTree( intermediateTree, oldBranchName, newBranchName[0] )

# close intermediate files
intermediateTree.Write()
intermediateFile.Close()
del intermediateFile
print 'P2VV - INFO: Wrote intermediate tree to file: %s'%intermediateFileName
print 'P2VV - INFO: Finished refining tree. Continuing to create RooDataSet'