|
ATLAS Offline Software
|
Standard tool to export cell energy and gain to the GPU.
More...
#include <BasicEventDataGPUExporter.h>
|
| BasicEventDataGPUExporter (const std::string &type, const std::string &name, const IInterface *parent) |
|
virtual StatusCode | initialize () override |
|
virtual StatusCode | convert (const EventContext &ctx, const CaloRecGPU::ConstantDataHolder &constant_data, const xAOD::CaloClusterContainer *cluster_collection, CaloRecGPU::EventDataHolder &event_data) const override |
| Fill the CaloRecGPU::EventDataHolder with the relevant information. More...
|
|
virtual StatusCode | finalize () override |
|
virtual | ~BasicEventDataGPUExporter ()=default |
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysInitialize () override |
| Perform system initialization for an algorithm. More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
| DeclareInterfaceID (ICaloClusterGPUInputTransformer, 1, 0) |
|
|
Gaudi::Property< bool > | m_keepCPUData {this, "KeepCPUData", true, "Keep CPU version of GPU data format"} |
| If true , do not delete the CPU version of the GPU-friendly data representation. More...
|
|
SG::ReadHandleKey< CaloCellContainer > | m_cellsKey {this, "CellsName", "", "Name(s) of Cell Containers"} |
| vector of names of the cell containers to use as input. More...
|
|
Gaudi::Property< bool > | m_considerSharedCells {this, "ConsiderSharedCells", false, "Take into account the possibility of a cell being shared between clusters."} |
| If true , into account the possibility of a cell being shared between clusters. More...
|
|
Gaudi::Property< std::vector< int > > | m_missingCellsToFill {this, "MissingCellsToFill", {}, "Force fill these cells as disabled on empty containers."} |
| Cell indices to fill as disabled cells (useful if the cell vector is always missing the same cells). More...
|
|
const CaloCell_ID * | m_calo_id {nullptr} |
| Pointer to Calo ID Helper. More...
|
|
StoreGateSvc_t | m_evtStore |
| Pointer to StoreGate (event store by default) More...
|
|
StoreGateSvc_t | m_detStore |
| Pointer to StoreGate (detector store by default) More...
|
|
std::vector< SG::VarHandleKeyArray * > | m_vhka |
|
bool | m_varHandleArraysDeclared |
|
Standard tool to export cell energy and gain to the GPU.
- Author
- Nuno Fernandes nuno..nosp@m.dos..nosp@m.santo.nosp@m.s.fe.nosp@m.rnand.nosp@m.es@c.nosp@m.ern.c.nosp@m.h
- Date
- 29 May 2022
Definition at line 30 of file BasicEventDataGPUExporter.h.
◆ StoreGateSvc_t
◆ BasicEventDataGPUExporter()
BasicEventDataGPUExporter::BasicEventDataGPUExporter |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ ~BasicEventDataGPUExporter()
virtual BasicEventDataGPUExporter::~BasicEventDataGPUExporter |
( |
| ) |
|
|
virtualdefault |
◆ convert()
Fill the CaloRecGPU::EventDataHolder
with the relevant information.
- Parameters
-
ctx | The event context. |
constant_data | Data held in GPU memory that is common to all events (cell noise and geometry). |
cluster_collection | The cluster collection, in the standard Athena structures. |
event_data | Data held in GPU memory that is specific to this event (including the description of the clusters themselves). |
Implements ICaloClusterGPUInputTransformer.
Definition at line 42 of file BasicEventDataGPUExporter.cxx.
47 using clock_type = boost::chrono::thread_clock;
48 auto time_cast = [](
const auto & before,
const auto & after)
50 return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count();
55 ed.m_cell_info.allocate();
58 if ( !cell_collection.isValid() )
60 ATH_MSG_ERROR(
" Cannot retrieve CaloCellContainer: " << cell_collection.name() );
61 return StatusCode::FAILURE;
70 auto export_cell = [&](
const CaloCell *
cell,
const int cell_index)
73 const unsigned int gain = GainConversion::from_standard_gain(
cell->gain());
74 ed.m_cell_info->energy[cell_index] =
energy;
75 ed.m_cell_info->gain[cell_index] =
gain;
76 ed.m_cell_info->time[cell_index] =
cell->time();
109 if (cell_collection->isOrderedAndComplete())
117 export_cell(
cell, cell_index);
124 ATH_MSG_DEBUG(
"Taking remediated fast path on event " << ctx.evt());
126 size_t missing_cell_count = 0;
134 ed.m_cell_info->gain[cell_index] = GainConversion::invalid_gain();
135 ++missing_cell_count;
140 export_cell(
cell, cell_index);
151 for (
int cell_index = 0; cell_index <
NCaloCells; ++cell_index)
153 ed.m_cell_info->gain[cell_index] = GainConversion::invalid_gain();
161 const int cell_index =
cell->caloDDE()->calo_hash();
164 export_cell(
cell, cell_index);
192 ed.m_clusters.allocate();
193 ed.m_cell_state.allocate();
195 if (cluster_collection->
size() > 0)
200 ed.m_cell_state->clusterTag[
i] = ClusterTag::make_invalid_tag();
203 const auto cluster_end = cluster_collection->
end();
204 auto cluster_iter = cluster_collection->
begin();
206 for (
int cluster_number = 0; cluster_iter != cluster_end; ++cluster_iter, ++cluster_number )
211 ed.m_clusters->clusterEnergy[cluster_number] = cluster->
e();
212 ed.m_clusters->clusterEt[cluster_number] = cluster->
et();
213 ed.m_clusters->clusterEta[cluster_number] = cluster->
eta();
214 ed.m_clusters->clusterPhi[cluster_number] = cluster->
phi();
218 ed.m_clusters->seedCellID[cluster_number] = seed_cell_index;
220 for (
auto it = cell_links->
begin();
it != cell_links->
end(); ++
it)
224 const int cell_ID =
m_calo_id->calo_cell_hash(
it->ID());
228 std::memcpy(&weight_as_int, &
weight,
sizeof(
float));
233 if (weight_as_int == 0)
241 const ClusterTag other_tag = ed.m_cell_state->clusterTag[cell_ID];
249 ed.m_cell_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number, weight_as_int, 0);
253 ed.m_cell_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number);
258 ed.m_cell_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number, other_tag.
secondary_cluster_weight(), other_index);
263 const int max_cluster = cluster_number > other_index ? cluster_number : other_index;
264 const int min_cluster = cluster_number > other_index ? other_index : cluster_number;
265 ed.m_cell_state->clusterTag[cell_ID] = ClusterTag::make_tag(max_cluster, weight_as_int, min_cluster);
269 ed.m_cell_state->clusterTag[cell_ID] = ClusterTag::make_tag(other_index, weight_as_int, cluster_number);
274 ed.m_cell_state->clusterTag[
m_calo_id->calo_cell_hash(
it->ID())] = ClusterTag::make_tag(cluster_number);
279 ed.m_clusters->number = cluster_collection->
size();
284 const bool has_cluster_info = cluster_collection->
size() > 0;
286 ed.sendToGPU(!
m_keepCPUData, has_cluster_info, has_cluster_info,
false);
293 time_cast(
start, post_cells),
294 time_cast(post_cells, post_clusters),
295 time_cast(post_clusters, post_send)
299 return StatusCode::SUCCESS;
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ DeclareInterfaceID()
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ extraDeps_update_handler()
Add StoreName to extra input/output deps as needed.
use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given
◆ finalize()
StatusCode BasicEventDataGPUExporter::finalize |
( |
| ) |
|
|
overridevirtual |
◆ initialize()
StatusCode BasicEventDataGPUExporter::initialize |
( |
| ) |
|
|
overridevirtual |
◆ inputHandles()
Return this algorithm's input handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ outputHandles()
Return this algorithm's output handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ print_times()
void CaloGPUTimed::print_times |
( |
const std::string & |
header, |
|
|
const size_t |
time_size |
|
) |
| const |
|
inlineprotectedinherited |
Definition at line 138 of file CaloGPUTimed.h.
145 std::vector<size_t>
indices(m_eventNumbers.size());
149 return m_eventNumbers[a] < m_eventNumbers[b];
154 out <<
"Event_Number Total " <<
header <<
"\n";
158 out << m_eventNumbers[
idx] <<
" ";
162 for (
size_t i = 0;
i < time_size; ++
i)
164 total += m_times[
idx * time_size +
i];
169 for (
size_t i = 0;
i < time_size; ++
i)
171 out << m_times[
idx * time_size +
i] <<
" ";
◆ record_times() [1/3]
template<class ... Args>
void CaloGPUTimed::record_times |
( |
const size_t |
event_num, |
|
|
const size_t & |
value |
|
) |
| const |
|
inlineprotectedinherited |
Definition at line 102 of file CaloGPUTimed.h.
104 const size_t time_size = 1;
110 std::lock_guard<std::mutex> lock_guard(
m_timeMutex);
111 old_size = m_times.size();
112 m_times.resize(old_size + time_size);
113 m_eventNumbers.push_back(event_num);
◆ record_times() [2/3]
template<class ... Args>
void CaloGPUTimed::record_times |
( |
const size_t |
event_num, |
|
|
const size_t & |
value, |
|
|
Args &&... |
args |
|
) |
| const |
|
inlineprotectedinherited |
Definition at line 120 of file CaloGPUTimed.h.
122 const size_t time_size =
sizeof...(args) + 1;
128 std::lock_guard<std::mutex> lock_guard(
m_timeMutex);
129 old_size = m_times.size();
130 m_times.resize(old_size + time_size);
131 m_eventNumbers.push_back(event_num);
◆ record_times() [3/3]
void CaloGPUTimed::record_times |
( |
const size_t |
event_num, |
|
|
const std::vector< size_t > & |
times |
|
) |
| const |
|
inlineprotectedinherited |
Definition at line 84 of file CaloGPUTimed.h.
89 std::lock_guard<std::mutex> lock_guard(
m_timeMutex);
90 old_size = m_times.size();
91 m_times.resize(old_size +
times.size());
92 m_eventNumbers.push_back(event_num);
95 for (
size_t i = 0;
i <
times.size(); ++
i)
97 m_times[old_size +
i] =
times[
i];
◆ record_times_helper() [1/3]
void CaloGPUTimed::record_times_helper |
( |
size_t |
index, |
|
|
size_t |
t |
|
) |
| const |
|
inlineprivateinherited |
◆ record_times_helper() [2/3]
template<class ... Args>
void CaloGPUTimed::record_times_helper |
( |
size_t |
index, |
|
|
size_t |
t, |
|
|
Args &&... |
args |
|
) |
| const |
|
inlineprivateinherited |
◆ record_times_helper() [3/3]
void CaloGPUTimed::record_times_helper |
( |
size_t |
| ) |
const |
|
inlineprivateinherited |
◆ renounce()
◆ renounceArray()
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ ATLAS_THREAD_SAFE [1/2]
std::vector<size_t> m_times CaloGPUTimed::ATLAS_THREAD_SAFE |
|
mutableprotectedinherited |
Vector to hold execution times to be recorded if necessary.
Definition at line 35 of file CaloGPUTimed.h.
◆ ATLAS_THREAD_SAFE [2/2]
std::vector<size_t> m_eventNumbers CaloGPUTimed::ATLAS_THREAD_SAFE |
|
mutableprotectedinherited |
Vector to hold the event numbers to be recorded if necessary.
Definition at line 40 of file CaloGPUTimed.h.
◆ m_calo_id
◆ m_cellsKey
◆ m_considerSharedCells
Gaudi::Property<bool> BasicEventDataGPUExporter::m_considerSharedCells {this, "ConsiderSharedCells", false, "Take into account the possibility of a cell being shared between clusters."} |
|
private |
If true
, into account the possibility of a cell being shared between clusters.
Hurts performance when not needed. Defaults to false
.
Definition at line 64 of file BasicEventDataGPUExporter.h.
◆ m_detStore
◆ m_evtStore
◆ m_keepCPUData
Gaudi::Property<bool> BasicEventDataGPUExporter::m_keepCPUData {this, "KeepCPUData", true, "Keep CPU version of GPU data format"} |
|
private |
If true
, do not delete the CPU version of the GPU-friendly data representation.
Defaults to true
.
Definition at line 52 of file BasicEventDataGPUExporter.h.
◆ m_measureTimes
Gaudi::Property<bool> CaloGPUTimed::m_measureTimes |
|
protectedinherited |
If true
, times are recorded to the file given by m_timeFileName
.
Defaults to false
.
Definition at line 46 of file CaloGPUTimed.h.
◆ m_missingCellsToFill
Gaudi::Property<std::vector<int> > BasicEventDataGPUExporter::m_missingCellsToFill {this, "MissingCellsToFill", {}, "Force fill these cells as disabled on empty containers."} |
|
private |
Cell indices to fill as disabled cells (useful if the cell vector is always missing the same cells).
Definition at line 68 of file BasicEventDataGPUExporter.h.
◆ m_timeFileName
Gaudi::Property<std::string> CaloGPUTimed::m_timeFileName |
|
protectedinherited |
File to which times should be saved.
Definition at line 50 of file CaloGPUTimed.h.
◆ m_timeMutex
std::mutex CaloGPUTimed::m_timeMutex |
|
mutableprotectedinherited |
Mutex that is locked when recording times.
Definition at line 32 of file CaloGPUTimed.h.
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
virtual double phi() const
The azimuthal angle ( ) of the particle.
Gaudi::Property< std::vector< int > > m_missingCellsToFill
Cell indices to fill as disabled cells (useful if the cell vector is always missing the same cells).
const_cell_iterator cell_begin() const
Iterator of the underlying CaloClusterCellLink (const version)
Const iterator class for DataVector/DataList.
SG::ReadHandleKey< CaloCellContainer > m_cellsKey
vector of names of the cell containers to use as input.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
std::pair< long int, long int > indices
const_iterator begin() const
const begin method
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Gaudi::Property< std::string > m_timeFileName
File to which times should be saved.
std::vector< SG::VarHandleKeyArray * > m_vhka
void record_times_helper(size_t) const
Gaudi::Property< bool > m_considerSharedCells
If true, into account the possibility of a cell being shared between clusters.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual void setOwner(IDataHandleHolder *o)=0
Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink,...
constexpr int32_t cluster_index() const
uint8_t qual2(void) const
get quality of second PMT (data member)
Description of a calorimeter cluster.
const CaloCell_ID * m_calo_id
Pointer to Calo ID Helper.
virtual double eta() const
The pseudorapidity ( ) of the particle.
constexpr static bool is_tile(const int cell)
void print_times(const std::string &header, const size_t time_size) const
uint8_t qbit1(void) const
get quality bits of first PMT (data member)
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
Gaudi::Property< bool > m_keepCPUData
If true, do not delete the CPU version of the GPU-friendly data representation.
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
std::mutex m_timeMutex
Mutex that is locked when recording times.
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
const_iterator end() const
const end method
constexpr bool is_part_of_cluster() const
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
uint8_t qbit2(void) const
get quality bits of second PMT (data member)
Data object for each calorimeter readout cell.
void record_times(const size_t event_num, const std::vector< size_t > ×) const
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Gaudi::Property< bool > m_measureTimes
If true, times are recorded to the file given by m_timeFileName.
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
uint8_t qual1(void) const
get quality of first PMT (data member)
size_type size() const noexcept
Returns the number of elements in the collection.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
virtual double e() const
The total energy of the particle.
constexpr int32_t secondary_cluster_weight() const
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.