diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/TrigHLTMonitoring/HLTMonTool.h b/Trigger/TrigMonitoring/TrigHLTMonitoring/TrigHLTMonitoring/HLTMonTool.h index a54969cb74558a73d64d1ea09b7f8a835e59b09e..98c698527d68beaca30bf74616d218f03a09c4b3 100755 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/TrigHLTMonitoring/HLTMonTool.h +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/TrigHLTMonitoring/HLTMonTool.h @@ -69,6 +69,7 @@ class HLTMonTool : public IHLTMonTool { std::vector<std::string> m_L2_summary; //!< vector of L2 Chains std::vector<std::string> m_EF_summary; //!< vector of EF Chains std::map<std::string,std::string> m_regexlist; //!< maps Groupnames to corresponding regular expressions + std::map<std::string,std::string> m_run1regexlist; //!< like m_regexlist but for Run-1 std::vector<std::string> m_rateregex; //!< chains matching one of these regexes will be rate monitored std::map<cool::ValidityKey, cool::UInt63> m_lbStartTimes; //!< map of LB to its start time in UNIX time std::map<cool::ValidityKey, cool::UInt63> m_lbStopTimes; //!< map of LB to its stop time in UNIX time @@ -79,6 +80,15 @@ class HLTMonTool : public IHLTMonTool { const xAOD::LumiBlockRangeContainer* m_lbc; bool m_scopeLumi; int m_nLBs; //# of lumi blocks in run; + bool _useRun1Trigger; + + // this is a hack (recommended by Frank Winklmeier) to determine + // if we are processing "old/Run-1 data" (and we should expect + // trigger chain names to begin with L2_ or EF_) vs "new data" + // (where trigger chains names begin with HLT_). It is not the most + // eloquent implementation ever, but it should work + bool useRun1Trigger(){return getRunNr() < 222222 && getRunNr() > 0;} + }; #endif diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/TrigHLTMonitoring/IHLTMonTool.h b/Trigger/TrigMonitoring/TrigHLTMonitoring/TrigHLTMonitoring/IHLTMonTool.h index 47933b5b91f0f19baa3f4a9be121ee6c7604cea8..f17e13de41523affb22b17dfc1455d617bcdf414 100755 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/TrigHLTMonitoring/IHLTMonTool.h +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/TrigHLTMonitoring/IHLTMonTool.h @@ -78,8 +78,6 @@ class IHLTMonTool : public ManagedMonitorToolBase { // Automatically casts a TTree to ntuple TNtuple *ntuple(const std::string &treeName, const std::string &monGroup = ""); - - protected: MsgStream *m_log; diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/MenuAwareMonitoring.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/MenuAwareMonitoring.py index c3bfccb8f371964737a11f09c32fb5cfb6df5701..030f00eb6da2eb1fa950f30fb06473db3d2df5d3 100644 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/MenuAwareMonitoring.py +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/MenuAwareMonitoring.py @@ -999,6 +999,14 @@ class MenuAwareMonitoring: # nice spacing for user print "" + def does_mck_athena_version_match_current_athena_version(self, mck_id): + "Compares the current Athena version to the one of the requested MCK" + + mck_info = self.ms.oi.read_mck_info_from_db(mck_id) + mck_athena_version = mck_info['MCK_ATHENA_VERSION'] + + return mck_athena_version == self.current_athena_version + def apply_mck(self,input1="",print_output_here=""): "Apply an MCK to locally running tools." diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitoringConfig.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitoringConfig.py index deda5fb33d2211f8a34816f3083adc43d9612bb0..29b4d3d0310d2050fe32c5f9a736d3fd2cd4ff2c 100644 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitoringConfig.py +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitoringConfig.py @@ -15,6 +15,18 @@ def HLTGeneralTool(): 'Taus' : 'HLT_(tau[0-9]*|trk.*Tau).*', 'Jets' : 'HLT_(FJ|j)[0-9]+.*' }, + # same as RegExes, but for Run-1; + # this is only useful for processing Run-1 data + Run1RegExes = { + 'AllChains' : '(L2|EF)_.*', + 'Electrons' : '(L2|EF)_e[0-9]+.*', + 'Gamma' : '(L2|EF)_g[0-9]+.*', + 'Muons' : '(L2|EF)_[0-9]*mu[0-9]+.*', + 'MinBias' : '(L2|EF)_mb.*', + 'MissingET' : '(L2|EF)_(t|x)e[0-9]+.*', + 'Taus' : '(L2|EF)_(tau[0-9]*|trk.*Tau).*', + 'Jets' : '(L2|EF)_(FJ|j)[0-9]+.*' + }, LumiKey = 'LumiBlocks' ) ToolSvc += HLTMon diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/share/addMonTools.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/share/addMonTools.py index 3fef3255b95afcdb625111cde266cbd6fa3c8e4f..6e66ceadd034405e04ed1dc3035989b1fca2a0f4 100644 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/share/addMonTools.py +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/share/addMonTools.py @@ -161,9 +161,11 @@ if HLTMonFlags.doDump: ########## Menu-aware Monitoring ########### -if HLTMonFlags.doMaM: +HLTMonFlags.doMaM = False +if HLTMonFlags.doMaM: # set up menu-aware monitoring + # this is where MaM needs to check whether it is running in a Trigger reprocessing job or not, and start an instance of MaM connected to the correct database accordingly from TrigHLTMonitoring.MenuAwareMonitoring import MenuAwareMonitoring mam = MenuAwareMonitoring() @@ -177,14 +179,17 @@ if HLTMonFlags.doMaM: # if a specific Monitoring Configuration Key (MCK) has been set, then use it if HLTMonFlags.MCK.StoredValue > 0: - - print "Using trigger Monitoring Configuration Key (MCK)",HLTMonFlags.MCK.StoredValue - mam.apply_mck( HLTMonFlags.MCK.StoredValue ) - - # if HLTMonFlags.MCK is -1 (the default) then we pick the MCK based on the SMK + if mam.does_mck_athena_version_match_current_athena_version( HLTMonFlags.MCK.StoredValue ): + print "Using trigger Monitoring Configuration Key (MCK)",HLTMonFlags.MCK.StoredValue + mam.apply_mck( HLTMonFlags.MCK.StoredValue ) + else: + print "MCK",HLTMonFlags.MCK.StoredValue,"cannot be applied as it is a patch for a different Athena version. No MCK applied." + # should MAM check Cool in this case? + + # if HLTMonFlags.MCK is -1 (the default) we get the MCK from Cool, if there is no MCK there then we pick the MCK based on the SMK if HLTMonFlags.MCK.StoredValue == -1: - - # MaM will translate the SMK into an MCK, and apply it + + # try to get the MCK from Cool from RecExConfig.InputFilePeeker import inputFileSummary #print "inputFileSummary =",inputFileSummary if inputFileSummary.__contains__('bs_metadata'): @@ -192,42 +197,96 @@ if HLTMonFlags.doMaM: run_number = inputFileSummary['bs_metadata']['run_number'] lumi_block = inputFileSummary['bs_metadata']['LumiBlock'] runiov = (int(run_number)<<32) + int(lumi_block) - + # get the database instance for getting the SMK from IOVDbSvc.IOVDbSvcConf import IOVDbSvc #print "svcMgr.IOVDbSvc.properties() =",svcMgr.IOVDbSvc.properties() DBInstance = svcMgr.IOVDbSvc.properties()['DBInstance'] - + + # is this the right way to connect for the Trigger repro DB? + # need to connect to some sqlite file instead + # try to connect to the COOL database from PyCool import cool from CoolConvUtilities.AtlCoolLib import indirectOpen connstring = "COOLONL_TRIGGER/"+str(DBInstance) - trigDB=indirectOpen(connstring,oracle='True') - if trigDB is None: - print "Unable to connect to",connstring + coolDB=indirectOpen(connstring,oracle='True') + if coolDB is None: + print "Unable to connect to",connstring,"to get MCK from Cool. Will also not be able to get the SMK so no MCK will be applied." else: - # get the SMK out of COOL - folder=trigDB.getFolder('/TRIGGER/HLT/HltConfigKeys') - retrieved_obj=folder.findObject(runiov,0) + # try to get the MCK out of COOL + MCKfolder=coolDB.getFolder('/TRIGGER/HLT/MonitoringConfigurationKey') + retrieved_obj=MCKfolder.findObject(runiov,0) retrieved_payload=retrieved_obj.payload() - retrieved_format=retrieved_payload['MasterConfigurationKey'] - SuperMasterKey = int(retrieved_format) + retrieved_format=retrieved_payload['MonitoringConfigurationKey'] + MonitoringConfigurationKey = int(retrieved_format) + # what happens here if there is no MCK found for that IOV? At what point is the MCK added to Cool? + + print "MCK from Cool MonitoringConfigurationKey =",MonitoringConfigurationKey + + + # if MCK found, check version + if MonitoringConfigurationKey > 0: + if mam.does_mck_athena_version_match_current_athena_version( MonitoringConfigurationKey ): + HLTMonFlags.MCK.StoredValue = MonitoringConfigurationKey + print "Using trigger Monitoring Configuration Key (MCK) from Cool",HLTMonFlags.MCK.StoredValue + mam.apply_mck( HLTMonFlags.MCK.StoredValue ) + else: + print "MCK",MonitoringConfigurationKey,"cannot be applied as it is a patch for a different Athena version." + + # if no MCK found or if MCK version doesn't match, check SMK + # If MCK version didn't match, should we update the MCK in Cool? + # should MAM do this check by SMK if we find MCK 0 in the db? I don't think so +# if """( MonitoringConfigurationKey not found in cool ) or""" !mam.does_mck_athena_version_match_current_athena_version( MonitoringConfigurationKey ): + if not mam.does_mck_athena_version_match_current_athena_version( MonitoringConfigurationKey ): + SMKfolder=coolDB.getFolder('/TRIGGER/HLT/HltConfigKeys') + retrieved_obj=SMKfolder.findObject(runiov,0) + retrieved_payload=retrieved_obj.payload() + retrieved_format=retrieved_payload['MasterConfigurationKey'] + SuperMasterKey = int(retrieved_format) + + print "SMK SuperMasterKey =",SuperMasterKey + + # We now have the required input info. Use mam to get the appropriate MCK + MCKfromSMK = mam.get_mck_id_from_smk(SuperMasterKey) + print "Have used Menu-aware monitoring to extract MCK",MCKfromSMK,"linked to SMK",SuperMasterKey + + # If the MCK is > 0 and is from the right release then apply it, otherwise use the default tool configurations + if MCKfromSMK > 0: + if mam.does_mck_athena_version_match_current_athena_version( MCKfromSMK ): + HLTMonFlags.MCK.StoredValue = MCKfromSMK + print "Using trigger Monitoring Configuration Key (MCK) from SMK",HLTMonFlags.MCK.StoredValue + mam.apply_mck( HLTMonFlags.MCK.StoredValue ) + # If MCK version didn't match, should we update the MCK in Cool? + # should we update the MCK in Cool if the MCK in Cool is the default and we find an MCK that should be applied? I don't think so + + # if we did not find the MCK in Cool + # we need to add the MCK to Cool + payloadSpec = cool.RecordSpecification() + payloadSpec.extend("MCK",cool.StorageType.UInt32) + dataforCool = cool.Record(payloadSpec) + dataforCool["MCK"] = HLTMonFlags.MCK.StoredValue + # store object with IOV valid from 0-max, channel 0 + # folder.storeObject(0,cool.ValidityKeyMax,data,chann,Tag) + # need to get IOV range + cooliov = cool.ValidityKey(runiov) + cooliovmax = cool.ValidityKeyMax + # is this the correct range? + print "Storing MCK",HLTMonFlags.MCK.StoredValue,"in Cool for IOVs",cooliov,"to",cooliovmax + MCKfolder.storeObject(cooliov,cooliovmax,dataforCool,0) + # check this was successful + + else: + print "MCK",MCKfromSMK,"cannot be applied as it is a patch for a different Athena version. No MCK applied." + + - print "SMK SuperMasterKey =",SuperMasterKey - - # We now have the required input info. Use mam to get the appropriate MCK - HLTMonFlags.MCK.StoredValue = mam.get_mck_id_from_smk(SuperMasterKey) - print "Have used Menu-aware monitoring to extract MCK",HLTMonFlags.MCK.StoredValue,"linked to SMK",SuperMasterKey - - # If the MCK is > 0 then apply it, otherwise use the default tool configurations - if HLTMonFlags.MCK.StoredValue > 0: - print "Using trigger Monitoring Configuration Key (MCK)",HLTMonFlags.MCK.StoredValue - mam.apply_mck( HLTMonFlags.MCK.StoredValue ) + + # if dumping the tool configurations (as a .json file) has been requested, then do that here if HLTMonFlags.doMaM_ExtractAndDumpConfigs: - # mam.setup_all_local_tools() # get updated configs for all tools, and dump them to HLTMonFlags.MaM_OutputJSON.StoredValue mam.get_current_local_info() mam.dump_local_config_to_json(HLTMonFlags.MaM_OutputJSON.StoredValue) @@ -241,8 +300,3 @@ print HLTMonManager; #--------------------------------------------------- #---- End #--------------------------------------------------- - -#try: -# print "ToolSvc.HLTMETMon.muon_pt_thresh",ToolSvc.HLTMETMon.muon_pt_thresh -#except: -# print "HLTMETMon is not set up, cannot print value" diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/src/HLTMonTool.cxx b/Trigger/TrigMonitoring/TrigHLTMonitoring/src/HLTMonTool.cxx index a12ac061544de7e58ad9e0d5f5a6d9c9e175f905..b1b28cd3768f9362aba10c378ea707bd0983759a 100755 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/src/HLTMonTool.cxx +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/src/HLTMonTool.cxx @@ -59,6 +59,7 @@ const IInterface* parent) : IHLTMonTool(type, name, parent) { declareProperty("RegExes",m_regexlist); + declareProperty("Run1RegExes",m_run1regexlist); declareProperty("LumiKey",m_lumikey = "LumiBlocks"); declareProperty("RateChains",m_rateregex); declareProperty("ScopeLumi",m_scopeLumi = 0); @@ -74,6 +75,7 @@ HLTMonTool::~HLTMonTool() StatusCode HLTMonTool:: init() /*---------------------------------------------------------*/ { + _useRun1Trigger = false; return StatusCode::SUCCESS; } @@ -83,21 +85,40 @@ StatusCode HLTMonTool::book( ) //suppress 'unused' compiler warning { StatusCode sc = StatusCode::SUCCESS; ATH_MSG_VERBOSE("HLTMonTool::book()"); - ATH_MSG_VERBOSE("Regular Expressions used for chain selection:\n" << m_regexlist); + _useRun1Trigger = useRun1Trigger(); + assert(getRunNr() > 0); // if this fails, run # is unknown & therefore _useRun1Trigger is not properly set -// if (isNewRun) { // Rebooking is now handled in the MonagedMonitorTool -- LS 20 Jan 2014 - addMonGroup(new MonGroup(this,"HLT/ResultMon",run)); - - sc = GetL1SummaryAndLBInfo(); - if(sc.isFailure()) ATH_MSG_WARNING("failed getting necessary info for booking"); + if(_useRun1Trigger) + ATH_MSG_VERBOSE("Regular Expressions used for chain selection:\n" << m_run1regexlist); + else + ATH_MSG_VERBOSE("Regular Expressions used for chain selection:\n" << m_regexlist); + + // if (isNewRun) { // Rebooking is now handled in the ManagedMonitorTool -- LS 20 Jan 2014 + addMonGroup(new MonGroup(this,"HLT/ResultMon",run)); + + sc = GetL1SummaryAndLBInfo(); + if(sc.isFailure()) ATH_MSG_WARNING("failed getting necessary info for booking"); + + if(_useRun1Trigger) + { + sc = bookResultAndConsistencyHistograms("L2"); + if(sc.isFailure()) ATH_MSG_WARNING("failed booking result and consistency histos L2"); + sc = bookResultAndConsistencyHistograms("EF"); + if(sc.isFailure()) ATH_MSG_WARNING("failed booking result and consistency histos EF"); + } + else + { sc = bookResultAndConsistencyHistograms("HLT"); if(sc.isFailure()) ATH_MSG_WARNING("failed booking result and consistency histos HLT"); - sc = bookLvl1Histograms(); - if(sc.isFailure()) ATH_MSG_WARNING("failed booking LVL1 histos"); - sc = bookHLTHistograms(); - if(sc.isFailure()) ATH_MSG_WARNING("failed booking HLT Histos"); -// } + } + + sc = bookLvl1Histograms(); + if(sc.isFailure()) ATH_MSG_WARNING("failed booking LVL1 histos"); + sc = bookHLTHistograms(); + if(sc.isFailure()) ATH_MSG_WARNING("failed booking HLT Histos"); + if(sc.isFailure()) ATH_MSG_WARNING("failed at booking histograms for HLTMonTool"); + return sc; } @@ -108,15 +129,37 @@ StatusCode HLTMonTool::fill() ATH_MSG_VERBOSE("fill()"); StatusCode sc = StatusCode::SUCCESS; + // Check HLTResult + if(getTDT()->ExperimentalAndExpertMethods()->isHLTTruncated()){ + ATH_MSG_WARNING("HLTResult truncated, skip event"); + return false; + } + //go to original MonGroup setCurrentMonGroup("HLT/ResultMon"); - sc = fillResultAndConsistencyHistograms("HLTResult_HLT", hist("ConfigConsistency_HLT"), hist("HLTResultHLT")); - if(sc.isFailure()) ATH_MSG_WARNING("Filling Result and Consistency histograms failed for HLT"); + + if(_useRun1Trigger) + { + sc = fillResultAndConsistencyHistograms("HLTResult_L2", hist("ConfigConsistency_L2"), hist("HLTResultL2")); + if(sc.isFailure()) ATH_MSG_WARNING("Filling Result and Consistency histograms failed for L2"); + sc = fillResultAndConsistencyHistograms("HLTResult_EF", hist("ConfigConsistency_EF"), hist("HLTResultEF")); + if(sc.isFailure()) ATH_MSG_WARNING("Filling Result and Consistency histograms failed for EF"); + } + else + { + sc = fillResultAndConsistencyHistograms("HLTResult_HLT", hist("ConfigConsistency_HLT"), hist("HLTResultHLT")); + if(sc.isFailure()) ATH_MSG_WARNING("Filling Result and Consistency histograms failed for HLT"); + } fillLvl1Histograms(); if(sc.isFailure()) ATH_MSG_WARNING("Filling Level 1 histograms failed"); - std::vector<std::string> myChains = getTDT()->getListOfTriggers("HLT_.*"); + std::vector<std::string> myChains; + if(_useRun1Trigger) + myChains = getTDT()->getListOfTriggers("L2_.*|EF_*"); + else + myChains = getTDT()->getListOfTriggers("HLT_.*"); + if (!(myChains.empty())) { std::vector<std::string>::const_iterator chIt; for (chIt=myChains.begin(); chIt!=myChains.end(); ++chIt) { @@ -125,7 +168,10 @@ StatusCode HLTMonTool::fill() } } else { - ATH_MSG_WARNING("No HLT chains found using TDT"); + if(_useRun1Trigger) + ATH_MSG_WARNING("No L2 and/or EF chains found using TDT"); + else + ATH_MSG_WARNING("No HLT chains found using TDT"); sc = StatusCode::FAILURE; } return sc; @@ -253,10 +299,16 @@ StatusCode HLTMonTool::bookLvl1Histograms(){ StatusCode HLTMonTool::bookHLTHistograms(){ StatusCode sc = StatusCode::SUCCESS; - std::map<std::string,std::string> streams = m_regexlist; - std::map<std::string,std::string>::iterator strItr; - for (strItr=streams.begin();strItr!=streams.end(); ++strItr) + const std::map<std::string,std::string> * streams; + if(_useRun1Trigger) + streams = &m_run1regexlist; + else + streams = &m_regexlist; + std::map<std::string,std::string>::const_iterator strItr; + for (strItr=streams->begin();strItr!=streams->end(); ++strItr){ + // we are trying to handle either "old" (L2_ and EF_) or "new" (HLT_) trigger chains here sc = bookHLTHistogramsForStream(strItr->first, strItr->second); + } return sc; } @@ -264,37 +316,60 @@ StatusCode HLTMonTool::bookHLTHistogramsForStream(const std::string& name, const ATH_MSG_DEBUG("booking histograms for stream " << name); StatusCode sc = StatusCode::SUCCESS; std::string monpath = "HLT/ResultMon/" + name; - std::vector<std::string>::iterator chItr; + std::vector<std::string>::const_iterator chItr; addMonGroup(new MonGroup(this,monpath,run)); - std::vector<std::string> lvl = {getTDT()->getListOfTriggers(regex)}; - + std::vector<std::string> onelevel[1]; // one level corresponds to HLT + std::vector<std::string> twolevels[2]; // two levels correspond to L2, EF + + const char* OneLevel[1] = {"HLT"}; const char * TwoLevels[2] = {"L2", "EF"}; + const char ** levelName = 0; + const std::vector<std::string> * listOfTriggers = 0; + unsigned array_length = 0; + if(_useRun1Trigger) + { + // some regex manipulation to replace "(L2|EF)_" from regex with "L2_" or "EF_" + twolevels[0] = getTDT()->getListOfTriggers("L2_"+regex.substr(8,regex.length()-8)); + twolevels[1] = getTDT()->getListOfTriggers("EF_"+regex.substr(8,regex.length()-8)); + listOfTriggers = &twolevels[0]; + levelName = &TwoLevels[0]; + array_length = 2; + } + else + { + onelevel[0] = getTDT()->getListOfTriggers(regex); + listOfTriggers = &onelevel[0]; + levelName = &OneLevel[0]; + array_length = 1; + } + //create helper strings std::stringstream tmp_histname; const char* triggerstatus[]={"RAW","PS","PT"}; - const char* level = "HLT"; - - for (uint j=0; j<sizeof(triggerstatus)/sizeof(triggerstatus[0]); ++j) - if(lvl.size()>0) { + + for(uint index=0; index != array_length; ++index){ + if(listOfTriggers[index].empty())continue; + + for (uint j=0; j != sizeof(triggerstatus)/sizeof(triggerstatus[0]); ++j){ + tmp_histname.str("");//reset - tmp_histname << level << "_" << name << triggerstatus[j]; + tmp_histname << levelName[index] << "_" << name << triggerstatus[j]; ATH_MSG_DEBUG("\tbooking --> " << tmp_histname.str()); - // addHistogram(new TH1F(tmp_histname.str().c_str(),name.c_str(),lvl.size(),0.5,lvl.size()+0.5),monpath); - addHistogram(new TH1F(tmp_histname.str().c_str(),tmp_histname.str().c_str(),lvl.size(),0.5,lvl.size()+0.5),monpath); + unsigned size = listOfTriggers[index].size(); + addHistogram(new TH1F(tmp_histname.str().c_str(),tmp_histname.str().c_str(),size,0.5,size+0.5),monpath); - for (chItr=lvl.begin(); chItr!=lvl.end(); chItr++) - hist(tmp_histname.str(),monpath)->GetXaxis()->SetBinLabel(chItr-lvl.begin()+1,chItr->c_str()); + for (chItr=listOfTriggers[index].begin(); chItr!=listOfTriggers[index].end(); chItr++) + hist(tmp_histname.str(),monpath)->GetXaxis()->SetBinLabel(chItr-listOfTriggers[index].begin()+1,chItr->c_str()); } + } //add a roi histo - // addHistogram(new TH2F(std::string(name+"RoIs").c_str(),tmp_histname.str().c_str(),100,-5,5,64,-3.2,3.2),monpath); - addHistogram(new TH2F(std::string(name+"RoIs").c_str(),std::string(name+"RoIs").c_str(),100,-5,5,64,-3.2,3.2),monpath); + // addHistogram(new TH2F(std::string(name+"RoIs").c_str(),std::string(name+"RoIs").c_str(),100,-5,5,64,-3.2,3.2),monpath); + addHistogram(new TH2F(std::string(name+"RoIs").c_str(),std::string(name+"RoIs").c_str(),64,-3.2,3.2,64,-3.2,3.2),monpath); - monpath+="/Rates"; addMonGroup(new MonGroup(this,monpath,run)); - - + if(m_scopeLumi) for(std::vector<std::string>::iterator rItr=m_rateregex.begin(); rItr!=m_rateregex.end();++rItr){ std::vector<std::string> ratechains = getTDT()->getListOfTriggers(*rItr); @@ -407,9 +482,11 @@ StatusCode HLTMonTool::fillForChain(const std::string& chain){ StatusCode sc = StatusCode::SUCCESS; //get results std::map<std::string,bool> results; - bool isHLTChain = !(chain.compare(0,3,"HLT")); - if(!(isHLTChain)){ - ATH_MSG_DEBUG(chain << "is not an HLT chain"); + bool isL2Chain = !(chain.compare(0,2,"L2")); + bool isHLTChain = !(chain.compare(0,3,"HLT")) || !(chain.compare(0,2,"EF")); + + if(!(isHLTChain||isL2Chain)){ + ATH_MSG_DEBUG(chain << "is neither HLT nor EF nor L2 chain"); return StatusCode::FAILURE; } @@ -421,20 +498,31 @@ StatusCode HLTMonTool::fillForChain(const std::string& chain){ //set up iterators and such const std::string basepath = "HLT/ResultMon/"; - std::map<std::string,std::string> streams = m_regexlist; + const std::map<std::string,std::string> * streams = 0; std::map<std::string,bool>::iterator rsIt; - std::map<std::string,std::string>::const_iterator sIt = streams.begin(); + std::vector<std::string>::iterator rItr=m_rateregex.begin(); - - - + unsigned length_to_chop = 0; + + if(_useRun1Trigger) + { + length_to_chop = 3; // L2_ or EF_ from trigger chain name gets chopped + streams = &m_run1regexlist; + } + else + { + length_to_chop = 4; // HLT_ from trigger chain name gets chopped + streams = &m_regexlist; + } + + std::map<std::string,std::string>::const_iterator sIt = streams->begin(); //loop streams, if chain matched stream, loop result and if result is true fill - for (;sIt!=streams.end();++sIt){ if (boost::regex_match(chain.c_str(),boost::regex(sIt->second))) { + for (;sIt!=streams->end();++sIt){ if (boost::regex_match(chain.c_str(),boost::regex(sIt->second))) { for (rsIt=results.begin();rsIt!=results.end(); rsIt ++){ if (rsIt->second) { ATH_MSG_DEBUG(chain << " passed " << rsIt->first << " and matches " << *sIt); const std::string monpath = basepath+sIt->first; - const std::string name = chain.substr(0,4)+sIt->first+rsIt->first; + const std::string name = chain.substr(0,length_to_chop)+sIt->first+rsIt->first; // ------------ Standard Fill --------------------- hist(name,monpath)->Fill(chain.c_str(),1);