|
ATLAS Offline Software
|
Go to the documentation of this file.
20 constexpr
float PI_F =
static_cast<float>(
M_PI);
25 ISvcLocator* pSvcLocator):
43 return StatusCode::FAILURE;
47 return StatusCode::FAILURE;
50 ATH_MSG_FATAL(
"Number of entries in minPt, phiWidth must match number of entries in OutputROIContainerName.");
51 return StatusCode::FAILURE;
59 std::sort(
m_outputIndex.begin(),
m_outputIndex.end(), [
this](
unsigned int idx_a,
unsigned int idx_b) { return this->m_minPtEm[idx_a] < this->m_minPtEm[idx_b];});
72 for (
unsigned int output_i=0; output_i<
m_outputIndex.size(); ++output_i) {
82 return StatusCode::SUCCESS;
95 return StatusCode::SUCCESS;
103 return StatusCode::SUCCESS;
114 unsigned int all_clusters{};
115 unsigned int selected_clusters{};
117 std::vector<unsigned int > n_rois;
120 std::vector<uint8_t > max_output;
121 rois.reserve( inputClusterContainer->
size());
122 max_output.resize(inputClusterContainer->
size());
132 addROI(*cluster, *caloMgr,
rois, max_output, n_rois);
143 std::vector< SG::WriteHandle<ROIPhiRZContainer> > output_rois;
146 unsigned int the_size = n_rois[output_rois.size()];
148 ATH_CHECK( output_rois.back().record( std::make_unique<ROIPhiRZContainer>() ) );
149 output_rois.back()->reserve( the_size);
154 std::vector<unsigned int> roi_order;
155 roi_order.reserve(
rois.size() );
156 for (
unsigned int idx=0;
idx<
rois.size(); ++
idx) { roi_order.push_back(
idx ); }
157 std::sort(roi_order.begin(),roi_order.end(),[&
rois](
unsigned int a,
unsigned int b) { return rois[a][0] < rois[b][0]; });
159 for (
unsigned int roi_i : roi_order) {
161 if (output_i>=max_output[roi_i])
break;
162 output_rois[output_i]->push_back(
rois[ roi_i ] );
170 for (
unsigned int roi_unordered_i=0; roi_unordered_i <
rois.size(); ++roi_unordered_i) {
172 if (output_i>=max_output[roi_unordered_i])
break;
173 if (std::abs(
rois[ roi_unordered_i ][0])<PI_F or (
rois[ roi_unordered_i ][0] == PI_F)) {
174 output_rois[output_i]->push_back(
rois[ roi_unordered_i ] );
182 unsigned int max_size;
185 }
while (
rois.size()>max_size && !
m_maxNROIs.compare_exchange_weak(max_size,
rois.size()));
189 return StatusCode::SUCCESS;
198 double eta = cluster.
eta();
199 double theta = 2 *
atan(
exp(-eta));
200 double tantheta =
tan(theta);
201 double phi = cluster.
phi();
207 double r = surfRefPoint.perp();
208 double z = tantheta == 0 ? 0. :
r / tantheta;
216 double z = surfRefPoint.z();
217 double r =
z * tantheta;
228 std::vector<uint_fast8_t> &max_output,
229 std::vector<unsigned int> &n_rois)
const {
237 if (
acc.isAvailable(cluster)) {
238 emFrac =
acc(cluster);
241 ATH_MSG_ERROR(
"EM energy requested, but No EM fraction momement stored");
247 std::unique_ptr<const Trk::Surface> surface(
getCaloSurface(cluster, caloDDMgr) );
258 unsigned int roi_idx=output_rois.size();
261 unsigned int n_duplicates = output_rois.size()-roi_idx-1;
262 if (n_duplicates>0) {
266 unsigned int output_idx=0;
269 n_rois[output_idx] += n_duplicates+1;
273 if (max_output.size() < output_rois.size()) {
274 max_output.resize (output_rois.size());
276 for (; roi_idx < output_rois.size(); ++roi_idx) {
277 max_output[roi_idx]=output_idx;
virtual double phi() const
The azimuthal angle ( ) of the particle.
Gaudi::Property< std::vector< float > > m_minPtEm
Extra patterns decribing particle interation process.
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Name of the CaloDetDescrManager condition object.
SG::WriteHandleKeyArray< ROIPhiRZContainer > m_outputClusterContainerName
Name of the ROI output collection.
std::atomic_uint m_maxNROIs
std::atomic_uint m_selectedClusters
container for phi sorted ROIs defined by phi, r and z.
ToolHandle< IegammaCaloClusterSelector > m_egammaCaloClusterSelector
Tool to filter the calo clusters.
Helper class to provide constant type-safe access to aux data.
virtual const Amg::Vector3D & globalReferencePoint() const
Returns a global reference point on the surface, for PlaneSurface, StraightLineSurface,...
const std::string & key() const
Return the StoreGate ID for the referenced object.
static Trk::LocalParameters getClusterLocalParameters(const xAOD::CaloCluster &cluster, const Trk::Surface &surf)
StatusCode execute(const EventContext &ctx) const override
StatusCode finalize() override
std::pair< double, ParamDefs > DefinedParameter
std::vector< float > m_sortedMinPtEm
An algorithm that can be simultaneously executed in multiple threads.
bool isBarrel(const xAOD::Egamma *eg)
return true if the cluster is in the barrel
std::vector< unsigned int > m_outputUnsorted
void addROI(const xAOD::CaloCluster &cluster, const CaloDetDescrManager &caloDDMgr, ROIPhiRZContainer &output_rois, std::vector< uint_fast8_t > &max_output, std::vector< unsigned int > &n_rois) const
Description of a calorimeter cluster.
virtual double eta() const
The pseudorapidity ( ) of the particle.
std::vector< unsigned int > m_outputIndex
::StatusCode StatusCode
StatusCode definition for legacy code.
std::atomic_uint m_duplicateROI
void addROI(const Amg::Vector3D &global_position, float roi_phi_width)
StatusCode initialize() override
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
CaloClusterROIPhiRZContainerMaker(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
ToolHandle< ICaloSurfaceBuilder > m_calosurf
Tool to build calorimeter layer surfaces.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_inputClusterContainerName
Name of the cluster intput collection.
@ ENG_FRAC_EM
Energy fraction in EM calorimeters.
StatusCode initialize(bool used=true)
Eigen::Matrix< double, 3, 1 > Vector3D
std::vector< unsigned int > m_outputSorted
const Trk::Surface * getCaloSurface(const xAOD::CaloCluster &cluster, const CaloDetDescrManager &caloDDMgr) const
Gaudi::Property< bool > m_EMEnergyOnly
~CaloClusterROIPhiRZContainerMaker()
This class provides the client interface for accessing the detector description information common to...
Gaudi::Property< std::vector< float > > m_phiWidth
size_type size() const noexcept
Returns the number of elements in the collection.
virtual double e() const
The total energy of the particle.
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const =0
Specified by each surface type: LocalToGlobal method without dynamic memory allocation.
std::atomic_uint m_allClusters