8#include "GaudiKernel/IToolSvc.h"
13#include "GaudiKernel/EventContext.h"
29#ifdef TRIGLARCELLDEBUG
30std::cout <<
"LArCellCont \t\t DEBUG \t in initialize" << std::endl;
46 for(
int i=0;i<
m_hash.max();i++){
47#ifdef TRIGLARCELLDEBUG
48 std::cout <<
"LArCellCont\t\t DEBUG \t"
49 << i <<
" " << std::hex <<
m_hash.identifier(i) << std::dec
55 this->push_back(mycoll);
62std::vector<const CaloCellCorrection*> LArCellCorrTools;
66makeCell.
initialize( roiMap, onOffMap, man, &LArCellCorrTools, 0 );
69bool toolAvailable =
sc.isSuccess();
73 "Failed to retrieve LArBadFebMasker - no masking will be done." <<
endmsg;
75std::vector<uint32_t> RobsFromMissingFeb;
78std::vector<HWIdentifier>::const_iterator beg = onlineId->
channel_begin();
79std::vector<HWIdentifier>::const_iterator end = onlineId->
channel_end ();
80for( ; beg != end; ++beg ){
93 for (
unsigned iFeb=0;iFeb<onlineId->
febHashMax();++iFeb) {
95 if( (toolAvailable && (
m_badFebMasker->febMissing(febid)) ) || !toolAvailable ){
96 RobsFromMissingFeb.push_back(
m_conv.getRobID(
m_conv.getRodID( febrod, febid ) ) );
98 if( (toolAvailable && !(
m_badFebMasker->febMissing(febid)) ) || !toolAvailable ){
101 unsigned int rodId32 =
m_conv.getRodIDFromROM(rodId);
103 int idx =
m_hash(rodId32);
104#ifdef TRIGLARCELLDEBUG
105 std::cout <<
"LArCellCont\t\t DEBUG \t"
106 << idx <<
" " << std::hex <<
m_hash.identifier(idx) << std::dec
110 std::map<LArRoIMap::TT_ID,std::vector<LArCell* > > collMap;
111 if ( (*
this)[idx]->size() != 0 ) {
114 std::vector<int>& hashTab =
m_hashSym[idx];
115 hashTab.reserve(256);
117 for(
int ch=0;ch<128;ch++){
123 (*this)[idx]->push_back(larcell);
134 if ( good ) collMap[ttId].push_back(larcell);
138 hashTab.push_back(
index );
139 }
else hashTab.push_back(indexsetmax);
140#ifdef TRIGLARCELLDEBUG
141 std::cout <<
"Cell registered at Collection "
143 " Channel " << ch <<
" TTId " << (
unsigned int)ttId
148#ifdef TRIGLARCELLDEBUG
149 std::cout <<
"Cell not existing" << std::endl;
152 (*this)[idx]->push_back(larcell);
153 hashTab.push_back( indexsetmax);
156 for (
const auto& [ttid, cells] : collMap) {
159 vec->reserve(cells.size());
165 (*this)[idx]->setTT(ttid,
vec->begin(),
vec->end());
172for(
size_t i = 0 ; i < RobsFromMissingFeb.size() ; i++)
173for(
size_t j = i+1 ; j < RobsFromMissingFeb.size() ; j++)
174if ( RobsFromMissingFeb[i] == RobsFromMissingFeb[j] )
176RobsFromMissingFeb.clear();
178return StatusCode::SUCCESS;
182int number_of_col =
m_hash.max();
183for(
int i=0;i<number_of_col;i++){
184 int number_of_cell = ((*this)[i])->size();
185 for(
int j=0;j<number_of_cell;j++)
186 delete ((*((*
this)[i]))[j]);
187 if ((*
this)[i] != NULL)
191for(
size_t i=0;i<
m_vecs.size();i++){
196return StatusCode::SUCCESS;
200const std::vector<LArCellCollection*>::const_iterator
203 return (std::vector<LArCellCollection*>::const_iterator)((*this).begin()+idx);
207const std::vector<LArCellCollection*>::const_iterator
212 return (std::vector<LArCellCollection*>::const_iterator)((*this).begin()+idx);
215 return (std::vector<LArCellCollection*>::const_iterator)((*this).end());
221 std::vector<LArCellCollection*>::const_iterator it = (std::vector<LArCellCollection*>::const_iterator)((*this).begin()+idx);
223 unsigned int itsize = col->
size();
224 std::vector<int>& hashTab =
m_hashSym[idx];
225 for(
unsigned int i=0; i< itsize; ++i){
227 LArCell* cell = col->operator[](i);
228#ifdef TRIGLARCELLDEBUG
229 std::cout <<
"LArCellId= " << cell->ID() <<
" Ecorr= " << cor <<
" MeV " << std::endl;
231 float cellenergy = cell->energy();
232 cell->setEnergyFast( cellenergy - cor );
245#ifdef TRIGLARCELLDEBUG
246 std::cout <<
"Update : CURRENT lumi_block, BCID = " << lumi_block <<
", " << BCID <<
" <--> PREVIOUS lumi_block = " <<
m_lumi_block <<
", " <<
m_bcid << std::endl;
255 std::map<HWIdentifier,int>::const_iterator end =
m_indexset.end ();
257 std::map<HWIdentifier,int>::const_iterator beg =
m_indexset.begin();
258 for( ; beg != end ; ++beg ) {
260 int idx = (*beg).second;
263 float corr = avg.average(
id);
271 uint32_t bcid = context.eventID().bunch_crossing_id();
272 if ( bcid ==
m_bcid )
return false;
273 EventIDBase::event_number_t evN = context.eventID().event_number();
Definition of CaloDetDescrManager.
std::vector< size_t > vec
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
#define CHECK_WITH_CONTEXT(...)
Evaluate an expression and check for errors, with an explicitly specified context name.
LArBadXCont< LArBadChannel > LArBadChannelCont
Mapping between calorimeter trigger id to offline/online Identifier.
void setGain(CaloGain::CaloGain gain=CaloGain::INVALIDGAIN)
set gain
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
This class provides the client interface for accessing the detector description information common to...
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
size_type size() const noexcept
Returns the number of elements in the collection.
value_type get_compact() const
Get the compact id.
This is a "hash" representation of an Identifier.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
bool problematicForUnknownReason() const
bool good() const
Returns true if no problems at all (all bits at zero)
LArBC_t offlineStatus(const Identifier id) const
Query the status of a particular channel by offline ID This is the main client access method.
Container Class for LArCell in a ROB used by EF.
Hid2RESrcID m_conv
Hardware to Source ID conversion.
std::vector< std::vector< int > > m_hashSym
hash references to BCID
std::vector< DataVector< LArCell > * > m_vecs
One needs to destroy the TT vectors.
std::vector< uint32_t > m_MissingROBs
List of Missing ROBs to be disabled at the RS.
StatusCode initialize(const LArRoIMap &roiMap, const LArOnOffIdMapping &onOffMap, const LArMCSym &mcsym, const LArFebRodMapping &febrod, const LArBadChannelCont &badchannel, const CaloDetDescrManager &ddm)
initialize method.
std::vector< float > m_corrBCID
corrections for a given BCID
const ILArBadFebMasker * m_badFebMasker
A tool to help mask cells.
LArRodIdHash m_hash
Hash ID Identifier mapping to collection index.
bool m_BCIDcache
flag to only update cache when trying to apply corrections
const std::vector< LArCellCollection * >::const_iterator find(const HWIdentifier &id) const
Finds a collection by its LArReadoutModuleID.
void applyBCIDCorrection(const unsigned int &rodid)
method to apply correction based on the luminosity to the energy
float m_lumi_block
current lumi_block
void lumiBlock_BCID(const unsigned int lumi_block, const unsigned int BCID)
sets LumiBlock and BCID
std::map< HWIdentifier, int > m_indexset
index table
void updateBCID(const CaloBCIDAverage &, const LArOnOffIdMapping &)
update BCID dependent correction table for MT case
HWIdentifier findsec(const unsigned int &id) const
Each Collection contains data from 2 FEBs.
StatusCode finalize(void)
finalize method.
LArCellCont()
Constructor.
EventIDBase::event_number_t m_bcidEvt
unsigned int m_event
this event number
std::vector< unsigned int > m_eventNumber
eventNumber of a given Collection
bool lumiBCIDCheck(const EventContext &context)
std::vector< HWIdentifier > m_second
FEB Hardware Identifier for second FEBs in a Collection.
Data object for LAr calorimeter readout cell.
const std::vector< HWIdentifier > & getLArRoModIDvec() const
"iterator" on LArReadoutModuleIDs
HWIdentifier getReadoutModuleID(const HWIdentifier &id) const
Helper class to handle z-phi symmetry of calibration constants in MC.
HWIdentifier ZPhiSymOnl(const HWIdentifier notSymOnlId) const
Find the symmetric HWID for an online channel identifier.
Identifier cnvToIdentifier(const HWIdentifier &sid) const
create an Identifier from a HWIdentifier (inline)
HWIdentifier channel_Id(int barrel_ec, int pos_neg, int feedthrough, int slot, int channel) const
create channel identifier from fields
id_iterator channel_end() const
id_iterator channel_begin() const
Returns an iterator pointing to a channel identifier collection.
size_type febHashMax() const
define feb hash tables max size
HWIdentifier feb_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Create feb_Id from fields.
Mapping between calorimeter trigger id to offline/online Identifier.
Building LArCell objects from LArRawChannel.
void initialize(const LArRoIMap &roiMap, const LArOnOffIdMapping &onOffMap, const CaloDetDescrManager &man, const std::vector< const CaloCellCorrection * > *pCorr, unsigned int poolMaxSize=190000)
initialize the internal map
void setThreshold(float t)
LArCell * getLArCell(unsigned int feb, unsigned int chan, int e, int t, int q, CaloGain::CaloGain caloGain, unsigned int &ttId) const
access by Identifier
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts