def showAvailableCorrs():

    import CorrectionManager

    availablecorrs = CorrectionManager.get_plugins(CorrectionManager.CorrectionProvider)
    print '-->> Available correction plugins : '
    for entry in availablecorrs:
        print entry
    print '<<--'
    print ' '
Beispiel #2
0
def showAvailableCorrs():

    import CorrectionManager

    availablecorrs = CorrectionManager.get_plugins(CorrectionManager.CorrectionProvider)
    print '-->> Available correction plugins : '
    for entry in availablecorrs:
        print entry
    print '<<--'
    print ' '
def doMakeGraphsFile(ConfigInfo):

    AnalysisDir = str(ConfigInfo['AnalysisDir'])
    Luminometer = str(ConfigInfo['Luminometer'])
    inputScanFile = str(ConfigInfo['InputScanFile'])
    inputBeamCurrentFile = str(ConfigInfo['InputBeamCurrentFile'])
    inputLuminometerData = str(ConfigInfo['InputLuminometerData'])
    corrName = ConfigInfo['Corr']

# For scan 1, which is always there as long as there are any scans at all:

    inData1 = vdmInputData(1)

    inData1.GetScanInfo(AnalysisDir + '/'+ inputScanFile)
#inData1.PrintScanInfo()

    inData1.GetBeamCurrentsInfo(AnalysisDir + '/' + inputBeamCurrentFile)
#    inData1.PrintBeamCurrentsInfo()

    inData1.GetLuminometerData(AnalysisDir + '/' + inputLuminometerData)
#    inData1.PrintLuminometerData()

    Fill = inData1.fill
    
    inData = []
    inData.append(inData1)

# For the remaining scans:

    for i in range(1,len(inData1.scanNamesAll)):
        inDataNext = vdmInputData(i+1)
        inDataNext.GetScanInfo(AnalysisDir + '/' + inputScanFile)
        inDataNext.GetBeamCurrentsInfo(AnalysisDir + '/' + inputBeamCurrentFile)
        inDataNext.GetLuminometerData(AnalysisDir + '/' + inputLuminometerData)
        inData.append(inDataNext)

#Check for missing data
    missedDataInfo="Information on missed data\n"
    if "BeamBeam" in corrName:
        missedDataInfo=missedDataInfo+"BeamBeam has been applied: Only BCIDs with complete scanpoint lists are considered\n See BeamBeam_.log for the list of excluded BCID\n"
    else:
        missedDataInfo=missedDataInfo+"BeamBeam has not been applied\n\n"

    for entry in inData:
        scanNumber = entry.scanNumber
        prefix = ''
        if 'X' in entry.scanName:
            prefix = str(scanNumber) +'_X'
        if 'Y' in entry.scanName:
            prefix = str(scanNumber)+'_Y'
        missedDataInfo=missedDataInfo+"Scan_"+prefix+"\n"
        missedSPList=checkScanpointList(entry)
        missedDataInfo=missedDataInfo+missedSPList+"\n"

# Apply corrections
# Note that calibrating SumFBCT to DCCT is done in makeBeamCurrentFile.py if calibration flag in config file is set to true

    showAvailableCorrs()

    availableCorr = CorrectionManager.get_plugins(CorrectionManager.CorrectionProvider)

    print "The following corrections will be applied, in order: "
    for i, entry in enumerate(corrName):
        print "Corr #"+str(i+1)  + ": " +entry

    corrFull = ''

    for entry in corrName:

        print "Now applying correction: ", entry

# Check whether correction requested in config json actually exists

        key = entry+'_Corr'
        if key in availableCorr:
            corrector= availableCorr[entry+'_Corr']()        
        else:
            if not entry == "noCorr":
                print "Correction " + entry + " requested via json file does not exist, ignore."
            continue

# Read Corr config in here

        corrValueFile = AnalysisDir + '/corr/'+ entry + '_' + Fill +'.pkl' 
        if entry == "BeamBeam":
            corrValueFile = AnalysisDir + '/corr/'+ entry + '_' +Luminometer + '_' + Fill +'.pkl' 
            
        corrector.doCorr(inData, corrValueFile)

        corrFull = corrFull + '_' + entry 

# check if any corrections are to be applied at all, if yes, define corr description string accordingly
# if no use "noCorr"

    import os

