ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
LArCellBuilderFromLArRawChannelTool Class Reference

Building LArCell objects from LArRawChannel. More...

#include <LArCellBuilderFromLArRawChannelTool.h>

Inheritance diagram for LArCellBuilderFromLArRawChannelTool:
Collaboration diagram for LArCellBuilderFromLArRawChannelTool:

Public Member Functions

virtual ~LArCellBuilderFromLArRawChannelTool ()=default
 Destructor, deletes the MsgService. More...
 
virtual StatusCode initialize () override
 Initialize method. More...
 
virtual StatusCode process (CaloCellContainer *theCellContainer, const EventContext &ctx) const override
 process method as defined in ICaloCellMaker interface More...
 

Private Attributes

SG::ReadHandleKey< LArRawChannelContainerm_rawChannelsKey {this,"RawChannelsName","LArRawChannels","Name of input container"}
 rdo container name (jO) More...
 
Gaudi::Property< bool > m_addDeadOTX {this,"addDeadOTX",true,"Add dummy cells for missing FEBs"}
 activate addition of missing cells from dead OTX More...
 
Gaudi::Property< int > m_initialDataPoolSize {this,"InitialCellPoolSize",-1,"Initial size of the DataPool<LArCells> (-1: Use nCells)"}
 Initial size of DataPool<LArCell> More...
 
unsigned m_nTotalCells =0
 Number of cells, set in Initialize() More...
 
SG::ReadCondHandleKey< LArOnOffIdMappingm_cablingKey {this,"LArCablingKey","LArOnOffIdMap","Key of conditions data object holding cabling"}
 
const LArOnlineIDm_onlineID =nullptr
 
const CaloCell_IDm_caloCID =nullptr
 
SG::ReadCondHandleKey< LArBadFebContm_missingFebKey {this,"MissingFebKey","LArBadFeb","Key of conditions data object holding bad-feb info"}
 
SG::ReadCondHandleKey< CaloDetDescrManagerm_caloMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}
 

Detailed Description

Building LArCell objects from LArRawChannel.

An AlgTool class to create a CaloCellContainer out of a LArRawChannel container.

AlgTool properties (name defined in cxx file): RawChannelsName : input RawChannelContainer EThreshold: energy threshold

Modified: Dec 4, 2002 Hong Ma Use MakeLArCellFromRaw to make LArCell. Modified: June 2, 2004, David Rousseau : converted to AlgTool

Inherits from ICaloCellMakerTool and should be called by an instance of the CaloCellMaker algorithm.

Definition at line 52 of file LArCellBuilderFromLArRawChannelTool.h.

Constructor & Destructor Documentation

◆ ~LArCellBuilderFromLArRawChannelTool()

virtual LArCellBuilderFromLArRawChannelTool::~LArCellBuilderFromLArRawChannelTool ( )
virtualdefault

Destructor, deletes the MsgService.

Member Function Documentation

◆ initialize()

StatusCode LArCellBuilderFromLArRawChannelTool::initialize ( )
overridevirtual

Initialize method.

Returns
Gaudi status code.

Initialazes pointers to servies and private members variable. Sets the m_subCalo variable based on the m_lArRegion jobOption. Computes the total number of cells based on the subcalo hash-range.

Definition at line 31 of file LArCellBuilderFromLArRawChannelTool.cxx.

