|
ATLAS Offline Software
|
Go to the documentation of this file.
22 #include "GaudiKernel/ServiceHandle.h"
23 #include "GaudiKernel/Incident.h"
31 #include "CLHEP/Random/RandFlat.h"
38 const std::string&
n,
const IInterface*
p):
41 declareInterface<TruthClusterizationFactory>(
this);
56 return StatusCode::FAILURE;
64 return StatusCode::SUCCESS;
71 const EventContext& ctx = Gaudi::Hive::currentContext();
78 std::vector<double> probabilities(3,0.);
79 const auto &rdos = pCluster.
rdoList();
80 unsigned int nPartContributing = 0;
83 std::set<int> uniqueIDs;
87 for (
auto rdoIter : rdos){
88 auto simDataIter = pixSdoColl->find(rdoIter);
89 if (simDataIter != pixSdoColl->end()){
91 auto simData = (simDataIter->second);
92 for(
const auto& deposit :
simData.getdeposits() ){
94 if (!deposit.first){
ATH_MSG_DEBUG(
"No deposits found");
continue;}
96 if (deposit.first.eventIndex() != 0)
continue;
97 uniqueIDs.insert(deposit.first.id());
104 nPartContributing = uniqueIDs.size();
111 std::set< std::pair<HepMcParticleLink::index_type, int> > uniqueIDs;
115 for (
auto rdoIter : rdos){
116 auto simDataIter = pixSdoColl->find(rdoIter);
117 if (simDataIter != pixSdoColl->end()){
119 auto simData = (simDataIter->second);
120 for(
const auto& deposit :
simData.getdeposits() ){
122 if (!deposit.first){
ATH_MSG_DEBUG(
"No deposits found");
continue;}
124 uniqueIDs.insert(std::make_pair(deposit.first.eventIndex(), deposit.first.id()));
131 nPartContributing = uniqueIDs.size();
134 ATH_MSG_VERBOSE(
"Smearing TruthClusterizationFactory probability output for TIDE studies");
137 if (nPartContributing<=1) {
139 probabilities[0] = 1.0;
142 else if (nPartContributing==2) {
146 else probabilities[0] = 1.0;
149 else if (nPartContributing>2) {
153 else probabilities[0] = 1.0;
156 return probabilities;
162 ATH_MSG_ERROR(
"TruthClusterizationFactory::estimatePositions called for ITk ambiguity setup, should never happen! Digital clustering should be run for positions & errors.");
ServiceHandle< IAthRNGSvc > m_rndmSvc
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Eigen::Matrix< double, 2, 1 > Vector2D
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
ATHRNG::RNGWrapper * m_rndmEngine
#define ATH_MSG_VERBOSE(x)
SG::ReadHandleKey< InDetSimDataCollection > m_simDataCollectionName
IncidentSvc to catch begining of event and end of event.
::StatusCode StatusCode
StatusCode definition for legacy code.
#define CHECK(...)
Evaluate an expression and check for errors.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TruthClusterizationFactory(const std::string &name, const std::string &n, const IInterface *p)
A wrapper class for event-slot-local random engines.
virtual StatusCode initialize()
Gaudi::Property< bool > m_discardPUHits
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Gaudi::Property< float > m_truthClusterSplittingEff
std::vector< double > estimateNumberOfParticles(const InDet::PixelCluster &pCluster) const
Gaudi::Property< std::string > m_rndmEngineName
#define ATLAS_THREAD_SAFE
Define macros for attributes used to control the static checker.
EventContext::ContextEvt_t evtSeeded() const
Return the event count at which the current slot was last seeded.
std::vector< Amg::Vector2D > estimatePositions(const InDet::PixelCluster &) const