ATLAS Offline Software
CaloCellContCopyTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "CaloCellContCopyTool.h"
7 #include "TileEvent/TileCell.h"
8 #include "LArRecEvent/LArCell.h"
9 #include "AthAllocators/DataPool.h"
10 
12 
13  ATH_MSG_INFO( "In initialize ");
15  return StatusCode::SUCCESS;
16 }
17 
18 
20  const EventContext& ctx) const {
21  // Retrieve source cell container
23 
24  //Copy indivial cells - profiting from DataPool to avoid small allocations
25  DataPool<LArCell> lArPool(ctx,182468);
26  DataPool<TileCell> tilePool(ctx,5217);
27  for (const CaloCell* oldCell : *srcCont) {
28  const CaloDetDescrElement* dde=oldCell->caloDDE();
29  if (dde->is_tile()) {
30  TileCell* tCell=tilePool.nextElementPtr();
31  const TileCell* oldtCell=static_cast<const TileCell*>(oldCell);
32  *tCell=*oldtCell;
33  theCont->push_back_fast(tCell);
34  }
35  else {
36  LArCell* pCell = lArPool.nextElementPtr();
37  const LArCell* oldlCell=static_cast<const LArCell*>(oldCell);
38  *pCell=*oldlCell;
39  theCont->push_back_fast(pCell);
40  }
41  }
42 
43  //Copy container-properties
44  theCont->setIsOrderedAndComplete(srcCont->isOrderedAndComplete());
45  theCont->setIsOrdered(srcCont->isOrdered());
46  theCont->setHasTotalSize(srcCont->hasTotalSize());
47  theCont->m_hasCalo=srcCont->m_hasCalo;
48  theCont->updateCaloIterators();
49  theCont->resetLookUpTable();
50 
51  return StatusCode::SUCCESS;
52 }
CaloCellContCopyTool::m_srcCellContainerKey
SG::ReadHandleKey< CaloCellContainer > m_srcCellContainerKey
Definition: CaloCellContCopyTool.h:34
TileCell
Definition: TileCell.h:57
CaloCellContainer::setHasTotalSize
void setHasTotalSize(const bool)
If @ flag is true, then the container size equals the maximum hash.
Definition: CaloCellContainer.cxx:169
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CaloCellContCopyTool::process
virtual StatusCode process(CaloCellContainer *theCellContainer, const EventContext &ctx) const override
Definition: CaloCellContCopyTool.cxx:19
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
CaloCellContainer::setIsOrdered
void setIsOrdered(const bool ordered)
indicates that the container is ordered
Definition: CaloCellContainer.cxx:204
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TileCell.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataPool::nextElementPtr
pointer nextElementPtr()
obtain the next available element in pool by pointer pool is resized if its limit has been reached On...
DataPool.h
CaloDetDescrElement::is_tile
bool is_tile() const
cell belongs to Tile
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:442
CaloCellContainer::push_back_fast
void push_back_fast(CaloCell *)
reimplementation of push_back to gain speed in readin
Definition: CaloCellContainer.cxx:102
CaloCellContainer::updateCaloIterators
void updateCaloIterators()
fill calo iterators and the index of first and last cell IT IS THE RESPONSABILITY OF THE PRODUCER TO ...
Definition: CaloCellContainer.cxx:268
CaloCellContCopyTool::initialize
virtual StatusCode initialize() override
Definition: CaloCellContCopyTool.cxx:11
LArCell.h
LArCell
Data object for LAr calorimeter readout cell.
Definition: LArCell.h:53
CaloCellContainer.h
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
CaloCellContCopyTool.h
CaloCellContainer::resetLookUpTable
void resetLookUpTable()
reset look up table
Definition: CaloCellContainer.cxx:462
CaloCellContainer::m_hasCalo
std::vector< bool > m_hasCalo
true if given cell from given calo has been filled (even if none)
Definition: CaloCellContainer.h:286
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
DataPool
a typed memory pool that saves time spent allocation small object. This is typically used by containe...
Definition: DataPool.h:47
CaloCellContainer::setIsOrderedAndComplete
void setIsOrderedAndComplete(const bool ordered)
indicate that the container is complete and in order
Definition: CaloCellContainer.cxx:165