# empty strings are false, so if no corrections are to be applied, use noCorr as corr descriptor
    if  not corrFull:
        corrFull = "_noCorr"


# Now fill graphs for all scans
# Counting of scans starts with 1
    graphsListAll = {'Scan_'+ str(n+1):{} for n in range(len(inData))} 

    missedDataInfo=missedDataInfo+"Excluded BCIDs with too short scanpoint list:\n"

    for entry in inData:
    
        scanNumber = entry.scanNumber
        print "Now at Scan number ", scanNumber
        nBX = len(entry.usedCollidingBunches)
        prefix = ''
        if 'X' in entry.scanName:
            prefix = str(scanNumber) +'_X_'
        if 'Y' in entry.scanName:
            prefix = str(scanNumber)+'_Y_'

        omittedBXList=[]
    # convert for TGraph
        from array import array

        graphsList = {}

        for i, bx in enumerate(entry.usedCollidingBunches):
# BCIDs written at small number of SP are omitted (the list of short omitted bunches is added to log)            
# to avoid problems in vdmFitter: the number of SP should exceed the minimal number of freedom degrees for fitting

             if len(entry.spPerBX[bx])>5:
                coord=entry.spPerBX[bx]
                coorde = [0.0 for a in coord] 
                coord = array("d",coord)
                coorde = array("d", coorde)
                currProduct = [ a*b/1e22 for a,b in zip(entry.avrgFbctB1PerBX[bx],entry.avrgFbctB2PerBX[bx])]
                if len(entry.spPerBX[bx])!=len(entry.splumiPerBX[bx]):
                    print "Attention: bx=", bx, ", number of scanpoints for lumi and currents do not match, normalization is not correct"         
                lumi = [a/b for a,b in zip(entry.lumiPerBX[bx],currProduct)]
                lumie = [a/b for a,b in zip(entry.lumiErrPerBX[bx],currProduct)]
                #lumi = [a/b for a,b in zip(entry.lumi[i],currProduct)]
                #lumie = [a/b for a,b in zip(entry.lumiErr[i],currProduct)]

                lumie = array("d",lumie)
                lumi = array("d",lumi)
                name = prefix +str(bx)
                graph = r.TGraphErrors(len(coord),coord,lumi,coorde,lumie)
                graph.SetName(name)
                graph.SetTitle(name)
                graph.SetMinimum(0.000001)
                graphsList[int(bx)] = graph
             else:
                omittedBXList.append(bx)
# same for the sum, as double check, where sumLumi comes from avgraw
        try:
            coord = entry.displacement
            coorde = [0.0 for a in coord] 
            coord = array("d",coord)
            coorde = array("d", coorde)
            currProduct = [ a*b/1e22 for a,b in zip(entry.sumCollAvrgFbctB1,entry.sumCollAvrgFbctB2)]
            lumi = [a/b for a,b in zip(entry.sumLumi,currProduct)]
            lumie = [a/b for a,b in zip(entry.sumLumiErr,currProduct)]
            lumie = array("d",lumie)
            lumi = array("d",lumi)
            name = prefix + 'sum'
            graph = r.TGraphErrors(len(coord),coord,lumi,coorde,lumie)
            graph.SetName(name)
            graph.SetTitle(name)
            graphsList['sum'] = graph
        except KeyError,e: 
            print 'KeyError in makeGraphsFile- reason "%s"' % str(e)


        graphsListAll['Scan_'+ str(scanNumber)]=graphsList
        missedDataInfo=missedDataInfo+"Scan_"+prefix+":"+str(omittedBXList)+"\n" 
Beispiel #4
0
def doMakeGraphsFile(ConfigInfo):

    AnalysisDir = str(ConfigInfo['AnalysisDir'])
    Luminometer = str(ConfigInfo['Luminometer'])
    inputScanFile = str(ConfigInfo['InputScanFile'])
    inputBeamCurrentFile = str(ConfigInfo['InputBeamCurrentFile'])
    inputLuminometerData = str(ConfigInfo['InputLuminometerData'])
    corrName = ConfigInfo['Corr']

    # For scan 1, which is always there as long as there are any scans at all:

    inData1 = vdmInputData(1)

    inData1.GetScanInfo(AnalysisDir + '/' + inputScanFile)
    #inData1.PrintScanInfo()

    #print inData1.fill
    #print inData1.date
    #print inData1.run
    #print inData1.inputDIPFile
    #print inData1.scanName
    #print inData1.scanNamesAll
    #print inData1.scanTimeWindows
    #print inData1.betaStar
    #print inData1.angle
    #print inData1.particleTypeB1
    #print inData1.particleTypeB2
    #print inData1.filledBunchesB1
    #print inData1.filledBunchesB2
    #print inData1.collidingBunches
    #print inData1.scanNumber
    # print inData1.sp
    #print inData1.tStart
    #print inData1.tStop
    #print inData1.displacement

    inData1.GetBeamCurrentsInfo(AnalysisDir + '/' + inputBeamCurrentFile)
    #    inData1.PrintBeamCurrentsInfo()

    #print inData1.curr
    #print inData1.avrgDcctB1
    #print inData1.avrgDcctB2
    #print inData1.sumAvrgFbctB1
    #print inData1.sumAvrgFbctB2
    #print inData1.sumCollAvrgFbctB1
    #print inData1.sumCollAvrgFbctB2
    #print "len(inData1.avrgFbctB1)", len(inData1.avrgFbctB1)
    #print inData1.avrgFbctB1
    #print inData1.avrgFbctB2
    #print "len(inData1.avrgFbctB1PerSP)", len(inData1.avrgFbctB1PerSP)
    #print inData1.avrgFbctB1PerSP
    #print inData1.avrgFbctB2PerSP

    inData1.GetLuminometerData(AnalysisDir + '/' + inputLuminometerData)
    #    inData1.PrintLuminometerData()
    #    import sys
    #    sys.exit()

    #print inData1.lum
    #    print inData1.usedCollidingBunches
    #for entry in inData1.lumiPerSP:
    #    print entry
    #for entry in inData1.lumiErrPerSP:
    #    print entry

    Fill = inData1.fill

    inData = []
    inData.append(inData1)

    # For the remaining scans:

    for i in range(1, len(inData1.scanNamesAll)):
        inDataNext = vdmInputData(i + 1)
        inDataNext.GetScanInfo(AnalysisDir + '/' + inputScanFile)
        inDataNext.GetBeamCurrentsInfo(AnalysisDir + '/' +
                                       inputBeamCurrentFile)
        inDataNext.GetLuminometerData(AnalysisDir + '/' + inputLuminometerData)
        inData.append(inDataNext)

# Apply corrections
# Note that calibrating SumFBCT to DCCT is done in makeBeamCurrentFile.py if calibration flag in config file is set to true

    showAvailableCorrs()

    availableCorr = CorrectionManager.get_plugins(
        CorrectionManager.CorrectionProvider)

    print "The following corrections will be applied, in order: "
    for i, entry in enumerate(corrName):
        print "Corr #" + str(i + 1) + ": " + entry

    corrFull = ''

    for entry in corrName:

        print "Now applying correction: ", entry

        # Check whether correction requested in config json actually exists

        key = entry + '_Corr'
        if key in availableCorr:
            corrector = availableCorr[entry + '_Corr']()
        else:
            if not entry == "noCorr":
                print "Correction " + entry + " requested via json file does not exist, ignore."
            continue

# Read Corr config in here

        corrValueFile = AnalysisDir + '/corr/' + entry + '_' + Fill + '.pkl'
        if entry == "BeamBeam":
            corrValueFile = AnalysisDir + '/corr/' + entry + '_' + Luminometer + '_' + Fill + '.pkl'

#    for element in inData:
#        print "before current correction B1 ", element.scanNumber
#        for i, bx in enumerate(element.collidingBunches):
#            print ">>>", i, element.avrgFbctB1[i]

        corrector.doCorr(inData, corrValueFile)

        #    for element in inData:
        #        print "after current correction B1 ", element.scanNumber
        #        for i, bx in enumerate(element.collidingBunches):
        #            print ">>>", i, element.avrgFbctB1[i]

        corrFull = corrFull + '_' + entry

# check if any corrections are to be applied at all, if yes, define corr description string accordingly
# if no use "noCorr"

    import os

    # empty strings are false, so if no corrections are to be applied, use noCorr as corr descriptor
    if not corrFull:
        corrFull = "_noCorr"

