diff --git a/LArCalorimeter/LArMonitoring/CMakeLists.txt b/LArCalorimeter/LArMonitoring/CMakeLists.txt index 31507db6ee03aef44b8c5267f7bcd00a0fe686a8..1eedde6ac866e891a55497e6317490a34643fea7 100644 --- a/LArCalorimeter/LArMonitoring/CMakeLists.txt +++ b/LArCalorimeter/LArMonitoring/CMakeLists.txt @@ -35,6 +35,13 @@ find_package( Boost COMPONENTS filesystem thread system ) find_package( CLHEP ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) +atlas_add_library( LArStrHelper + src/LArStrHelper.cxx LArMonitoring/LArStrHelper.h + PUBLIC_HEADERS LArMonitoring + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${ROOT_LIBRARIES}) + + # Component(s) in the package: atlas_add_component( LArMonitoring src/*.cxx @@ -42,6 +49,12 @@ atlas_add_component( LArMonitoring INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} CaloDetDescrLib CaloGeoHelpers CaloIdentifier AthenaMonitoringLib SGtests Identifier LArIdentifier LArRawEvent LArRecConditions LArCablingLib TrigDecisionToolLib CaloConditions AthenaKernel AthenaPoolUtilities xAODEventInfo LArCOOLConditions LArRawConditions LArRecEvent ) +atlas_add_dictionary( LArStrHelperDict + LArMonitoring/LArStrHelperDict.h + LArMonitoring/selection.xml + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} LArStrHelper) + # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/LArCalorimeter/LArMonitoring/python/GlobalVariables.py b/LArCalorimeter/LArMonitoring/python/GlobalVariables.py index f0a928426d7088a151b2b4f34f3bb8f60cd1cdc9..9a9eaece64a12f0a3af5a5b490fa820ca5594a37 100644 --- a/LArCalorimeter/LArMonitoring/python/GlobalVariables.py +++ b/LArCalorimeter/LArMonitoring/python/GlobalVariables.py @@ -5,6 +5,13 @@ from __future__ import print_function from ROOT import TMath import AthenaCommon.SystemOfUnits as Units +#import cppyy +#cppyy.load_library("libLArStrHelperDict") +#import LArStrHelper +#import ROOT +#ROOT.gROOT.GetClass('LArStrHelper::febNameString') +from ROOT import LArStrHelper + class LArDQGlobals(object): __slots__ = ('HVeta_EMB','HVphi_EMB','HVeta_EMEC','HVphi_EMEC','HVeta_HECFcal','HVphi_HECFcal', 'LB_Bins','LB_Min','LB_Max','BCID_Bins','BCID_Min','BCID_Max', @@ -118,14 +125,19 @@ lArDQGlobals.Sides=["A","C"] #numbers from LArCalorimeter/LArIdentifier/LArIdentifier/LArOnlineID_Base.h -feedthroughString="ft" -slotString="slot" -barrelString="Barrel" -endcapString="Endcap" -lArDQGlobals.febsBarrelA=[barrelString+"A"+feedthroughString+str(i_ft).zfill(2)+slotString+str(i_slot).zfill(2) for i_ft in range_0_32 for i_slot in range_1_15] -lArDQGlobals.febsBarrelC=[barrelString+"C"+feedthroughString+str(i_ft).zfill(2)+slotString+str(i_slot).zfill(2) for i_ft in range_0_32 for i_slot in range_1_15] -lArDQGlobals.febsEndcapA=[endcapString+"A"+feedthroughString+str(i_ft).zfill(2)+slotString+str(i_slot).zfill(2) for i_ft in range_0_25 for i_slot in range_1_16] -lArDQGlobals.febsEndcapC=[endcapString+"C"+feedthroughString+str(i_ft).zfill(2)+slotString+str(i_slot).zfill(2) for i_ft in range_0_25 for i_slot in range_1_16] +#feedthroughString="ft" +#slotString="slot" +#barrelString="Barrel" +#endcapString="Endcap" +larStrHelp=LArStrHelper() +lArDQGlobals.febsBarrelA=[larStrHelp.febNameString(True,1,i_ft,i_slot) for i_ft in range_0_32 for i_slot in range_1_15] +lArDQGlobals.febsBarrelC=[larStrHelp.febNameString(True,0,i_ft,i_slot) for i_ft in range_0_32 for i_slot in range_1_15] +lArDQGlobals.febsEndcapA=[larStrHelp.febNameString(False,1,i_ft,i_slot) for i_ft in range_0_25 for i_slot in range_1_16] +lArDQGlobals.febsEndcapC=[larStrHelp.febNameString(False,0,i_ft,i_slot) for i_ft in range_0_25 for i_slot in range_1_16] +#lArDQGlobals.febsBarrelA=[barrelString+"A"+feedthroughString+str(i_ft).zfill(2)+slotString+str(i_slot).zfill(2) for i_ft in range_0_32 for i_slot in range_1_15] +#lArDQGlobals.febsBarrelC=[barrelString+"C"+feedthroughString+str(i_ft).zfill(2)+slotString+str(i_slot).zfill(2) for i_ft in range_0_32 for i_slot in range_1_15] +#lArDQGlobals.febsEndcapA=[endcapString+"A"+feedthroughString+str(i_ft).zfill(2)+slotString+str(i_slot).zfill(2) for i_ft in range_0_25 for i_slot in range_1_16] +#lArDQGlobals.febsEndcapC=[endcapString+"C"+feedthroughString+str(i_ft).zfill(2)+slotString+str(i_slot).zfill(2) for i_ft in range_0_25 for i_slot in range_1_16] #ROD ranges diff --git a/LArCalorimeter/LArMonitoring/python/LArNoiseCorrelationMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArNoiseCorrelationMonAlg.py index 3b68abe1366cc96cc4dfbb7d00edb12e11670f66..a65572d6d72a485efbb138e72f34ec393c1eec68 100644 --- a/LArCalorimeter/LArMonitoring/python/LArNoiseCorrelationMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArNoiseCorrelationMonAlg.py @@ -31,8 +31,17 @@ def LArNoiseCorrelationMonConfigCore(helper, algoinstance,inputFlags): larNoiseCorrelMonAlg = helper.addAlgorithm(algoinstance,'larNoiseCorrelMonAlg') - #set custom list of FEBs to be monitored (if you want one): each FEB should be passed as a string of the form "BarrelAft01slot10", case sensitive, numbers should have 2 digits (should match function LArNoiseCorrelationMonAlg::febString - customFEBStoMonitor=["BarrelAft03slot09","EndcapCft11slot05","EndcapAft06slot02"] + #set custom list of FEBs to be monitored (if you want one): each FEB should be passed as a string of the form "BarrelAft01slot10" + FEBs_from_DQ_run_350440 = ["endcapAft19slot12","endcapAft19slot09","endcapAft20slot09"] + + customFEBStoMonitor=FEBs_from_DQ_run_350440 + + + #correct custom FEBs for upper-lower cases or single-digit ft and slot numbers (e.g. 3 instead of 03) + from ROOT import LArStrHelper + larStrHelp=LArStrHelper() + customFEBStoMonitor=[larStrHelp.fixFEBname(nm) for nm in customFEBStoMonitor] + # adding BadChan masker private tool from AthenaConfiguration.ComponentFactory import isRun3Cfg @@ -72,7 +81,7 @@ def LArNoiseCorrelationMonConfigCore(helper, algoinstance,inputFlags): larNoiseCorrelMonAlg.IgnoreBadChannels=True larNoiseCorrelMonAlg.TriggerChain = "HLT_noalg_zb_L1ZB, HLT_noalg_cosmiccalo_L1RD1_EMPTY" #turn off for calibration run - larNoiseCorrelMonAlg.IsCalibrationRun = True #test with calibration + larNoiseCorrelMonAlg.IsCalibrationRun = False # larNoiseCorrelMonAlg.LArDigitContainerKey=Gain #test with calibration #deal with custom febs to monitor (if any) @@ -93,6 +102,7 @@ def LArNoiseCorrelationMonConfigCore(helper, algoinstance,inputFlags): febsToMonitorEndcapA=list(setCustomFEBS.intersection(lArDQGlobals.febsEndcapA)) febsToMonitorBarrelC=list(setCustomFEBS.intersection(lArDQGlobals.febsBarrelC)) febsToMonitorEndcapC=list(setCustomFEBS.intersection(lArDQGlobals.febsEndcapC)) + if len(febsToMonitorBarrelA)==0 and len(febsToMonitorEndcapA)==0 and len(febsToMonitorBarrelC)==0 and len(febsToMonitorEndcapC)==0: print("LArNoiseCorrelationMonAlg:WARNING. None of the following FEBs were recognised, no plot will be produced") print(customFEBStoMonitor) @@ -104,7 +114,7 @@ def LArNoiseCorrelationMonConfigCore(helper, algoinstance,inputFlags): # customFEBStoMonitor_forAlgo=[[lArDQGlobals.dictBarrelEndcap[i[0]],lArDQGlobals.dictSides[i[1]],int(i[2]),int(i[3])] for i in customFEBStoMonitor] # larNoiseCorrelMonAlg.FEBsToMonitor=customFEBStoMonitor_forAlgo larNoiseCorrelMonAlg.PlotCustomFEBSset=True - larNoiseCorrelMonAlg.FEBlist=customFEBStoMonitor + larNoiseCorrelMonAlg.FEBlist=febsToMonitorBarrelA+febsToMonitorBarrelC+febsToMonitorEndcapA+febsToMonitorEndcapC pass pass @@ -186,6 +196,7 @@ def LArNoiseCorrelationMonConfigCore(helper, algoinstance,inputFlags): ybins=lArDQGlobals.FEB_N_channels,ymin=lArDQGlobals.FEB_channels_Min,ymax=lArDQGlobals.FEB_channels_Max, pattern=febsToMonitorEndcapC) + print(correlArray) if isRun3Cfg(): cfg.merge(helper.result()) @@ -207,12 +218,8 @@ if __name__=='__main__': from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags createLArMonConfigFlags() - # from AthenaConfiguration.TestDefaults import defaultTestFiles -# ConfigFlags.Input.Files = defaultTestFiles.RAW - - #test on calibration - ConfigFlags.Input.Files = ['/eos/user/m/mspalla/DATA/data18_13TeV.00364098.physics_CosmicCalo.merge.RAW/data18_13TeV.00364098.physics_CosmicCalo.merge.RAW._lb0150._SFO-ALL._0001.1'] -#['/eos/atlas/atlastier0/rucio//data20_calib/calibration_LArElec-Pedestal-5s-High-Barrel-A-RawData/00380631/data20_calib.00380631.calibration_LArElec-Pedestal-5s-High-Barrel-A-RawData.daq.RAW/data20_calib.00380631.calibration_LArElec-Pedestal-5s-High-Barrel-A-RawData.daq.RAW._lb0000._SFO-1._0001.data'] + from AthenaConfiguration.TestDefaults import defaultTestFiles + ConfigFlags.Input.Files = defaultTestFiles.RAW ConfigFlags.Output.HISTFileName = 'LArNoiseCorrMonOutput.root' ConfigFlags.DQ.enableLumiAccess = False diff --git a/LArCalorimeter/LArMonitoring/src/LArNoiseCorrelationMonAlg.cxx b/LArCalorimeter/LArMonitoring/src/LArNoiseCorrelationMonAlg.cxx index d05357d5d70db1268daccb55fa6ebb17d9f1595a..69c02fdb790244c8e641ad02457b3a6b1ffaa236 100644 --- a/LArCalorimeter/LArMonitoring/src/LArNoiseCorrelationMonAlg.cxx +++ b/LArCalorimeter/LArMonitoring/src/LArNoiseCorrelationMonAlg.cxx @@ -1,3 +1,4 @@ + /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -54,6 +55,8 @@ //for looping on FEBs #include "LArRawEvent/LArFebHeaderContainer.h" +//Helper: +#include "LArMonitoring/LArStrHelper.h" //Header: #include "LArNoiseCorrelationMonAlg.h" @@ -175,7 +178,10 @@ LArNoiseCorrelationMonAlg::fillHistograms(const EventContext& ctx) const LArDigitContainer::const_iterator itDig = pLArDigitContainer->begin(); LArDigitContainer::const_iterator itDig_2; LArDigitContainer::const_iterator itDig_e= pLArDigitContainer->end(); - + + /** helper for feb names*/ + LArStrHelper larStrHelp; + /** Loop over digits*/ for ( ; itDig!=itDig_e;++itDig) { const LArDigit* pLArDigit = *itDig; @@ -195,7 +201,8 @@ LArNoiseCorrelationMonAlg::fillHistograms(const EventContext& ctx) const HWIdentifier febID = m_LArOnlineIDHelper->feb_Id(id); int ch1 = m_LArOnlineIDHelper->channel(id); - std::string febSTR = febString(febID); + std::string febSTR = larStrHelp.febNameString(m_LArOnlineIDHelper->isEMBchannel(id),m_LArOnlineIDHelper->pos_neg(id),m_LArOnlineIDHelper->feedthrough(id),m_LArOnlineIDHelper->slot(id)); + //febString(febID); /** If we are only plotting a sub-set of FEBs, check if it belongs to that set */ if(m_plotCustomFEBSset) { bool plotThisFEB=false; diff --git a/LArCalorimeter/LArMonitoring/src/LArNoiseCorrelationMonAlg.h b/LArCalorimeter/LArMonitoring/src/LArNoiseCorrelationMonAlg.h index 16f52379faf9ac71b9e1c5ab4f429417b4685a90..b19d459945ba06d7654ba80d57331b10ec37ecae 100644 --- a/LArCalorimeter/LArMonitoring/src/LArNoiseCorrelationMonAlg.h +++ b/LArCalorimeter/LArMonitoring/src/LArNoiseCorrelationMonAlg.h @@ -64,7 +64,7 @@ private: SG::ReadCondHandleKey<ILArPedestal> m_keyPedestal{this,"LArPedestalKey","LArPedestal","SG key of LArPedestal CDO"}; /** Handle to event info */ - SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "EventInfoKey", "EventInfo"}; + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "EventInfo", "EventInfo"}; /**correlation histograms*/