32 long long totLockHits;
35 void zero() { totGroup = totSeg = totLockHits = totInvCand =
trunc = 0; }
36 void incr(
long long g,
long long s,
long long l) {
41 void truncated() { ++
trunc; }
42 void invalid() { ++totInvCand; }
44 std::cout <<
"TrajectorySegmentBuilder stat\nGroup/Seg/Lock/Inv/Trunc " << totGroup <<
'/' << totSeg <<
'/' 45 << totLockHits <<
'/' << totInvCand <<
'/' <<
trunc << std::endl;
47 StatCount() {
zero(); }
48 ~StatCount() {
print(); }
54 void incr(
long long,
long long,
long long) {}
69 theLockedHits.clear();
70 TempTrajectory startingTrajectory(theFullPropagator.propagationDirection(), 0);
75 theLayerMeasurements->groupedMeasurements(theLayer, startingState, theFullPropagator, theEstimator);
78 cout <<
"TSB: number of measurement groups = " << measGroups.size() << endl;
95 for (
auto const& gr : measGroups) {
98 for (
auto const&
m : gr.measurements())
99 if LIKELY (
m.recHitR().isValid())
106 <<
" found " << measGroups.size() <<
" groups and more than " <<
static_cast<unsigned int>(MAXCOMB)
107 <<
" combinations - limiting to " << (ngrp - 1) <<
" groups";
110 statCount.truncated();
117 measGroups.resize(ngrp - 1);
124 for (vector<TMG>::const_iterator ig = measGroups.begin(); ig != measGroups.end(); ++ig) {
126 const vector<TM>& measurements = ig->measurements();
127 for (vector<TM>::const_iterator im = measurements.begin(); im != measurements.end(); ++im) {
128 if (im->recHit()->isValid())
136 cout <<
"TrajectorySegmentBuilder::partialTrajectories:: det ids & hit types / group" << endl;
137 for (vector<TMG>::const_iterator ig = measGroups.begin(); ig != measGroups.end(); ++ig) {
138 const vector<TM>& measurements = ig->measurements();
139 for (vector<TM>::const_iterator im = measurements.begin(); im != measurements.end(); ++im) {
140 if (im != measurements.begin())
142 if (im->recHit()->det())
143 cout << im->recHit()->det()->geographicalId().rawId() <<
" " << im->recHit()->getType();
151 cout <<
typeid(theLayer).
name() << endl;
172 cout <<
"TSB: back with " <<
candidates.size() <<
" candidates" << endl;
178 updateWithInvalidHit(startingTrajectory, measGroups,
candidates);
181 cout <<
"TSB: " <<
candidates.size() <<
" candidates after invalid hit" << endl;
183 statCount.incr(measGroups.size(),
candidates.size(), theLockedHits.size());
185 theLockedHits.clear();
194 if (
hit->isValid()) {
195 auto&& upState = theUpdator.update(predictedState, *
hit);
216 vector<TMG>::const_iterator begin,
217 vector<TMG>::const_iterator end) {
218 vector<TempTrajectory>
ret;
222 cout <<
"TSB::addGroup : no groups left" << endl;
235 updatedTrajectories.reserve(2);
237 if (theMaxCand == 1) {
238 auto&& firstMeasurements = unlockedMeasurements(begin->measurements());
239 if (!firstMeasurements.empty())
240 updateCandidatesWithBestHit(traj,
std::move(firstMeasurements.front()), updatedTrajectories);
242 updateCandidates(traj, begin->measurements(), updatedTrajectories);
245 cout <<
"TSB::addGroup : updating with first group - " << updatedTrajectories.size() <<
" trajectories" << endl;
247 auto&& meas = redoMeasurements(traj, begin->detGroup());
249 if (theBestHitOnly) {
250 updateCandidatesWithBestHit(traj,
std::move(meas.front()), updatedTrajectories);
252 updateCandidates(traj, meas, updatedTrajectories);
255 cout <<
"TSB::addGroup : updating" << updatedTrajectories.size() <<
" trajectories-1" << endl;
260 updatedTrajectories.push_back(traj);
262 if (begin + 1 != end) {
264 for (
auto const& ut : updatedTrajectories) {
266 cout <<
"TSB::addGroup : trying to extend candidate at " << &ut <<
" size " << ut.measurements().size() << endl;
267 vector<TempTrajectory>&& finalTrajectories = addGroup(ut, begin + 1, end);
269 cout <<
"TSB::addGroup : " << finalTrajectories.size() <<
" finalised candidates before cleaning" << endl;
272 cleanCandidates(finalTrajectories);
276 for (
auto const&
t : finalTrajectories)
279 cout <<
"TSB::addGroup : got " << ntf <<
" finalised candidates" << endl;
282 for (
auto&
t : finalTrajectories)
290 ret.reserve(updatedTrajectories.size());
291 for (
auto&
t : updatedTrajectories)
305 const vector<TM>& measurements,
310 for (
auto im = measurements.begin(); im != measurements.end(); ++im) {
311 if (im->recHit()->isValid()) {
315 lockMeasurement(*im);
327 lockMeasurement(measurement);
339 cout <<
"TSB::redoMeasurements : nr. of measurements / group =";
343 for (
auto const& det : detGroup) {
347 if UNLIKELY (theDbgFlg && !compat.first)
355 if (mdet.
measurements(compat.second, theEstimator, tmps) && tmps.
hits[0]->isValid())
356 for (std::size_t
i = 0;
i != tmps.
size(); ++
i)
373 const vector<TMG>& groups,
381 for (
auto const& gr : groups) {
382 auto const& measurements = gr.measurements();
383 for (
auto im = measurements.rbegin(); im != measurements.rend(); ++im) {
384 auto const&
hit = im->recHitR();
392 auto const& predState = im->predictedState();
394 (predState.isValid() &&
hit.det()->surface().bounds().inside(predState.localPosition()))) {
399 cout <<
"TrajectorySegmentBuilder::updateWithInvalidHit " 400 <<
"added inactive hit" << endl;
414 for (
auto const& gr : groups) {
415 auto const& measurements = gr.measurements();
416 for (
auto im = measurements.rbegin(); im != measurements.rend(); ++im) {
418 auto const&
hit = im->recHitR();
423 auto const& predState = im->predictedState();
424 if (
iteration > 0 || (predState.isValid() &&
hit.surface()->bounds().inside(predState.localPosition()))) {
433 cout <<
"TrajectorySegmentBuilder::updateWithInvalidHit: " 434 <<
" did not find invalid hit on 1st iteration" << endl;
438 cout <<
"TrajectorySegmentBuilder::updateWithInvalidHit: " 439 <<
" did not find invalid hit" << endl;
446 result.reserve(measurements.size());
450 for (
auto const&
m : measurements) {
451 auto const& testHit =
m.recHitR();
456 for (
auto const&
h : theLockedHits) {
483 for (
int i = 0;
i != NC; ++
i)
void emplace(Args &&... args)
const_iterator rbegin() const
TrajectoryStateOnSurface const & predictedState() const
const LocalTrajectoryError & localError() const
std::vector< TempTrajectory > TempTrajectoryContainer
bool measurements(const TrajectoryStateOnSurface &stateOnThisDet, const MeasurementEstimator &est, TempMeasurements &result) const
ret
prodAgent to be discontinued
TempTrajectoryContainer segments(const TSOS startingState)
new segments within layer
const DataContainer & measurements() const
std::vector< TempTrajectory > addGroup(TempTrajectory const &traj, std::vector< TrajectoryMeasurementGroup >::const_iterator begin, std::vector< TrajectoryMeasurementGroup >::const_iterator end)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
static std::pair< bool, TrajectoryStateOnSurface > isCompatible(const GeomDet *theDet, const TrajectoryStateOnSurface &ts, const Propagator &prop, const MeasurementEstimator &est)
void updateCandidatesWithBestHit(TempTrajectory const &traj, TM measurements, TempTrajectoryContainer &candidates)
creation of a new candidate from a segment and the best hit out of a collection
void lockMeasurement(const TM &measurement)
mark a hit as used
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
const TrajectoryMeasurement & lastMeasurement() const
void updateWithInvalidHit(TempTrajectory &traj, const std::vector< TMG > &groups, TempTrajectoryContainer &candidates) const
void updateTrajectory(TempTrajectory &traj, TM tm) const
update of a trajectory with a hit
void cleanCandidates(std::vector< TempTrajectory > &candidates) const
clean a set of candidates
std::vector< TrajectoryMeasurement > redoMeasurements(const TempTrajectory &traj, const DetGroup &detGroup) const
retrieve compatible hits from a DetGroup
Log< level::Info, false > LogInfo
bool lessByFoundHits(const Trajectory &a, const Trajectory &b)
TrajectoryStateOnSurface const & updatedState() const
const AlgebraicSymMatrix55 & matrix() const
void updateCandidates(TempTrajectory const &traj, const std::vector< TM > &measurements, TempTrajectoryContainer &candidates)
creation of new candidates from a segment and a collection of hits
const_iterator rend() const
std::vector< TrajectoryMeasurement > unlockedMeasurements(const std::vector< TM > &measurements) const
get list of unused hits
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const DetLayer * layer() const
ConstRecHitPointer const & recHit() const
bool empty() const
True if trajectory has no measurements.