ATLAS Offline Software
Loading...
Searching...
No Matches
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
virtual StatusCode finalize () override
 finalize the tool
virtual StatusCode process (CaloCellContainer *theCellContainer, const EventContext &ctx) const override
 update theCellContainer

Private Attributes

SG::ReadCondHandleKey< LArOnOffIdMappingm_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of Cabling obj"}
 handle to LAr cabling
SG::ReadHandleKey< LArRawChannelContainerm_rawChannelContainerName
 key for raw channel container to merge to cells
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") );
37 ATH_CHECK( m_cablingKey.initialize() );
38
40
41 return StatusCode::SUCCESS;
42}
#define ATH_CHECK
Evaluate an expression and check for errors.
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
handle to LAr cabling
SG::ReadHandleKey< LArRawChannelContainer > m_rawChannelContainerName
key for raw channel container to merge to cells
const LArOnlineID * m_onlineID
const CaloCell_ID * m_calo_id
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ 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
53 SG::ReadHandle<LArRawChannelContainer> rawColl(m_rawChannelContainerName, ctx);
54 if (!rawColl.isValid()) {
55 ATH_MSG_ERROR("Failed to retrieve LArRawChannelContainer with key " <<
56 rawColl.name());
57 return StatusCode::FAILURE;
58 }
59
60 SG::ReadCondHandle<LArOnOffIdMapping> larCablingHdl(m_cablingKey, ctx);
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}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
virtual double e() const override final
get energy (data member) (synonym to method energy()
Definition CaloCell.h:333
virtual void setTime(float time)
set time
Definition CaloCell.h:484
virtual void setEnergy(float energy)
set energy
Definition CaloCell.h:472
void setQuality(uint16_t quality)
set quality
Definition CaloCell.h:460
void setProvenance(uint16_t prov)
set Provenance
Definition CaloCell.h:490
value_type get_compact() const
Get the compact id.
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.
str index
Definition DeMoScan.py:362

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.

59{this,"CablingKey","LArOnOffIdMap","SG Key of Cabling obj"};

◆ 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.

64 {this,"RawChannelsName","LArRawChannels_digits",
65 "SG key of rebuilt LArRawChannelContainer"};

The documentation for this class was generated from the following files: