66 {
68 selectEvent = false;
69
70
72 ATH_CHECK(importedMuonCollection.isValid());
73 ATH_MSG_DEBUG(
"Muon container size "<<importedMuonCollection->size());
74
75
77 ATH_CHECK(importedTrackCollection.isValid());
78 ATH_MSG_DEBUG(
"ID TrackParticle container size "<< importedTrackCollection->size());
79
80
81 std::vector<const xAOD::Muon*> theMuonsAfterSelection;
82 SG::WriteDecorHandle<xAOD::MuonContainer, int> muonDecorator(
m_muonIndex, ctx);
83 unsigned int nCombMuons = 0;
84 unsigned int nSegmentTaggedMuons = 0;
85
86 for (const auto * muon : *importedMuonCollection) {
87 if ( !muon ) continue;
88 muonDecorator(*muon) = -1;
89 if ( (
muon->muonType() != xAOD::Muon::Combined ) && (
muon->muonType() != xAOD::Muon::SegmentTagged ) )
continue;
90 if (!
muon->inDetTrackParticleLink().isValid())
continue;
91 auto& link =
muon->inDetTrackParticleLink();
93 if ( !muonTrk ) continue;
96 if ( fabs(muonTrk->
pt())<
m_ptCut )
continue;
98 if (
muon->muonType() == xAOD::Muon::Combined ) ++nCombMuons;
99 if (
muon->muonType() == xAOD::Muon::SegmentTagged ) ++nSegmentTaggedMuons;
100 theMuonsAfterSelection.push_back(muon);
101 }
102 unsigned int nSelectedMuons = theMuonsAfterSelection.size();
103 ATH_MSG_DEBUG(
"Number of muons after selection: " << nSelectedMuons);
105 ATH_MSG_DEBUG(
"and " << nSegmentTaggedMuons <<
" are segment tagged");
106 if ( (nSelectedMuons < 4) || (nCombMuons < 1) ) {
108 return StatusCode::SUCCESS;
109 }
110 selectEvent = true;
111
112
115
116
118 return b->pt() < a->pt();
119 });
120
121
122 unsigned int muonIndex(0);
123 for (auto selMuon : theMuonsAfterSelection) {
124 muonDecorator(*selMuon) = muonIndex;
125 ++muonIndex;
126 }
127
128
129 std::vector<Combination> quadruplets;
130 std::vector<Combination>
pairs;
132 if (quadruplets.size()==0) {
134 return StatusCode::SUCCESS;
135 }
136
137
141
142
144 for (std::vector<Combination>::iterator pairItr =
pairs.begin(); pairItr!=
pairs.end(); ++pairItr) {
145 std::vector<const xAOD::TrackParticle*> theTracks = (*pairItr).trackParticles("pair1");
146 xAOD::Vertex* pairVxCandidate =
fit(theTracks,importedTrackCollection.get(),beamSpot);
147 if (pairVxCandidate) {
148
149 indexDecorator(*pairVxCandidate) = (*pairItr).combinationIndices();
150 chargeDecorator(*pairVxCandidate) = (*pairItr).combinationCharges();
151
152 xAOD::BPhysHelper
helper(pairVxCandidate);
154 std::vector<const xAOD::Muon*> theStoredMuons;
155 theStoredMuons = (*pairItr).muons;
156 helper.setMuons(theStoredMuons,importedMuonCollection.get());
157
158 pairVxContainer->
push_back(pairVxCandidate);
159 ATH_MSG_DEBUG(
"..... indices: " << (*pairItr).combinationIndices() <<
160 " charges: " << (*pairItr).combinationCharges() <<
162 } else {
164 }
165 }
167
168
170 for (std::vector<Combination>::iterator quadItr = quadruplets.begin(); quadItr!=quadruplets.end(); ++quadItr) {
171 std::vector<const xAOD::TrackParticle*> theDCTracks; theDCTracks.clear();
172 theDCTracks = (*quadItr).trackParticles("DC");
173 xAOD::Vertex* dcVxCandidate =
fit(theDCTracks,importedTrackCollection.get(), beamSpot);
174 if (dcVxCandidate != 0) {
175
176 indexDecorator(*dcVxCandidate) = (*quadItr).combinationIndices();
177 chargeDecorator(*dcVxCandidate) = (*quadItr).combinationCharges();
178
180
181 xAOD::BPhysHelper
helper(dcVxCandidate);
183 const std::vector<const xAOD::Muon*> &theStoredMuons = (*quadItr).muons;
184 helper.setMuons(theStoredMuons,importedMuonCollection.get());
185
186 quadVxContainer->
push_back(dcVxCandidate);
187 ATH_MSG_DEBUG(
"..... indices: " << (*quadItr).combinationIndices() <<
188 " charges: " << (*quadItr).combinationCharges() <<
189 " chi2(DC): " << dcChi2);
190 } else {
192 }
193 }
195
196 return StatusCode::SUCCESS;;
197 }
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
SG::Decorator< T, ALLOC > Decorator
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
float chiSquared() const
Returns the of the vertex fit as float.
Eigen::Matrix< double, 3, 1 > Vector3D
AthConfigFlags beamSpot(AthConfigFlags flags, str instanceName, str recoMode)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Muon_v1 Muon
Reference the current persistent version: