Script Bash para abrir telas e compilar o mesmo arquivo

1

Eu escrevi um script bash para iniciar sessões de tela separadas e executar um comando em cada uma delas que compila o mesmo arquivo de origem C++ em ROOT (uma estrutura de análise de dados orientada a objeto link ) em cada sessão de tela. Funcionou bem no começo; no entanto, como o tempo de compilação aumentou (como uma observação), ele não conseguiu compilar e numerosos erros foram produzidos. A mensagem de erro dentro do arquivo de texto está abaixo:

Info in <TUnixSystem::ACLiC>: creating shared library /DIRECTORY/./readerSummerStd_C.so
ACLiC:0: RuntimeWarning: Failed to generate the dependency file for /DIRECTORY/./readerSummerStd_C.so
Note: Link requested for already precompiled class map<string,int,less<string>,allocator<pair<const string,int> > > (ignore this message) :0:
g++: /DIRECTORY/readerSummerStd_C_ACLiC_dict.o: No such file or directory
Error in <ACLiC>: Compilation failed!
Traceback (most recent call last):
  File "./NEWrunReader.py", line 87, in <module>
    from ROOT import readerSummerStd as reader
ImportError: cannot import name readerSummerStd

O script zsh de análise é fornecido abaixo para referência, se eu esperar que um código compile e execute o outro código, nenhum problema ocorrerá. Como posso contornar este problema?

    #! /bin/zsh
    ### Script for running everything in screens ###
    echo You have the following screens running:
    screen -ls
    echo Press any key to proceed. NOTE THAT YOUR OTHER SCREENS WILL GET KILLED!
    read
    pkill -15 -U arisevon screen ## We make sure that no screens are running for now
    bkgarr=(TopJets BosonJets DiBoson TTbar)
    sigarr=(NM1 NM2 NM3 Scenario4 Scenario6)
    puarr=(50PU 140PU)
    lumarr=(30 300 3000)

    echo Please type 1 for 50PU samples and 2 for 140PU samples
    read PU
    if [[ $PU -ne 1 && $PU -ne 2 ]] ; then
        echo You have to enter 1 or 2
        return 1
    fi

    echo Please type 1 for 300fb-1 and 2 for 3000fb-1
    read lum

    if [[ $lum -ne 1 && $lum -ne 2 ]] ; then
        echo You have to enter 1 or 2
        return 1
    fi

    if [ $PU = 1 ]; then
        let "lum = $lum + 1"
        #echo $lum
    fi

    ex NEWrunReader.py  <<EOEX
      :43s/Lumi.*/Lumi=$lumarr[lum]/
      :x
    EOEX

    echo Press any key to proceed or Ctrl+C to abort!
    read
    for index in $bkgarr
    do
        screen -dmS $index
        screen -S $index -p 0 -X stuff "$(typeset -p bkgarr)"$'\r'
        screen -S $index -p 0 -X stuff "./NEWrunReader.py SummerStd $puarr[PU]_$index >& $index.txt &"$'\r'
    done
    for sigind in $sigarr
    do
        screen -dmS $sigind
        screen -S $sigind -p 0 -X stuff "$(typeset -p bkgarr)"$'\r'
        screen -S $sigind -p 0 -X stuff "./NEWrunReader.py SummerStd $puarr[PU]_$sigind >& $sigind.txt &"$'\r'
    done
    return 0

Esses códigos são para realizar uma análise em física de alta energia e estou realmente curioso, pois esse script funcionou perfeitamente antes. A única diferença é que o código-fonte do C ++ ficou mais complexo do que antes. O código Python é o seguinte:

#!/usr/bin/python


import sys
from ROOT import gROOT

