20#include "GaudiKernel/EventContext.h"
47 ISvcLocator* pSvcLocator)
66 return StatusCode::SUCCESS;
70egammaSelectedTrackCopy::egammaSelectedTrackCopy::finalize()
72 ATH_MSG_INFO(
"===> egamma Selected Tracks Statistics ===========");
73 ATH_MSG_INFO(
"--- All Central Clusters: " << m_AllClusters);
74 ATH_MSG_INFO(
"--- Selected Central Clusters: " << m_SelectedClusters);
76 ATH_MSG_INFO(
"--- Selected Central Tracks: " << m_SelectedTracks);
78 ATH_MSG_INFO(
"--- Selected Central Si Tracks: " << m_SelectedSiTracks);
80 ATH_MSG_INFO(
"--- Selected TRT Tracks: " << m_SelectedTRTTracks);
81 if (m_doForwardTracks) {
82 ATH_MSG_INFO(
"--- All Forward Clusters: " << m_AllFwdClusters);
83 ATH_MSG_INFO(
"--- Selected Forward Tracks: " << m_SelectedFwdTracks);
85 ATH_MSG_INFO(
"<=================================================");
87 return StatusCode::SUCCESS;
118 auto viewCopy = std::make_unique<ConstDataVector<xAOD::TrackParticleContainer>>(
SG::VIEW_ELEMENTS);
133 std::vector<const xAOD::CaloCluster*> passingClusters;
136 passingClusters.push_back(cluster);
146 bool isNotValidForRefit = !checkIfValidForRefit(track);
147 if (isNotValidForRefit) {
156 if (
selectTrack(ctx, cluster, track, isNotValidForRefit, *calodetdescrmgr)) {
157 viewCopy->push_back(track);
159 if (isNotValidForRefit) {
172 if (
selectTrack(ctx, cluster, track, isNotValidForRefit, *calodetdescrmgr)) {
173 viewCopy->push_back(track);
183 return StatusCode::SUCCESS;
194 if (cluster ==
nullptr || track ==
nullptr) {
198 const Trk::Perigee& candidatePerigee = track->perigeeParameters();
201 const double trkPhi = candidatePerigee.parameters()[
Trk::phi];
202 const double trkEta = candidatePerigee.
eta();
203 const double z_perigee = candidatePerigee.
position().z();
204 const double r_perigee = candidatePerigee.
position().perp();
214 const double Et = trkTRT ? cluster->
et() : cluster->
e() / cosh(trkEta);
217 if (std::abs(clusterEta) > 10.0 || std::abs(trkEta) > 10.0 || Et < 10.0) {
219 "FAILS sanity checks : Track Eta : " << trkEta <<
220 ", Cluster Eta " << clusterEta
253 const double clusterPhiCorrected = XYZClusterWrtTrackPerigee.phi();
278 "FAILS broad window phi match (track phi, phirotCluster , phiRotTrack , " <<
279 "cluster phi corrected, cluster phi): ( " <<
281 phiRotRescaled <<
", " <<
282 phiRotTrack <<
", " <<
283 clusterPhiCorrected <<
", " <<
284 cluster->
phi() <<
")"
291 if (trkTRT) {
return true; }
293 const double clusterEtaCorrected = XYZClusterWrtTrackPerigee.eta();
301 "FAILS broad window eta match (track eta, cluster eta, cluster eta corrected): ( " <<
303 cluster->
etaBE(2) <<
", " <<
304 clusterEtaCorrected <<
" )"
311 std::vector<CaloSampling::CaloSample>,
312 std::vector<std::unique_ptr<Trk::Surface>>
317 std::array<double, 4>
eta = { -999.0, -999.0, -999.0, -999.0 };
318 std::array<double, 4>
phi = { -999.0, -999.0, -999.0, -999.0 };
319 std::array<double, 4> deltaEta = { -999.0, -999.0, -999.0, -999.0 };
320 std::array<double, 4>
deltaPhi = { -999.0, -999.0, -999.0, -999.0 };
325 layersAndSurfaces.first,
326 layersAndSurfaces.second,
352 cluster->
et() > track->pt()
355 std::array<double, 4> etaRes = { -999.0, -999.0, -999.0, -999.0 };
356 std::array<double, 4> phiRes = { -999.0, -999.0, -999.0, -999.0 };
357 std::array<double, 4> deltaEtaRes = { -999.0, -999.0, -999.0, -999.0 };
358 std::array<double, 4> deltaPhiRes = { -999.0, -999.0, -999.0, -999.0 };
364 layersAndSurfaces.first,
365 layersAndSurfaces.second,
Scalar eta() const
pseudorapidity method
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition of CaloDetDescrManager.
Helpers for checking error return status codes and reporting errors.
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
An algorithm that can be simultaneously executed in multiple threads.
This class provides the client interface for accessing the detector description information common to...
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
double eta() const
Access method for pseudorapidity - from momentum.
const Amg::Vector3D & position() const
Access method for the position.
Gaudi::Accumulators::Counter m_SelectedSiTracks
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloDetDescrMgrKey
Gaudi::Accumulators::Counter m_SelectedClusters
ToolHandle< IegammaCaloClusterSelector > m_egammaCaloClusterSelector
Tool to filter the calo clusters.
Gaudi::Accumulators::Counter m_AllFwdClusters
Gaudi::Property< double > m_narrowDeltaPhiBrem
Gaudi::Property< double > m_narrowDeltaPhi
virtual StatusCode initialize() override final
Gaudi::Accumulators::Counter m_SelectedFwdTracks
Gaudi::Accumulators::Counter m_AllSiTracks
Gaudi::Accumulators::Counter m_AllTracks
Gaudi::Accumulators::Counter m_AllClusters
Gaudi::Property< double > m_broadDeltaEta
Broad windows.
Gaudi::Property< double > m_narrowRescale
SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > m_trackParticleTimeDecorKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackParticleContainerKey
Gaudi::Accumulators::Counter m_SelectedTRTTracks
Gaudi::Property< double > m_broadDeltaPhi
virtual StatusCode execute(const EventContext &ctx) const override final
Gaudi::Property< bool > m_doForwardTracks
Private member flag to select forward tracks.
Gaudi::Accumulators::Counter m_SelectedTracks
ToolHandle< IEMExtrapolationTools > m_extrapolationTool
Tool for extrapolation.
SG::WriteHandleKey< ConstDataVector< xAOD::TrackParticleContainer > > m_OutputTrkPartContainerKey
Gaudi::Property< double > m_narrowRescaleBrem
bool selectTrack(const EventContext &ctx, const xAOD::CaloCluster *cluster, const xAOD::TrackParticle *track, bool trkTRT, const CaloDetDescrManager &caloDD) const
Broad track selection.
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_fwdClusterContainerKey
Names of forward input output collections.
Gaudi::Property< double > m_narrowDeltaEta
Narrow windows.
Gaudi::Accumulators::Counter m_AllTRTTracks
egammaSelectedTrackCopy(const std::string &name, ISvcLocator *pSvcLocator)
Default constructor.
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clusterContainerKey
Names of input output collections.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
int summaryValueInt(const xAOD::TrackParticle &tp, const xAOD::SummaryType &info, int deflt=-999)
return the summary value for a TrackParticle or default value (-999) (to be used mostly in python whe...
Eigen::Matrix< double, 3, 1 > Vector3D
double PhiROT(const double pt, const double eta, const int charge, const double r_start, const bool isEndCap)
Function to calculate the approximate rotation in phi/bending of a track until it reaches the calo.
Amg::Vector3D approxXYZwrtPoint(const xAOD::CaloCluster &cluster, const Amg::Vector3D &point, const bool isEndCap)
Function to get the (x,y,z) of the cluster wrt to a point (x0,y0,z0)
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
bool isBarrel(const xAOD::Egamma *eg)
return true if the cluster is in the barrel
bool isFCAL(const xAOD::CaloCluster *cluster)
return true if the cluster (or the majority of its energy) is in the FCAL0
int summaryValueInt(const xAOD::TrackParticle &tp, const xAOD::SummaryType &info, int deflt=-999)
return the summary value for a TrackParticle or default value (-999) (to be used mostly in python whe...
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].