ATLAS Offline Software
Loading...
Searching...
No Matches
TopoAutomatonClustering Class Reference

Topological cluster maker algorithm to be run on GPUs. More...

#include <TopoAutomatonClustering.h>

Inheritance diagram for TopoAutomatonClustering:
Collaboration diagram for TopoAutomatonClustering:

Public Member Functions

 TopoAutomatonClustering (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize () override
virtual StatusCode initialize_non_CUDA () override
 Initialization that does not invoke CUDA functions.
virtual StatusCode initialize_CUDA () override
 Initialization that invokes CUDA functions.
virtual StatusCode execute (const EventContext &ctx, const CaloRecGPU::ConstantDataHolder &constant_data, CaloRecGPU::EventDataHolder &event_data, void *temporary_buffer) const override
virtual StatusCode finalize () override
virtual ~TopoAutomatonClustering ()=default
void handle (const Incident &incident) override

Protected Member Functions

void record_times (const size_t event_num, const std::vector< size_t > &times) const
template<class ... Args>
void record_times (const size_t event_num, const size_t &value) const
template<class ... Args>
void record_times (const size_t event_num, const size_t &value, Args &&... args) const
void print_times (const std::string &header, const size_t time_size) const

Protected Attributes

std::shared_mutex m_timeMutex
 Mutex that is locked when recording times.
std::vector< size_t > m_times ATLAS_THREAD_SAFE
 Vector to hold execution times to be recorded if necessary.
std::vector< size_t > m_eventNumbers ATLAS_THREAD_SAFE
 Vector to hold the event numbers to be recorded if necessary.
Gaudi::Property< bool > m_measureTimes
 If true, times are recorded to the file given by m_timeFileName.
Gaudi::Property< std::string > m_timeFileName
 File to which times should be saved.

Private Member Functions

void record_times_helper (const size_t) const
template<class Arg>
void record_times_helper (const size_t index, Arg &&arg) const
template<class ... Args>
void record_times_helper (size_t index, Args &&... args) const

Private Attributes

Gaudi::Property< std::vector< std::string > > m_caloNames {this, "CalorimeterNames", {}, "Name(s) of Calorimeters to use for clustering"}
 vector of names of the calorimeters to consider.
Gaudi::Property< std::vector< std::string > > m_samplingNames {this, "SeedSamplingNames", {}, "Name(s) of Calorimeter Samplings to consider for seeds"}
 vector of names of the calorimeter samplings to consider for seeds.
Gaudi::Property< float > m_cellThresholdOnEorAbsEinSigma {this, "CellThresholdOnEorAbsEinSigma", 0., "Cell (terminal) threshold (in units of noise Sigma)"}
 all cells have to satisfy \(|E| > N_{\rm cell}\,\sigma\)
Gaudi::Property< float > m_neighborThresholdOnEorAbsEinSigma {this, "NeighborThresholdOnEorAbsEinSigma", 2., "Neighbor (grow) threshold (in units of noise Sigma)"}
 cells with \(|E| > N_{\rm neighbor}\,\sigma\) extend the cluster
Gaudi::Property< float > m_seedThresholdOnEorAbsEinSigma {this, "SeedThresholdOnEorAbsEinSigma", 4., "Seed threshold (in units of noise Sigma)"}
 cells with \(|E| > N_{\rm seed}\,\sigma\) start a cluster
Gaudi::Property< bool > m_seedCutsInAbsE {this, "SeedCutsInAbsE", true, "Seed cuts in Abs E instead of E"}
 if set to true seed cuts are on \(|E|\) and \(|E|_\perp\).
Gaudi::Property< bool > m_neighborCutsInAbsE {this, "NeighborCutsInAbsE", true, "Neighbor (grow) cuts in Abs E instead of E"}
 if set to true neighbor cuts are on \(|E|\) and \(|E|_\perp\).
Gaudi::Property< bool > m_cellCutsInAbsE {this, "CellCutsInAbsE", true, "Cell (terminal) cuts in Abs E instead of E"}
 if set to true cell cuts are on \(|E|\) and \(|E|_\perp\).
Gaudi::Property< bool > m_cutCellsInTime {this, "SeedCutsInT", false, "Do seed cuts in time"}
 if set to true, time cut is applied to seed cells, no cut otherwise
Gaudi::Property< float > m_timeThreshold {this, "SeedThresholdOnTAbs", 12.5 * CLHEP::ns, "Time thresholds (in abs. val.)"}
 threshold used for timing cut on seed cells.
Gaudi::Property< float > m_thresholdForKeeping {this, "TimeCutUpperLimit", 20., "Significance upper limit for applying time cut"}
 upper limit on the energy significance, for applying the cell time cut
Gaudi::Property< bool > m_treatL1PredictedCellsAsGood {this, "TreatL1PredictedCellsAsGood", true, "Treat bad cells with dead OTX if predicted from L1 as good"}
 if set to true treat cells with a dead OTX which can be predicted by L1 trigger info as good instead of bad cells
Gaudi::Property< bool > m_excludeCutSeedsFromClustering {this, "CutOOTseed", true, "Exclude out-of-time seeds from neighbouring and cell stage"}
 if set to true, seed cells failing the time cut are also excluded from cluster at all
Gaudi::Property< bool > m_keepSignificantCells {this, "UseTimeCutUpperLimit", false, "Do not apply time cut on cells of large significance"}
 if set to true, the time cut is not applied on cell of large significance
Gaudi::Property< bool > m_twoGaussianNoise {this, "TwoGaussianNoise", false, "Use 2-gaussian noise description for TileCal"}
 if set to true use 2-gaussian noise description for TileCal
Gaudi::Property< std::string > m_neighborOptionString
 type of neighbor relations to use.
Gaudi::Property< bool > m_restrictHECIWandFCalNeighbors
 if set to true limit the neighbors in HEC IW and FCal2&3.
Gaudi::Property< bool > m_restrictPSNeighbors
 if set to true limit the neighbors in presampler Barrel and Endcap.
Gaudi::Property< bool > m_xtalkEM2
 If set to true, the time window is softened in the EMB2 and EME2_OW due to crosstalk from direct neighbour cells in phi.
Gaudi::Property< float > m_xtalkDeltaT
 Additional maximum delta t added to the upper limit time window in case crosstalk in EM2 should be accounted for.
TAGrowing::TACOptionsHolder m_options
 Options for the algorithm, held in a GPU-friendly way.
ServiceHandle< IGPUKernelSizeOptimizerSvcm_kernelSizeOptimizer { this, "KernelSizeOptimizer", "GPUKernelSizeOptimizerSvc", "CUDA kernel size optimization service." }
 Handle to the CUDA kernel block and grid size optimization service.

Detailed Description

Topological cluster maker algorithm to be run on GPUs.

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
31 May 2022

Definition at line 36 of file TopoAutomatonClustering.h.

Constructor & Destructor Documentation

◆ TopoAutomatonClustering()

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

Definition at line 24 of file TopoAutomatonClustering.cxx.

24 :
25 base_class(type, name, parent),
26 CaloGPUTimed(this)
27{
28}
CaloGPUTimed(T *ptr)

◆ ~TopoAutomatonClustering()

virtual TopoAutomatonClustering::~TopoAutomatonClustering ( )
virtualdefault

Member Function Documentation

◆ execute()

StatusCode TopoAutomatonClustering::execute ( const EventContext & ctx,
const CaloRecGPU::ConstantDataHolder & constant_data,
CaloRecGPU::EventDataHolder & event_data,
void * temporary_buffer ) const
overridevirtual

Definition at line 254 of file TopoAutomatonClustering.cxx.

256{
257
258 using clock_type = boost::chrono::thread_clock;
259 auto time_cast = [](const auto & before, const auto & after)
260 {
261 return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count();
262 };
263
264 const auto start = clock_type::now();
265
266 const auto before_snr = clock_type::now();
267
268 signalToNoise(event_data, constant_data, m_options, *(m_kernelSizeOptimizer.get()), m_measureTimes);
269
270 const auto before_pairs = clock_type::now();
271
272 cellPairs(event_data, constant_data, m_options, *(m_kernelSizeOptimizer.get()), m_measureTimes);
273
274 const auto before_growing = clock_type::now();
275
276 clusterGrowing(event_data, constant_data, m_options, *(m_kernelSizeOptimizer.get()), m_measureTimes);
277
278 const auto end = clock_type::now();
279
280
281 if (m_measureTimes)
282 {
283 record_times(ctx.evt(),
284 time_cast(start, before_snr),
285 time_cast(before_snr, before_pairs),
286 time_cast(before_pairs, before_growing),
287 time_cast(before_growing, end)
288 );
289 }
290
291 return StatusCode::SUCCESS;
292
293
294}
Gaudi::Property< bool > m_measureTimes
If true, times are recorded to the file given by m_timeFileName.
void record_times(const size_t event_num, const std::vector< size_t > &times) const
TAGrowing::TACOptionsHolder m_options
Options for the algorithm, held in a GPU-friendly way.
ServiceHandle< IGPUKernelSizeOptimizerSvc > m_kernelSizeOptimizer
Handle to the CUDA kernel block and grid size optimization service.
void signalToNoise(CaloRecGPU::EventDataHolder &holder, const CaloRecGPU::ConstantDataHolder &instance_data, const TACOptionsHolder &options, const IGPUKernelSizeOptimizer &optimizer, const bool synchronize=false, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use={})
void clusterGrowing(CaloRecGPU::EventDataHolder &holder, const CaloRecGPU::ConstantDataHolder &instance_data, const TACOptionsHolder &options, const IGPUKernelSizeOptimizer &optimizer, const bool synchronize=false, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use={})
void cellPairs(CaloRecGPU::EventDataHolder &holder, const CaloRecGPU::ConstantDataHolder &instance_data, const TACOptionsHolder &options, const IGPUKernelSizeOptimizer &optimizer, const bool synchronize=false, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use={})

◆ finalize()

StatusCode TopoAutomatonClustering::finalize ( )
overridevirtual

Definition at line 297 of file TopoAutomatonClustering.cxx.

298{
299 if (m_measureTimes)
300 {
301 print_times("Preprocessing Signal-to-Noise_Ratio Cell_Pair_Creation Cluster_Growing", 4);
302 }
303 return StatusCode::SUCCESS;
304}
void print_times(const std::string &header, const size_t time_size) const

◆ handle()

void CaloGPUCUDAInitialization::handle ( const Incident & incident)
inlineoverrideinherited

Definition at line 66 of file CaloGPUCUDAInitialization.h.

67 {
68 const bool is_multiprocess = (Gaudi::Concurrency::ConcurrencyFlags::numProcs() > 0);
69 if (is_multiprocess && incident.type() == AthenaInterprocess::UpdateAfterFork::type())
70 {
71 if (!this->initialize_CUDA().isSuccess())
72 {
73 throw GaudiException("Failed to perform the CUDA initialization!",
74 "CaloGPUCUDAInitialization::handle",
75 StatusCode::FAILURE);
76 }
77 }
78 }
static const std::string & type()
Incident type.
Definition Incidents.h:49
virtual StatusCode initialize_CUDA()
Initialization that invokes CUDA functions.

◆ initialize()

virtual StatusCode TopoAutomatonClustering::initialize ( )
inlineoverridevirtual

Reimplemented from CaloGPUCUDAInitialization.

Definition at line 43 of file TopoAutomatonClustering.h.

◆ initialize_CUDA()

StatusCode TopoAutomatonClustering::initialize_CUDA ( )
overridevirtual

Initialization that invokes CUDA functions.

Reimplemented from CaloGPUCUDAInitialization.

Definition at line 244 of file TopoAutomatonClustering.cxx.

245{
246 m_options.sendToGPU();
248
249 return StatusCode::SUCCESS;
250}
void register_kernels(IGPUKernelSizeOptimizer &optimizer)

◆ initialize_non_CUDA()

StatusCode TopoAutomatonClustering::initialize_non_CUDA ( )
overridevirtual

Initialization that does not invoke CUDA functions.

Reimplemented from CaloGPUCUDAInitialization.

Definition at line 30 of file TopoAutomatonClustering.cxx.

31{
32
33 m_options.allocate();
34
35
36 using PackType = decltype(m_options.m_options->valid_sampling_seed);
37
38 static_assert(CaloCell_ID::getNumberOfSamplings() <= sizeof(PackType) * CHAR_BIT, "We are assuming that we have fewer samplings that bits per int!");
39
40 //Possibly more elegant alternative: compile-time packed bool vector (std::bitset?) with CUDA compat.
41 //Been there, done that, overkill since number of samplings shouldn't change unexpectedly overnight
42 //and it doesn't seem that likely to me that it'll reach anything that a 64-bit int wouldn't cover
43 //(at least without implying such a major overhaul that the code will need a deeper redesign anyway...)
44
45 auto get_sampling_from_string = [](const std::string & str, bool & failed)
46 {
47 failed = false;
49 CRGPU_CHEAP_STRING_TO_ENUM( str, CaloCell_ID,
50 PreSamplerB,
51 EMB1,
52 EMB2,
53 EMB3,
54 PreSamplerE,
55 EME1,
56 EME2,
57 EME3,
58 HEC0,
59 HEC1,
60 HEC2,
61 HEC3,
62 TileBar0,
63 TileBar1,
64 TileBar2,
65 TileGap1,
66 TileGap2,
67 TileGap3,
68 TileExt0,
69 TileExt1,
70 TileExt2,
71 FCAL0,
72 FCAL1,
73 FCAL2
74 )
75 )
76 else
77 {
78 failed = true;
79 return CaloCell_ID::Unknown;
80 }
81 };
82
83
84 PackType & seed_samplings = m_options.m_options->valid_sampling_seed;
85
86 seed_samplings = 0;
87
88 for (const std::string & samp_name : m_samplingNames)
89 {
90 bool failed = false;
91 const PackType sampling = (PackType) get_sampling_from_string(samp_name, failed);
92
93 if (failed)
94 {
95 ATH_MSG_ERROR( "Calorimeter sampling" << samp_name
96 << " is not a valid Calorimeter sampling name and will be ignored! "
97 << "Valid names are: "
98 << "PreSamplerB, EMB1, EMB2, EMB3, "
99 << "PreSamplerE, EME1, EME2, EME3, "
100 << "HEC0, HEC1, HEC2, HEC3, "
101 << "TileBar0, TileBar1, TileBar2, "
102 << "TileGap1, TileGap2, TileGap3, "
103 << "TileExt0, TileExt1, TileExt2, "
104 << "FCAL0, FCAL1, FCAL2." );
105 }
106 else
107 {
108 seed_samplings |= ((PackType) 1) << sampling;
109 }
110 }
111
112 auto get_calo_from_string = [](const std::string & str, bool & failed)
113 {
114 failed = false;
116 CRGPU_CHEAP_STRING_TO_ENUM( str, CaloCell_ID,
117 LAREM, LARHEC,
118 LARFCAL, TILE,
119 LARMINIFCAL
120 )
121 )
122 else
123 {
124 failed = true;
126 }
127 };
128
129
130 auto calo_to_sampling_mask = [](const CaloCell_ID::SUBCALO sc) -> PackType
131 {
132 switch (sc)
133 {
135 return 0xFFU;
136 //PreSamplerB=0, EMB1, EMB2, EMB3,
137 //PreSamplerE, EME1, EME2, EME3=7,
139 return 0xF00U;
140 //HEC0=8, HEC1, HEC2, HEC3=11,
142 return 0x1FF000U;
143 //TileBar0=12, TileBar1, TileBar2,
144 //TileGap1, TileGap2, TileGap3,
145 //TileExt0, TileExt1, TileExt2=20,
147 return 0xE00000U;
148 //FCAL0=21, FCAL1, FCAL2=23
150 return 0xF000000U;
151 //MINIFCAL0=24, MINIFCAL1, MINIFCAL2, MINIFCAL3=27,
152 default:
153 return 0;
154 }
155 };
156
157 PackType & calo_samplings = m_options.m_options->valid_calorimeter_by_sampling;
158
159 calo_samplings = 0;
160
161 for (const std::string & calo_name : m_caloNames)
162 {
163 bool failed = false;
164 const PackType sample_mask = calo_to_sampling_mask(get_calo_from_string(calo_name, failed));
165
166 if (failed)
167 {
168 ATH_MSG_ERROR( "Calorimeter " << calo_name
169 << " is not a valid Calorimeter name and will be ignored! "
170 << "Valid names are: LAREM, LARHEC, LARFCAL, and TILE." );
171 }
172 else
173 {
174 calo_samplings |= sample_mask;
175 }
176 }
177
178 auto get_neighbour_option_from_string = [](const std::string & str, bool & failed)
179 {
180 failed = false;
182 CRGPU_CHEAP_STRING_TO_ENUM( str, LArNeighbours,
183 prevInPhi,
184 nextInPhi,
185 prevInEta,
186 nextInEta,
187 faces2D,
188 corners2D,
189 all2D,
190 prevInSamp,
191 nextInSamp,
192 upAndDown,
193 prevSubDet,
194 nextSubDet,
195 all3D,
196 corners3D,
197 all3DwithCorners,
198 prevSuperCalo,
199 nextSuperCalo,
200 super3D
201 )
202 )
203 else
204 {
205 failed = true;
207 }
208 };
209
210 bool neigh_failed = false;
211 m_options.m_options->neighbour_options = (unsigned int) get_neighbour_option_from_string(m_neighborOptionString, neigh_failed);
212
213 if (neigh_failed)
214 {
215 ATH_MSG_ERROR("Invalid Neighbour Option: " << m_neighborOptionString);
216 }
217
218 m_options.m_options->seed_threshold = m_seedThresholdOnEorAbsEinSigma;
219 m_options.m_options->grow_threshold = m_neighborThresholdOnEorAbsEinSigma;
220 m_options.m_options->terminal_threshold = m_cellThresholdOnEorAbsEinSigma;
221 m_options.m_options->abs_seed = m_seedCutsInAbsE;
222 m_options.m_options->abs_grow = m_neighborCutsInAbsE;
223 m_options.m_options->abs_terminal = m_cellCutsInAbsE;
224 m_options.m_options->use_two_gaussian = m_twoGaussianNoise;
225
226 m_options.m_options->treat_L1_predicted_as_good = m_treatL1PredictedCellsAsGood;
227 m_options.m_options->use_time_cut = m_cutCellsInTime;
228 m_options.m_options->keep_significant_cells = m_keepSignificantCells;
229 m_options.m_options->completely_exclude_cut_seeds = m_excludeCutSeedsFromClustering;
230 m_options.m_options->time_threshold = m_timeThreshold;
231 m_options.m_options->snr_threshold_for_keeping_cells = m_thresholdForKeeping;
232
233 m_options.m_options->limit_HECIW_and_FCal_neighs = m_restrictHECIWandFCalNeighbors;
234 m_options.m_options->limit_PS_neighs = m_restrictPSNeighbors;
235
236 m_options.m_options->use_crosstalk = m_xtalkEM2;
237 m_options.m_options->crosstalk_delta = m_xtalkDeltaT;
238
239 ATH_CHECK( m_kernelSizeOptimizer.retrieve() );
240
241 return StatusCode::SUCCESS;
242}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
static Double_t sc
#define CRGPU_RECURSIVE_MACRO(...)
Expands recursive macros.
#define CRGPU_CHEAP_STRING_TO_ENUM(VAR, PREFIX, ONE,...)
Checks a string variable, VAR, for matching enum identifiers (ONE and the remaining variadic argument...
@ TILE
Definition RegSelEnums.h:30
CaloCell_Base_ID::SUBCALO SUBCALO
Definition CaloCell_ID.h:50
static constexpr unsigned int getNumberOfSamplings()
Get number of available samplings.
Gaudi::Property< bool > m_twoGaussianNoise
if set to true use 2-gaussian noise description for TileCal
Gaudi::Property< std::vector< std::string > > m_caloNames
vector of names of the calorimeters to consider.
Gaudi::Property< bool > m_restrictHECIWandFCalNeighbors
if set to true limit the neighbors in HEC IW and FCal2&3.
Gaudi::Property< bool > m_xtalkEM2
If set to true, the time window is softened in the EMB2 and EME2_OW due to crosstalk from direct neig...
Gaudi::Property< bool > m_cellCutsInAbsE
if set to true cell cuts are on and .
Gaudi::Property< float > m_timeThreshold
threshold used for timing cut on seed cells.
Gaudi::Property< float > m_xtalkDeltaT
Additional maximum delta t added to the upper limit time window in case crosstalk in EM2 should be ac...
Gaudi::Property< float > m_cellThresholdOnEorAbsEinSigma
all cells have to satisfy
Gaudi::Property< float > m_seedThresholdOnEorAbsEinSigma
cells with start a cluster
Gaudi::Property< bool > m_restrictPSNeighbors
if set to true limit the neighbors in presampler Barrel and Endcap.
Gaudi::Property< std::string > m_neighborOptionString
type of neighbor relations to use.
Gaudi::Property< bool > m_treatL1PredictedCellsAsGood
if set to true treat cells with a dead OTX which can be predicted by L1 trigger info as good instead ...
Gaudi::Property< bool > m_neighborCutsInAbsE
if set to true neighbor cuts are on and .
Gaudi::Property< float > m_neighborThresholdOnEorAbsEinSigma
cells with extend the cluster
Gaudi::Property< std::vector< std::string > > m_samplingNames
vector of names of the calorimeter samplings to consider for seeds.
Gaudi::Property< bool > m_excludeCutSeedsFromClustering
if set to true, seed cells failing the time cut are also excluded from cluster at all
Gaudi::Property< bool > m_cutCellsInTime
if set to true, time cut is applied to seed cells, no cut otherwise
Gaudi::Property< float > m_thresholdForKeeping
upper limit on the energy significance, for applying the cell time cut
Gaudi::Property< bool > m_keepSignificantCells
if set to true, the time cut is not applied on cell of large significance
Gaudi::Property< bool > m_seedCutsInAbsE
if set to true seed cuts are on and .

◆ print_times()

void CaloGPUTimed::print_times ( const std::string & header,
const size_t time_size ) const
inlineprotectedinherited

Definition at line 143 of file CaloGPUTimed.h.

144 {
145 std::shared_lock<std::shared_mutex> lock(m_timeMutex);
146
147 if (m_timeFileName.size() == 0)
148 {
149 return;
150 }
151
152 std::vector<size_t> indices(m_eventNumbers.size());
153
154 std::iota(indices.begin(), indices.end(), 0);
155 std::sort(indices.begin(), indices.end(), [&](size_t a, size_t b)
156 {
157 return m_eventNumbers[a] < m_eventNumbers[b];
158 }
159 );
160 std::ofstream out(m_timeFileName);
161
162 out << "Event_Number Total " << header << "\n";
163
164 for (const size_t idx : indices)
165 {
166 out << m_eventNumbers[idx] << " ";
167
168 size_t total = 0;
169
170 for (size_t i = 0; i < time_size; ++i)
171 {
172 total += m_times[idx * time_size + i];
173 }
174
175 out << total << " ";
176
177 for (size_t i = 0; i < time_size; ++i)
178 {
179 out << m_times[idx * time_size + i] << " ";
180 }
181 out << "\n";
182 }
183
184 out << std::endl;
185
186 out.close();
187 }
static Double_t a
Gaudi::Property< std::string > m_timeFileName
File to which times should be saved.
std::shared_mutex m_timeMutex
Mutex that is locked when recording times.
std::pair< long int, long int > indices
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ 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 105 of file CaloGPUTimed.h.

106 {
107 const size_t time_size = 1;
108
109 size_t old_size;
110
111 {
112 std::unique_lock<std::shared_mutex> lock(m_timeMutex);
113 old_size = m_times.size();
114 m_times.resize(old_size + time_size);
115 m_eventNumbers.push_back(event_num);
116 }
117 {
118 std::shared_lock<std::shared_mutex> lock(m_timeMutex);
119 record_times_helper(old_size, value);
120 }
121 }
void record_times_helper(const size_t) const

◆ 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 124 of file CaloGPUTimed.h.

125 {
126 const size_t time_size = sizeof...(args) + 1;
127
128 size_t old_size;
129
130 {
131 std::unique_lock<std::shared_mutex> lock(m_timeMutex);
132 old_size = m_times.size();
133 m_times.resize(old_size + time_size);
134 m_eventNumbers.push_back(event_num);
135 }
136 {
137 std::shared_lock<std::shared_mutex> lock(m_timeMutex);
138 record_times_helper(old_size, value, std::forward<Args>(args)...);
139 }
140
141 }

◆ record_times() [3/3]

void CaloGPUTimed::record_times ( const size_t event_num,
const std::vector< size_t > & times ) const
inlineprotectedinherited

Definition at line 86 of file CaloGPUTimed.h.

87 {
88 size_t old_size;
89 {
90 std::unique_lock<std::shared_mutex> lock(m_timeMutex);
91 old_size = m_times.size();
92 m_times.resize(old_size + times.size());
93 m_eventNumbers.push_back(event_num);
94 }
95 {
96 std::shared_lock<std::shared_mutex> lock(m_timeMutex);
97 for (size_t i = 0; i < times.size(); ++i)
98 {
99 m_times[old_size + i] = times[i];
100 }
101 }
102 }

◆ record_times_helper() [1/3]

template<class Arg>
void CaloGPUTimed::record_times_helper ( const size_t index,
Arg && arg ) const
inlineprivateinherited

Definition at line 70 of file CaloGPUTimed.h.

71 {
72 // coverity[missing_lock]
73 m_times[index] = std::forward<Arg>(arg);
74
75 //This is called within a function that holds the lock itself.
76 }
str index
Definition DeMoScan.py:362

◆ record_times_helper() [2/3]

void CaloGPUTimed::record_times_helper ( const size_t ) const
inlineprivateinherited

Definition at line 64 of file CaloGPUTimed.h.

65 {
66 //Do nothing
67 }

◆ record_times_helper() [3/3]

template<class ... Args>
void CaloGPUTimed::record_times_helper ( size_t index,
Args &&... args ) const
inlineprivateinherited

Definition at line 79 of file CaloGPUTimed.h.

80 {
81 (record_times_helper(index++, std::forward<Args>(args)), ...);
82 }

Member Data Documentation

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

Gaudi::Property<std::vector<std::string> > TopoAutomatonClustering::m_caloNames {this, "CalorimeterNames", {}, "Name(s) of Calorimeters to use for clustering"}
private

vector of names of the calorimeters to consider.

The default is to use all calorimeters (i.e. LAREM, LARHEC, LARFCAL, TILE). Cells which belong to one of the input cell containers and to one of the calorimeters in this vector are used as input for the cluster maker. This property is used in order to ignore a certain subsystem (e.g. for LAREM only clusters specify only LAREM in the jobOptions).

Definition at line 72 of file TopoAutomatonClustering.h.

72{this, "CalorimeterNames", {}, "Name(s) of Calorimeters to use for clustering"};

◆ m_cellCutsInAbsE

Gaudi::Property<bool> TopoAutomatonClustering::m_cellCutsInAbsE {this, "CellCutsInAbsE", true, "Cell (terminal) cuts in Abs E instead of E"}
private

if set to true cell cuts are on \(|E|\) and \(|E|_\perp\).

The cell cuts will be on absolute energy and absolute transverse energy if this is set to true. If set to false the cuts will be on energy and transverse energy instead.

Definition at line 150 of file TopoAutomatonClustering.h.

150{this, "CellCutsInAbsE", true, "Cell (terminal) cuts in Abs E instead of E"};

◆ m_cellThresholdOnEorAbsEinSigma

Gaudi::Property<float> TopoAutomatonClustering::m_cellThresholdOnEorAbsEinSigma {this, "CellThresholdOnEorAbsEinSigma", 0., "Cell (terminal) threshold (in units of noise Sigma)"}
private

all cells have to satisfy \(|E| > N_{\rm cell}\,\sigma\)

This cut determines how much the cluster will extend beyond the last cell passing the neighbor threshold. The smaller this cut is the more cells will be allowed in the tail of the cluster. It should be smaller or equal to the neighbor threshold. If a cell passing this cut is neighbor of two or more cells passing the neighbor cut it will be inserted in the cluster which has the neighbor cell that was asked first for its neighbors. Since the original list of seed cells is ordered in descending order of \(E/\sigma\) (or \(|E|/\sigma\)) the distance of the cell (in number of cell generations passing the neighbor cut until this cell will be reached) usually determines in which cluster the cell will end up in. The cell cut should be lower or equal to the neighbor cut.

Definition at line 102 of file TopoAutomatonClustering.h.

102{this, "CellThresholdOnEorAbsEinSigma", 0., "Cell (terminal) threshold (in units of noise Sigma)"};

◆ m_cutCellsInTime

Gaudi::Property<bool> TopoAutomatonClustering::m_cutCellsInTime {this, "SeedCutsInT", false, "Do seed cuts in time"}
private

if set to true, time cut is applied to seed cells, no cut otherwise

Definition at line 155 of file TopoAutomatonClustering.h.

155{this, "SeedCutsInT", false, "Do seed cuts in time"};

◆ m_excludeCutSeedsFromClustering

Gaudi::Property<bool> TopoAutomatonClustering::m_excludeCutSeedsFromClustering {this, "CutOOTseed", true, "Exclude out-of-time seeds from neighbouring and cell stage"}
private

if set to true, seed cells failing the time cut are also excluded from cluster at all

Definition at line 174 of file TopoAutomatonClustering.h.

174{this, "CutOOTseed", true, "Exclude out-of-time seeds from neighbouring and cell stage"};

◆ m_keepSignificantCells

Gaudi::Property<bool> TopoAutomatonClustering::m_keepSignificantCells {this, "UseTimeCutUpperLimit", false, "Do not apply time cut on cells of large significance"}
private

if set to true, the time cut is not applied on cell of large significance

Definition at line 179 of file TopoAutomatonClustering.h.

179{this, "UseTimeCutUpperLimit", false, "Do not apply time cut on cells of large significance"};

◆ m_kernelSizeOptimizer

ServiceHandle<IGPUKernelSizeOptimizerSvc> TopoAutomatonClustering::m_kernelSizeOptimizer { this, "KernelSizeOptimizer", "GPUKernelSizeOptimizerSvc", "CUDA kernel size optimization service." }
private

Handle to the CUDA kernel block and grid size optimization service.

Definition at line 256 of file TopoAutomatonClustering.h.

256{ this, "KernelSizeOptimizer", "GPUKernelSizeOptimizerSvc", "CUDA kernel size optimization service." };

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

Gaudi::Property<bool> TopoAutomatonClustering::m_neighborCutsInAbsE {this, "NeighborCutsInAbsE", true, "Neighbor (grow) cuts in Abs E instead of E"}
private

if set to true neighbor cuts are on \(|E|\) and \(|E|_\perp\).

The neighbor cuts will be on absolute energy and absolute transverse energy if this is set to true. If set to false the cuts will be on energy and transverse energy instead.

Definition at line 142 of file TopoAutomatonClustering.h.

142{this, "NeighborCutsInAbsE", true, "Neighbor (grow) cuts in Abs E instead of E"};

◆ m_neighborOptionString

Gaudi::Property<std::string> TopoAutomatonClustering::m_neighborOptionString
private
Initial value:
{this, "NeighborOption", "super3D",
"Neighbor option to be used for cell neighborhood relations"}

type of neighbor relations to use.

The CaloIdentifier package defines different types of neighbors for the calorimeter cells. Currently supported neighbor relations for topological clustering are:

  • "all2D" for all cells in the same layer (sampling or module) of one calorimeter subsystem. Note that endcap and barrel will be unconnected in this case even for the LAREM.
  • "all3D" for all cells in the same calorimeter. This means all the "all2D" neighbors for each cell plus the cells in adjacent samplings overlapping at least partially in \(\eta\) and \(\phi\) with the cell. Note that endcap and barrel will be connected in this case for the LAREM.
  • "super3D" for all cells. This means all the "all3D" neighbors for each cell plus the cells in adjacent samplings from other subsystems overlapping at least partially in \(\eta\) and \(\phi\) with the cell. All calorimeters are connected in this case.

The default setting is "super3D".

Definition at line 211 of file TopoAutomatonClustering.h.

211 {this, "NeighborOption", "super3D",
212 "Neighbor option to be used for cell neighborhood relations"};

◆ m_neighborThresholdOnEorAbsEinSigma

Gaudi::Property<float> TopoAutomatonClustering::m_neighborThresholdOnEorAbsEinSigma {this, "NeighborThresholdOnEorAbsEinSigma", 2., "Neighbor (grow) threshold (in units of noise Sigma)"}
private

cells with \(|E| > N_{\rm neighbor}\,\sigma\) extend the cluster

This cut determines how many cells are asked for their neighbors to expand the cluster. The smaller this cut is the more cells will be asked for their neighbors. If a cell passing this cut is neighbor of two other cells passing this cut from different clusters, the two clusters are merged. The neighbor cut should be lower or equal to the seed cut.

Definition at line 113 of file TopoAutomatonClustering.h.

113{this, "NeighborThresholdOnEorAbsEinSigma", 2., "Neighbor (grow) threshold (in units of noise Sigma)"};

◆ m_options

TAGrowing::TACOptionsHolder TopoAutomatonClustering::m_options
private

Options for the algorithm, held in a GPU-friendly way.

Definition at line 253 of file TopoAutomatonClustering.h.

◆ m_restrictHECIWandFCalNeighbors

Gaudi::Property<bool> TopoAutomatonClustering::m_restrictHECIWandFCalNeighbors
private
Initial value:
{this, "RestrictHECIWandFCalNeighbors",
false, "Limit the neighbors in HEC IW and FCal2&3"}

if set to true limit the neighbors in HEC IW and FCal2&3.

The cells in HEC IW and FCal2&3 get very large in terms of eta and phi. Since this might pose problems on certain jet algorithms one might need to avoid expansion in eta and phi for those cells. If this property is set to true the 2d neighbors of these cells are not used - only the next sampling neighbors are probed.

Definition at line 223 of file TopoAutomatonClustering.h.

223 {this, "RestrictHECIWandFCalNeighbors",
224 false, "Limit the neighbors in HEC IW and FCal2&3"};

◆ m_restrictPSNeighbors

Gaudi::Property<bool> TopoAutomatonClustering::m_restrictPSNeighbors
private
Initial value:
{this, "RestrictPSNeighbors",
false, "Limit the neighbors in presampler Barrel and Endcap"}

if set to true limit the neighbors in presampler Barrel and Endcap.

The presampler cells add a lot of PileUp in the Hilum samples. With this option set to true the presampler cells do not expand the cluster in the presampler layer. Only the next sampling is used as valid neighbor source.

Definition at line 233 of file TopoAutomatonClustering.h.

233 {this, "RestrictPSNeighbors",
234 false, "Limit the neighbors in presampler Barrel and Endcap"};

◆ m_samplingNames

Gaudi::Property<std::vector<std::string> > TopoAutomatonClustering::m_samplingNames {this, "SeedSamplingNames", {}, "Name(s) of Calorimeter Samplings to consider for seeds"}
private

vector of names of the calorimeter samplings to consider for seeds.

The default is to use all calorimeter samplings. Excluding a sampling from this vector prevents the definition of a seed cell in this sampling. Cells in those samplings are still used and incorporated in the topo clusters (both on the neighbor and the cell level) they can therefore even expand a cluster but not seed one ...

Definition at line 84 of file TopoAutomatonClustering.h.

84{this, "SeedSamplingNames", {}, "Name(s) of Calorimeter Samplings to consider for seeds"};

◆ m_seedCutsInAbsE

Gaudi::Property<bool> TopoAutomatonClustering::m_seedCutsInAbsE {this, "SeedCutsInAbsE", true, "Seed cuts in Abs E instead of E"}
private

if set to true seed cuts are on \(|E|\) and \(|E|_\perp\).

The seed cuts and the \(E_\perp\) cut on the final clusters before insertion to the CaloClusterContainer will be on absolute energy and absolute transverse energy if this is set to true. If set to false the cuts will be on energy and transverse energy instead.

Definition at line 134 of file TopoAutomatonClustering.h.

134{this, "SeedCutsInAbsE", true, "Seed cuts in Abs E instead of E"};

◆ m_seedThresholdOnEorAbsEinSigma

Gaudi::Property<float> TopoAutomatonClustering::m_seedThresholdOnEorAbsEinSigma {this, "SeedThresholdOnEorAbsEinSigma", 4., "Seed threshold (in units of noise Sigma)"}
private

cells with \(|E| > N_{\rm seed}\,\sigma\) start a cluster

This cut determines how many clusters are formed initially. The smaller this cut is the more clusters will be created. During the accumulation of cells inside the clusters it can happen that clusters are merged if a cell passing the neighbor threshold would be included in both clusters.

Definition at line 123 of file TopoAutomatonClustering.h.

123{this, "SeedThresholdOnEorAbsEinSigma", 4., "Seed threshold (in units of noise Sigma)"};

◆ m_thresholdForKeeping

Gaudi::Property<float> TopoAutomatonClustering::m_thresholdForKeeping {this, "TimeCutUpperLimit", 20., "Significance upper limit for applying time cut"}
private

upper limit on the energy significance, for applying the cell time cut

Definition at line 163 of file TopoAutomatonClustering.h.

163{this, "TimeCutUpperLimit", 20., "Significance upper limit for applying time cut"};

◆ 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::shared_mutex CaloGPUTimed::m_timeMutex
mutableprotectedinherited

Mutex that is locked when recording times.

Definition at line 32 of file CaloGPUTimed.h.

◆ m_timeThreshold

Gaudi::Property<float> TopoAutomatonClustering::m_timeThreshold {this, "SeedThresholdOnTAbs", 12.5 * CLHEP::ns, "Time thresholds (in abs. val.)"}
private

threshold used for timing cut on seed cells.

Implemented as |seed_cell_time|<m_timeThreshold. No such cut on neighbouring cells.

Definition at line 159 of file TopoAutomatonClustering.h.

159{this, "SeedThresholdOnTAbs", 12.5 * CLHEP::ns, "Time thresholds (in abs. val.)"};

◆ m_treatL1PredictedCellsAsGood

Gaudi::Property<bool> TopoAutomatonClustering::m_treatL1PredictedCellsAsGood {this, "TreatL1PredictedCellsAsGood", true, "Treat bad cells with dead OTX if predicted from L1 as good"}
private

if set to true treat cells with a dead OTX which can be predicted by L1 trigger info as good instead of bad cells

Definition at line 169 of file TopoAutomatonClustering.h.

169{this, "TreatL1PredictedCellsAsGood", true, "Treat bad cells with dead OTX if predicted from L1 as good"};

◆ m_twoGaussianNoise

Gaudi::Property<bool> TopoAutomatonClustering::m_twoGaussianNoise {this, "TwoGaussianNoise", false, "Use 2-gaussian noise description for TileCal"}
private

if set to true use 2-gaussian noise description for TileCal

Definition at line 184 of file TopoAutomatonClustering.h.

184{this, "TwoGaussianNoise", false, "Use 2-gaussian noise description for TileCal"};

◆ m_xtalkDeltaT

Gaudi::Property<float> TopoAutomatonClustering::m_xtalkDeltaT
private
Initial value:
{this, "XTalkDeltaT",
15 * CLHEP::ns, "Delta T to add to upper time threshold for EM2 cells affected by xtalk."}

Additional maximum delta t added to the upper limit time window in case crosstalk in EM2 should be accounted for.

Definition at line 247 of file TopoAutomatonClustering.h.

247 {this, "XTalkDeltaT",
248 15 * CLHEP::ns, "Delta T to add to upper time threshold for EM2 cells affected by xtalk."};

◆ m_xtalkEM2

Gaudi::Property<bool> TopoAutomatonClustering::m_xtalkEM2
private
Initial value:
{this, "XTalkEM2",
false, "Relax time window (if timing is used) in EM2 when xTalk is present"}

If set to true, the time window is softened in the EMB2 and EME2_OW due to crosstalk from direct neighbour cells in phi.

Definition at line 241 of file TopoAutomatonClustering.h.

241 {this, "XTalkEM2",
242 false, "Relax time window (if timing is used) in EM2 when xTalk is present"};

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