# scenarios and samples
scenarios = ['NoPU','50PU','140PU']
#scenarios = ['140PU']
########################################################
# FOR THE PAPER (SNOWMASS)
#samples   = ['DiBoson','BosonJets','TopJets','TTbar','TDR4','TDR5','TDR6','TDR8','naturalSUSY']
########################################################
#samples   = ['TTbar']
# by historic reason we have as dir names: bjets  diboson  tdr tdrNew tjets  ttbar for snowmass
# by historic reason we have as dir names: bjets  diboson  tdr        tjets  ttbar for snowmass2
#for (ecfa) PhaseII_C3 / C4v2
########################################################
#samples w.o weight (snowmass)
#noWeight  = ['TDR4','TDR5','TDR6','TDR8','naturalSUSY']

# nTuple input path
#########################################################
# for susyhit
samples   = ['DiBoson','BosonJets','TopJets','TTbar','NM1','NM2','NM3','Scenario6','Scenario4','Scenario1']
noWeight  = ['NM1','NM2','NM3','Scenario6','Scenario4','Scenario1']
base = '/nfs/dust/cms/user/safarzad/Output/EOSforFutureStudies/14TeV/PhaseII/Configuration4v2/140PileUp'
#########################################################
# for naturalSUSY
#base = 'nTuples/ECFA/PhaseII_C3'
#base = 'nTuples/ECFA/PhaseII_C4'
#########################################################
# FOR THE PAPER (SNOWMASS)
#base = 'nTuples/snowmass2'
#########################################################
# for PhaseII_C3 & PhaseII_C4v2 (ecfa) #################  !!!!!!!!! #####################
#base = 'Output/ECFA/PhaseII_C3' #### noch per Hand aendern, besser in scenarios C3, C4 beruecksichtigen! ####
#base = 'Output/ECFA/PhaseII_C4v2'
#base = 'Output/14TeV/'
#
#
# lumi in fb^-1
Lumi=30


def help():
    print 'First argument analysis:'
    print '   SingleS'
    print ' then a list of inputs - read the code'
    sys.exit(0)

from operator import mul
def scale(fac,list):
    return map(mul,len(list)*[fac],list)

# choose the analysis and a sample
if len(sys.argv)>1:
    if sys.argv[1]=='SingleS':       # single lepton  stop - CMS
        gROOT.LoadMacro('readerSingleS.C+')
        from ROOT import readerSingleS as reader
    if sys.argv[1]=='Claudia_task':       # single lepton  stop - CMS
        gROOT.LoadMacro('readerClaudia_task.C+')
        from ROOT import readerClaudia_task as reader
    elif sys.argv[1]=='Skeleton':  # SKELETON
        gROOT.LoadMacro('readerSkeleton.C+')
        from ROOT import readerSkeleton as reader
    elif sys.argv[1]=='SingleSOld':  # single lepton testing version 
        gROOT.LoadMacro('readerSingleSOld.C+')
        from ROOT import readerSingleSOld as reader
    elif sys.argv[1]=='SingleS_P':  # single lepton testing version 
        gROOT.LoadMacro('readerSingleS_P.C+')
        from ROOT import readerSingleS_P as reader
    elif sys.argv[1]=='SingleSDelphMET':  # single lepton testing version 
        gROOT.LoadMacro('readerSingleSDelphMET.C+')
        from ROOT import readerSingleSDelphMET as reader
    elif sys.argv[1]=='EWKino':  # EWKino
        gROOT.LoadMacro('readerEWKino.C+') # used to be EWKinoNew
        from ROOT import readerEWKino as reader
    elif sys.argv[1]=='AtlasH_Sb':  # Exc
        gROOT.LoadMacro('readerAtlasH_Sb.C+') # used to be EXc
        from ROOT import readerAtlasH_Sb as reader
    elif sys.argv[1]=='AtlasH':  # Atlas hadronic
        gROOT.LoadMacro('readerAtlasH.C+') # used to be ?????
        from ROOT import readerAtlasH as reader
    elif sys.argv[1]=='SummerStd':  #
        gROOT.LoadMacro('readerSummerStd.C+') # used to be ?????
        from ROOT import readerSummerStd as reader
    else: 
        help()
else: 
    help()


#prepare empty dictionaries
do={}
for scene in scenarios:
    do[scene]={}
    for samp in samples:
        do[scene][samp] = 0
# read input line and set flags what to process
flag=False
for e in sys.argv:
    for scene in scenarios:
        for samp in samples:
            if e==scene+'_'+samp: 
                do[scene][samp] = 1
                if scene=='140PU': Lumi=Lumi*10  # lumi*10 for 140PU
                flag=True
if not flag: help()


# prepare empty dictionaries
dirsHT={}
inDir={}
weights={}
for scene in scenarios:
    inDir[scene]={}
#   weights[scene]={}


### for PhaseII_C3 / C4v2 ((from ecfa)) ONLY TTbar



#--------------------------------------------- sample properties for processing <<<<<<<<<<<<<<<<<<<<<<<<<<<
#                                               I:  HT dirs, xsecs --> 33TeV
#                                              II:  HT dirs, xsecs --> 14TeV
#------------------------------------------------ diboson
# HT dirs 
#I:dirsHT['DiBoson']  = ['0-400/','400-1000/','1000-2000/','2000-3400/','3400-100000/']
dirsHT['DiBoson']  = ['0-300/','300-700/','700-1300/','1300-2100/','2100-100000/']
#    xsec
#I:weights['DiBoson'] = [776.00399, 106.85023, 10.16835, 0.86136, 0.09507]
weights['DiBoson'] = [249.97710, 35.23062, 4.13743, 0.41702, 0.04770]
#    multiply all by lumi
weights['DiBoson'] = scale(Lumi,weights['DiBoson'])
#
# NoPU
inDir['NoPU']['DiBoson']  = base+'/NoPU/diboson/'
# 50PU
inDir['50PU']['DiBoson']  = '/afs/desy.de/user/s/safarzad/dust/Output/delphes/PhaseI_50PU_ProdAug6/diboson/' 
# 140PU
#inDir['140PU']['DiBoson'] = base+'/diboson/'

