ATLAS Offline Software
DigitEffiData.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
5 #include "GeoModelKernel/throwExcept.h"
6 
7 namespace Muon{
8  DigitEffiData::DigitEffiData(const Muon::IMuonIdHelperSvc* idHelperSvc, double defaultEffi):
9  AthMessaging{"DigitEffiData"},
10  m_idHelperSvc{idHelperSvc},
11  m_defaultEffi{defaultEffi}{}
12 
13  Identifier DigitEffiData::getLookUpId(const Identifier& channelId, bool isInnerQ1 /*=false*/) const {
14  Identifier lookUpId{};
17  case TechIndex::MDT:
18  lookUpId = channelId;
19  break;
20  case TechIndex::RPC:
21  case TechIndex::TGC:
22  case TechIndex::CSCI:
23  lookUpId = m_idHelperSvc->gasGapId(channelId);
24  break;
25  case TechIndex::MM:
26  lookUpId = m_idHelperSvc->mmIdHelper().febID(channelId);
27  break;
28  case TechIndex::STGC:
29  lookUpId = m_idHelperSvc->stgcIdHelper().hvID(channelId, isInnerQ1);
30  break;
31  default:
32  THROW_EXCEPTION("Invalid muon technology");
33  };
34  return lookUpId;
35  }
36  double DigitEffiData::getEfficiency(const Identifier& channelId, bool isInnerQ1 /*=false*/) const {
37  EffiMap::const_iterator effi_itr = m_effiData.find(getLookUpId(channelId, isInnerQ1));
38  if (effi_itr != m_effiData.end()) {
39  ATH_MSG_VERBOSE("Channel "<<m_idHelperSvc->toString(channelId) <<" has an efficiency of "<<effi_itr->second);
40  return effi_itr->second;
41  }
42  ATH_MSG_VERBOSE("Efficiency of channel "<<m_idHelperSvc->toString(channelId)<<" is unknown. Return 1.");
43  return m_defaultEffi;
44  }
45 
46  StatusCode DigitEffiData::setEfficiency(const Identifier& channelId, const double effi, bool isInnerQ1 /*=false*/){
47  const Identifier gasGapId = getLookUpId(channelId, isInnerQ1);
48  auto insert_itr = m_effiData.insert(std::make_pair(gasGapId, effi));
49  if (!insert_itr.second) {
50  ATH_MSG_ERROR("An efficiency for gasGap "<<m_idHelperSvc->toString(gasGapId)
51  <<" has already been stored "<<m_effiData[gasGapId]<<" vs. "<<effi);
52  return StatusCode::FAILURE;
53  }
54  return StatusCode::SUCCESS;
55  }
56 }
TGC
@ TGC
Definition: RegSelEnums.h:33
STGC
@ STGC
Definition: RegSelEnums.h:39
Muon::IMuonIdHelperSvc::stgcIdHelper
virtual const sTgcIdHelper & stgcIdHelper() const =0
access to TgcIdHelper
Muon::DigitEffiData::m_effiData
EffiMap m_effiData
Definition: DigitEffiData.h:36
Muon::DigitEffiData::DigitEffiData
DigitEffiData(const Muon::IMuonIdHelperSvc *idHelperSvc, double defaultEffi)
Constructor taking the pointer to the IdHelperSvc & defining a default efficiency for cases wher the ...
Definition: DigitEffiData.cxx:8
MmIdHelper::febID
Identifier febID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int radius) const
Definition: MmIdHelper.cxx:340
MM
@ MM
Definition: RegSelEnums.h:38
Muon::DigitEffiData::m_idHelperSvc
const Muon::IMuonIdHelperSvc * m_idHelperSvc
Definition: DigitEffiData.h:34
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
THROW_EXCEPTION
#define THROW_EXCEPTION(MSG)
Definition: MMReadoutElement.cxx:48
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
Muon::IMuonIdHelperSvc::mmIdHelper
virtual const MmIdHelper & mmIdHelper() const =0
access to CscIdHelper
sTgcDigitEffiDump.effi
list effi
Definition: sTgcDigitEffiDump.py:38
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Muon::DigitEffiData::setEfficiency
StatusCode setEfficiency(const Identifier &sectionId, const double effi, bool isInnerQ1=false)
Sets the efficiency for a given minimal section of the dector.
Definition: DigitEffiData.cxx:46
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Muon::DigitEffiData::getLookUpId
Identifier getLookUpId(const Identifier &channelId, bool isInnerQ1=false) const
Definition: DigitEffiData.cxx:13
Muon::DigitEffiData::getEfficiency
double getEfficiency(const Identifier &channelId, bool isInnerQ1=false) const
Returns the signal generation efficiency of the sTgc channel.
Definition: DigitEffiData.cxx:36
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
Muon::IMuonIdHelperSvc::technologyIndex
virtual MuonStationIndex::TechnologyIndex technologyIndex(const Identifier &id) const =0
calculate layer index from Identifier
RPC
@ RPC
Definition: RegSelEnums.h:32
Muon::IMuonIdHelperSvc::gasGapId
virtual Identifier gasGapId(const Identifier &id) const =0
create a gasGap ID (will return layer Id for MDTs)
Muon::IMuonIdHelperSvc::toString
virtual std::string toString(const Identifier &id) const =0
print all fields to string
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:27
DigitEffiData.h
sTgcIdHelper::hvID
Identifier hvID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, bool isInnerQ1) const
Definition: sTgcIdHelper.cxx:339
Muon::DigitEffiData::m_defaultEffi
double m_defaultEffi
Definition: DigitEffiData.h:37
Muon::MuonStationIndex::TechnologyIndex
TechnologyIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:54
MDT
@ MDT
Definition: RegSelEnums.h:31
Identifier
Definition: IdentifierFieldParser.cxx:14