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

Replace cells in calo cell container with cells from alternate raw channel container. More...

#include <LArCellMerger.h>

Inheritance diagram for LArCellMerger:
Collaboration diagram for LArCellMerger:

Public Member Functions

virtual StatusCode initialize () override
 initialize the tool More...
 
virtual StatusCode finalize () override
 finalize the tool More...
 
virtual StatusCode process (CaloCellContainer *theCellContainer, const EventContext &ctx) const override
 update theCellContainer More...
 

Private Attributes

SG::ReadCondHandleKey< LArOnOffIdMappingm_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of Cabling obj"}
 handle to LAr cabling More...
 
SG::ReadHandleKey< LArRawChannelContainerm_rawChannelContainerName
 key for raw channel container to merge to cells More...
 
const CaloCell_IDm_calo_id =nullptr
 
const LArOnlineIDm_onlineID =nullptr
 

Detailed Description

Replace cells in calo cell container with cells from alternate raw channel container.

Use case: when full calo cell container is made from DSP computed cells, replace some of then with better energies from offline reconstructed digits

AlgTool properties (name defined in cxx file): Name of the alternate raw channel container (i.e made from the digits offline)

Created July 09, 2009 G.Unal

Definition at line 34 of file LArCellMerger.h.

Member Function Documentation

◆ finalize()

StatusCode LArCellMerger::finalize ( )
overridevirtual

finalize the tool

Definition at line 44 of file LArCellMerger.cxx.

44  {
45  return StatusCode::SUCCESS;
46 }

◆ initialize()

StatusCode LArCellMerger::initialize ( )
overridevirtual

initialize the tool

Definition at line 33 of file LArCellMerger.cxx.

33  {
34 
35  ATH_CHECK(detStore()->retrieve(m_calo_id,"CaloCell_ID"));
36  ATH_CHECK( detStore()->retrieve(m_onlineID, "LArOnlineID") );
38 
40 
41  return StatusCode::SUCCESS;
42 }

◆ process()

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

update theCellContainer

Definition at line 48 of file LArCellMerger.cxx.

50 {
51  ATH_MSG_DEBUG("in LArCellMerger::process");
52 
54  if (!rawColl.isValid()) {
55  ATH_MSG_ERROR("Failed to retrieve LArRawChannelContainer with key " <<
56  rawColl.name());
57  return StatusCode::FAILURE;
58  }
59 
61  const LArOnOffIdMapping* cabling=*larCablingHdl;
62 
63  unsigned nReplaced=0;
64 
65  // loop over raw channel container
66  // as this new container is supposed to contain only few cells, we do a simple loop and the basics onlineId to offlineId conversion
67  // this could be a little slow if by mistake this container contains all cells (not what this tool is supposed to be used for)
68  for ( const LArRawChannel& theRawChannel : *rawColl ) {
69  const HWIdentifier hwid=theRawChannel.channelID();
70  const IdentifierHash onlHash=m_onlineID->channel_Hash(hwid);
71  if( cabling->isOnlineConnectedFromHash(onlHash)) {
72  const IdentifierHash theCellHashID= cabling->oflHashFromOnlHash(onlHash);
73  const Identifier id=m_calo_id->cell_id(theCellHashID);
74  int index = theCont->findIndex(theCellHashID);
75  if (index<0) {
76  ATH_MSG_WARNING( " cell " << hwid.get_compact() << " " << id.get_compact() << " is not in the container " );
77  continue;
78  }
79  CaloCell* aCell = theCont->at(index);
80 
81  if (aCell) {
82  ATH_MSG_DEBUG(" replace energies in cell hwid= " << hwid.get_identifier32().get_compact()
83  << " offlineid = " << id.get_identifier32().get_compact()
84  << " old energy " << aCell->e() << " new energy " << theRawChannel.energy());
85  nReplaced++;
86  aCell->setEnergy((float)(theRawChannel.energy()));
87  aCell->setTime((float)(theRawChannel.time())*0.001); // convert from ps int in raw channel to ns float in calocell
88  aCell->setQuality(theRawChannel.quality());
89  aCell->setProvenance(theRawChannel.provenance());
90  }
91 
92  }// isConnected
93  }// loop over raw channel container
94 
95  if (nReplaced*5>theCont->size()) {
96  ATH_MSG_WARNING("Replaced more than 20% of channels reco'ed online by channels reco'ed offline");
97  }
98  return StatusCode::SUCCESS;
99 }

Member Data Documentation

◆ m_cablingKey

SG::ReadCondHandleKey<LArOnOffIdMapping> LArCellMerger::m_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of Cabling obj"}
private

handle to LAr cabling

Definition at line 59 of file LArCellMerger.h.

◆ m_calo_id

const CaloCell_ID* LArCellMerger::m_calo_id =nullptr
private

Definition at line 67 of file LArCellMerger.h.

◆ m_onlineID

const LArOnlineID* LArCellMerger::m_onlineID =nullptr
private

Definition at line 68 of file LArCellMerger.h.

◆ m_rawChannelContainerName

SG::ReadHandleKey<LArRawChannelContainer> LArCellMerger::m_rawChannelContainerName
private
Initial value:
{this,"RawChannelsName","LArRawChannels_digits",
"SG key of rebuilt LArRawChannelContainer"}

key for raw channel container to merge to cells

Definition at line 64 of file LArCellMerger.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArOnlineID_Base::channel_Hash
IdentifierHash channel_Hash(HWIdentifier channelId) const
Create channel_hash from channel_Id.
Definition: LArOnlineID_Base.cxx:1632
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
CaloCell::setTime
virtual void setTime(float time)
set time
Definition: CaloCell.cxx:151
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
index
Definition: index.py:1
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
Identifier::get_compact
value_type get_compact() const
Get the compact id.
CaloCell::e
virtual double e() const override final
get energy (data member) (synonym to method energy()
Definition: CaloCell.h:317
CaloCell::setEnergy
virtual void setEnergy(float energy)
set energy
Definition: CaloCell.cxx:136
HWIdentifier
Definition: HWIdentifier.h:13
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
LArCellMerger::m_calo_id
const CaloCell_ID * m_calo_id
Definition: LArCellMerger.h:67
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CaloCell::setQuality
virtual void setQuality(uint16_t quality)
set quality
Definition: CaloCell.cxx:156
LArRawChannel
Liquid Argon ROD output object base class.
Definition: LArRawChannel.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArCellMerger::m_rawChannelContainerName
SG::ReadHandleKey< LArRawChannelContainer > m_rawChannelContainerName
key for raw channel container to merge to cells
Definition: LArCellMerger.h:64
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
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
CaloCell::setProvenance
void setProvenance(uint16_t prov)
set Provenance
Definition: CaloCell.cxx:167
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
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,...
LArCellMerger::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
handle to LAr cabling
Definition: LArCellMerger.h:59
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
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
LArCellMerger::m_onlineID
const LArOnlineID * m_onlineID
Definition: LArCellMerger.h:68
Identifier
Definition: IdentifierFieldParser.cxx:14