# Now fill graphs for all scans
# Counting of scans starts with 1

    graphsListAll = {'Scan_' + str(n + 1): {} for n in range(len(inData))}

    for entry in inData:

        scanNumber = entry.scanNumber
        print "Now at Scan number ", scanNumber
        nBX = len(entry.collidingBunches)
        prefix = ''
        if 'X' in entry.scanName:
            prefix = str(scanNumber) + '_X_'
        if 'Y' in entry.scanName:
            prefix = str(scanNumber) + '_Y_'

    # convert for TGraph
        from array import array

        graphsList = {}

        for i, bx in enumerate(entry.usedCollidingBunches):
            coord = entry.spPerBX[bx]
            coorde = [0.0 for a in coord]
            coord = array("d", coord)
            coorde = array("d", coorde)
            currProduct = [
                a * b / 1e22 for a, b in zip(entry.avrgFbctB1PerBX[bx],
                                             entry.avrgFbctB2PerBX[bx])
            ]
            lumi = [a / b for a, b in zip(entry.lumi[i], currProduct)]
            lumie = [a / b for a, b in zip(entry.lumiErr[i], currProduct)]
            lumie = array("d", lumie)
            lumi = array("d", lumi)
            name = prefix + str(bx)
            graph = r.TGraphErrors(len(coord), coord, lumi, coorde, lumie)
            graph.SetName(name)
            graph.SetTitle(name)
            graph.SetMinimum(0.000001)
            graphsList[bx] = graph


# same for the sum, as double check, where sumLumi comes from avgraw
        try:
            coord = entry.displacement
            coorde = [0.0 for a in coord]
            coord = array("d", coord)
            coorde = array("d", coorde)
            currProduct = [
                a * b / 1e22 for a, b in zip(entry.sumCollAvrgFbctB1,
                                             entry.sumCollAvrgFbctB2)
            ]
            lumi = [a / b for a, b in zip(entry.sumLumi, currProduct)]
            lumie = [a / b for a, b in zip(entry.sumLumiErr, currProduct)]
            lumie = array("d", lumie)
            lumi = array("d", lumi)
            name = prefix + 'sum'
            graph = r.TGraphErrors(len(coord), coord, lumi, coorde, lumie)
            graph.SetName(name)
            graph.SetTitle(name)
            graphsList['sum'] = graph
        except KeyError, e:
            print 'KeyError in makeGraphsFile- reason "%s"' % str(e)

        graphsListAll['Scan_' + str(scanNumber)] = graphsList
def doMakeGraphsFile(ConfigInfo):

    AnalysisDir = str(ConfigInfo['AnalysisDir'])
    Luminometer = str(ConfigInfo['Luminometer'])
    inputScanFile = str(ConfigInfo['InputScanFile'])
    inputBeamCurrentFile = str(ConfigInfo['InputBeamCurrentFile'])
    inputLuminometerData = str(ConfigInfo['InputLuminometerData'])
    corrName = ConfigInfo['Corr']

# For scan 1, which is always there as long as there are any scans at all:

    inData1 = vdmInputData(1)

    inData1.GetScanInfo(AnalysisDir + '/'+ inputScanFile)
#inData1.PrintScanInfo()
 
#print inData1.fill
#print inData1.date
#print inData1.run
#print inData1.inputDIPFile
#print inData1.scanName
#print inData1.scanNamesAll
#print inData1.scanTimeWindows
#print inData1.betaStar
#print inData1.angle
#print inData1.particleTypeB1
#print inData1.particleTypeB2
#print inData1.filledBunchesB1
#print inData1.filledBunchesB2
#print inData1.collidingBunches
#print inData1.scanNumber
# print inData1.sp
#print inData1.tStart
#print inData1.tStop
#print inData1.displacement


    inData1.GetBeamCurrentsInfo(AnalysisDir + '/' + inputBeamCurrentFile)
#    inData1.PrintBeamCurrentsInfo()