31  {
32 
34 
35  ATH_CHECK( detStore()->retrieve (m_caloCID, "CaloCell_ID") );
36 
38  ATH_CHECK( detStore()->retrieve(m_onlineID, "LArOnlineID") );
39 
40  if (!m_missingFebKey.key().empty()) {
41  ATH_CHECK( m_missingFebKey.initialize() );
42  }
43  else {
44  if (m_addDeadOTX) {
45  ATH_MSG_ERROR( "Configuration problem: 'addDeadOTX' set, but no missing FEB container given." );
46  return StatusCode::FAILURE;
47  }
48  }
49 
51 
52  //Compute total number of cells
53  m_nTotalCells=0;
54 
55  IdentifierHash caloCellMin, caloCellMax ;
56  m_caloCID->calo_cell_hash_range(CaloCell_ID::LAREM,caloCellMin,caloCellMax);
57  m_nTotalCells+=caloCellMax-caloCellMin;
58  m_caloCID->calo_cell_hash_range(CaloCell_ID::LARHEC,caloCellMin,caloCellMax);
59  m_nTotalCells+=caloCellMax-caloCellMin;
60  m_caloCID->calo_cell_hash_range(CaloCell_ID::LARFCAL,caloCellMin,caloCellMax);
61  m_nTotalCells+=caloCellMax-caloCellMin;
62 
64  ATH_MSG_DEBUG("Initial size of DataPool<LArCell>: " << m_initialDataPoolSize);
65 
66  ATH_MSG_DEBUG("Initialisating finished");
67  return StatusCode::SUCCESS;
68 }

◆ process()

StatusCode LArCellBuilderFromLArRawChannelTool::process ( CaloCellContainer theCellContainer,
const EventContext &  ctx 
) const
overridevirtual

process method as defined in ICaloCellMaker interface

Parameters
theCellContainerPointer to the CaloCellContainer we are working on
ctxThe event context.
Returns
Gaudi status code.

Definition at line 74 of file LArCellBuilderFromLArRawChannelTool.cxx.

