Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
EmptyCellBuilderTool Class Reference

Building Cells objects from Atlfast. More...

#include <EmptyCellBuilderTool.h>

Inheritance diagram for EmptyCellBuilderTool:
Collaboration diagram for EmptyCellBuilderTool:

Public Member Functions

 EmptyCellBuilderTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual StatusCode initialize () override
 
virtual StatusCode process (CaloCellContainer *theCellContainer, const EventContext &ctx) const override
 

Private Member Functions

void create_empty_calo (const EventContext &ctx, CaloCellContainer *theCellContainer) const
 

Private Attributes

SG::ReadCondHandleKey< CaloDetDescrManagerm_caloMgrKey
 

Detailed Description

Building Cells objects from Atlfast.

Author
Michael Duehrssen

Definition at line 20 of file EmptyCellBuilderTool.h.

Constructor & Destructor Documentation

◆ EmptyCellBuilderTool()

EmptyCellBuilderTool::EmptyCellBuilderTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 13 of file EmptyCellBuilderTool.cxx.

16  : base_class(type, name, parent)
17 {
18 }

Member Function Documentation

◆ create_empty_calo()

void EmptyCellBuilderTool::create_empty_calo ( const EventContext &  ctx,
CaloCellContainer theCellContainer 
) const
private

Definition at line 36 of file EmptyCellBuilderTool.cxx.

38 {
40  if (!caloMgrHandle.isValid()) {
41  ATH_MSG_FATAL("Failed to retrieve CaloDetDescrManager!");
42  std::abort();
43  }
44  const CaloDetDescrManager* caloDDM = *caloMgrHandle;
45 
46  ATH_MSG_DEBUG("Executing start calo size=" <<theCellContainer->size()<<" Event="<<ctx.evt());
47  bool check_exist=false;
48  if(theCellContainer->size()>0) {
49  check_exist=true;
50  ATH_MSG_DEBUG(" CaloCells do already exist: check required when creating!");
51  }
52 
53  int ncreate=0;
54  int nfound=0;
55  double E_tot=0;
56  double Et_tot=0;
57 
58  DataPool<TileCell> CellsPTile(10000);
59  DataPool<CaloCell> CellsPCalo(190000);
60  ATH_MSG_DEBUG("before: CellsPTile.capacity()="<<CellsPTile.capacity()<<" CellsPTile.allocated()="<<CellsPTile.allocated());
61  ATH_MSG_DEBUG("before: CellsPCalo.capacity()="<<CellsPCalo.capacity()<<" CellsPCalo.allocated()="<<CellsPCalo.allocated());
62 
63  for (const CaloDetDescrElement* theDDE : caloDDM->element_range()) {
64  if (theDDE) {
65  CaloCell* theCaloCell=0;
66 
67  if (check_exist) { theCaloCell = (CaloCell*)(theCellContainer->findCell(theDDE->calo_hash())); }
68 
69  if (theCaloCell) {
70  theCaloCell->setGain(CaloGain::INVALIDGAIN);
71  E_tot += theCaloCell->energy();
72  Et_tot += theCaloCell->energy() / cosh(theCaloCell->eta());
73  ++nfound;
74  } else {
75  CaloCell_ID::SUBCALO calo=theDDE->getSubCalo();
76  if (calo == CaloCell_ID::TILE) {
77  theCaloCell = CellsPTile.nextElementPtr();
78  } else {
79  theCaloCell = CellsPCalo.nextElementPtr();
80  }
81 
82  theCaloCell->setEnergy(0);
83  theCaloCell->setTime(0);
84  theCaloCell->setQuality(1.0);
85  theCaloCell->setGain(CaloGain::INVALIDGAIN);
86  theCaloCell->setCaloDDE(theDDE);
87 
88  theCellContainer->push_back(theCaloCell);
89  ++ncreate;
90  }
91  }
92  }
93 
94  ATH_MSG_DEBUG(ncreate<<" cells created, "<<nfound<<" cells already found: size="<<theCellContainer->size()<<" e="<<E_tot<<" ; et="<<Et_tot<<". Now initialize and order calo...");
95 
96  // check whether has max hash id size
97  const CaloCell_ID * theCaloCCIDM = caloDDM->getCaloCell_ID() ;
98  unsigned int hashMax = theCaloCCIDM->calo_cell_hash_max();
99  if (theCellContainer->size() < hashMax) {
100  ATH_MSG_DEBUG("CaloCellContainer size " << theCellContainer->size() << " smaller than hashMax: " << hashMax);
101  }
102  else if (theCellContainer->size() == hashMax) {
103  ATH_MSG_DEBUG("CaloCellContainer size " << theCellContainer->size() << " correspond to hashMax : " << hashMax);
104  theCellContainer->setHasTotalSize(true);
105  }
106  else {
107  ATH_MSG_WARNING("CaloCellContainer size " << theCellContainer->size()
108  << " larger than hashMax ! Too many cells ! " << hashMax);
109 
110  }
111 
112  // check whether in order and complete
113  if (theCellContainer->checkOrderedAndComplete()){
114  ATH_MSG_DEBUG("CaloCellContainer ordered and complete");
115  theCellContainer->setIsOrderedAndComplete(true);
116  theCellContainer->setIsOrdered(true);
117  } else {
118  ATH_MSG_DEBUG("CaloCellContainer not ordered or incomplete");
119  theCellContainer->setIsOrderedAndComplete(false);
120  // check whether in order
121  if (theCellContainer->checkOrdered()){
122  ATH_MSG_DEBUG("CaloCellContainer ordered");
123  theCellContainer->setIsOrdered(true);
124  } else {
125  ATH_MSG_DEBUG("CaloCellContainer not ordered");
126  theCellContainer->setIsOrdered(false);
127  }
128  }
129 
130  if (!theCellContainer->isOrdered()) {theCellContainer->order();}
131 
132  ATH_MSG_DEBUG("before: CellsPTile.capacity()="<<CellsPTile.capacity()<<" CellsPTile.allocated()="<<CellsPTile.allocated());
133  ATH_MSG_DEBUG("before: CellsPCalo.capacity()="<<CellsPCalo.capacity()<<" CellsPCalo.allocated()="<<CellsPCalo.allocated());
134 }

