|
ATLAS Offline Software
|
Go to the documentation of this file.
31 ATH_MSG_ERROR(
"JetTrackMomentsTool needs to have its input container name configured!");
32 return StatusCode::FAILURE;
36 for (
size_t iCut = 0; iCut <
m_minTrackPt.size(); ++iCut) {
58 return StatusCode::SUCCESS;
68 if (!handle_v.isValid()){
71 return StatusCode::FAILURE;
74 const auto *vertexContainer = handle_v.cptr();
78 if (!handle_tva.isValid()){
79 ATH_MSG_ERROR(
"Could not retrieve the TrackVertexAssociation: "
81 return StatusCode::FAILURE;
84 const auto *tva = handle_tva.cptr();
90 std::vector<const xAOD::TrackParticle*> tracks;
95 std::vector<const xAOD::TrackParticle*> pflowTracks;
96 bool isPFlowJet =
false;
102 size_t numConstit =
jet->numConstituents();
103 for (
size_t i=0;
i<numConstit;
i++ ) {
107 pflowTracks.push_back(thisTrack);
113 size_t numConstit =
jet->numConstituents();
114 for (
size_t i=0;
i<numConstit;
i++ ) {
121 if(thisTrack !=
nullptr) pflowTracks.push_back(thisTrack);
130 for (
size_t iCut = 0; iCut <
m_minTrackPt.size(); ++iCut) {
136 const std::vector<TrackMomentStruct> moments =
getTrackMoments(*
jet,vertexContainer,minPt,tracks,tva);
138 std::vector<int> numTrkVec; numTrkVec.resize(moments.size());
139 std::vector<float> sumPtTrkVec; sumPtTrkVec.resize(moments.size());
140 std::vector<float> trackWidthVec; trackWidthVec.resize(moments.size());
141 for (
size_t iVertex = 0; iVertex < moments.size(); ++iVertex ) {
142 numTrkVec[iVertex] = moments.at(iVertex).numTrk;
143 sumPtTrkVec[iVertex] = moments.at(iVertex).sumPtTrk;
144 trackWidthVec[iVertex] = moments.at(iVertex).trackWidth;
147 numTrkHandle(*
jet) = numTrkVec;
148 sumPtTrkHandle(*
jet) = sumPtTrkVec;
149 trkWidthHandle(*
jet) = trackWidthVec;
157 const std::vector<TrackMomentStruct> pflowMoments =
getTrackMoments(*
jet,vertexContainer,minPt,pflowTracks,tva);
159 std::vector<int> pflowNumTrkVec; pflowNumTrkVec.resize(pflowMoments.size());
160 std::vector<float> pflowSumPtTrkVec; pflowSumPtTrkVec.resize(pflowMoments.size());
161 std::vector<float> pflowTrackWidthVec; pflowTrackWidthVec.resize(pflowMoments.size());
162 for (
size_t iVertex = 0; iVertex < pflowMoments.size(); ++iVertex ) {
163 pflowNumTrkVec[iVertex] = pflowMoments.at(iVertex).numTrk;
164 pflowSumPtTrkVec[iVertex] = pflowMoments.at(iVertex).sumPtTrk;
165 pflowTrackWidthVec[iVertex] = pflowMoments.at(iVertex).trackWidth;
168 numCPFOHandle(*
jet) = pflowNumTrkVec;
169 sumPtCPFOHandle(*
jet) = pflowSumPtTrkVec;
170 cPFOWidthHandle(*
jet) = pflowTrackWidthVec;
174 numCPFOHandle(*
jet) = std::vector<int>();
175 sumPtCPFOHandle(*
jet) = std::vector<float>();
176 cPFOWidthHandle(*
jet) = std::vector<float>();
182 return StatusCode::SUCCESS;
188 std::vector<TrackMomentStruct> moments;
189 moments.resize(vertices->
size());
191 for (
size_t iVertex = 0; iVertex < vertices->
size(); ++iVertex)
202 moments.sumPtTrk = 0;
203 moments.trackWidth = 0;
206 const float jetEta =
jet.eta();
207 const float jetPhi =
jet.phi();
211 unsigned int nkeep = 0;
212 unsigned int nskip = 0;
215 for (
size_t iTrack = 0; iTrack < tracks.size(); ++iTrack)
243 moments.trackWidth = moments.sumPtTrk > 0 ? moments.trackWidth / moments.sumPtTrk : -1;
246 <<
": nsel=" << nkeep
247 <<
", nrej=" <<
nskip <<
" minpt="<<minTrackPt);
254 if (fabs(
value - minTrackPt) > 0.1)
255 ATH_MSG_WARNING(
"Cut float and int disagree: " << minTrackPt <<
" float vs " <<
value <<
" int");
257 std::ostringstream sout;
258 sout <<
"Pt" <<
value;
const TrackParticle * track(unsigned int index) const
Retrieve a const pointer to a Rec::TrackParticle.
float round(const float toRound, const unsigned int decimals)
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
::StatusCode StatusCode
StatusCode definition for legacy code.
Class to hold N-to-one aassociations between tracks and vertices.
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Handle class for adding a decoration to an object.
signal_t signalType() const
@ ParticleFlow
The object is a particle-flow object.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
const xAOD::Vertex * associatedVertex(const xAOD::TrackParticle *trk) const
bool isCharged() const
is a charged PFO
bool trackPt(const xAOD::TauJet &, const xAOD::TauTrack &track, double &out)
const xAOD::IParticle * chargedObject(std::size_t i) const
Class describing a particle flow object.
Class describing a Vertex.
#define ATH_MSG_WARNING(x)
Class describing a TrackParticle.
const T * at(size_type n) const
Access an element, as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
A detector object made of other lower level object(s)