ATLAS Offline Software
Loading...
Searching...
No Matches
DigitEffiData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
5#include "GeoModelKernel/throwExcept.h"
6
7namespace 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{};
16 switch (m_idHelperSvc->technologyIndex(channelId)){
17 case TechIndex::MDT:
18 lookUpId = channelId;
19 break;
20 case TechIndex::RPC:
21 lookUpId = m_idHelperSvc->layerId(channelId);
22 break;
23 case TechIndex::TGC:
24 case TechIndex::CSC:
25 lookUpId = m_idHelperSvc->gasGapId(channelId);
26 break;
27 case TechIndex::MM:
28 lookUpId = m_idHelperSvc->mmIdHelper().febID(channelId);
29 break;
30 case TechIndex::STGC:
31 lookUpId = m_idHelperSvc->stgcIdHelper().hvID(channelId, isInnerQ1);
32 break;
33 default:
34 THROW_EXCEPTION("Invalid muon technology");
35 };
36 return lookUpId;
37 }
38 double DigitEffiData::getEfficiency(const Identifier& channelId, bool isInnerQ1 /*=false*/) const {
39 EffiMap::const_iterator effi_itr = m_effiData.find(getLookUpId(channelId, isInnerQ1));
40 if (effi_itr != m_effiData.end()) {
41 ATH_MSG_VERBOSE("Channel "<<m_idHelperSvc->toString(channelId) <<" has an efficiency of "<<effi_itr->second);
42 return effi_itr->second;
43 }
44 ATH_MSG_VERBOSE("Efficiency of channel "<<m_idHelperSvc->toString(channelId)<<" is unknown. Return 1.");
45 return m_defaultEffi;
46 }
47
48 StatusCode DigitEffiData::setEfficiency(const Identifier& channelId, const double effi, bool isInnerQ1 /*=false*/){
49 const Identifier gasGapId = getLookUpId(channelId, isInnerQ1);
50 auto insert_itr = m_effiData.insert(std::make_pair(gasGapId, effi));
51 if (!insert_itr.second) {
52 ATH_MSG_ERROR("An efficiency for gasGap "<<m_idHelperSvc->toString(gasGapId)
53 <<" has already been stored "<<m_effiData[gasGapId]<<" vs. "<<effi);
54 return StatusCode::FAILURE;
55 }
56 return StatusCode::SUCCESS;
57 }
58}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
const Muon::IMuonIdHelperSvc * m_idHelperSvc
Identifier getLookUpId(const Identifier &channelId, bool isInnerQ1=false) const
StatusCode setEfficiency(const Identifier &sectionId, const double effi, bool isInnerQ1=false)
Sets the efficiency for a given minimal section of the dector.
DigitEffiData(const Muon::IMuonIdHelperSvc *idHelperSvc, double defaultEffi)
Constructor taking the pointer to the IdHelperSvc & defining a default efficiency for cases wher the ...
double getEfficiency(const Identifier &channelId, bool isInnerQ1=false) const
Returns the signal generation efficiency of the sTgc channel.
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
TechnologyIndex
enum to classify the different layers in the muon spectrometer
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10