76 {
77  if (theCellContainer->ownPolicy() == SG::OWN_ELEMENTS) {
78  ATH_MSG_ERROR( "Called with a CaloCellContainer with wrong ownership policy! Need a VIEW container!" );
79  return StatusCode::FAILURE;
80  }
81 
83  if(!rawColl.isValid()) {
84  ATH_MSG_ERROR( " Can not retrieve LArRawChannelContainer: "
85  << m_rawChannelsKey.key() );
86  return StatusCode::FAILURE;
87  }
88 
89  const size_t nRawChannels=rawColl->size();
90  if (nRawChannels==0) {
91  ATH_MSG_WARNING( "Got empty LArRawChannel container. Do nothing" );
92  return StatusCode::SUCCESS;
93  }
94  else
95  ATH_MSG_DEBUG("Got " << nRawChannels << " LArRawChannels");
96 
97 
98  unsigned nCellsAdded=0;
99  std::bitset<CaloCell_ID::NSUBCALO> includedSubcalos;
100  // resize calo cell container to correct size
101  if (!theCellContainer->empty()) {
102  ATH_MSG_WARNING( "Container should be empty! Clear now.");
103  theCellContainer->clear();
104  }
105 
107 
109  const LArOnOffIdMapping* cabling=*cablingHdl;
110 
112  const CaloDetDescrManager* caloDDM = *caloMgrHandle;
113 
114  theCellContainer->resize(m_nTotalCells);
115 
116  for (const LArRawChannel& rawChan : *rawColl) {
117  const HWIdentifier hwid=rawChan.channelID();
118  const IdentifierHash onlHash=m_onlineID->channel_Hash(hwid);
119  if( cabling->isOnlineConnectedFromHash(onlHash)) {
120  const IdentifierHash oflHash= cabling->oflHashFromOnlHash(onlHash);
121  const Identifier id=m_caloCID->cell_id(oflHash);
122  const CaloDetDescrElement * theDDE=caloDDM->get_element(oflHash);
123 
124  LArCell *pCell = pool.nextElementPtr();
125 
126  *pCell = LArCell (theDDE,
127  id,
128  rawChan.energy(),
129  rawChan.time()*Gaudi::Units::picosecond/Gaudi::Units::nanosecond, // convert time from ps (LArRawChannel) to ns
130  rawChan.quality(),
131  rawChan.provenance(),
132  rawChan.gain());
133 
134  if ((*theCellContainer)[oflHash]) {
135  ATH_MSG_WARNING("Channel added twice! Data corruption? hash="
136  << oflHash << " online ID=0x" << std::hex
137  << hwid.get_identifier32().get_compact() << std::dec
138  << " " << m_onlineID->channel_name(hwid));
139  } else {
140  (*theCellContainer)[oflHash] = pCell;
141  ++nCellsAdded;
142  includedSubcalos.set(m_caloCID->sub_calo(oflHash));
143  }
144  }//end if connected
145  }//end loop over LArRawChannelContainer
146 
147  //Now add in dummy cells (if requested)
148  unsigned nMissingButPresent=0;
149 
150  if (m_addDeadOTX) {
152  const LArBadFebCont::BadChanVec& allMissingFebs=(*missingFebHdl)->fullCont();
153 
154  for (const LArBadFebCont::BadChanEntry& it : allMissingFebs) {
155  const LArBadFeb& febstatus=it.second;
156  if (febstatus.deadReadout() || febstatus.deadAll() || febstatus.deactivatedInOKS() ) {
157  const HWIdentifier febId(it.first);
158  //Loop over channels belonging to this FEB
159  const int chansPerFeb=m_onlineID->channelInSlotMax(febId);
160  for (int ch=0; ch<chansPerFeb; ++ch) {
161  const HWIdentifier hwid = m_onlineID->channel_Id(febId, ch);
162  if ( cabling->isOnlineConnected(hwid)) {
163  const Identifier id=cabling->cnvToIdentifier(hwid);
164  const IdentifierHash hashid= m_caloCID->calo_cell_hash(id);
165  const CaloDetDescrElement * theDDE=caloDDM->get_element(hashid);
166  LArCell *pCell = pool.nextElementPtr();
167  *pCell = LArCell (theDDE,
168  id,
169  0.0, //energy
170  0.0, //time
171  0.0, //quality;
172  0x0A00, // 0x0800 (dead) + 0x0200 (to indicate missing readout)
174 
175 
176  if ((*theCellContainer)[hashid]) {
177  ++nMissingButPresent;
178  ATH_MSG_DEBUG("The supposedly missing channel with online ID=0x" << std::hex
179  << hwid.get_identifier32().get_compact() << std::dec
180  << " " << m_onlineID->channel_name(hwid)
181  << " is actually present in the LArRawChannel container");
182  }
183  else {
184  (*theCellContainer)[hashid]=pCell;
185  ++nCellsAdded;
186  includedSubcalos.set(m_caloCID->sub_calo(hashid));
187  }
188  }//end if connected
189  }//end loop over channels of one missing FEB
190  }//end if is dead/missing FEB
191  }//end loop over bad/missing FEBs
192  }//end if m_addDeadOTX
193 
194  //Set the 'hasCalo' variable of CaloCellContainer
195  for (int iCalo=0;iCalo<CaloCell_ID::NSUBCALO;++iCalo) {
196  if (includedSubcalos.test(iCalo))
197  theCellContainer->setHasCalo(static_cast<CaloCell_ID::SUBCALO>(iCalo));
198  }
199 
200  if (nMissingButPresent)
201  ATH_MSG_WARNING( "A total of " << nMissingButPresent
202  << " supposedly missing channels where present in the LArRawChannelContainer" );
203 
204  if (nCellsAdded!=m_nTotalCells) {
205  ATH_MSG_DEBUG("Filled only " << nCellsAdded << " out of " << m_nTotalCells << " cells. Removing holes");
206  auto end1=std::remove(theCellContainer->begin(),theCellContainer->end(),nullptr);
207  theCellContainer->erase(end1,theCellContainer->end());
208  ATH_MSG_DEBUG("Shrunk the cell container to " << theCellContainer->size() << " (" << m_nTotalCells-nCellsAdded << " cells missing)");
209  }//end if nCellsAdded!=m_nTotalCells
210  else
211  ATH_MSG_DEBUG("All " << nCellsAdded << " cells filled (no holes)");
212 
213  return StatusCode::SUCCESS;
214 }

Member Data Documentation

◆ m_addDeadOTX

Gaudi::Property<bool> LArCellBuilderFromLArRawChannelTool::m_addDeadOTX {this,"addDeadOTX",true,"Add dummy cells for missing FEBs"}
private

activate addition of missing cells from dead OTX

Definition at line 89 of file LArCellBuilderFromLArRawChannelTool.h.

◆ m_cablingKey

SG::ReadCondHandleKey<LArOnOffIdMapping> LArCellBuilderFromLArRawChannelTool::m_cablingKey {this,"LArCablingKey","LArOnOffIdMap","Key of conditions data object holding cabling"}
private

Definition at line 96 of file LArCellBuilderFromLArRawChannelTool.h.

◆ m_caloCID

const CaloCell_ID* LArCellBuilderFromLArRawChannelTool::m_caloCID =nullptr
private

Definition at line 98 of file LArCellBuilderFromLArRawChannelTool.h.

◆ m_caloMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> LArCellBuilderFromLArRawChannelTool::m_caloMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}
private

