def __init__(self, rootFileName): """ Get the Run Number. Open the file and cd to the Run Summary Directory Initialize whatever is needed """ self.__rootFileName = rootFileName self.__runNumber = util.getRunNumber(rootFileName) self.__rootFile = R.TFile(self.__rootFileName) self.__rsDir = self.__rootFile.GetDirectory( "DQMData/Run %d/Hcal/Run summary/" % self.__runNumber) pass
def generate(files, info): """ trigger the comparison """ # initialization tfile = files[0] rfiles = files[1:] rtfile = TFile(tfile, "update") # iterate over each reference file and add the comparison for f in rfiles: # 1. create a dir "Comparison_<refrun>" folder in the appropriate task # 2. For each quantity to be compared, generate a folder with # comparison histograms # for pedestal it is only Pedestal # for led/laser it is either Signal or Time refRunNumber = getRunNumber(f) rfile = TFile(f) if info.runType=="Pedestal": # setup reference histos rfile.cd("DQMData/Run %s/Hcal/Run summary/PedestalTask" % refRunNumber) hsetr = HistogramSet("Pedestal") # setup target histos rtfile.cd("DQMData/Run %s/Hcal/Run summary/PedestalTask" % info.runNumber) hsett = HistogramSet("Pedestal") # setup comparison set ROOT.gDirectory.mkdir("Comparison_%d" % refRunNumber) ROOT.gDirectory.cd("Comparison_%d" % refRunNumber) pset = ComparisonSet("Pedestal") # compare and save pset.compare(hsett, hsetr) rtfile.Write() elif info.runType=="LED": # setup reference histos rfile.cd("DQMData/Run %s/Hcal/Run summary/LEDTask" % refRunNumber) hsetrS = HistogramSet("Signal") hsetrT = HistogramSet("Timing") # setup target histos rtfile.cd("DQMData/Run %s/Hcal/Run summary/LEDTask" % info.runNumber) hsettS = HistogramSet("Signal") hsettT = HistogramSet("Timing") # setup comparison set ROOT.gDirectory.mkdir("Comparison_%d" % refRunNumber) ROOT.gDirectory.cd("Comparison_%d" % refRunNumber) psetS = ComparisonSet("Signal") psetT = ComparisonSet("Timing") #compare and save psetS.compare(hsettS, hsetrS) psetT.compare(hsettT, hsetrT) rtfile.Write() elif info.runType=="Laser": # setup reference histos rfile.cd("DQMData/Run %s/Hcal/Run summary/LaserTask" % refRunNumber) hsetrS = HistogramSet("Signal") hsetrT = HistogramSet("Timing") # setup target histos + init comparison set rtfile.cd("DQMData/Run %s/Hcal/Run summary/LaserTask" % info.runNumber) hsettS = HistogramSet("Signal") hsettT = HistogramSet("Timing") # setup comparsion set ROOT.gDirectory.mkdir("Comparison_%d" % refRunNumber) ROOT.gDirectory.cd("Comparison_%d" % refRunNumber) psetS = ComparisonSet("Signal") psetT = ComparisonSet("Timing") # compare and save psetS.compare(hsettS, hsetrS) psetT.compare(hsettT, hsetrT) rtfile.Write() else: continue
def generate(files, info): """ trigger the comparison """ # initialization tfile = files[0] rfiles = files[1:] rtfile = TFile(tfile, "update") # iterate over each reference file and add the comparison for f in rfiles: # 1. create a dir "Comparison_<refrun>" folder in the appropriate task # 2. For each quantity to be compared, generate a folder with # comparison histograms # for pedestal it is only Pedestal # for led/laser it is either Signal or Time refRunNumber = getRunNumber(f) rfile = TFile(f) if info.runType == "Pedestal": # setup reference histos rfile.cd("DQMData/Run %s/Hcal/Run summary/PedestalTask" % refRunNumber) hsetr = HistogramSet("Pedestal") # setup target histos rtfile.cd("DQMData/Run %s/Hcal/Run summary/PedestalTask" % info.runNumber) hsett = HistogramSet("Pedestal") # setup comparison set ROOT.gDirectory.mkdir("Comparison_%d" % refRunNumber) ROOT.gDirectory.cd("Comparison_%d" % refRunNumber) pset = ComparisonSet("Pedestal") # compare and save pset.compare(hsett, hsetr) rtfile.Write() elif info.runType == "LED": # setup reference histos rfile.cd("DQMData/Run %s/Hcal/Run summary/LEDTask" % refRunNumber) hsetrS = HistogramSet("Signal") hsetrT = HistogramSet("Timing") # setup target histos rtfile.cd("DQMData/Run %s/Hcal/Run summary/LEDTask" % info.runNumber) hsettS = HistogramSet("Signal") hsettT = HistogramSet("Timing") # setup comparison set ROOT.gDirectory.mkdir("Comparison_%d" % refRunNumber) ROOT.gDirectory.cd("Comparison_%d" % refRunNumber) psetS = ComparisonSet("Signal") psetT = ComparisonSet("Timing") #compare and save psetS.compare(hsettS, hsetrS) psetT.compare(hsettT, hsetrT) rtfile.Write() elif info.runType == "Laser": # setup reference histos rfile.cd("DQMData/Run %s/Hcal/Run summary/LaserTask" % refRunNumber) hsetrS = HistogramSet("Signal") hsetrT = HistogramSet("Timing") # setup target histos + init comparison set rtfile.cd("DQMData/Run %s/Hcal/Run summary/LaserTask" % info.runNumber) hsettS = HistogramSet("Signal") hsettT = HistogramSet("Timing") # setup comparsion set ROOT.gDirectory.mkdir("Comparison_%d" % refRunNumber) ROOT.gDirectory.cd("Comparison_%d" % refRunNumber) psetS = ComparisonSet("Signal") psetT = ComparisonSet("Timing") # compare and save psetS.compare(hsettS, hsetrS) psetT.compare(hsettT, hsetrT) rtfile.Write() else: continue