13from tools 
import getMaxRunNo_mc, getBelleUrl_mc, readConfigFile_mc, countEventsInUrl, addLine
 
   20    sys.exit(
'Need one argument: path of config file with job parameters !')
 
   23thresholdEventsNo, expNoList, eventTypeList, dataTypeList, belleLevelList =\
 
   27if not os.path.exists(
'tables'):
 
   32tableName = 
'tables/lookUpTable_mc_' + \
 
   33    str(int(thresholdEventsNo / 1000)) + 
'k.txt' 
   34f = open(tableName, 
'w')
 
   38for expNo 
in expNoList:
 
   40    absMaxRunNo = getMaxRunNo_mc(expNo)
 
   41    if absMaxRunNo 
is None:
 
   42        sys.exit(
'ExpNo ' + str(expNo) + 
' not found. Does it exist ?')
 
   45        print(
'For expNo ' + str(expNo) + 
' max runNo is ' + str(absMaxRunNo))
 
   47    if expNo 
in range(7, 28):
 
   49    elif expNo 
in range(31, 66):
 
   52    for eventType 
in eventTypeList:
 
   53        for dataType 
in dataTypeList:
 
   54            for belleLevel 
in belleLevelList:
 
   57                while minRunNo < absMaxRunNo:  
 
   59                    maxRunNo = minRunNo + 1
 
   63                    for add 
in range(1, 1000):
 
   65                        maxRunNo = minRunNo + add
 
   67                        thisUrl = getBelleUrl_mc(expNo, minRunNo, maxRunNo,
 
   69                                                 belleLevel, streamNo_dummy)
 
   72                            print(
'Checking up url: ' + thisUrl)
 
   74                        thisUrlCount = countEventsInUrl(thisUrl)
 
   76                            print(
'Count is up to: ' + str(thisUrlCount))
 
   78                        if maxRunNo > absMaxRunNo 
or thisUrlCount > thresholdEventsNo:
 
   81                    addLine(f, [expNo, eventType,
 
   86                    if debug 
and debugCounter > 2:
 
   90                    minRunNo = maxRunNo + 1