"""
    configMgr.initialize()

    RooRandom.randomGenerator().SetSeed(configMgr.toySeed)

    ReduceCorrMatrix = configMgr.ReduceCorrMatrix

    """
    runs Trees->histos and/or histos->workspace according to specifications
    """
    if configMgr.readFromTree or configMgr.executeHistFactory:
        if doCodeProfiling:
            import cProfile
            cProfile.run('configMgr.executeAll()')
        else:
            configMgr.executeAll()

    """
    shows systematics
    """
    if drawSystematics:
       from ROOT import Util
       if not os.path.isdir("./plots"): 
          log.info("no directory 'plots' found.... creating one")
          os.mkdir("./plots")
       for fC in configMgr.fitConfigs:
           for chan in fC.channels:
               for sam in chan.sampleList:
                if not sam.isData:
                  if HistFitterArgs.systematics:
                      Systs = HistFitterArgs.systematics
            configMgr.useAsimovSet = True
        elif opt == '-g':
            sigSamples = arg.split(',')    
        pass
    gROOT.SetBatch(not runInterpreter)
    

    #mandatory user-defined configuration
    execfile(configFile)

    #standard execution from now on. 
    configMgr.initialize()
        
    #runs Trees->histos and/or histos->workspace according to specifications
    if configMgr.readFromTree or configMgr.executeHistFactory:
        configMgr.executeAll()

    if runFit:
        for i in range(0,len(configMgr.topLvls)-1):
	#if len(configMgr.topLvls)>1:
            r=GenerateFitAndPlot(configMgr.topLvls[i])
            #for idx in range(len(configMgr.topLvls)):
            #    r=GenerateFitAndPlot(configMgr.topLvls[idx]) #1])
            pass
        #configMgr.cppMgr.fitAll()
        print "\nr0=GenerateFitAndPlot(configMgr.topLvls[0])"
        print "r1=GenerateFitAndPlot(configMgr.topLvls[1])"
        print "r2=GenerateFitAndPlot(configMgr.topLvls[2])"
        pass
    
    if printLimits: