ATLAS Offline Software
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 
9 LArADC2MeV::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 
23 bool 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);
34  std::copy(adc2mev.begin(),adc2mev.end(),it);
35 
36  return true;
37 }
38 
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
LArADC2MeV::LArADC2MeV
LArADC2MeV()=delete
LArOnlineID_Base.h
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
skel.it
it
Definition: skel.GENtoEVGEN.py:396
LArADC2MeV::~LArADC2MeV
~LArADC2MeV()
Definition: LArADC2MeV.cxx:21
LArADC2MeV::m_rampDegree
const unsigned m_rampDegree
Definition: LArADC2MeV.h:65
LArADC2MeV.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
LArADC2MeV::m_adc2MeV
std::array< validVec_t, CaloGain::LARNGAIN > m_adc2MeV
Definition: LArADC2MeV.h:61
LArADC2MeV::set
bool set(const IdentifierHash &hid, const int gain, const std::vector< float > &adc2mev)
Definition: LArADC2MeV.cxx:23
LArOnlineID_Base
Helper for the Liquid Argon Calorimeter cell identifiers.
Definition: LArOnlineID_Base.h:105
LArOnlineID_Base::channelHashMax
size_type channelHashMax(void) const
Define channel hash tables max size.
Definition: LArOnlineID_Base.cxx:1897
LArADC2MeV::m_onlineID
const LArOnlineID_Base * m_onlineID
Definition: LArADC2MeV.h:63
calibdata.copy
bool copy
Definition: calibdata.py:27
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20