#print inData1.curr
#print inData1.avrgDcctB1
#print inData1.avrgDcctB2
#print inData1.sumAvrgFbctB1
#print inData1.sumAvrgFbctB2
#print inData1.sumCollAvrgFbctB1
#print inData1.sumCollAvrgFbctB2
#print "len(inData1.avrgFbctB1)", len(inData1.avrgFbctB1)
#print inData1.avrgFbctB1
#print inData1.avrgFbctB2
#print "len(inData1.avrgFbctB1PerSP)", len(inData1.avrgFbctB1PerSP)
#print inData1.avrgFbctB1PerSP
#print inData1.avrgFbctB2PerSP

    inData1.GetLuminometerData(AnalysisDir + '/' + inputLuminometerData)
#    inData1.PrintLuminometerData()
#    import sys
#    sys.exit()


#print inData1.lum
#    print inData1.usedCollidingBunches
#for entry in inData1.lumiPerSP:
#    print entry
#for entry in inData1.lumiErrPerSP:
#    print entry

    Fill = inData1.fill
    
    inData = []
    inData.append(inData1)

# For the remaining scans:

    for i in range(1,len(inData1.scanNamesAll)):
        inDataNext = vdmInputData(i+1)
        inDataNext.GetScanInfo(AnalysisDir + '/' + inputScanFile)
        inDataNext.GetBeamCurrentsInfo(AnalysisDir + '/' + inputBeamCurrentFile)
        inDataNext.GetLuminometerData(AnalysisDir + '/' + inputLuminometerData)
        inData.append(inDataNext)



# Apply corrections
# Note that calibrating SumFBCT to DCCT is done in makeBeamCurrentFile.py if calibration flag in config file is set to true

    showAvailableCorrs()

    availableCorr = CorrectionManager.get_plugins(CorrectionManager.CorrectionProvider)

    print "The following corrections will be applied, in order: "
    for i, entry in enumerate(corrName):
        print "Corr #"+str(i+1)  + ": " +entry

    corrFull = ''

    for entry in corrName:

        print "Now applying correction: ", entry

# Check whether correction requested in config json actually exists

        key = entry+'_Corr'
        if key in availableCorr:
            corrector= availableCorr[entry+'_Corr']()        
        else:
            if not entry == "noCorr":
                print "Correction " + entry + " requested via json file does not exist, ignore."
            continue

# Read Corr config in here

        corrValueFile = AnalysisDir + '/corr/'+ entry + '_' + Fill +'.pkl' 
        if entry == "BeamBeam":
            corrValueFile = AnalysisDir + '/corr/'+ entry + '_' +Luminometer + '_' + Fill +'.pkl' 
            

#    for element in inData:
#        print "before current correction B1 ", element.scanNumber
#        for i, bx in enumerate(element.collidingBunches):
#            print ">>>", i, element.avrgFbctB1[i]

        corrector.doCorr(inData, corrValueFile)

#    for element in inData:
#        print "after current correction B1 ", element.scanNumber
#        for i, bx in enumerate(element.collidingBunches):
#            print ">>>", i, element.avrgFbctB1[i]

        corrFull = corrFull + '_' + entry 

# check if any corrections are to be applied at all, if yes, define corr description string accordingly
# if no use "noCorr"

    import os

# empty strings are false, so if no corrections are to be applied, use noCorr as corr descriptor
    if  not corrFull:
        corrFull = "_noCorr"


# Now fill graphs for all scans
# Counting of scans starts with 1

    graphsListAll = {'Scan_'+ str(n+1):{} for n in range(len(inData))} 

    for entry in inData:
    
        scanNumber = entry.scanNumber
        print "Now at Scan number ", scanNumber
        nBX = len(entry.collidingBunches)
        prefix = ''
        if 'X' in entry.scanName:
            prefix = str(scanNumber) +'_X_'
        if 'Y' in entry.scanName:
            prefix = str(scanNumber)+'_Y_'

    # convert for TGraph
        from array import array

        graphsList = {}

        for i, bx in enumerate(entry.usedCollidingBunches):
            coord = entry.spPerBX[bx]
            coorde = [0.0 for a in coord] 
            coord = array("d",coord)
            coorde = array("d", coorde)
            currProduct = [ a*b/1e22 for a,b in zip(entry.avrgFbctB1PerBX[bx],entry.avrgFbctB2PerBX[bx])]
            lumi = [a/b for a,b in zip(entry.lumi[i],currProduct)]
            lumie = [a/b for a,b in zip(entry.lumiErr[i],currProduct)]
            lumie = array("d",lumie)
            lumi = array("d",lumi)
            name = prefix +str(bx)
            graph = r.TGraphErrors(len(coord),coord,lumi,coorde,lumie)
            graph.SetName(name)
            graph.SetTitle(name)
            graph.SetMinimum(0.000001)
            graphsList[bx] = graph
            