inDir['140PU']['DiBoson'] = '/nfs/dust/cms/user/trippk/dust/AN_PAS_TP/DELPHES/nTUPLER/batch/1st_Output/PhaseII_140PU_ProdJul28/diboson/'
#'/140PU/diboson/'
#
#------------------------------------------------ boson+jets
# HT dirs 
#I:dirsHT['BosonJets']  = ['0-400/','400-1000/','1000-1800/','1800-3000/','3000-4600/','4600-6600/','6600-100000/']
dirsHT['BosonJets']  = ['0-300/','300-600/','600-1100/','1100-1800/','1800-2700/','2700-3700/','3700-100000/']
#    xsec
#I:weights['BosonJets'] = [129824.79383, 6598.37529, 325.55814, 32.45249, 3.16778, 0.32737, 0.04045]
weights['BosonJets'] = [34409.92339, 2642.85309, 294.12311, 25.95000, 2.42111, 0.22690, 0.02767]
#    multiply all by lumi
weights['BosonJets'] = scale(Lumi,weights['BosonJets'])
#
# NoPU
inDir['NoPU']['BosonJets']  = base+'/NoPU/bjets/'
# 50PU
inDir['50PU']['BosonJets']  = '/afs/desy.de/user/s/safarzad/dust/Output/delphes/PhaseI_50PU_ProdAug6/bjets/' 
# 140PU
inDir['140PU']['BosonJets'] = '/afs/desy.de/user/s/safarzad/dust/Output/delphes/PhaseII_140PU_ProdJul28/bjets/'
#inDir['140PU']['BosonJets'] ='/nfs/dust/cms/user/safarzad/Output/EOSforFutureStudies/14TeV/PhaseII/Configuration4v2/140PileUp/bjets/'
#inDir['140PU']['BosonJets'] = '/nfs/dust/cms/user/safarzad/Delphes/nTupler_topness/Batch/Output/delphes/ProdJun14/bjets/'
#base+'/bjets/'
#'/140PU/bjets/'
#
#---------------------------------------------- ttbar
# HT dirs 
#I:dirsHT['TTbar']  = ['0-600/','600-1200/','1200-2000/','2000-3200/','3200-4800/','4800-100000/']
dirsHT['TTbar']  = ['0-600/','600-1100/','1100-1700/','1700-2500/','2500-100000/']
#    xsec
#I:weights['TTbar'] = [3438.70635, 505.82210, 61.81892, 7.65752, 0.72643, 0.07147]
weights['TTbar'] = [530.89358, 42.55351, 4.48209, 0.52795, 0.05449]
#    multiply all by lumi
weights['TTbar'] = scale(Lumi,weights['TTbar'])
#
# NoPU
inDir['NoPU']['TTbar']  = base+'/NoPU/ttbar/'
# 50PU
inDir['50PU']['TTbar']  = '/nfs/dust/cms/user/clseitz/Delphes/FILES/PhaseI_50PU_ProdAug6/ttbar/' 
# 140PU
inDir['140PU']['TTbar'] = '/afs/desy.de/user/s/safarzad/dust/Output/delphes/PhaseII_140PU_ProdJul28/ttbar/'
#inDir['140PU']['TTbar'] = '/nfs/dust/cms/user/safarzad/Delphes/nTupler_topness/Batch/Output/delphes/ProdJun14/ttbar/'
#inDir['140PU']['TTbar'] = base+'/ttbar/'
#'/140PU/ttbar/'
#
#--------------------------------------------- tjets
# HT dirs 
#I:dirsHT['TopJets']  = ['0-600/','600-1200/','1200-2200/','2200-3600/','3600-100000/']
dirsHT['TopJets']  = ['0-500/','500-1000/','1000-1600/','1600-2400/','2400-100000/']
#    xsec
#I:weights['TopJets'] = [493.50469, 23.51848, 1.97369, 0.13199, 0.01099]
weights['TopJets'] = [109.73602, 5.99325, 0.37680, 0.03462, 0.00312]
#    multiply all by lumi
weights['TopJets'] = scale(Lumi,weights['TopJets'])
#
# NoPU
inDir['NoPU']['TopJets']  = base+'/NoPU/tjets/'
# 50PU
inDir['50PU']['TopJets']  = '/nfs/dust/cms/user/clseitz/Delphes/FILES/PhaseI_50PU_ProdAug6/tjets/' 
# 140PU
inDir['140PU']['TopJets'] = '/afs/desy.de/user/t/trippk/dust/AN_PAS_TP/DELPHES/nTUPLER/batch/Output/PhaseII_140PU_ProdJul28/tjets/'
#inDir['140PU']['TopJets'] = base+'/tjets/'
#'/140PU/tjets/'
#---------------------------------------------STCs
# HT dirs - none for STC samples
#dirsHT['TDR4'] = ['/']
#dirsHT['TDR5'] = ['/']
#dirsHT['TDR6'] = ['/']
#dirsHT['TDR8'] = ['/']
# naturalSUSY
#dirsHT['naturalSUSY'] = ['/']
# susyhit
dirsHT['Scenario1'] = ['/']
dirsHT['Scenario4'] = ['/']
dirsHT['Scenario6'] = ['/']
dirsHT['NM1'] = ['/']
dirsHT['NM2'] = ['/']
dirsHT['NM3'] = ['/']

# xsec - we multiply by lumi   xsec*k-factor*Lumi calculated with parse.py: values for 33 TeV with 140 Pile Up
# 33TeV 
#weights['TDR4'] = [68.31*1.3626*Lumi]    # values for ? 14 TeV      #12.80 
#weights['TDR5'] = [19.08*1.4105*Lumi]                               # 3.82
#weights['TDR6'] = [10.87*1.4438*Lumi]                               # 2.53
#weights['TDR8'] = [ 7.777*1.4917*Lumi]                              # 2.19
# 14TeV ####### wrong ##########
#weights['TDR4'] = [9.060*1.3626*Lumi]      # values for ? 14 TeV     #12.80 
#weights['TDR5'] = [4.299*1.4105*Lumi]                                # 3.82
#weights['TDR6'] = [2.039*1.4438*Lumi]                                # 2.53
#weights['TDR8'] = [1.788*1.4917*Lumi]                                # 2.19
# 14TeV
weights['TDR4'] = [12.80*Lumi] 
weights['TDR5'] = [3.82*Lumi]  
weights['TDR6'] = [2.53*Lumi]  
weights['TDR8'] = [2.19*Lumi]
weights['naturalSUSY'] = [1.211*Lumi]
# susyhit
weights['Scenario1'] = [2.52*Lumi]
weights['Scenario4'] = [0.009635*Lumi] 
weights['Scenario6'] = [2.52*Lumi] 
#weights['Scenario6'] = [2.19*Lumi] 
weights['NM1'] = [0.15*Lumi] 
weights['NM2'] = [0.07*Lumi] 
weights['NM3'] = [1.1*Lumi] 
#
bit=''
if base=='nTuples/snowmass/':bit='New' 
# NoPU
#inDir['NoPU']['TDR4'] = base+'/NoPU/tdr/'+bit+'/4/'
#inDir['NoPU']['TDR5'] = base+'/NoPU/tdr/'+bit+'/5/'
#inDir['NoPU']['TDR6'] = base+'/NoPU/tdr/'+bit+'/6/'
#inDir['NoPU']['TDR8'] = base+'/NoPU/tdr/'+bit+'/8/'
# 50PU
#inDir['50PU']['TDR4'] = base+'/50PU/tdr/'+bit+'/4/'
#inDir['50PU']['TDR5'] = base+'/50PU/tdr/'+bit+'/5/'
#inDir['50PU']['TDR6'] = base+'/50PU/tdr/'+bit+'/6/'
#inDir['50PU']['TDR8'] = base+'/50PU/tdr/'+bit+'/8/'
# 140PU
#inDir['140PU']['TDR4'] = base+'/140PU/tdr/'+bit+'/4/'
#inDir['140PU']['TDR5'] = base+'/140PU/tdr/'+bit+'/5/'
#inDir['140PU']['TDR6'] = base+'/140PU/tdr/'+bit+'/6/'
#inDir['140PU']['TDR8'] = base+'/140PU/tdr/'+bit+'/8/'
#
############## susyhit ############################
#inDir['140PU']['Scenario1'] = '/nfs/dust/cms/user/safarzad/Delphes/nTupler_topness/Batch/Ntuple/STC_Third/'
inDir['140PU']['Scenario4'] = '/afs/desy.de/user/s/safarzad/dust/Output/delphes/PhaseII_140PU_ProdJul28/Ntuple/STOC'
inDir['140PU']['Scenario6'] = '/nfs/dust/cms/user/trippk/dust/AN_PAS_TP/DELPHES/nTUPLER/batch/Output/stc/READY/'
inDir['140PU']['NM1'] = '/nfs/dust/cms/user/trippk/dust/AN_PAS_TP/DELPHES/nTUPLER/batch/Output/naturalModel/1/READY/'
inDir['140PU']['NM2'] = '/nfs/dust/cms/user/trippk/dust/AN_PAS_TP/DELPHES/nTUPLER/batch/Output/naturalModel/2/READY/'
inDir['140PU']['NM3'] = '/nfs/dust/cms/user/trippk/dust/AN_PAS_TP/DELPHES/nTUPLER/batch/Output/naturalModel/3/READY/'

