ATLAS Offline Software
Public Member Functions | Protected Attributes | List of all members
CaloCellContainerSD Class Reference

#include <CaloCellContainerSD.h>

Inheritance diagram for CaloCellContainerSD:
Collaboration diagram for CaloCellContainerSD:

Public Member Functions

 CaloCellContainerSD (const std::string &name, const std::string &CaloCellContainerName, PublicToolHandle< ICaloCellMakerTool > FastHitConvertTool)
 
 ~CaloCellContainerSD ()
 
void StartOfAthenaEvent (const EventContext &ctx)
 
void EndOfAthenaEvent (const EventContext &ctx)
 
G4bool ProcessHits (G4Step *, G4TouchableHistory *) override final
 
void recordCells (TFCSSimulationState &)
 

Protected Attributes

PublicToolHandle< ICaloCellMakerToolm_EmptyCellBuilderTool
 
SG::WriteHandle< CaloCellContainerm_caloCellContainer
 
PublicToolHandle< ICaloCellMakerToolm_FastHitConvertTool
 

Detailed Description

Definition at line 21 of file CaloCellContainerSD.h.

Constructor & Destructor Documentation

◆ CaloCellContainerSD()

CaloCellContainerSD::CaloCellContainerSD ( const std::string &  name,
const std::string &  CaloCellContainerName,
PublicToolHandle< ICaloCellMakerTool FastHitConvertTool 
)

Definition at line 17 of file CaloCellContainerSD.cxx.

18  : G4VSensitiveDetector( name ),
19  m_EmptyCellBuilderTool("EmptyCellBuilderTool/EmptyCellBuilderTool"),
22 {
23  if(m_EmptyCellBuilderTool.retrieve().isFailure()) {
24  G4Exception("CaloCellContainerSD", "FailedEmptyCellBuilderToolRetrieval", FatalException, "CaloCellContainerSD: Failed to retrieve the empty cell builder tool.");
25  abort();
26  }
27 }

◆ ~CaloCellContainerSD()

CaloCellContainerSD::~CaloCellContainerSD ( )
inline

Definition at line 25 of file CaloCellContainerSD.h.

25 {}

Member Function Documentation

◆ EndOfAthenaEvent()

void CaloCellContainerSD::EndOfAthenaEvent ( const EventContext &  ctx)

Definition at line 43 of file CaloCellContainerSD.cxx.

43  {
44 
45  // Update the calo iterators of the calo cell container
47 
48  // Convert FastCaloSim hits into HitCollections, taking into account sampling fractions
49  if(m_FastHitConvertTool->process(&*m_caloCellContainer, ctx).isFailure()){
50  G4Exception("CaloCellContainerSD", "FailedFastHitConvertToolProcess", FatalException, "CaloCellContainerSD: Failed to process calo cell container with the fast hit convert tool.");
51  abort();
52  }
53 
54  return;
55 }

◆ ProcessHits()

G4bool CaloCellContainerSD::ProcessHits ( G4Step *  ,
G4TouchableHistory *   
)
finaloverride

Definition at line 57 of file CaloCellContainerSD.cxx.

57  {
58  // This method needs to be implemented when deriving from G4VSensitiveDetector has no use in this case
59  G4Exception("CaloCellContainerSD", "UndefinedProcessHitsCall", FatalException, "CaloCellContainerSD: Call to undefined ProcessHits.");
60  abort();
61  return true;
62 }

◆ recordCells()

void CaloCellContainerSD::recordCells ( TFCSSimulationState simState)

Definition at line 65 of file CaloCellContainerSD.cxx.

66 {
67  // Add the energies from the simulation state to the CaloCellContainer
68  for(const auto& icell : simState.cells()) {
69  CaloCell* caloCell = (CaloCell*)m_caloCellContainer->findCell(icell.first->calo_hash());
70  caloCell->addEnergy(icell.second);
71  }
72 
73 }

◆ StartOfAthenaEvent()

void CaloCellContainerSD::StartOfAthenaEvent ( const EventContext &  ctx)

Definition at line 30 of file CaloCellContainerSD.cxx.

30  {
31 
32  if (!m_caloCellContainer.isValid()) m_caloCellContainer = std::make_unique<CaloCellContainer>(SG::VIEW_ELEMENTS);
33 
34  //Initialize cell container with empty cells
35  if(m_EmptyCellBuilderTool->process(&*m_caloCellContainer, ctx).isFailure()){
36  G4Exception("CaloCellContainerSD", "FailedEmptyCellBuilderToolProcess", FatalException, "CaloCellContainerSD: Failed to process calo cell container with the empty cell builder tool.");
37  abort();
38  }
39 
40  return;
41 }

Member Data Documentation

◆ m_caloCellContainer

SG::WriteHandle<CaloCellContainer> CaloCellContainerSD::m_caloCellContainer
protected

Definition at line 43 of file CaloCellContainerSD.h.

◆ m_EmptyCellBuilderTool

PublicToolHandle<ICaloCellMakerTool> CaloCellContainerSD::m_EmptyCellBuilderTool
protected

Definition at line 41 of file CaloCellContainerSD.h.

◆ m_FastHitConvertTool

PublicToolHandle<ICaloCellMakerTool> CaloCellContainerSD::m_FastHitConvertTool
protected

Definition at line 45 of file CaloCellContainerSD.h.


The documentation for this class was generated from the following files:
FastHitConvertTool
Definition: FastHitConvertTool.h:44
WriteCellNoiseToCool.icell
icell
Definition: WriteCellNoiseToCool.py:339
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
TFCSSimulationState::cells
Cellmap_t & cells()
Definition: TFCSSimulationState.h:72
CaloCellContainerSD::m_EmptyCellBuilderTool
PublicToolHandle< ICaloCellMakerTool > m_EmptyCellBuilderTool
Definition: CaloCellContainerSD.h:41
CaloCellContainerSD::m_caloCellContainer
SG::WriteHandle< CaloCellContainer > m_caloCellContainer
Definition: CaloCellContainerSD.h:43
CaloCellContainerSD::m_FastHitConvertTool
PublicToolHandle< ICaloCellMakerTool > m_FastHitConvertTool
Definition: CaloCellContainerSD.h:45
TBMuToCaloAlg_jobOptions.CaloCellContainerName
CaloCellContainerName
Definition: TBMuToCaloAlg_jobOptions.py:9
CaloCellContainer::findCell
const CaloCell * findCell(const IdentifierHash theHash) const
fast find method given identifier hash.
Definition: CaloCellContainer.cxx:345
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
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
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloCell::addEnergy
virtual void addEnergy(float energy)
add energy
Definition: CaloCell.cxx:141