19 "Jet collection that will be used for matching the Hits");
21 "Name of PV collection. Default is PrimaryVertices");
23 "Name of output pixel hit collection. JetAssociatedPixelClusters is default.");
25 "Name of output SCT hit collection. JetAssociatedSCTClusters is default.");
27 "Name of input pixel hit collection. PixelClusters is default");
29 "Name of input SCT hit collection. SCT_Clusters is default");
31 "Hits are saved only if they match to jets with pT > jetPtThreshold [in MeV]");
33 "The radius used for matching hits to jets");
61 return StatusCode::SUCCESS;
71 if ( !jetReadHandle.
isValid() ) {
73 return StatusCode::FAILURE;
77 std::vector<const xAOD::Jet*> jets;
78 jets.reserve( jetReadHandle->size() );
90 if ( !vertexReadHandle.
isValid() ) {
91 ATH_MSG_ERROR(
"Failed to retrieve PrimaryVertices container" );
92 return StatusCode::FAILURE;
106 if ( !pixHitReadHandle.
isValid() ) {
108 return StatusCode::FAILURE;
113 if ( !sctHitReadHandle.
isValid() ) {
115 return StatusCode::FAILURE;
123 return StatusCode::SUCCESS;
131 unsigned long long int &nStoredHits,
132 unsigned long long int &nTotalHits) {
135 auto outputHitCollection = std::make_unique<xAOD::TrackMeasurementValidationContainer>();
136 auto outputHitCollectionAux = std::make_unique<xAOD::TrackMeasurementValidationAuxContainer>();
137 outputHitCollection->setStore(outputHitCollectionAux.get());
143 if (!jets.empty() && vertex!=
nullptr) {
146 TVector3 PVposition(vertex->x(), vertex->y(), vertex->z());
147 ATH_MSG_DEBUG(
"JetHitAssociation: PrimaryVertex Z Position = " << PVposition.Z());
152 float x = hit->globalX();
153 float y = hit->globalY();
154 float z = hit->globalZ();
157 TVector3 hitPosition(
x,
y,
z);
160 hitPosition = hitPosition - PVposition;
165 float dR = hitPosition.DeltaR(
jet->p4().Vect());
169 outputHitCollection->push_back(std::make_unique<xAOD::TrackMeasurementValidation>(*hit));
170 *outputHitCollection->back() = *hit;
178 nTotalHits += hits->size();
181 if ( ! outputHits.
put( std::move(outputHitCollection), std::move(outputHitCollectionAux) ) ) {
183 return StatusCode::FAILURE;
186 return StatusCode::SUCCESS;
196 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
unsigned long long int m_nTotalPixHits
SG::ReadHandleKey< xAOD::JetContainer > m_jetCollectionName
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexCollectionName
SG::WriteHandleKey< xAOD::TrackMeasurementValidationContainer > m_outputSCTHitCollectionName
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_inputSCTHitCollectionName
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_inputPixHitCollectionName
unsigned long long int m_nTotalSCTHits
StatusCode saveHits(const std::vector< const xAOD::Jet * > &jets, const xAOD::Vertex *const vertex, SG::ReadHandle< xAOD::TrackMeasurementValidationContainer > &hits, const SG::WriteHandle< xAOD::TrackMeasurementValidationContainer > &writeHandle, unsigned long long int &nStoredHits, unsigned long long int &nTotalHits)
virtual StatusCode initialize() override
JetHitAssociation(const std::string &name, ISvcLocator *svcloc)
Constructor with parameters:
virtual StatusCode finalize() override
unsigned long long int m_nStoredPixHits
unsigned long long int m_nStoredSCTHits
SG::WriteHandleKey< xAOD::TrackMeasurementValidationContainer > m_outputPixHitCollectionName
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type put(std::unique_ptr< T > data, bool returnExisting=false) const
Record an object to the store.
Jet_v1 Jet
Definition of the current "jet version".
TrackMeasurementValidation_v1 TrackMeasurementValidation
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.