From 945558e1298e7fc37e3be541053ce34f2f66771b Mon Sep 17 00:00:00 2001 From: Patrick Karl Czodrowski <patrick.czodrowski@cern.ch> Date: Fri, 12 Dec 2014 14:26:17 +0100 Subject: [PATCH] updating TrigTest_CheckCounts.C and chainDump.py to print and compare the L1 counts (after veto) histo: CTPSimulation/L1ItemsAV that Joerg implemented (TrigValTools-00-03-86) * updating TrigTest_CheckCounts.C and chainDump.py to print and compare the L1 counts (after veto) histo: CTPSimulation/L1ItemsAV that Joerg implemented * TrigValTools-00-03-86 2014-11-07 David Quarrie <David.Quarrie@cern.ch> * cmt2cmake/cmt2cmake.py Specify the required ROOT components for cmake and that this package has private header files (transparent to CMT) * Tagged as TrigValTools-00-03-84 2014-10-30 Frank Winklmeier <fwinkl@cern> * TRoot2Html: Fix coverity warnings * TrigValTools-00-03-83 2014-10-02 Marcin Nowak <Marcin.Nowak@cern.ch> * TrigValTools\TrigValToolsDict.h: add include TPRegexp.h for ROOT6 * TrigValTools-00-03-81 * updating TrigTest_CheckCounts.C macro to provide more meaningful ERROR messages (and make it a bit less chatty at the same time) --- .../TrigValTools/TrigValToolsDict.h | 2 + .../TrigValTools/bin/chainDump.py | 53 +++-- .../TrigValTools/cmt/requirements | 6 + .../macros/TrigTest_CheckCounts.C | 181 ++++++++++++------ .../TrigValTools/src/TRoot2Html.cxx | 7 +- 5 files changed, 166 insertions(+), 83 deletions(-) diff --git a/Trigger/TrigValidation/TrigValTools/TrigValTools/TrigValToolsDict.h b/Trigger/TrigValidation/TrigValTools/TrigValTools/TrigValToolsDict.h index 5ca39ec5143..06fa29bed71 100644 --- a/Trigger/TrigValidation/TrigValTools/TrigValTools/TrigValToolsDict.h +++ b/Trigger/TrigValidation/TrigValTools/TrigValTools/TrigValToolsDict.h @@ -6,3 +6,5 @@ #include "TFileLooper.h" #include "TMultiFileLooper.h" #include "TRoot2Html.h" + +#include "TPRegexp.h" diff --git a/Trigger/TrigValidation/TrigValTools/bin/chainDump.py b/Trigger/TrigValidation/TrigValTools/bin/chainDump.py index 5a566f01817..548d16c9d57 100755 --- a/Trigger/TrigValidation/TrigValTools/bin/chainDump.py +++ b/Trigger/TrigValidation/TrigValTools/bin/chainDump.py @@ -3,7 +3,7 @@ # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration ################################################################# # script to dump selected results to a text file -# +# Upated by czodrows, 12-12-14 - adding the L1 items implemented by Joerg # ################################################################# @@ -20,22 +20,22 @@ import datetime; # set defaults here so they are same for RTT and command line rfile = "expert-monitoring.root" # directories and histograms for chain acceptance and TEs -dirs = ["TrigSteer_L2","TrigSteer_EF", "TrigSteer_HLT"] -hists = ["ChainAcceptance_runsummary","NumberOfActiveTEs_runsummary"] +dirs = ["TrigSteer_HLT","CTPSimulation"] +hists = ["ChainAcceptance","NumberOfActiveTEs","L1ItemsAV"] #backup names -backupName = { "ChainAcceptance_runsummary":"ChainAcceptance", - "NumberOfActiveTEs_runsummary":"NumberOfActiveTEs" } +#backupName = { "ChainAcceptance":"ChainAcceptance_runsummary", +# "NumberOfActiveTEs":"NumberOfActiveTEs_runsummary"} # directories and histogram to be used for finding number of events that # were run on totDirs = dirs totHist ="NInitialRoIsPerEvent" # short names for files -histDict = { "TrigSteer_L2":"L2", - "TrigSteer_EF":"EF", - "TrigSteer_HLT":"HLT", - "ChainAcceptance_runsummary":"Chain", - "NumberOfActiveTEs_runsummary":"TE" } +histDict = { "TrigSteer_HLT":"HLT", + "ChainAcceptance":"Chain", + "NumberOfActiveTEs":"TE", + "CTPSimulation":"L1", + "L1ItemsAV":"AV" } defFracTolerance = "0.001" defSigmaTolerance = "0.0" defIntTolerance = "2" @@ -114,6 +114,9 @@ class chainDump: for j in range(nbins): # first bin is for underflows char_label = hst.GetXaxis().GetBinLabel(j+1) + #PC - skip the ones without any label + if char_label=="" : + continue chainCounts = hst.GetBinContent(j+1) pairedList +=[[char_label,chainCounts]] if self.verbose: @@ -350,12 +353,15 @@ class chainDump: #print "grandTotalEvents", self.grandTotalEvents else: if hist_entries != total_events: - print "WARNING: total events in different directories don't match" + print "WARNING: total events in different directories don't match" + if total_events != -1: + print "Found %s events" % total_events + break tfile.cd("..") except: print "ERROR: cound not cd to directory: ", dir else: - print "WARNING: direcory ", dir," not found, could be normal if only HLT, EF or L2 is run" + print "WARNING: direcory ", dir," not found, could be normal if only HLT is run" found = False fileList=[] @@ -369,12 +375,13 @@ class chainDump: try: tfile.cd(dir) for histName in self.checkHist: - print "dir,histName",dir,histName + #print "trying dir,histName",dir,histName + hist = 0 if histName in gDirectory.GetListOfKeys(): hist = gDirectory.Get(histName) - else: - print "trying backup",backupName[histName] - hist = gDirectory.Get(backupName[histName]) + # else: + # print "trying backup",backupName[histName] + # hist = gDirectory.Get(backupName[histName]) if hist != 0: if dir in histDict and histName in histDict: textFileName=histDict[dir]+histDict[histName]+".txt" @@ -385,12 +392,15 @@ class chainDump: fileList +=[chainList] found = True else: - print "WARNING: missing L2 or EF resutls (normal if only HLT, L2 or EF is run)" + #not really useful to print a warning for not working dir/hist combinations + #print "WARNING: missing L2 or EF resutls (normal if only HLT is run)" + #print "nope combination ain't working - but fine" + continue tfile.cd("..") except: - print "ERROR: cound not cd to directory: ", dir + print "ERROR2: cound not cd to directory: ", dir else: - print "WARNING: direcory ", dir," not found, could be normal if only EF or L2 is run" + print "WARNING: direcory ", dir," not found" self.results += [ [fileList,file,total_events] ] #print "DMS len:",len(self.results) @@ -540,8 +550,9 @@ class chainDump: except: print "WARNING: exception could not interpret direcotry structure" releases +=[file] - else: - print "WARNING: no directory and/or release sturucture found" + else: + #this is not appropiate here + #print "WARNING: no directory and/or release sturucture found" releases +=[file] if self.verbose: diff --git a/Trigger/TrigValidation/TrigValTools/cmt/requirements b/Trigger/TrigValidation/TrigValTools/cmt/requirements index 4fdb8782965..de873da0705 100644 --- a/Trigger/TrigValidation/TrigValTools/cmt/requirements +++ b/Trigger/TrigValidation/TrigValTools/cmt/requirements @@ -9,6 +9,12 @@ use AtlasROOT AtlasROOT-* External apply_tag ROOTGraphicsLibs +# Specify the required ROOT components for cmake (transparent to CMT) +apply_pattern cmake_add_command command="find_package(ROOT COMPONENTS Hist Graf Gpad RIO)" + +# Declare for cmake that this package has private header files (transparent to CMT) +apply_pattern cmake_add_command command="include_directories(src)" + apply_pattern declare_scripts files="../bin/*.py \ ../bin/*.pl \ ../bin/*.sh" diff --git a/Trigger/TrigValidation/TrigValTools/macros/TrigTest_CheckCounts.C b/Trigger/TrigValidation/TrigValTools/macros/TrigTest_CheckCounts.C index b267b38cb26..31c6ec12abb 100644 --- a/Trigger/TrigValidation/TrigValTools/macros/TrigTest_CheckCounts.C +++ b/Trigger/TrigValidation/TrigValTools/macros/TrigTest_CheckCounts.C @@ -7,14 +7,26 @@ Original version from N. Sinev - Upated by Strom, 05-10-09 - Upated by Czodrowski, 08-05-14 - to ensure merged HLT compatibility + Upated by Strom, 05-10-09 + Upated by czodrows 08-05-14 - to ensure merged HLT compatibility + Upated by czodrows 12-12-14 - add the L1 Chains added by Joerg + Compare both total chain acceptance and results of individual TEs + #to test "offline" do: + tol=10 + + ref=/path/to/a/refence/expert/monitoring/file.root + #in my local case + ref=r.root + level="HLT" + echo -e ".x TrigTest_CheckCounts.C($tol,\042${ref}\042,\042${level}\042) \n .q " | root -b */ + + #include <TTree.h> #include <TFile.h> #include <TMath.h> @@ -52,6 +64,13 @@ void TrigTest_CheckCounts(Int_t toler,char *refname, char *level) exit(-1); } + TDirectory *l1_dir_cur = rf->GetDirectory("../CTPSimulation");///L1ItemsAV"); + TDirectory *l1_dir_ref = ref->GetDirectory("../CTPSimulation");///L1ItemsAV"); + bool run_l1=0; + if((l1_dir_cur)&&(l1_dir_ref)) run_l1=1; + + + ///this is option for possible direct calls of levels if(TString(level)=="L2"||TString(level)=="EF"||TString(level)=="HLT"){ hnames[0] =new TString("ChainAcceptance"); @@ -66,6 +85,13 @@ void TrigTest_CheckCounts(Int_t toler,char *refname, char *level) //hanames[1]=new TString("NumberOfActiveTEs_runsummary"); fnames[1] =new TString("TrigSteer_"+TString(level)); ncheck =2; + + if(run_l1) { + hnames[2] =new TString("L1ItemsAV"); + hanames[2]=new TString("L1ItemsAV"); + fnames[2] =new TString("CTPSimulation"); + ncheck =3; + } cout << "Checking " << level << " trigger counts" << endl; } @@ -85,6 +111,12 @@ void TrigTest_CheckCounts(Int_t toler,char *refname, char *level) hanames[1]=new TString("NumberOfActiveTEsPerEvent"); fnames[1] =new TString("TrigSteer_HLT"); ncheck =2; + if(run_l1) { + hnames[2] =new TString("L1ItemsAV"); + hanames[2]=new TString("L1ItemsAV"); + fnames[2] =new TString("CTPSimulation"); + ncheck =3; + } cout << "Checking HLT trigger counts" << endl; } else { //cout << "TrigLevel BOTH was given -- please ignore the following info line if this is a release < 18 "<< endl; @@ -113,6 +145,12 @@ void TrigTest_CheckCounts(Int_t toler,char *refname, char *level) //hanames[3]=new TString("NumberOfActiveTEs_runsummary"); fnames[3] =new TString("TrigSteer_EF"); ncheck =4; + if(run_l1) { + hnames[4] =new TString("L1ItemsAV"); + hanames[4]=new TString("L1ItemsAV"); + fnames[4] =new TString("CTPSimulation"); + ncheck =5; + } cout << "Checking L2 and EF trigger counts " << endl; } } //end if(TString(level)=="BOTH") @@ -124,46 +162,52 @@ void TrigTest_CheckCounts(Int_t toler,char *refname, char *level) Bool_t DIRERROR=0; //check if any TrigSteer directory exists - and also if they are the correct one(s) - TDirectory *hlt_dir_ref = ref->GetDirectory("TrigSteer_HLT"); - TDirectory *hlt_dir_cur = rf->GetDirectory("TrigSteer_HLT"); - - TDirectory *ef_dir_ref = ref->GetDirectory("TrigSteer_EF"); - TDirectory *ef_dir_cur = rf->GetDirectory("TrigSteer_EF"); - TDirectory *l2_dir_ref = ref->GetDirectory("TrigSteer_L2"); - TDirectory *l2_dir_cur = rf->GetDirectory("TrigSteer_L2"); - - if(TString(level)=="L2"){ + TDirectory *hlt_dir_ref = ref->GetDirectory("TrigSteer_HLT"); + TDirectory *hlt_dir_cur = rf->GetDirectory("TrigSteer_HLT"); + + TDirectory *ef_dir_ref = ref->GetDirectory("TrigSteer_EF"); + TDirectory *ef_dir_cur = rf->GetDirectory("TrigSteer_EF"); + TDirectory *l2_dir_ref = ref->GetDirectory("TrigSteer_L2"); + TDirectory *l2_dir_cur = rf->GetDirectory("TrigSteer_L2"); + // TDirectory *l1_dir_cur = rf->GetDirectory("../CTPSimulation");///L1ItemsAV"); + // TDirectory *l1_dir_ref = ref->GetDirectory("../CTPSimulation");///L1ItemsAV"); + + if(TString(level)=="L2"){ + if(!(l2_dir_ref)) cout << "Bad reference file: " << *reffile << " : Does not contain the directory: TrigSteer_L2 " << endl; + if(!(l2_dir_cur)) cout << "Bad expert-monitoring.root file: Does not contain the directory: TrigSteer_L2 " << endl; + if(!(l2_dir_ref)||!(l2_dir_cur)) DIRERROR=1; + } + if(TString(level)=="EF"){ + if(!(ef_dir_ref)) cout << "Bad reference file: " << *reffile << " : Does not contain the directory: TrigSteer_EF " << endl; + if(!(ef_dir_cur)) cout << "Bad expert-monitoring.root file: Does not contain the directory: TrigSteer_EF " << endl; + if(!(ef_dir_ref)||!(ef_dir_cur)) DIRERROR=1; + } + if(TString(level)=="HLT"){ + // if(!(l1_dir_cur)) cout << "Bad reference file: " << *reffile << " : Does not contain the directory: CTPSimulation " << endl; + // if((l1_dir_cur)) cout << "good reference file: " << *reffile << " : Does contain the directory: CTPSimulation " << endl; + if(!(hlt_dir_ref)) cout << "Bad reference file: " << *reffile << " : Does not contain the directory: TrigSteer_HLT " << endl; + if(!(hlt_dir_cur)) cout << "Bad expert-monitoring.root file: Does not contain the directory: TrigSteer_HLT " << endl; + if(!(hlt_dir_ref)||!(hlt_dir_cur)) DIRERROR=1; + } + if(TString(level)=="BOTH"){ + // if(!(l1_dir_cur)) cout << "Bad reference file: " << *reffile << " : Does not contain the directory: CTPSimulation " << endl; + // if((l1_dir_cur)) cout << "good reference file: " << *reffile << " : Does contain the directory: CTPSimulation " << endl; + //check for existence of TrigSteer_HLT in either of the 2 files + if(!(hlt_dir_ref)||!(hlt_dir_cur)){ //not found -> check for L2 and EF TrigSteer_ directories if(!(l2_dir_ref)) cout << "Bad reference file: " << *reffile << " : Does not contain the directory: TrigSteer_L2 " << endl; if(!(l2_dir_cur)) cout << "Bad expert-monitoring.root file: Does not contain the directory: TrigSteer_L2 " << endl; if(!(l2_dir_ref)||!(l2_dir_cur)) DIRERROR=1; - } - if(TString(level)=="EF"){ if(!(ef_dir_ref)) cout << "Bad reference file: " << *reffile << " : Does not contain the directory: TrigSteer_EF " << endl; if(!(ef_dir_cur)) cout << "Bad expert-monitoring.root file: Does not contain the directory: TrigSteer_EF " << endl; if(!(ef_dir_ref)||!(ef_dir_cur)) DIRERROR=1; } - if(TString(level)=="HLT"){ + //check for existence of L2 and EF TrigSteer_ directories in either of the 2 files + if(!(ef_dir_ref)||!(ef_dir_cur)||!(l2_dir_ref)||!(l2_dir_cur)){ //not found -> check for TrigSteer_HLT dirs if(!(hlt_dir_ref)) cout << "Bad reference file: " << *reffile << " : Does not contain the directory: TrigSteer_HLT " << endl; if(!(hlt_dir_cur)) cout << "Bad expert-monitoring.root file: Does not contain the directory: TrigSteer_HLT " << endl; if(!(hlt_dir_ref)||!(hlt_dir_cur)) DIRERROR=1; } - if(TString(level)=="BOTH"){ - //check for existence of TrigSteer_HLT in either of the 2 files - if(!(hlt_dir_ref)||!(hlt_dir_cur)){ //not found -> check for L2 and EF TrigSteer_ directories - if(!(l2_dir_ref)) cout << "Bad reference file: " << *reffile << " : Does not contain the directory: TrigSteer_L2 " << endl; - if(!(l2_dir_cur)) cout << "Bad expert-monitoring.root file: Does not contain the directory: TrigSteer_L2 " << endl; - if(!(l2_dir_ref)||!(l2_dir_cur)) DIRERROR=1; - if(!(ef_dir_ref)) cout << "Bad reference file: " << *reffile << " : Does not contain the directory: TrigSteer_EF " << endl; - if(!(ef_dir_cur)) cout << "Bad expert-monitoring.root file: Does not contain the directory: TrigSteer_EF " << endl; - if(!(ef_dir_ref)||!(ef_dir_cur)) DIRERROR=1; - } - //check for existence of L2 and EF TrigSteer_ directories in either of the 2 files - if(!(ef_dir_ref)||!(ef_dir_cur)||!(l2_dir_ref)||!(l2_dir_cur)){ //not found -> check for TrigSteer_HLT dirs - if(!(hlt_dir_ref)) cout << "Bad reference file: " << *reffile << " : Does not contain the directory: TrigSteer_HLT " << endl; - if(!(hlt_dir_cur)) cout << "Bad expert-monitoring.root file: Does not contain the directory: TrigSteer_HLT " << endl; - if(!(hlt_dir_ref)||!(hlt_dir_cur)) DIRERROR=1; - } - } + } if(DIRERROR){ cout << "checkcounts: ERROR : Inconsitency/Problem with the TrigSteer_ directories in the reference and/or expert-monitoring.root file detected - exiting CheckCounts!" << endl; @@ -234,28 +278,36 @@ void TrigTest_CheckCounts(Int_t toler,char *refname, char *level) } for(Int_t i=0; i<nbins+EXT_BNS; i++) { + newbc[i]=0.; oldbc[i]=0.; } + for(Int_t i=0; i<nbins; i++) newbc[i]=tchain->GetBinContent(i); TH1 *echist; - gDirectory->GetObject("NInitialRoIsPerEvent",echist); + gDirectory->GetObject("NInitialRoIsPerEvent",echist); + if (*fname=="CTPSimulation"){ + const char * olddir ; + olddir = gDirectory->GetPath() ; + gDirectory->GetObject("../"+(*fnames[0])+"/NInitialRoIsPerEvent",echist); + gDirectory->cd(olddir); + } // look for old sytle names if new one is not there - if(echist == 0 ){ - ` if(fname->Contains("_EF")) - ` { - gDirectory->GetObject("N_Initial_RoI_in_Event_EF",echist); - } - if(fname->Contains("_L2")) - { - gDirectory->GetObject("N_Initial_RoI_in_Event_L2",echist); - } - if(echist==0) - { - cout << "checkcounts FAILURE : can't determine number of events processed" << endl; - continue; - } - } + // if(echist == 0 ){ + // ` if(fname->Contains("_EF")) + // ` { + // gDirectory->GetObject("N_Initial_RoI_in_Event_EF",echist); + // } + // if(fname->Contains("_L2")) + // { + // gDirectory->GetObject("N_Initial_RoI_in_Event_L2",echist); + // } + if(echist==0) + { + cout << "checkcounts FAILURE : can't determine number of events processed" << endl; + continue; + } + // } nrnnew=echist->GetEntries(); cout << "Number of events processed in test: " << nrnnew << endl; rf->Close(); @@ -296,7 +348,7 @@ void TrigTest_CheckCounts(Int_t toler,char *refname, char *level) { Int_t bi = -1; TString *obna = new TString(otchain->GetXaxis()->GetBinLabel(i)); - if( debug ){ cout << "reference bin label: " << *obna << endl; } + if( debug ){ cout << i << "reference bin label: " << *obna << endl; } for(Int_t si=0; si<nbins+nexlb; si++) { if(xlabels[si]->CompareTo(*obna) == 0) bi=si; @@ -321,21 +373,28 @@ void TrigTest_CheckCounts(Int_t toler,char *refname, char *level) } TH1 *echist; gDirectory->GetObject("NInitialRoIsPerEvent",echist); + if (*fname=="CTPSimulation"){ + const char * olddir ; + olddir = gDirectory->GetPath() ; + gDirectory->GetObject("../"+(*fnames[0])+"/NInitialRoIsPerEvent",echist); + gDirectory->cd(olddir); + } + // look for old sytle names if new one is not there - if(echist == 0 ){ - if(fname->Contains("_EF")) - { - gDirectory->GetObject("N_Initial_RoI_in_Event_EF",echist); - } - if(fname->Contains("_L2")) - { - gDirectory->GetObject("N_Initial_RoI_in_Event_L2",echist); - } - if(echist==0){ - cout << "failed to find number of events in reference" << endl; - continue; - } + // if(echist == 0 ){ + // if(fname->Contains("_EF")) + // { + // gDirectory->GetObject("N_Initial_RoI_in_Event_EF",echist); + // } + // if(fname->Contains("_L2")) + // { + // gDirectory->GetObject("N_Initial_RoI_in_Event_L2",echist); + // } + if(echist==0){ + cout << "failed to find number of events in reference" << endl; + continue; } + // } nrnold=echist->GetEntries(); cout << "Number of events in reference: " << nrnold << endl; orf->Close(); diff --git a/Trigger/TrigValidation/TrigValTools/src/TRoot2Html.cxx b/Trigger/TrigValidation/TrigValTools/src/TRoot2Html.cxx index 7d019a401f9..80445812fa9 100644 --- a/Trigger/TrigValidation/TrigValTools/src/TRoot2Html.cxx +++ b/Trigger/TrigValidation/TrigValTools/src/TRoot2Html.cxx @@ -26,6 +26,7 @@ using namespace std; TRoot2Html::TRoot2Html() : + _nodeId(1), _showFullFileName(kFALSE) { setOutputDir("./"); @@ -33,7 +34,11 @@ TRoot2Html::TRoot2Html() : } TRoot2Html::TRoot2Html(const TRoot2Html& other): - TMultiFileLooper(other) + TMultiFileLooper(other), + _imgHeight(other._imgHeight), + _imgWidth(other._imgWidth), + _nodeId(other._nodeId), + _showFullFileName(other._showFullFileName) { } -- GitLab