예제 #1
0
##__________________________________________________________________||
thisdir = os.path.dirname(os.path.realpath(__file__))
alphatwirldir = os.path.dirname(thisdir)
sys.path.insert(1, alphatwirldir)
from alphatwirl.Counter import Counts
from alphatwirl.binning import RoundLog, Echo
import alphatwirl

##__________________________________________________________________||
heppydir = '/Users/sakuma/work/cms/c150130_RA1_data/PHYS14/20150507_SingleMu'
nevents = 100000
outdir = tempfile.mkdtemp()
sys.argv.extend(["-i", heppydir, "-n", str(nevents), "-o", outdir])

##__________________________________________________________________||
alphaTwirl = alphatwirl.AlphaTwirl()

tblcfg = [
    dict(outFileName='tbl_met.txt',
         branchNames=('met_pt', ),
         outColumnNames=('met', ),
         binnings=(RoundLog(0.1, 0), ),
         countsClass=Counts),
    dict(outFileName='tbl_jetpt.txt',
         branchNames=('jet_pt', ),
         binnings=(RoundLog(0.1, 0), ),
         indices=(0, ),
         countsClass=Counts),
    dict(outFileName='tbl_njets_nbjets.txt',
         branchNames=('nJet40', 'nBJet40'),
         outColumnNames=('njets', 'nbjets'),
예제 #2
0
    '--nevents',
    default=-1,
    type=int,
    help='maximum number of events to process for each component')
parser.add_argument('--max-events-per-process',
                    default=-1,
                    type=int,
                    help='maximum number of events per process')

configurer = alphatwirl.AlphaTwirlConfigurerFromArgs()
configurer.add_arguments(parser)

args = parser.parse_args()

cfg = configurer.configure(args)
alphaTwirl = alphatwirl.AlphaTwirl(config=cfg)

##__________________________________________________________________||
analyzerName = 'roctree'
fileName = 'tree.root'
treeName = 'tree'

##__________________________________________________________________||
tbl_xsec_path = os.path.join(args.outDir, 'tbl_xsec.txt')
tblXsec = heppyresult.TblComponentConfig(
    outPath=tbl_xsec_path,
    columnNames=('xsec', ),
    keys=('xSection', ),
)
alphaTwirl.addComponentReader(tblXsec)