Definition at line 101 of file LArCellBuilderFromLArRawChannelTool.h.

◆ m_initialDataPoolSize

Gaudi::Property<int> LArCellBuilderFromLArRawChannelTool::m_initialDataPoolSize {this,"InitialCellPoolSize",-1,"Initial size of the DataPool<LArCells> (-1: Use nCells)"}
private

Initial size of DataPool<LArCell>

Definition at line 90 of file LArCellBuilderFromLArRawChannelTool.h.

◆ m_missingFebKey

SG::ReadCondHandleKey<LArBadFebCont> LArCellBuilderFromLArRawChannelTool::m_missingFebKey {this,"MissingFebKey","LArBadFeb","Key of conditions data object holding bad-feb info"}
private

Definition at line 99 of file LArCellBuilderFromLArRawChannelTool.h.

◆ m_nTotalCells

unsigned LArCellBuilderFromLArRawChannelTool::m_nTotalCells =0
private

Number of cells, set in Initialize()

Definition at line 93 of file LArCellBuilderFromLArRawChannelTool.h.

◆ m_onlineID

const LArOnlineID* LArCellBuilderFromLArRawChannelTool::m_onlineID =nullptr
private

Definition at line 97 of file LArCellBuilderFromLArRawChannelTool.h.

◆ m_rawChannelsKey

SG::ReadHandleKey<LArRawChannelContainer> LArCellBuilderFromLArRawChannelTool::m_rawChannelsKey {this,"RawChannelsName","LArRawChannels","Name of input container"}
private

rdo container name (jO)

