12#include "CaloDetDescr/CaloDetDescrElement.h"
19#include "GaudiKernel/Bootstrap.h"
20#include "GaudiKernel/ISvcLocator.h"
21#include "GaudiKernel/IToolSvc.h"
22#include "GaudiKernel/ThreadLocalContext.h"
26#include "CLHEP/Units/SystemOfUnits.h"
48 const std::vector<const CaloCellCorrection*>* pCorr,
unsigned int poolMaxSize )
50 const EventContext& ctx = Gaudi::Hive::currentContext();
56 log << MSG::INFO <<
" initializing MakeLArCellFromRaw"<<
endmsg ;
58 if(pCorr) log <<MSG::INFO <<
" Number of Corrections "<< pCorr->size()<<
endmsg ;
61 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator( )->service(
"DetectorStore")};
64 log << MSG::ERROR <<
"MakeLArCellFromRaw ERROR cannot retrieve DetectorStore " <<
endmsg;
71 log << MSG::INFO <<
"MakeLArCellFromRaw Creating DataPool<LArCell> of size " << poolMaxSize <<
endmsg ;
73 log << MSG::INFO <<
"MakeLArCellFromRaw do not use DataPool" <<
endmsg ;
82 if (detStore->retrieve(
m_onlineID,
"LArOnlineID").isFailure()) {
83 log <<MSG::ERROR <<
"cannot find LArOnlineID in MakeLArCellFromRaw " <<
endmsg;
96 const std::vector<Identifier>& emIds = em_id.
channel_ids();
97 const std::vector<Identifier>& hecIds = hec_id.
channel_ids();
98 const std::vector<Identifier>& fcalIds = fcal_id.
channel_ids();
113 info0.
elem = nullptr ;
116 std::vector<Identifier>::const_iterator it = emIds.begin();
117 std::vector<Identifier>::const_iterator it2 = emIds.end();
126 CELL_VEC::size_type chan =
m_onlineID->channel(sigId);
128 if (cellVec.empty())cellVec.resize(128,info0);
137 cell.eta = caloDDE->
eta();
138 cell.phi = caloDDE->
phi();
147 LArCell larCell(caloDDE,en,time,qu,g);
169 CELL_VEC::size_type chan =
m_onlineID->channel(sigId);
171 if (cellVec.empty())cellVec.resize(128,info0);
180 cell.eta = caloDDE->
eta();
181 cell.phi = caloDDE->
phi();
188 LArCell larCell(caloDDE,en,time,qu,g);
198 it = fcalIds.begin();
209 CELL_VEC::size_type chan =
m_onlineID->channel(sigId);
211 if (cellVec.empty())cellVec.resize(128,info0);
220 cell.eta = caloDDE->
eta();
221 cell.phi = caloDDE->
phi();
228 LArCell larCell(caloDDE,en,time,qu,g);
238 log <<MSG::INFO <<
" number of em, hec, fcal cells="<<n_em<<
" "<<n_hec<<
" "<<n_fcal<<
endmsg;
239 log <<MSG::INFO<<
" number of exceptions for em,hec,fcal="<<n_em_err<<
" "<<n_hec_err<<
" "<<n_fcal_err<<
endmsg;
240 log <<MSG::INFO<<
" done with initializing MakeLArCellFromRaw"<<
endmsg;
265 int e,
int t,
int q,
unsigned int& ttId )
const
276 CELL_MAP::const_iterator it =
m_cellMap.find( feb );
279 MsgStream log(
m_msgSvc,
"MakeLArCellFromRaw");
280 log << MSG::ERROR <<
" MakeLArCellFromRaw ERROR, failed to find existing cells. "<<
endmsg;
281 std::cout <<std::hex<<
"FEBID = "<< feb <<std::dec<< std::endl ;
286 const CELL_VEC& cellVec = (*it).second;
287 if(cellVec.size()<= chan){
288 MsgStream log(
m_msgSvc,
"MakeLArCellFromRaw");
289 log << MSG::FATAL <<
" MakeLArCellFromRaw ERROR, channel number= "<<chan<<
endmsg ;
294 const CellInfo& info = cellVec[chan] ;
296 if(info.elem ==
nullptr)
return nullptr;
299 double de = e * info.eCorr;
303 double time = t/1000.0;
307 cell =
new (
pool.nextElementPtr())
LArCell(info.elem,de,time,q,g);
311 cell =
new LArCell(info.elem,de,time,q,g);
322 const std::vector<const CaloCellCorrection*>& vCorr,
323 const EventContext& ctx)
const
326 double en= 50. *
GeV ;
332 corr->MakeCorrection (cell, ctx);
335 double c= cell->energy()/en;
Definition of CaloDetDescrManager.
Mapping between calorimeter trigger id to offline/online Identifier.
Helper class for offline cell identifiers.
const LArFCAL_ID * fcal_idHelper() const
access to FCAL idHelper
const LArEM_ID * em_idHelper() const
access to EM idHelper
const LArHEC_ID * hec_idHelper() const
access to HEC idHelper
This class groups all DetDescr information related to a CaloCell.
float eta() const
cell eta
float phi() const
cell phi
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
This class provides the client interface for accessing the detector description information common to...
const CaloCell_ID * getCaloCell_ID() const
get calo cell ID helper
a typed memory pool that saves time spent allocation small object.
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
Data object for LAr calorimeter readout cell.
const std::vector< Identifier > & channel_ids() const
provide access to channel id vector, accessed via hash
Helper class for LArEM offline identifiers.
const std::vector< Identifier > & channel_ids() const
provide acces to channel id vector, accessed via hash
Helper class for LArFCAL offline identifiers.
const std::vector< Identifier > & channel_ids() const
provide access to channel id vector, accessed via hash
Helper class for LArHEC offline identifiers.
Exception class for LAr Identifiers.
HWIdentifier createSignalChannelID(const Identifier &id) const
create a HWIdentifier from an Identifier (not inline)
Mapping between calorimeter trigger id to offline/online Identifier.
TT_ID trigTowerID(const Identifier &channel_id) const
Translate offline channel identifier to trigger tower ID.
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
MakeLArCellFromRaw()
constructor
~MakeLArCellFromRaw()
destructor
void setThreshold(float t)
const LArOnlineID * m_onlineID
double getCorrection(LArCell *cell, const std::vector< const CaloCellCorrection * > &vCorr, const EventContext &ctx) const
LArCell * getLArCell(unsigned int feb, unsigned int chan, int e, int t, int q, CaloGain::CaloGain caloGain, unsigned int &ttId) const
access by Identifier
std::vector< CellInfo > CELL_VEC
IMessageSvc * getMessageSvc(bool quiet=false)
const CaloDetDescrElement * elem