ATLAS Offline Software
eflowRecTrack.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*
6  * eflowRecTrack.cxx
7  *
8  * Created on: 30.09.2013
9  * Author: tlodd
10  */
11 
12 #include "eflowRec/eflowRecTrack.h"
15 
17 #include "GaudiKernel/StatusCode.h"
18 
19 
21  const ElementLink<xAOD::TrackParticleContainer>& trackElemLink,
22  const ToolHandle<eflowTrackExtrapolatorBaseAlgTool>& theTrackExtrapolatorTool) :
23  m_trackId(-1), m_trackElemLink(trackElemLink), m_track(*trackElemLink), m_type(5),
24  m_pull15(0.0),
25  m_layerHED(-1),
26  m_eExpect(1.0),
27  m_varEExpect(0.0),
28  m_isInDenseEnvironment(false),
29  m_isSubtracted(false),
30  m_isRecovered(false),
31  m_hasBin(true),
32  m_trackCaloPoints(theTrackExtrapolatorTool->execute(m_track))
33 {
34 }
35 
37  : m_trackId (eflowRecTrack.m_trackId),
38  m_trackElemLink (eflowRecTrack.m_trackElemLink),
39  m_track (*m_trackElemLink),
41  m_pull15 (eflowRecTrack.m_pull15),
42  m_layerHED (eflowRecTrack.m_layerHED),
43  m_eExpect (eflowRecTrack.m_eExpect),
44  m_varEExpect (eflowRecTrack.m_varEExpect),
45  m_isInDenseEnvironment (eflowRecTrack.m_isInDenseEnvironment),
46  m_isSubtracted (eflowRecTrack.m_isSubtracted),
47  m_isRecovered (eflowRecTrack.m_isRecovered),
48  m_hasBin (eflowRecTrack.m_hasBin),
49  m_trackCaloPoints (std::make_unique<eflowTrackCaloPoints>(*eflowRecTrack.m_trackCaloPoints))
50 {
51 }
52 
54  if (this == &originalEflowRecTrack) return *this;
55  //if not assigning to self, then we copy the data to the new object
56  else{
57  m_trackId = originalEflowRecTrack.m_trackId;
58  m_trackElemLink = originalEflowRecTrack.m_trackElemLink;
60  m_type = originalEflowRecTrack.m_type;
61  m_pull15 = originalEflowRecTrack.m_pull15;
62  m_eExpect = originalEflowRecTrack.m_eExpect;
63  m_varEExpect = originalEflowRecTrack.m_varEExpect;
64  m_isInDenseEnvironment = originalEflowRecTrack.m_isInDenseEnvironment;
65  m_isSubtracted = originalEflowRecTrack.m_isSubtracted;
66  m_isRecovered = originalEflowRecTrack.m_isRecovered;
67  m_hasBin = originalEflowRecTrack.m_hasBin;
68  m_trackCaloPoints = std::make_unique<eflowTrackCaloPoints>(*originalEflowRecTrack.m_trackCaloPoints);
69  m_layerHED = originalEflowRecTrack.m_layerHED;
70  return *this;
71  }//if not assigning to self, then we have copied the data to the new object
72 }
73 
75 
76 void eflowRecTrack::setCaloDepthArray(const double* depthArray) {
77  m_caloDepthArray.assign(depthArray, depthArray + eflowDepthCalculator::NDepth() + 1);
78 }
79 
80 const std::vector<eflowTrackClusterLink*>* eflowRecTrack::getAlternativeClusterMatches(const std::string& key) const {
81 
82  std::map<std::string,std::vector<eflowTrackClusterLink*> >::const_iterator thisIterator = m_alternativeClusterMatches.find(key);
83  if (thisIterator != m_alternativeClusterMatches.end()) return &m_alternativeClusterMatches.at(key);
84  else return nullptr;
85 
86  return nullptr;
87 
88 }
89 
90 void eflowRecTrack::insertTruthEnergyPair (const CaloCell* cell, double truthEnergy){
91  if (m_cellTruthEnergyStore.count(cell->ID()) == 0) m_cellTruthEnergyStore[cell->ID()] = truthEnergy;
92  else m_cellTruthEnergyStore[cell->ID()] += truthEnergy;
93 }
94 
96  if (m_cellTruthEnergyStore.count(cell->ID()) == 0) return 0.0;
97  else return m_cellTruthEnergyStore.at(cell->ID());
98 }
99 
101  if (isSubtracted()){
102  REPORT_MESSAGE_WITH_CONTEXT(MSG::WARNING, "eflowRecTrack")
103  << "Invoke setSubtracted() on track that is subtracted already!" << endmsg;
104  return;
105  }//if track was already subtracted then print a warning to the user about that and return
106  m_isSubtracted = true;
107 }
eflowRecTrack::m_track
const xAOD::TrackParticle * m_track
Definition: eflowRecTrack.h:122
eflowRecTrack::m_isSubtracted
bool m_isSubtracted
Definition: eflowRecTrack.h:135
eflowTrackCaloPoints
This class stores a map of calorimeter layers and track parameters (the result of the track extrapola...
Definition: eflowTrackCaloPoints.h:30
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
eflowRecTrack::getAlternativeClusterMatches
const std::vector< eflowTrackClusterLink * > * getAlternativeClusterMatches(const std::string &key) const
Definition: eflowRecTrack.cxx:80
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
eflowRecTrack::setCaloDepthArray
void setCaloDepthArray(const double *depthArray)
Definition: eflowRecTrack.cxx:76
eflowRecTrack::getCellTruthEnergy
double getCellTruthEnergy(const CaloCell *cell) const
Definition: eflowRecTrack.cxx:95
eflowRecTrack::m_varEExpect
double m_varEExpect
Definition: eflowRecTrack.h:132
eflowRecTrack::m_type
int m_type
Definition: eflowRecTrack.h:123
eflowRecTrack::insertTruthEnergyPair
void insertTruthEnergyPair(const CaloCell *cell, double truthEnergy)
Definition: eflowRecTrack.cxx:90
eflowRecTrack::m_trackElemLink
ElementLink< xAOD::TrackParticleContainer > m_trackElemLink
Definition: eflowRecTrack.h:121
eflowRecTrack::m_eExpect
double m_eExpect
Definition: eflowRecTrack.h:131
eflowRecTrack::m_hasBin
bool m_hasBin
Definition: eflowRecTrack.h:138
LArG4FSStartPointFilterLegacy.execute
execute
Definition: LArG4FSStartPointFilterLegacy.py:20
eflowRecTrack
This class extends the information about a xAOD::Track.
Definition: eflowRecTrack.h:46
m_type
TokenType m_type
the type
Definition: TProperty.cxx:44
eflowRecTrack::setSubtracted
void setSubtracted()
Definition: eflowRecTrack.cxx:100
eflowRecTrack.h
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
eflowRecTrack::isSubtracted
bool isSubtracted() const
Definition: eflowRecTrack.h:80
eflowRecTrack::m_layerHED
int m_layerHED
Definition: eflowRecTrack.h:126
eflowRecTrack::~eflowRecTrack
virtual ~eflowRecTrack()
eflowRecTrack::m_cellTruthEnergyStore
std::map< Identifier, double > m_cellTruthEnergyStore
Definition: eflowRecTrack.h:151
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:345
eflowDepthCalculator::NDepth
static int NDepth()
Definition: eflowDepthCalculator.h:42
eflowRecTrack::operator=
eflowRecTrack & operator=(const eflowRecTrack &originalEflowRecTrack)
Definition: eflowRecTrack.cxx:53
errorcheck.h
Helpers for checking error return status codes and reporting errors.
eflowDepthCalculator.h
eflowRecTrack::m_caloDepthArray
std::vector< double > m_caloDepthArray
Definition: eflowRecTrack.h:140
eflowRecTrack::m_isRecovered
bool m_isRecovered
Tells us whether this track underwent split shower revovery.
Definition: eflowRecTrack.h:137
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
eflowRecTrack::m_pull15
double m_pull15
Definition: eflowRecTrack.h:124
eflowRecTrack::m_alternativeClusterMatches
std::map< std::string, std::vector< eflowTrackClusterLink * > > m_alternativeClusterMatches
Definition: eflowRecTrack.h:147
eflowTrackExtrapolatorBaseAlgTool.h
eflowRecTrack::eflowRecTrack
eflowRecTrack(const ElementLink< xAOD::TrackParticleContainer > &trackElemLink, const ToolHandle< eflowTrackExtrapolatorBaseAlgTool > &theTrackExtrapolatorTool)
Definition: eflowRecTrack.cxx:20
eflowRecTrack::m_isInDenseEnvironment
bool m_isInDenseEnvironment
Definition: eflowRecTrack.h:134
eflowRecTrack::m_trackCaloPoints
std::unique_ptr< eflowTrackCaloPoints > m_trackCaloPoints
Definition: eflowRecTrack.h:142
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
eflowRecTrack::m_trackId
int m_trackId
Definition: eflowRecTrack.h:120