Definition at line 88 of file LArCellBuilderFromLArRawChannelTool.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition: CaloCell_Base_ID.h:46
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
LArOnlineID_Base::channel_Hash
IdentifierHash channel_Hash(HWIdentifier channelId) const
Create channel_hash from channel_Id.
Definition: LArOnlineID_Base.cxx:1632
CaloCell_Base_ID::calo_cell_hash
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
python.SystemOfUnits.nanosecond
int nanosecond
Definition: SystemOfUnits.py:119
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
CaloCellContainer::setHasCalo
void setHasCalo(const CaloCell_ID::SUBCALO caloNum)
set which calo has been filled.
Definition: CaloCellContainer.cxx:213
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition: CaloDetDescrManager.cxx:159
pool
pool namespace
Definition: libname.h:15
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
skel.it
it
Definition: skel.GENtoEVGEN.py:396
LArBadFeb::deadReadout
bool deadReadout() const
FEB is not sending readout data, but the L1 trigger path is working.
Definition: LArBadFeb.h:33
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
CaloCell_Base_ID::LARHEC
@ LARHEC
Definition: CaloCell_Base_ID.h:46
LArBadXCont::BadChanVec
std::vector< BadChanEntry > BadChanVec
Definition: LArBadChannelCont.h:32
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
HWIdentifier
Definition: HWIdentifier.h:13
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
LArCellBuilderFromLArRawChannelTool::m_rawChannelsKey
SG::ReadHandleKey< LArRawChannelContainer > m_rawChannelsKey
rdo container name (jO)
Definition: LArCellBuilderFromLArRawChannelTool.h:88
PixelModuleFeMask_create_db.remove
string remove
Definition: PixelModuleFeMask_create_db.py:83
LArCellBuilderFromLArRawChannelTool::m_initialDataPoolSize
Gaudi::Property< int > m_initialDataPoolSize
Initial size of DataPool<LArCell>
Definition: LArCellBuilderFromLArRawChannelTool.h:90
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition: OwnershipPolicy.h:17
LArRawChannel
Liquid Argon ROD output object base class.
Definition: LArRawChannel.h:40
CaloCell_Base_ID::calo_cell_hash_range
void calo_cell_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
LArOnlineID_Base::channelInSlotMax
int channelInSlotMax(const HWIdentifier Id) const
Return the Maximum channel number of a given feb slot.
Definition: LArOnlineID_Base.cxx:287
LArCellBuilderFromLArRawChannelTool::m_addDeadOTX
Gaudi::Property< bool > m_addDeadOTX
activate addition of missing cells from dead OTX
Definition: LArCellBuilderFromLArRawChannelTool.h:89
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArBadFeb::deadAll
bool deadAll() const
FEB is completely missing, e.g. powered off.
Definition: LArBadFeb.h:30
CaloCell_Base_ID::SUBCALO
SUBCALO
enumeration of sub calorimeters
Definition: CaloCell_Base_ID.h:46
LArCellBuilderFromLArRawChannelTool::m_onlineID
const LArOnlineID * m_onlineID
Definition: LArCellBuilderFromLArRawChannelTool.h:97
LArOnlineID_Base::channel_Id
HWIdentifier channel_Id(int barrel_ec, int pos_neg, int feedthrough, int slot, int channel) const
create channel identifier from fields
Definition: LArOnlineID_Base.cxx:1565
CaloCell_Base_ID::sub_calo
int sub_calo(const Identifier id) const
returns an int taken from SUBCALO enum and describing the subCalo to which the Id belongs.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArBadXCont::BadChanEntry
std::pair< ChanId_t, LArBC_t > BadChanEntry
Definition: LArBadChannelCont.h:31
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
LArCellBuilderFromLArRawChannelTool::m_missingFebKey
SG::ReadCondHandleKey< LArBadFebCont > m_missingFebKey
Definition: LArCellBuilderFromLArRawChannelTool.h:99
LArCellBuilderFromLArRawChannelTool::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: LArCellBuilderFromLArRawChannelTool.h:96
LArCellBuilderFromLArRawChannelTool::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition: LArCellBuilderFromLArRawChannelTool.h:101
DataVector::clear
void clear()
Erase all the elements in the collection.
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
DataVector::resize
void resize(size_type sz)
Resizes the collection to the specified number of elements.
LArBadFeb
Definition: LArBadFeb.h:10
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
LArCell
Data object for LAr calorimeter readout cell.
Definition: LArCell.h:53
CaloGain::LARHIGHGAIN
@ LARHIGHGAIN
Definition: CaloGain.h:18
CaloCell_Base_ID::cell_id
Identifier cell_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy, const int eta, const int phi) const
Make a cell (== channel) ID from constituting fields and subCalo index; for (Mini)FCAL,...
LArBadFeb::deactivatedInOKS
bool deactivatedInOKS() const
Deactivated in OKS.
Definition: LArBadFeb.h:39
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
DataPool
a typed memory pool that saves time spent allocation small object. This is typically used by containe...
Definition: DataPool.h:63
DataVector::ownPolicy
SG::OwnershipPolicy ownPolicy() const
Return the ownership policy setting for this container.
CaloCell_Base_ID::NSUBCALO
@ NSUBCALO
Definition: CaloCell_Base_ID.h:46
LArCellBuilderFromLArRawChannelTool::m_nTotalCells
unsigned m_nTotalCells
Number of cells, set in Initialize()
Definition: LArCellBuilderFromLArRawChannelTool.h:93
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
DataVector::erase
iterator erase(iterator position)
Remove element at a given position.
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46
LArOnlineID_Base::channel_name
std::string channel_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
Definition: LArOnlineID_Base.cxx:219
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
python.SystemOfUnits.picosecond
int picosecond
Definition: SystemOfUnits.py:123
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
LArCellBuilderFromLArRawChannelTool::m_caloCID
const CaloCell_ID * m_caloCID
Definition: LArCellBuilderFromLArRawChannelTool.h:98
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20
Identifier
Definition: IdentifierFieldParser.cxx:14