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),
14 assert(m_onlineID);
16
17 for (size_t i=0;i<nGains;++i) {
18 m_adc2MeV[i].data.resize(onlineID->channelHashMax()*m_rampDegree,1.0);
19 }
20}
21
23
24bool LArADC2MeV::set(const IdentifierHash& hid, const int gain, const std::vector<float>& adc2mev) {
25 if (gain>=(int)m_adc2MeV.size() || hid*m_rampDegree >= m_adc2MeV[gain].data.size()) {
26 //std::cout << "hid="<< hid << ",size overrun: " << gain << " ," << m_adc2MeV.size() << " ," << hid*m_rampDegree << " ," << m_adc2MeV[gain].data.size() << std::endl;
27 return false;
28 }
29 if (adc2mev.size()!=m_rampDegree) {
30 //std::cout << "hid="<< hid << ", Got deg " << adc2mev.size() << ", expected " << m_rampDegree << std::endl;
31 return false;
32 }
33 m_adc2MeV[gain].valid.set(hid);
34 std::vector<float>::iterator it=m_adc2MeV[gain].data.begin()+hid*m_rampDegree;
35 std::copy(adc2mev.begin(),adc2mev.end(),it);
36
37 return true;
38}
39
This is a "hash" representation of an Identifier.
LArADC2MeV()=delete
const int m_nGains
Definition LArADC2MeV.h:69
const LArOnOffIdMapping * m_cabling
Definition LArADC2MeV.h:67
std::array< validVec_t, CaloGain::LARNGAIN > m_adc2MeV
Definition LArADC2MeV.h:64
int nGains() const
Definition LArADC2MeV.h:55
const unsigned m_rampDegree
Definition LArADC2MeV.h:68
const LArOnlineID_Base * m_onlineID
Definition LArADC2MeV.h:66
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.