◆ initialize()

StatusCode EmptyCellBuilderTool::initialize ( )
overridevirtual

Definition at line 20 of file EmptyCellBuilderTool.cxx.

21 {
22  ATH_MSG_INFO("Initialisating started");
24  ATH_MSG_INFO("Initialisating finished");
25  return StatusCode::SUCCESS;
26 }

◆ process()

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

Definition at line 29 of file EmptyCellBuilderTool.cxx.

31 {
32  create_empty_calo(ctx, theCellContainer);
33  return StatusCode::SUCCESS;
34 }

Member Data Documentation

◆ m_caloMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> EmptyCellBuilderTool::m_caloMgrKey
private
Initial value:
{ this
, "CaloDetDescrManager"
, "CaloDetDescrManager"
, "SG Key for CaloDetDescrManager in the Condition Store" }

Definition at line 37 of file EmptyCellBuilderTool.h.


The documentation for this class was generated from the following files:
CaloDetDescrManager_Base::element_range
calo_element_range element_range() const
Range over element vector.
Definition: CaloDetDescrManager.cxx:123
CaloCell::setCaloDDE
virtual void setCaloDDE(const CaloDetDescrElement *caloDDE)
set pointer to CaloDetDescrElement
Definition: CaloCell.cxx:127
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
CaloCellContainer::checkOrderedAndComplete
bool checkOrderedAndComplete() const
verify one by one the container is complete (i.e.
Definition: CaloCellContainer.cxx:150
CaloCellContainer::setHasTotalSize
void setHasTotalSize(const bool)
If @ flag is true, then the container size equals the maximum hash.
Definition: CaloCellContainer.cxx:169
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CaloCell::setTime
virtual void setTime(float time)
set time
Definition: CaloCell.cxx:151
EmptyCellBuilderTool::create_empty_calo
void create_empty_calo(const EventContext &ctx, CaloCellContainer *theCellContainer) const
Definition: EmptyCellBuilderTool.cxx:36
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
CaloCellContainer::isOrdered
bool isOrdered() const
tell wether container is ordered
Definition: CaloCellContainer.h:293
CaloCell::setEnergy
virtual void setEnergy(float energy)
set energy
Definition: CaloCell.cxx:136
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
CaloCell::energy
double energy() const
get energy (data member)
Definition: CaloCell.h:311
EmptyCellBuilderTool::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition: EmptyCellBuilderTool.h:37
CaloGain::INVALIDGAIN
@ INVALIDGAIN
Definition: CaloGain.h:18
CaloCell::setQuality
virtual void setQuality(uint16_t quality)
set quality
Definition: CaloCell.cxx:156
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CaloCell_Base_ID::SUBCALO
SUBCALO
enumeration of sub calorimeters
Definition: CaloCell_Base_ID.h:46
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCell_Base_ID::TILE
@ TILE
Definition: CaloCell_Base_ID.h:46
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
CaloCell::setGain
void setGain(CaloGain::CaloGain gain=CaloGain::INVALIDGAIN)
set gain
Definition: CaloCell.cxx:173
CaloCellContainer::findCell
const CaloCell * findCell(const IdentifierHash theHash) const
fast find method given identifier hash.
Definition: CaloCellContainer.cxx:345
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
CaloCellContainer::checkOrdered
bool checkOrdered() const
verify one by one the container is ordered
Definition: CaloCellContainer.cxx:173
CaloCellContainer::order
void order()
order container
Definition: CaloCellContainer.cxx:474
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CaloCellContainer::push_back
void push_back(CaloCell *)
reimplementation of const push_back
Definition: CaloCellContainer.cxx:74
DataPool
a typed memory pool that saves time spent allocation small object. This is typically used by containe...
Definition: DataPool.h:63
CaloDetDescrManager::getCaloCell_ID
const CaloCell_ID * getCaloCell_ID() const
get calo cell ID helper
Definition: CaloDetDescrManager.cxx:1590
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
CaloCellContainer::setIsOrderedAndComplete
void setIsOrderedAndComplete(const bool ordered)
indicate that the container is complete and in order
Definition: CaloCellContainer.cxx:165
CaloCell::eta
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition: CaloCell.h:366
CaloCell_Base_ID::calo_cell_hash_max
size_type calo_cell_hash_max(void) const
cell 'global' hash table max size