# same for the sum, as double check, where sumLumi comes from avgraw
        try:
            coord = entry.displacement
            coorde = [0.0 for a in coord] 
            coord = array("d",coord)
            coorde = array("d", coorde)
            currProduct = [ a*b/1e22 for a,b in zip(entry.sumCollAvrgFbctB1,entry.sumCollAvrgFbctB2)]
            lumi = [a/b for a,b in zip(entry.sumLumi,currProduct)]
            lumie = [a/b for a,b in zip(entry.sumLumiErr,currProduct)]
            lumie = array("d",lumie)
            lumi = array("d",lumi)
            name = prefix + 'sum'
            graph = r.TGraphErrors(len(coord),coord,lumi,coorde,lumie)
            graph.SetName(name)
            graph.SetTitle(name)
            graphsList['sum'] = graph
        except KeyError,e: 
            print 'KeyError in makeGraphsFile- reason "%s"' % str(e)


        graphsListAll['Scan_'+ str(scanNumber)]=graphsList 
def doMakeGraphsFile(ConfigInfo):

    AnalysisDir = str(ConfigInfo['AnalysisDir'])
    Luminometer = str(ConfigInfo['Luminometer'])
    inputScanFile = str(ConfigInfo['InputScanFile'])
    inputBeamCurrentFile = str(ConfigInfo['InputBeamCurrentFile'])
    inputLuminometerData = str(ConfigInfo['InputLuminometerData'])
    corrName = ConfigInfo['Corr']

# For scan 1, which is always there as long as there are any scans at all:

    inData1 = vdmInputData(1)

    inData1.GetScanInfo(AnalysisDir + '/'+ inputScanFile)
#inData1.PrintScanInfo()

    inData1.GetBeamCurrentsInfo(AnalysisDir + '/' + inputBeamCurrentFile)
#    inData1.PrintBeamCurrentsInfo()

    inData1.GetLuminometerData(AnalysisDir + '/' + inputLuminometerData)
#    inData1.PrintLuminometerData()

    Fill = inData1.fill
    
    inData = []
    inData.append(inData1)

# For the remaining scans:

    for i in range(1,len(inData1.scanNamesAll)):
        inDataNext = vdmInputData(i+1)
        inDataNext.GetScanInfo(AnalysisDir + '/' + inputScanFile)
        inDataNext.GetBeamCurrentsInfo(AnalysisDir + '/' + inputBeamCurrentFile)
        inDataNext.GetLuminometerData(AnalysisDir + '/' + inputLuminometerData)
        inData.append(inDataNext)

#Check for missing data
    missedDataInfo="Information on missed data\n"
    if "BeamBeam" in corrName:
        missedDataInfo=missedDataInfo+"BeamBeam has been applied: Only BCIDs with complete scanpoint lists are considered\n See BeamBeam_.log for the list of excluded BCID\n"
    else:
        missedDataInfo=missedDataInfo+"BeamBeam has not been applied\n\n"

    for entry in inData:
        scanNumber = entry.scanNumber
        prefix = ''
        if 'X' in entry.scanName:
            prefix = str(scanNumber) +'_X'
        if 'Y' in entry.scanName:
            prefix = str(scanNumber)+'_Y'
        missedDataInfo=missedDataInfo+"Scan_"+prefix+"\n"
        missedSPList=checkScanpointList(entry)
        missedDataInfo=missedDataInfo+missedSPList+"\n"

# Apply corrections
# Note that calibrating SumFBCT to DCCT is done in makeBeamCurrentFile.py if calibration flag in config file is set to true

    showAvailableCorrs()

    availableCorr = CorrectionManager.get_plugins(CorrectionManager.CorrectionProvider)

    print "The following corrections will be applied, in order: "
    for i, entry in enumerate(corrName):
        print "Corr #"+str(i+1)  + ": " +entry

    corrFull = ''

    for entry in corrName:

        print "Now applying correction: ", entry