inDir['50PU']['NM1'] = '/afs/desy.de/user/s/safarzad/dust/Output/delphes/PhaseI_50PU_ProdAug6/NM1/'
inDir['50PU']['NM2'] = '/afs/desy.de/user/s/safarzad/dust/Output/delphes/PhaseI_50PU_ProdAug6/NM2/'
inDir['50PU']['NM3'] = '/afs/desy.de/user/s/safarzad/dust/Output/delphes/PhaseI_50PU_ProdAug6/NM3/'
inDir['50PU']['Scenario4'] = '/afs/desy.de/user/s/safarzad/dust/Output/delphes/PhaseI_50PU_ProdAug6/STOC/' 
inDir['50PU']['Scenario6'] = '/afs/desy.de/user/s/safarzad/dust/Output/delphes/PhaseI_50PU_ProdAug6/STC/'
#inDir['140PU']['Scenario6'] = '/afs/desy.de/user/t/trippk/dust/snowmass/NewTupler_topness/Batch/Output/14TeV/140PU/tdr_delphes3.0.9.1_card3.0.9.1/8'
#inDir['140PU']['NM1'] = '/nfs/dust/cms/user/safarzad/Delphes/nTupler_topness/Batch/Ntuple/NM1/'
#inDir['140PU']['NM2'] = '/nfs/dust/cms/user/safarzad/Delphes/nTupler_topness/Batch/Ntuple/NM2/'
#inDir['140PU']['NM3'] = '/nfs/dust/cms/user/safarzad/Delphes/nTupler_topness/Batch/Ntuple/NM3/'
####################################################
################# naturalSUSY ######################
####################################################
# 140PU
#inDir['140PU']['naturalSUSY'] = 'Output/naturalSUSY/14TeV/140PU/PhaseII_conf3/'
#inDir['140PU']['naturalSUSY'] = 'Output/naturalSUSY/14TeV/140PU/PhaseII_conf4/'
#
# NoPU 3.0.10
#inDir['NoPU']['TDR4'] = base+'/NoPU/tdr_delphes3.0.10_card3.0.10'+bit+'/4/'
#inDir['NoPU']['TDR5'] = base+'/NoPU/tdr_delphes3.0.10_card3.0.10'+bit+'/5/'
#inDir['NoPU']['TDR6'] = base+'/NoPU/tdr_delphes3.0.10_card3.0.10'+bit+'/6/'
#inDir['NoPU']['TDR8'] = base+'/NoPU/tdr_delphes3.0.10_card3.0.10'+bit+'/8/'
#3.0.10 - 3.0.9.1
#inDir['NoPU']['TDR4'] = base+'/NoPU/tdr_delphes3.0.10_card3.0.9.1'+bit+'/4/'
#inDir['NoPU']['TDR5'] = base+'/NoPU/tdr_delphes3.0.10_card3.0.9.1'+bit+'/5/'
#inDir['NoPU']['TDR6'] = base+'/NoPU/tdr_delphes3.0.10_card3.0.9.1'+bit+'/6/'
#inDir['NoPU']['TDR8'] = base+'/NoPU/tdr_delphes3.0.10_card3.0.9.1'+bit+'/8/'
#3.0.9.1 
#inDir['NoPU']['TDR4'] = base+'/NoPU/tdr_delphes3.0.9.1_card3.0.9.1'+bit+'/4/'
#inDir['NoPU']['TDR5'] = base+'/NoPU/tdr_delphes3.0.9.1_card3.0.9.1'+bit+'/5/'
#inDir['NoPU']['TDR6'] = base+'/NoPU/tdr_delphes3.0.9.1_card3.0.9.1'+bit+'/6/'
#inDir['NoPU']['TDR8'] = base+'/NoPU/tdr_delphes3.0.9.1_card3.0.9.1'+bit+'/8/'
#
#
# 50PU 3.0.10
#inDir['50PU']['TDR4'] = base+'/50PU/tdr_delphes3.0.10_card3.0.10'+bit+'/4/'
#inDir['50PU']['TDR5'] = base+'/50PU/tdr_delphes3.0.10_card3.0.10'+bit+'/5/'
#inDir['50PU']['TDR6'] = base+'/50PU/tdr_delphes3.0.10_card3.0.10'+bit+'/6/'
#inDir['50PU']['TDR8'] = base+'/50PU/tdr_delphes3.0.10_card3.0.10'+bit+'/8/'
# 50PU 3.0.10 - 3.0.9.1
#inDir['50PU']['TDR4'] = base+'/50PU/tdr_delphes3.0.10_card3.0.9.1'+bit+'/4/'
#inDir['50PU']['TDR5'] = base+'/50PU/tdr_delphes3.0.10_card3.0.9.1'+bit+'/5/'
#inDir['50PU']['TDR6'] = base+'/50PU/tdr_delphes3.0.10_card3.0.9.1'+bit+'/6/'
#inDir['50PU']['TDR8'] = base+'/50PU/tdr_delphes3.0.10_card3.0.9.1'+bit+'/8/'
# 50PU 3.0.9.1
#inDir['50PU']['TDR4'] = base+'/50PU/tdr_delphes3.0.9.1_card3.0.9.1'+bit+'/4/'
#inDir['50PU']['TDR5'] = base+'/50PU/tdr_delphes3.0.9.1_card3.0.9.1'+bit+'/5/'
#inDir['50PU']['TDR6'] = base+'/50PU/tdr_delphes3.0.9.1_card3.0.9.1'+bit+'/6/'
#inDir['50PU']['TDR8'] = base+'/50PU/tdr_delphes3.0.9.1_card3.0.9.1'+bit+'/8/'
#
#
# 140PU 3.0.10
#inDir['140PU']['TDR4'] = base+'/140PU/tdr_delphes3.0.10_card3.0.10'+bit+'/4/'
#inDir['140PU']['TDR5'] = base+'/140PU/tdr_delphes3.0.10_card3.0.10'+bit+'/5/'
#inDir['140PU']['TDR6'] = base+'/140PU/tdr_delphes3.0.10_card3.0.10'+bit+'/6/'
#inDir['140PU']['TDR8'] = base+'/140PU/tdr_delphes3.0.10_card3.0.10'+bit+'/8/'
# 140PU 3.0.10 - 3.0.9.1
#inDir['140PU']['TDR4'] = base+'/140PU/tdr_delphes3.0.10_card3.0.9.1'+bit+'/4/'
#inDir['140PU']['TDR5'] = base+'/140PU/tdr_delphes3.0.10_card3.0.9.1'+bit+'/5/'
#inDir['140PU']['TDR6'] = base+'/140PU/tdr_delphes3.0.10_card3.0.9.1'+bit+'/6/'
#inDir['140PU']['TDR8'] = base+'/140PU/tdr_delphes3.0.10_card3.0.9.1'+bit+'/8/'
# 140PU 3.0.9.1
#print  base+'/140PU/tdr_delphes3.0.9.1_card3.0.9.1'+bit+'/4/'
#inDir['140PU']['TDR4'] = base+'/140PU/tdr_delphes3.0.9.1_card3.0.9.1'+bit+'/4/'
#inDir['140PU']['TDR5'] = base+'/140PU/tdr_delphes3.0.9.1_card3.0.9.1'+bit+'/5/'
#inDir['140PU']['TDR6'] = base+'/140PU/tdr_delphes3.0.9.1_card3.0.9.1'+bit+'/6/'
#inDir['140PU']['TDR8'] = base+'/140PU/tdr_delphes3.0.9.1_card3.0.9.1'+bit+'/8/'
#--------------------------------------------- end of sample properties

from ROOT import TFile
from glob import glob
from sys import exit
def GetEntries(dirname):
    files = glob(dirname+'/*nTuple.root')
    if len(files)>1:
        print 'GetEntries: there is more than 1 root file in '+dirname
        exit(0)
    print dirname,files
    file=TFile(files[0])
    tree = file.Get("delphTree")
    return tree.GetEntries()

# do it
for scene in scenarios:
    for samp in samples:
        if do[scene][samp]: 
            f=''
            print dirsHT, samp
            for i in range(len(dirsHT[samp])):
                entries = GetEntries(inDir[scene][samp]+dirsHT[samp][i])
                f=f+inDir[scene][samp]+dirsHT[samp][i]+' '+str(weights[samp][i]/entries)+' '
            print f,samp,scene
            if samp in noWeight:
                reader(f,scene+'_'+samp,False)
            else:   
                reader(f,scene+'_'+samp)
    
por Vesnog 28.08.2014 / 21:37

0 respostas