64 {
66 selectEvent = false;
67
68
70 ATH_CHECK(importedMuonCollection.isValid());
71 ATH_MSG_DEBUG(
"Muon container size "<<importedMuonCollection->size());
72
73
75 ATH_CHECK(importedTrackCollection.isValid());
76 ATH_MSG_DEBUG(
"ID TrackParticle container size "<< importedTrackCollection->size());
77
78
79 std::vector<const xAOD::Muon*> theMuonsAfterSelection;
80 SG::WriteDecorHandle<xAOD::MuonContainer, int> muonDecorator(
m_muonIndex, ctx);
81 unsigned int nCombMuons = 0;
82 unsigned int nSegmentTaggedMuons = 0;
83
84 for (const auto * muon : *importedMuonCollection) {
85 if ( !muon ) continue;
86 muonDecorator(*muon) = -1;
87 if ( (
muon->muonType() != xAOD::Muon::MuonType::Combined ) && (
muon->muonType() != xAOD::Muon::MuonType::SegmentTagged ) )
continue;
88 const xAOD::TrackParticle* muonTrk =
muon->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle);
89 if ( !muonTrk ) continue;
92 if ( fabs(muonTrk->
pt())<
m_ptCut )
continue;
94 if (
muon->muonType() == xAOD::Muon::MuonType::Combined ) ++nCombMuons;
95 if (
muon->muonType() == xAOD::Muon::MuonType::SegmentTagged ) ++nSegmentTaggedMuons;
96 theMuonsAfterSelection.push_back(muon);
97 }
98 unsigned int nSelectedMuons = theMuonsAfterSelection.size();
99 ATH_MSG_DEBUG(
"Number of muons after selection: " << nSelectedMuons);
101 ATH_MSG_DEBUG(
"and " << nSegmentTaggedMuons <<
" are segment tagged");
102 if ( (nSelectedMuons < 4) || (nCombMuons < 1) ) {
104 return StatusCode::SUCCESS;
105 }
106 selectEvent = true;
107
108
111
112
114 return b->pt() < a->pt();
115 });
116
117
118 unsigned int muonIndex(0);
119 for (auto selMuon : theMuonsAfterSelection) {
120 muonDecorator(*selMuon) = muonIndex;
121 ++muonIndex;
122 }
123
124
125 std::vector<Combination> quadruplets;
126 std::vector<Combination> pairs;
128 if (quadruplets.size()==0) {
130 return StatusCode::SUCCESS;
131 }
132
133
137
138
140 const std::string pairStr{"pair1"};
141 for (std::vector<Combination>::iterator pairItr = pairs.begin(); pairItr!=pairs.end(); ++pairItr) {
142 std::vector<const xAOD::TrackParticle*> theTracks = (*pairItr).trackParticles(pairStr);
143 std::unique_ptr<xAOD::Vertex> pairVxCandidate =
fit(ctx,theTracks,importedTrackCollection.get(),beamSpot);
144 if (pairVxCandidate) {
145
146 indexDecorator(*pairVxCandidate) = (*pairItr).combinationIndices();
147 chargeDecorator(*pairVxCandidate) = (*pairItr).combinationCharges();
148
149 xAOD::BPhysHelper
helper(pairVxCandidate.get());
151 std::vector<const xAOD::Muon*> theStoredMuons;
152 theStoredMuons = (*pairItr).muons;
153 helper.setMuons(theStoredMuons,importedMuonCollection.get());
154 ATH_MSG_DEBUG(
"..... indices: " << (*pairItr).combinationIndices() <<
155 " charges: " << (*pairItr).combinationCharges() <<
156 " chi2: " << pairVxCandidate->chiSquared());
157
158 pairVxContainer->
push_back(std::move(pairVxCandidate));
159 } else {
161 }
162 }
164
165
167 const std::string dcStr{"DC"};
168 for (std::vector<Combination>::iterator quadItr = quadruplets.begin(); quadItr!=quadruplets.end(); ++quadItr) {
169 std::vector<const xAOD::TrackParticle*> theDCTracks; theDCTracks.clear();
170 theDCTracks = (*quadItr).trackParticles(dcStr);
171 std::unique_ptr<xAOD::Vertex> dcVxCandidate =
fit(ctx,theDCTracks,importedTrackCollection.get(), beamSpot);
172 if (dcVxCandidate != 0) {
173
174 indexDecorator(*dcVxCandidate) = (*quadItr).combinationIndices();
175 chargeDecorator(*dcVxCandidate) = (*quadItr).combinationCharges();
176
177 double dcChi2 = dcVxCandidate->chiSquared();
178
179 xAOD::BPhysHelper
helper(dcVxCandidate.get());
181 const std::vector<const xAOD::Muon*> &theStoredMuons = (*quadItr).muons;
182 helper.setMuons(theStoredMuons,importedMuonCollection.get());
183
184 quadVxContainer->
push_back(std::move(dcVxCandidate));
185 ATH_MSG_DEBUG(
"..... indices: " << (*quadItr).combinationIndices() <<
186 " charges: " << (*quadItr).combinationCharges() <<
187 " chi2(DC): " << dcChi2);
188 } else {
190 }
191 }
193 if(quadVxContainer->
size() > 500){
194 ATH_MSG_WARNING(
"Event Run: " <<
evt->runNumber() <<
" Event: " <<
evt->eventNumber() <<
" quadruplet container size " << quadVxContainer->
size());
195 }
196
197 return StatusCode::SUCCESS;;
198 }
#define ATH_MSG_WARNING(x,...)
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.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Eigen::Matrix< double, 3, 1 > Vector3D
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
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:
Vertex_v1 Vertex
Define the latest version of the vertex class.
Muon_v1 Muon
Reference the current persistent version: