diff --git a/LArCalorimeter/LArCabling/python/LArCablingAccess.py b/LArCalorimeter/LArCabling/python/LArCablingAccess.py index 2b3ea74506eeb32df8b533f36ce39c4a2474f82e..eedc350ed301b2a83f9e73cf08b5b18a1c6c241a 100644 --- a/LArCalorimeter/LArCabling/python/LArCablingAccess.py +++ b/LArCalorimeter/LArCabling/python/LArCablingAccess.py @@ -23,17 +23,16 @@ def LArOnOffIdMapping(): def LArOnOffIdMappingSC(): condSequence = AthSequencer("AthCondSeq") - if hasattr(condSequence,"LArOnOffMappingAlg"): + folder="/LAR/IdentifierOfl/OnOffIdMap_SC" + if hasattr(condSequence,"LArOnOffMappingAlg") and condSequence.LArOnOffMappingAlg.ReadKey==folder: return #Already there.... - if conddb.isMC: - dbname="LAR_OFL" - else: - dbname="LAR" - - folder="/LAR/IdentifierOfl/OnOffIdMap_SC" - conddb.addFolder(dbname,folder,className="AthenaAttributeList") - condSequence+=LArOnOffMappingAlg(ReadKey=folder, WriteKey="LArOnOffIdMapSC", isSuperCell=True) + #for the moment SC mapping is only in MC database + #and with one tag + #conddb.addFolder(dbname,folder,className="AthenaAttributeList",forceMC=True) + conddb.addFolder("","<db>COOLOFL_LAR/OFLP200</db>"+folder,className="AthenaAttributeList",forceMC=True) + conddb.addOverride(folder,"LARIdentifierOflOnOffIdMap_SC-000") + condSequence+=LArOnOffMappingAlg("LArOnOffMappingAlgSC",ReadKey=folder, WriteKey="LArOnOffIdMapSC", isSuperCell=True) return @@ -68,3 +67,23 @@ def LArCalibIdMapping(): conddb.addFolder(dbname,folder,className="AthenaAttributeList") condSequence+=LArCalibLineMappingAlg(ReadKey=folder) return + +def LArCalibIdMappingSC(): + condSequence = AthSequencer("AthCondSeq") + #temporarily disabled, until conditions will arrive to COOL + #folder="/LAR/Identifier/CalibIdMap" + #if hasattr(condSequence,"LArCalibLineMappingAlg") and condSequence.LArCalibLineMappingAlg.ReadKey==folder: + # return #Already there.... + + #if conddb.isMC: + # dbname="LAR_OFL" + #else: + # dbname="LAR" + #conddb.addFolder(dbname,folder,className="AthenaAttributeList") + # SC only in OFL database + folder="/LAR/IdentifierOfl/CalibIdMap_SC" + dbname="LAR_OFL" + conddb.addFolder("","<db>sqlite://;schema=/afs/cern.ch/user/p/pavol/w0/public/LAr_Reco_SC_22/run/SCCalibMap.db;dbname=OFLP200</db>"+folder,className="AthenaAttributeList",forceMC=True) + conddb.addOverride(folder,"LARIdentifierOflCalibIdMap_SC-000") + condSequence+=LArCalibLineMappingAlg("LArCalibLineMappingAlgSC",ReadKey=folder, WriteKey="LArCalibIdMapSC",isSuperCell=True,MaxCL=16) + return diff --git a/LArCalorimeter/LArCalibTools/LArCalibTools/LArCond2NtupleBase.h b/LArCalorimeter/LArCalibTools/LArCalibTools/LArCond2NtupleBase.h index 3721e0d34787884f22613f0a662eb0fc85b0ebf0..643e17f727862e79bb1d0f6ef5a4c56560e93e35 100644 --- a/LArCalorimeter/LArCalibTools/LArCalibTools/LArCond2NtupleBase.h +++ b/LArCalorimeter/LArCalibTools/LArCalibTools/LArCond2NtupleBase.h @@ -20,11 +20,11 @@ class HWIdentifier; class LArOnlineID_Base; +class CaloCell_Base_ID; class StoreGateSvc; class LArEM_Base_ID; class LArHEC_Base_ID; class LArFCAL_Base_ID; -class CaloCell_ID; class MsgStream; class LArCond2NtupleBase : public AthAlgorithm { @@ -71,11 +71,10 @@ class LArCond2NtupleBase : public AthAlgorithm { const LArHEC_Base_ID* m_hecId; const LArFCAL_Base_ID* m_fcalId; const LArOnlineID_Base* m_onlineId; - const CaloCell_ID* m_caloId; + const CaloCell_Base_ID* m_caloId; ToolHandle<ILArFEBTempTool> m_FEBTempTool; SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}; - SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKeySC{this,"SCCablingKey","LArOnOffIdMapSC","SG Key of SC LArOnOffIdMapping object"}; SG::ReadCondHandleKey<LArBadChannelCont> m_BCKey{this, "BadChanKey", "LArBadChannel", "SG bad channels key"}; SG::ReadCondHandleKey<LArCalibLineMapping> m_calibMapKey{this,"CalibMapKey","LArCalibLineMap","SG Key of calib line mapping object"}; diff --git a/LArCalorimeter/LArCalibTools/src/LArCond2NtupleBase.cxx b/LArCalorimeter/LArCalibTools/src/LArCond2NtupleBase.cxx index 70ea0c0d55657276b6f968b4a478878b076e9890..4be41544d68d53b1d0548c0a1ef75e99b0fbaaab 100644 --- a/LArCalorimeter/LArCalibTools/src/LArCond2NtupleBase.cxx +++ b/LArCalorimeter/LArCalibTools/src/LArCond2NtupleBase.cxx @@ -7,6 +7,8 @@ #include "LArIdentifier/LArOnlineID.h" #include "LArIdentifier/LArOnline_SuperCellID.h" #include "CaloIdentifier/CaloCell_ID.h" +#include "CaloIdentifier/CaloCell_SuperCell_ID.h" +#include "CaloIdentifier/CaloIdManager.h" LArCond2NtupleBase::LArCond2NtupleBase(const std::string& name, ISvcLocator* pSvcLocator): AthAlgorithm(name, pSvcLocator), m_initialized(false), m_nt(NULL), @@ -62,17 +64,37 @@ StatusCode LArCond2NtupleBase::initialize() { m_detStore= &(*detStore()); //for backward compatiblity - const CaloCell_ID* idHelper = nullptr; + const CaloIdManager* calo_id_manager; + ATH_CHECK(detStore()->retrieve(calo_id_manager,"CaloIdManager")); + + StatusCode sc; if ( m_isSC ){ - ATH_CHECK( detStore()->retrieve (idHelper, "CaloCell_SuperCell_ID") ); - } - else { - ATH_CHECK( detStore()->retrieve (idHelper, "CaloCell_ID") ); - ATH_CHECK( detStore()->retrieve (m_caloId, "CaloCell_ID") ); - } - m_emId=idHelper->em_idHelper(); - m_fcalId=idHelper->fcal_idHelper(); - m_hecId=idHelper->hec_idHelper(); + const LArOnline_SuperCellID* ll; + sc = detStore()->retrieve(ll, "LArOnline_SuperCellID"); + if (sc.isFailure()) { + ATH_MSG_ERROR( "Could not get LArOnlineID helper !" ); + return StatusCode::FAILURE; + } else { + m_onlineId = ll; + ATH_MSG_DEBUG("Found the LArOnlineID helper"); + } + m_caloId = calo_id_manager->getCaloCell_SuperCell_ID(); + } else { // m_isSC + const LArOnlineID* ll; + sc = detStore()->retrieve(ll, "LArOnlineID"); + if (sc.isFailure()) { + msg(MSG::ERROR) << "Could not get LArOnlineID helper !" << endmsg; + return StatusCode::FAILURE; + } else { + m_onlineId = ll; + ATH_MSG_DEBUG(" Found the LArOnlineID helper. "); + } + m_caloId = calo_id_manager->getCaloCell_ID(); + } // end of m_isSC if + + m_emId=m_caloId->em_idHelper(); + m_fcalId=m_caloId->fcal_idHelper(); + m_hecId=m_caloId->hec_idHelper(); if (!m_emId) { ATH_MSG_ERROR( "Could not access lar EM ID helper" ); @@ -88,31 +110,6 @@ StatusCode LArCond2NtupleBase::initialize() { } - StatusCode sc; - if ( m_isSC ){ - const LArOnline_SuperCellID* ll; - sc = detStore()->retrieve(ll, "LArOnline_SuperCellID"); - if (sc.isFailure()) { - ATH_MSG_ERROR( "Could not get LArOnlineID helper !" ); - return StatusCode::FAILURE; - } - else { - m_onlineId = (const LArOnlineID_Base*)ll; - ATH_MSG_DEBUG("Found the LArOnlineID helper"); - } - - } else { // m_isSC - const LArOnlineID* ll; - sc = detStore()->retrieve(ll, "LArOnlineID"); - if (sc.isFailure()) { - msg(MSG::ERROR) << "Could not get LArOnlineID helper !" << endmsg; - return StatusCode::FAILURE; - } else { - m_onlineId = (const LArOnlineID_Base*)ll; - ATH_MSG_DEBUG(" Found the LArOnlineID helper. "); - } - - } // end of m_isSC if if (m_addFEBTemp) { sc = m_FEBTempTool.retrieve(); @@ -125,7 +122,6 @@ StatusCode LArCond2NtupleBase::initialize() { ATH_CHECK( m_BCKey.initialize() ); ATH_CHECK( m_cablingKey.initialize() ); ATH_CHECK( m_calibMapKey.initialize() ); - if ( m_isSC ) ATH_CHECK( m_cablingKeySC.initialize() ); //Online-identifier variables sc=nt->addItem("channelId",m_onlChanId,0x38000000,0x3A000000); @@ -173,13 +169,12 @@ StatusCode LArCond2NtupleBase::initialize() { return StatusCode::FAILURE; } - if ( !m_isSC) { - sc=nt->addItem("calibLine",m_calibLine,0,127); - if (sc!=StatusCode::SUCCESS) { - ATH_MSG_ERROR( "addItem 'calibLine' failed" ); - return StatusCode::FAILURE; - } + sc=nt->addItem("calibLine",m_calibLine,0,127); + if (sc!=StatusCode::SUCCESS) { + ATH_MSG_ERROR( "addItem 'calibLine' failed" ); + return StatusCode::FAILURE; } + sc=nt->addItem("isConnected",m_isConnected,0,1); if (sc!=StatusCode::SUCCESS) { @@ -277,14 +272,8 @@ bool LArCond2NtupleBase::fillFromIdentifier(const HWIdentifier& hwid) { ATH_MSG_WARNING( "Do not have calib line mapping !!!" ); return false; } - const LArOnOffIdMapping* cabling=nullptr; - if(!m_isSC) { - SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey}; - cabling = *cablingHdl; - } else { - SG::ReadCondHandle<LArOnOffIdMapping> cablingHdlSC{m_cablingKeySC}; - cabling = *cablingHdlSC; - } + SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey}; + const LArOnOffIdMapping* cabling=*cablingHdl; if(!cabling) { ATH_MSG_WARNING( "Do not have cabling !" ); return false; @@ -303,11 +292,10 @@ bool LArCond2NtupleBase::fillFromIdentifier(const HWIdentifier& hwid) { m_febHash=m_onlineId->feb_Hash(m_onlineId->feb_Id(hwid)); } - if ( !m_isSC) { m_calibLine=NOT_VALID; const std::vector<HWIdentifier>& calibLineV=clCont->calibSlotLine(hwid); if(calibLineV.size()) m_calibLine = m_onlineId->channel(calibLineV[0]); - } + m_detector=NOT_VALID; m_region=NOT_VALID; diff --git a/LArCalorimeter/LArCalibUtils/src/LArCalibDigitMaker.cxx b/LArCalorimeter/LArCalibUtils/src/LArCalibDigitMaker.cxx index b30bad857fc91b6ea03d438334d1cdfdbc3db51c..7a4a666a50e156c3daf4e1a090c0ec688a3ece9a 100644 --- a/LArCalorimeter/LArCalibUtils/src/LArCalibDigitMaker.cxx +++ b/LArCalorimeter/LArCalibUtils/src/LArCalibDigitMaker.cxx @@ -134,8 +134,9 @@ StatusCode LArCalibDigitMaker::execute() { const std::vector<short>& samples=(*it)->samples(); CaloGain::CaloGain gain=(*it)->gain(); const std::vector<HWIdentifier>& calibChannelIDs=clcabling->calibSlotLine(chid); - if (calibChannelIDs.size()==0) + if (calibChannelIDs.size()==0) { continue; //Disconnected channel + } //For the time beeing, I assume we are in H8 and have only one calib channel per FEB channel std::vector<HWIdentifier>::const_iterator csl_it=calibChannelIDs.begin(); //Now the CalibBoard settings: @@ -144,13 +145,12 @@ StatusCode LArCalibDigitMaker::execute() { uint16_t delay=calibParams->Delay(eventNb,*csl_it); bool ispulsed=calibParams->isPulsed(eventNb,*csl_it); //build LArCalibDigit: - // std::cout << "Event:" << eventNb - // << "Building a LArCalibDigit with DAC=" << dac << ", Delay=" << delay << ", isPulsed=" << ispulsed << std::endl; + LArCalibDigit* calibDigit=new LArCalibDigit(chid,gain, samples, dac, delay, ispulsed); calibDigitContainer->push_back(calibDigit); } //End iteration to build calibDigits ATH_CHECK( evtStore()->record(calibDigitContainer,*key_it) ); - //log << MSG::DEBUG << "LArCalibDigitContainer recorded to StoreGate. key=" << m_key << endmsg; + ATH_MSG_DEBUG ("LArCalibDigitContainer recorded to StoreGate. key=" << *key_it ); } //End loop key list return StatusCode::SUCCESS; } diff --git a/LArCalorimeter/LArCnv/LArByteStream/src/ABBAMapping.cxx b/LArCalorimeter/LArCnv/LArByteStream/src/ABBAMapping.cxx index b159a4cade578cd39385da6c06ba11deb1c5305a..62c552f12a550c9491b7d4ae56c794debc64333f 100755 --- a/LArCalorimeter/LArCnv/LArByteStream/src/ABBAMapping.cxx +++ b/LArCalorimeter/LArCnv/LArByteStream/src/ABBAMapping.cxx @@ -14,7 +14,7 @@ typedef std::map<int, HWIdentifier> abba_map; }*/ void add_to_map_2(abba_map* map, long value, int key) { - HWIdentifier identifier((HWIdentifier::value_type) value); + HWIdentifier identifier((HWIdentifier::value_type) (value<<32)); (*map)[key] = identifier; } diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py index 7c7b02612460cd88a05fc25cda11f3521844fc4f..2cdfac3fa703c0c99971e490b5e3093a4b092db1 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py @@ -420,6 +420,14 @@ DelayOFCLog.info( " ======================================================== " ) include ("LArConditionsCommon/LArMinimalSetup.py") +from LArCabling.LArCablingAccess import LArOnOffIdMapping +LArOnOffIdMapping() +if SuperCells: + from LArCabling.LArCablingAccess import LArOnOffIdMappingSC,LArCalibIdMappingSC + LArOnOffIdMappingSC() + LArCalibIdMappingSC() +from LArBadChannelTool.LArBadChannelAccess import LArBadChannelAccess +LArBadChannelAccess() # # Provides ByteStreamInputSvc name of the data file to process in the offline context @@ -529,28 +537,28 @@ include("LArCondAthenaPool/LArCondAthenaPool_joboptions.py") from IOVDbSvc.CondDB import conddb PoolFileList = [] -include ("LArCalibProcessing/LArCalib_BadChanTool.py") +#include ("LArCalibProcessing/LArCalib_BadChanTool.py") + if not 'InputBadChannelSQLiteFile' in dir(): DelayOFCLog.info( "Read Bad Channels from Oracle DB") else : DelayOFCLog. info( "Read Bad Channels from SQLite file") -if 'BadChannelsLArCalibFolderTag' in dir() : +if 'BadChannelsFolder' in dir(): + if 'BadChannelsLArCalibFolderTag' in dir() : BadChannelsTagSpec = LArCalibFolderTag (BadChannelsFolder,BadChannelsLArCalibFolderTag) conddb.addFolder("",BadChannelsFolder+"<tag>"+BadChannelsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>") -else : + else : conddb.addFolder("",BadChannelsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>") -if 'MissingFEBsLArCalibFolderTag' in dir() : +if 'MissingFEBsFolder' in dir(): + if 'MissingFEBsLArCalibFolderTag' in dir() : MissingFEBsTagSpec = LArCalibFolderTag (MissingFEBsFolder,MissingFEBsLArCalibFolderTag) conddb.addFolder("",MissingFEBsFolder+"<tag>"+MissingFEBsTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>") -else : + else : conddb.addFolder("",MissingFEBsFolder+"<dbConnection>"+InputDBConnectionBadChannel+"</dbConnection>") -if SuperCells: - conddb.addFolder("","/LAR/IdentifierOfl/OnOffIdMap_SC<db>COOLOFL_LAR/OFLP200</db><tag>LARIdentifierOflOnOffIdMap_SC-000</tag>") - ## define the DB Gobal Tag : svcMgr.IOVDbSvc.GlobalTag = LArCalib_Flags.globalFlagDB try: @@ -672,6 +680,9 @@ if StripsXtalkCorr: LArCaliWaveBuilder.ADCsaturation = 0 else: LArCaliWaveBuilder.ADCsaturation = ADCsaturation + +if SuperCells: + LArCaliWaveBuilder.CablingKey="LArOnOffIdMapSC" topSequence+=LArCaliWaveBuilder @@ -844,6 +855,8 @@ if (WriteNtuple): LArCaliWaves2Ntuple.SaveJitter = SaveJitter LArCaliWaves2Ntuple.KeyList = [ KeyOutput ] LArCaliWaves2Ntuple.isSC = SuperCells + if SuperCells: + LArCaliWaves2Ntuple.CalibMapKey = "LArCalibIdMapSC" topSequence+=LArCaliWaves2Ntuple diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py index 23fa746b1bf8c3c4bf47986e85c64dd808656618..cd1b27da29fe28e0cba9b04387218ce4199644e3 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py @@ -245,6 +245,15 @@ PedestalAutoCorrLog.info( " ==================================================== ####################################################################################### include ("LArConditionsCommon/LArMinimalSetup.py") +# new way to configure mapping: +# we need standard mapping for BadChannelAlg, there is no SC bad channel DB yet +from LArCabling.LArCablingAccess import LArCalibIdMapping,LArOnOffIdMapping +LArOnOffIdMapping() +LArCalibIdMapping() +if SuperCells: + from LArCabling.LArCablingAccess import LArCalibIdMappingSC,LArOnOffIdMappingSC + LArOnOffIdMappingSC() + LArCalibIdMappingSC() # # Provides ByteStreamInputSvc name of the data file to process in the offline context @@ -452,6 +461,7 @@ if runAccumulator: LArAutoCorrMaker.Nsamples = NSamples LArAutoCorrMaker.KeyOutput = KeyOutputAC LArAutoCorrMaker.GroupingType = GroupingType + LArAutoCorrMaker.BunchCrossingTool = "" topSequence += LArAutoCorrMaker @@ -476,8 +486,6 @@ else : # # ###################################################################### -from xAODEventInfoCnv.xAODEventInfoCreator import xAODMaker__EventInfoCnvAlg -topSequence+=xAODMaker__EventInfoCnvAlg() if ( doLArCalibDataQuality ) : from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker @@ -619,7 +627,7 @@ if ( doMonitoring ) : svcMgr += THistSvc() #svcMgr.THistSvc.Output = ["AllMon DATAFILE='"+OutputPedAutoCorrRootFileDir + "/" +RootHistOutputFileName+"' OPT='New'"] - svcMgr.THistSvc.Output = ["GLOBAL DATAFILE='"+OutputPedAutoCorrRootFileDir + "/" +RootHistOutputFileName+"' OPT='New'"] + svcMgr.THistSvc.Output = ["GLOBAL DATAFILE='"+OutputPedAutoCorrRootFileDir + "/" +RootHistOutputFileName+"' OPT='RECREATE'"] @@ -631,7 +639,10 @@ if ( WriteNtuple ) : LArPedestals2Ntuple.ContainerKey = KeyOutputPed LArPedestals2Ntuple.AddFEBTempInfo = False LArPedestals2Ntuple.isSC = SuperCells - + if SuperCells: + LArPedestals2Ntuple.CablingKey = "LArOnOffIdMapSC" + LArPedestals2Ntuple.CalibMapKey = "LArCalibIdMapSC" + topSequence += LArPedestals2Ntuple if AutoCorr : @@ -641,7 +652,10 @@ if ( WriteNtuple ) : LArAutoCorr2Ntuple.AddFEBTempInfo = False LArAutoCorr2Ntuple.ContainerKey = KeyOutputAC LArAutoCorr2Ntuple.isSC = SuperCells - + if SuperCells: + LArAutoCorr2Ntuple.CablingKey = "LArOnOffIdMapSC" + LArAutoCorr2Ntuple.CalibMapKey = "LArCalibIdMapSC" + topSequence += LArAutoCorr2Ntuple theApp.HistogramPersistency = "ROOT" diff --git a/LArCalorimeter/LArIdentifier/LArIdentifier/LArOnline_SuperCellID.h b/LArCalorimeter/LArIdentifier/LArIdentifier/LArOnline_SuperCellID.h index 7e6879bdc16e90f27a6a88c1029c6a1f93580529..dec5c5f93d743caa6ee8bf439fab70223f78e553 100755 --- a/LArCalorimeter/LArIdentifier/LArIdentifier/LArOnline_SuperCellID.h +++ b/LArCalorimeter/LArIdentifier/LArIdentifier/LArOnline_SuperCellID.h @@ -41,8 +41,6 @@ private: }; -static const int s_slar_online_field_value = 4 ; - CLASS_DEF( LArOnline_SuperCellID , 115600394 , 1 ) #endif // LARONLINE_ID_H diff --git a/LArCalorimeter/LArROD/LArROD/LArCalibDigitsAccumulator.h b/LArCalorimeter/LArROD/LArROD/LArCalibDigitsAccumulator.h index 943628aaa145365aa0440f06808ae3685f8b9b4b..20291f0ff284465347bf0fc69c4461dd3430aa81 100644 --- a/LArCalorimeter/LArROD/LArROD/LArCalibDigitsAccumulator.h +++ b/LArCalorimeter/LArROD/LArROD/LArCalibDigitsAccumulator.h @@ -23,7 +23,7 @@ #include "GaudiKernel/ToolHandle.h" #include "LArRawEvent/LArCalibDigitContainer.h" #include "LArRawEvent/LArAccumulatedCalibDigitContainer.h" -#include "LArIdentifier/LArOnlineID.h" +#include "LArIdentifier/LArOnlineID_Base.h" #include "StoreGate/StoreGateSvc.h" #include "LArRawConditions/LArCalibParams.h" #include "LArRecConditions/LArCalibLineMapping.h" @@ -54,7 +54,7 @@ public: private: SG::ReadCondHandleKey<LArCalibLineMapping> m_calibMapKey{this,"CalibCablingKey","LArCalibLineMap","SG Key of LArCalibLineMapping object"}; - const LArOnlineID* m_onlineHelper; + const LArOnlineID_Base* m_onlineHelper; typedef std::vector<LArAccumulatedCalibDigit*> ACCUMDIGIT_VEC; ACCUMDIGIT_VEC m_my_vec; @@ -89,6 +89,11 @@ private: * */ bool m_keepPulsed; + /** + * @brief Tells you wether you run on SuperCells or Cells + * */ + bool m_isSC; + /** * @brief Vector (index=hash ID) of accumulation quantities * */ diff --git a/LArCalorimeter/LArROD/src/LArCalibDigitsAccumulator.cxx b/LArCalorimeter/LArROD/src/LArCalibDigitsAccumulator.cxx index 16310c9cd25740ea7307bfefce839f10878fef7f..cdf9a1abbc4e09c6e4ed239898bcca6feb4e3a95 100644 --- a/LArCalorimeter/LArROD/src/LArCalibDigitsAccumulator.cxx +++ b/LArCalorimeter/LArROD/src/LArCalibDigitsAccumulator.cxx @@ -3,6 +3,8 @@ */ #include "LArROD/LArCalibDigitsAccumulator.h" +#include "LArIdentifier/LArOnlineID.h" +#include "LArIdentifier/LArOnline_SuperCellID.h" #include "CLHEP/Units/SystemOfUnits.h" #include <math.h> @@ -12,18 +14,14 @@ using CLHEP::ns; LArCalibDigitsAccumulator::LArCalibDigitsAccumulator (const std::string& name, ISvcLocator* pSvcLocator): AthAlgorithm(name, pSvcLocator), - m_onlineHelper(0), - m_calibAccuDigitContainerName("LArAccumulatedCalibDigits"), - m_nStepTrigger(1), - m_delayScale(1*ns), - m_keepPulsed(false) + m_onlineHelper(0) { - declareProperty("LArAccuCalibDigitContainerName",m_calibAccuDigitContainerName); + declareProperty("LArAccuCalibDigitContainerName",m_calibAccuDigitContainerName, "LArAccumulatedCalibDigits"); declareProperty("KeyList",m_keylist); - declareProperty("StepOfTriggers",m_nStepTrigger); - declareProperty("DelayScale",m_delayScale); - declareProperty("KeepOnlyPulsed",m_keepPulsed); - + declareProperty("StepOfTriggers",m_nStepTrigger=1); + declareProperty("DelayScale",m_delayScale=1*ns); + declareProperty("KeepOnlyPulsed",m_keepPulsed=false); + declareProperty("isSC",m_isSC=false); m_delay=-1; m_event_counter=0; } @@ -32,7 +30,28 @@ LArCalibDigitsAccumulator::LArCalibDigitsAccumulator (const std::string& name, I StatusCode LArCalibDigitsAccumulator::initialize(){ // retrieve online ID helper - ATH_CHECK( detStore()->retrieve(m_onlineHelper, "LArOnlineID") ); + StatusCode sc; + if(m_isSC){ + const LArOnline_SuperCellID *scid; + sc = detStore()->retrieve(scid, "LArOnline_SuperCellID"); + if (sc.isFailure()) { + ATH_MSG_ERROR( "Could not get LArOnline_SuperCellID helper !" ); + return sc; + } else { + m_onlineHelper = (const LArOnlineID_Base*)scid; + ATH_MSG_DEBUG("Found the LArOnlineID helper"); + } + } else { + const LArOnlineID* ll; + sc = detStore()->retrieve(ll, "LArOnlineID"); + if (sc.isFailure()) { + ATH_MSG_ERROR( "Could not get LArOnlineID helper !" ); + return sc; + } else { + m_onlineHelper = (const LArOnlineID_Base*)ll; + ATH_MSG_DEBUG(" Found the LArOnlineID helper. "); + } + } //m_isSC ATH_CHECK( m_calibMapKey.initialize() ); diff --git a/LArCalorimeter/LArRecConditions/LArRecConditions/LArCalibLineMapping.h b/LArCalorimeter/LArRecConditions/LArRecConditions/LArCalibLineMapping.h index 84ef422d6e12cdd8ac3935832ca4601e4d08d430..0f80f883a69a94dda4a25cb2ca1e068e214bdb3d 100644 --- a/LArCalorimeter/LArRecConditions/LArRecConditions/LArCalibLineMapping.h +++ b/LArCalorimeter/LArRecConditions/LArRecConditions/LArCalibLineMapping.h @@ -1,7 +1,7 @@ //Dear emacs, this is -*-c++-*- /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef LARRECCONDITIONS_LARCALIBLINEMAPPING_ @@ -12,7 +12,7 @@ #include "Identifier/IdentifierHash.h" #include <vector> -class LArOnlineID; +class LArOnlineID_Base; class LArCalibLineMapping { @@ -20,14 +20,14 @@ class LArCalibLineMapping { public: LArCalibLineMapping()=delete; - LArCalibLineMapping(const LArOnlineID* onlineId); + LArCalibLineMapping(const LArOnlineID_Base* onlineId); const std::vector<HWIdentifier>& calibSlotLine(const HWIdentifier id) const; const std::vector<HWIdentifier>& calibSlotLineFromHash(const IdentifierHash h) const; private: std::vector<std::vector<HWIdentifier> > m_onlHashToCalibLines; - const LArOnlineID* m_onlineId ; + const LArOnlineID_Base* m_onlineId ; }; diff --git a/LArCalorimeter/LArRecConditions/src/LArCalibLineMapping.cxx b/LArCalorimeter/LArRecConditions/src/LArCalibLineMapping.cxx index 158b70be191060b42d170d259c1307514de7d8f0..41eb1a8ec0416643663c50d0b6d902d8b8992d36 100644 --- a/LArCalorimeter/LArRecConditions/src/LArCalibLineMapping.cxx +++ b/LArCalorimeter/LArRecConditions/src/LArCalibLineMapping.cxx @@ -3,10 +3,10 @@ */ #include "LArRecConditions/LArCalibLineMapping.h" -#include "LArIdentifier/LArOnlineID.h" +#include "LArIdentifier/LArOnlineID_Base.h" -LArCalibLineMapping::LArCalibLineMapping(const LArOnlineID* onlineId) : +LArCalibLineMapping::LArCalibLineMapping(const LArOnlineID_Base* onlineId) : m_onlineId(onlineId) {} diff --git a/LArCalorimeter/LArRecUtils/src/LArCalibLineMappingAlg.cxx b/LArCalorimeter/LArRecUtils/src/LArCalibLineMappingAlg.cxx index 65a32239f0513066c8652af72061c62a953aec04..c251f7a39a36f2a1608550a628d0c4c47baa1c3e 100644 --- a/LArCalorimeter/LArRecUtils/src/LArCalibLineMappingAlg.cxx +++ b/LArCalorimeter/LArRecUtils/src/LArCalibLineMappingAlg.cxx @@ -9,17 +9,21 @@ #include "CoralBase/Blob.h" #include "LArIdentifier/LArOnlineID.h" +#include "LArIdentifier/LArOnline_SuperCellID.h" LArCalibLineMappingAlg::LArCalibLineMappingAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_readKey("/LAR/Identifier/CalibIdMap"), - m_writeKey("LArCalibLineMap","LArCalibLineMap"), - m_condSvc("CondSvc",name) + m_writeKey("LArCalibLineMap"), + m_condSvc("CondSvc",name), + m_isSuperCell(false), + m_maxCalibLines(4) { declareProperty("ReadKey",m_readKey); declareProperty("WriteKey",m_writeKey); - //declareProperty("isSuperCell",m_isSuperCell,"switch to true to use the SuperCell Identfier helper"); + declareProperty("isSuperCell",m_isSuperCell); + declareProperty("MaxCL",m_maxCalibLines,"in case of SuperCell should be set to higher value then default 4"); } LArCalibLineMappingAlg::~LArCalibLineMappingAlg() {} @@ -60,9 +64,17 @@ StatusCode LArCalibLineMappingAlg::execute() { return StatusCode::FAILURE; } - const LArOnlineID* onlineID; - ATH_CHECK(detStore()->retrieve(onlineID,"LArOnlineID")); - + const LArOnlineID_Base* onlineID; + if(m_isSuperCell) { + const LArOnline_SuperCellID* scidhelper; + ATH_CHECK(detStore()->retrieve(scidhelper,"LArOnline_SuperCellID")); + onlineID=scidhelper; //cast to base-class + } else { + const LArOnlineID* idhelper; + ATH_CHECK(detStore()->retrieve(idhelper,"LArOnlineID")); + onlineID=idhelper; //cast to base-class + } + std::unique_ptr<LArCalibLineMapping> calibLineMap=std::make_unique<LArCalibLineMapping>(onlineID); std::vector<std::vector<HWIdentifier> >&onlHashToCalibLines=calibLineMap->m_onlHashToCalibLines; //basically a shorthand @@ -82,7 +94,7 @@ StatusCode LArCalibLineMappingAlg::execute() { for (;blobIdx<nEntries && chanIdx<chanMax;++chanIdx) { const unsigned nCalibLines=pBlobCalib[blobIdx++]; totCalibLines+=nCalibLines; - if (nCalibLines>4) { + if (nCalibLines>m_maxCalibLines) { msg(MSG::ERROR) << "Found unresonable large number of calib lines (" << nCalibLines << ") for channel hash " << chanIdx << endmsg; return StatusCode::FAILURE; } diff --git a/LArCalorimeter/LArRecUtils/src/LArCalibLineMappingAlg.h b/LArCalorimeter/LArRecUtils/src/LArCalibLineMappingAlg.h index 7d15f577b1af1ec8b703963c8aea9c3ba0a5ba66..73964ea7869ba130b47e607a40a3fc8bdc6aac92 100644 --- a/LArCalorimeter/LArRecUtils/src/LArCalibLineMappingAlg.h +++ b/LArCalorimeter/LArRecUtils/src/LArCalibLineMappingAlg.h @@ -29,7 +29,8 @@ public: SG::ReadCondHandleKey<AthenaAttributeList> m_readKey; SG::WriteCondHandleKey<LArCalibLineMapping> m_writeKey; ServiceHandle<ICondSvc> m_condSvc; - //bool m_isSuperCell; + bool m_isSuperCell; + unsigned m_maxCalibLines; }; diff --git a/LArCalorimeter/LArRecUtils/src/LArOnOffMappingAlg.cxx b/LArCalorimeter/LArRecUtils/src/LArOnOffMappingAlg.cxx index a3b8401c5579f7fdbc93c388bc7554831d6702aa..1eb01fc333509b0bf1de08e2492650d5601ed1fd 100644 --- a/LArCalorimeter/LArRecUtils/src/LArOnOffMappingAlg.cxx +++ b/LArCalorimeter/LArRecUtils/src/LArOnOffMappingAlg.cxx @@ -17,7 +17,7 @@ LArOnOffMappingAlg::LArOnOffMappingAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_readKey("/LAr/Identifier/OnOnffMap"), - m_writeKey("LArOnOffIdMap","LArOnOffIdMap"), + m_writeKey("LArOnOffIdMap"), m_condSvc("CondSvc",name), m_isSuperCell(false) {