ATLAS Offline Software
Loading...
Searching...
No Matches
LArADC2MeV.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
6
7#include <cassert>
8
9LArADC2MeV::LArADC2MeV(const LArOnlineID_Base* onlineID, const LArOnOffIdMapping* cabling, const size_t nGains, const unsigned rampSize=2) :
10 m_onlineID(onlineID),
11 m_cabling(cabling),
12 m_rampDegree(rampSize){
13 assert(m_onlineID);
14 assert(nGains<=CaloGain::LARNGAIN && nGains>0);
15
16 for (size_t i=0;i<nGains;++i) {
17 m_adc2MeV[i].data.resize(onlineID->channelHashMax()*m_rampDegree,1.0);
18 }
19}
20
22
23bool LArADC2MeV::set(const IdentifierHash& hid, const int gain, const std::vector<float>& adc2mev) {
24 if (gain>=(int)m_adc2MeV.size() || hid*m_rampDegree >= m_adc2MeV[gain].data.size()) {
25 //std::cout << "hid="<< hid << ",size overrun: " << gain << " ," << m_adc2MeV.size() << " ," << hid*m_rampDegree << " ," << m_adc2MeV[gain].data.size() << std::endl;
26 return false;
27 }
28 if (adc2mev.size()!=m_rampDegree) {
29 //std::cout << "hid="<< hid << ", Got deg " << adc2mev.size() << ", expected " << m_rampDegree << std::endl;
30 return false;
31 }
32 m_adc2MeV[gain].valid.set(hid);
33 std::vector<float>::iterator it=m_adc2MeV[gain].data.begin()+hid*m_rampDegree;
34 std::copy(adc2mev.begin(),adc2mev.end(),it);
35
36 return true;
37}
38
This is a "hash" representation of an Identifier.
LArADC2MeV()=delete
const LArOnOffIdMapping * m_cabling
Definition LArADC2MeV.h:64
std::array< validVec_t, CaloGain::LARNGAIN > m_adc2MeV
Definition LArADC2MeV.h:61
const unsigned m_rampDegree
Definition LArADC2MeV.h:65
const LArOnlineID_Base * m_onlineID
Definition LArADC2MeV.h:63
bool set(const IdentifierHash &hid, const int gain, const std::vector< float > &adc2mev)
Helper for the Liquid Argon Calorimeter cell identifiers.
size_type channelHashMax() const
Define channel hash tables max size.