# Check whether correction requested in config json actually exists

        key = entry+'_Corr'
        if key in availableCorr:
            corrector= availableCorr[entry+'_Corr']()        
        else:
            if not entry == "noCorr":
                print "Correction " + entry + " requested via json file does not exist, ignore."
            continue

# Read Corr config in here

        corrValueFile = AnalysisDir + '/corr/'+ entry + '_' + Fill +'.pkl' 
        if entry == "BeamBeam":
            corrValueFile = AnalysisDir + '/corr/'+ entry + '_' +Luminometer + '_' + Fill +'.pkl'
            
        corrector.doCorr(inData, corrValueFile)

        corrFull = corrFull + '_' + entry 

# check if any corrections are to be applied at all, if yes, define corr description string accordingly
# if no use "noCorr"

    import os

# empty strings are false, so if no corrections are to be applied, use noCorr as corr descriptor
    if  not corrFull:
        corrFull = "_noCorr"


# Now fill graphs for all scans
# Counting of scans starts with 1
    graphsListAll = {'Scan_'+ str(n+1):{} for n in range(len(inData))} 

    missedDataInfo=missedDataInfo+"Excluded BCIDs with too short scanpoint list:\n"

    for entry in inData:
    
        scanNumber = entry.scanNumber
        print "Now at Scan number ", scanNumber
        nBX = len(entry.usedCollidingBunches)
        prefix = ''
        if 'X' in entry.scanName:
            prefix = str(scanNumber) +'_X_'
        if 'Y' in entry.scanName:
            prefix = str(scanNumber)+'_Y_'

        omittedBXList=[]
    # convert for TGraph
        from array import array

        graphsList = {}

        for i, bx in enumerate(entry.usedCollidingBunches):
# BCIDs written at small number of SP are omitted (the list of short omitted bunches is added to log)            
# to avoid problems in vdmFitter: the number of SP should exceed the minimal number of freedom degrees for fitting

             if len(entry.spPerBX[bx])>5:
                coord=entry.spPerBX[bx]
                coorde = [0.0 for a in coord] 
                coord = array("d",coord)
                coorde = array("d", coorde)
                currProduct = [ a*b/1e22 for a,b in zip(entry.avrgFbctB1PerBX[bx],entry.avrgFbctB2PerBX[bx])]
                if len(entry.spPerBX[bx])!=len(entry.splumiPerBX[bx]):
                    print "Attention: bx=", bx, ", number of scanpoints for lumi and currents do not match, normalization is not correct"         
                lumi = [a/b for a,b in zip(entry.lumiPerBX[bx],currProduct)]
                lumie = [a/b for a,b in zip(entry.lumiErrPerBX[bx],currProduct)]
                #lumi = [a/b for a,b in zip(entry.lumi[i],currProduct)]
                #lumie = [a/b for a,b in zip(entry.lumiErr[i],currProduct)]

                lumie = array("d",lumie)
                lumi = array("d",lumi)
                name = prefix +str(bx)
                graph = r.TGraphErrors(len(coord),coord,lumi,coorde,lumie)
                graph.SetName(name)
                graph.SetTitle(name)
                graph.SetMinimum(0.000001)
                graphsList[int(bx)] = graph
             else:
                omittedBXList.append(bx)
# same for the sum, as double check, where sumLumi comes from avgraw
        try:
            coord = entry.displacement
            coorde = [0.0 for a in coord] 
            coord = array("d",coord)
            coorde = array("d", coorde)
            currProduct = [ a*b/1e22 for a,b in zip(entry.sumCollAvrgFbctB1,entry.sumCollAvrgFbctB2)]
            lumi = [a/b for a,b in zip(entry.sumLumi,currProduct)]
            lumie = [a/b for a,b in zip(entry.sumLumiErr,currProduct)]
            lumie = array("d",lumie)
            lumi = array("d",lumi)
            name = prefix + 'sum'
            graph = r.TGraphErrors(len(coord),coord,lumi,coorde,lumie)
            graph.SetName(name)
            graph.SetTitle(name)
            graphsList['sum'] = graph
        except KeyError,e: 
            print 'KeyError in makeGraphsFile- reason "%s"' % str(e)


        graphsListAll['Scan_'+ str(scanNumber)]=graphsList
        missedDataInfo=missedDataInfo+"Scan_"+prefix+":"+str(omittedBXList)+"\n"