23 const vector<TrajectoryMeasurement>& meas = traj.
measurements();
24 const Propagator* forwardPropagator = getPropagator();
25 const Propagator* backwardPropagator = getReversePropagator();
27 forwardPropagator = getReversePropagator();
28 backwardPropagator = getPropagator();
31 return vector<TrajectoryMeasurement>();
34 vector<pair<const DetLayer*, vector<TrajectoryMeasurement> > > mol;
37 vector<TrajectoryMeasurement>
result;
41 return vector<TrajectoryMeasurement>();
53 LogDebug(
"MultiRecHitCollector") <<
"Layer " << mol.back().first <<
" has " << mol.back().second.size()
55 LogTrace(
"MultiRecHitCollector") <<
"Original measurements are:";
56 for (
unsigned int iLay = 0; iLay < mol.size(); iLay++) {
57 LogTrace(
"MultiRecHitCollector") <<
" Layer " << mol.at(iLay).first <<
" has " << mol.at(iLay).second.size()
59 vector<TrajectoryMeasurement>::const_iterator ibeg = (mol.at(iLay)).
second.begin();
60 vector<TrajectoryMeasurement>::const_iterator iend = (mol.at(iLay)).
second.end();
61 for (vector<TrajectoryMeasurement>::const_iterator imeas = ibeg; imeas != iend; ++imeas) {
62 if (imeas->recHit()->isValid()) {
63 LogTrace(
"MultiRecHitCollector") <<
" Valid Hit with DetId " << imeas->recHit()->geographicalId().rawId()
64 <<
" local position " << imeas->recHit()->hit()->localPosition()
65 <<
" global position " << imeas->recHit()->hit()->globalPosition();
67 LogTrace(
"MultiRecHitCollector") <<
" Invalid Hit with DetId " << imeas->recHit()->geographicalId().rawId();
73 vector<TrajectoryMeasurementGroup> groupedMeas;
75 groupedMeas = theLM.groupedMeasurements(*(mol.back().first), current, *backwardPropagator, *(getEstimator()));
79 vector<TrajectoryMeasurementGroup> sortedgroupedMeas;
80 for (vector<TrajectoryMeasurementGroup>::reverse_iterator iter = groupedMeas.rbegin(); iter != groupedMeas.rend();
82 sortedgroupedMeas.push_back(*iter);
86 buildMultiRecHits(sortedgroupedMeas,
result, theMTE);
89 current = mol.back().second.front().updatedState();
92 for (
vector<pair<
const DetLayer*, vector<TrajectoryMeasurement> > >::reverse_iterator imol = mol.rbegin() + 1;
96 LogDebug(
"MultiRecHitCollector") <<
"Layer " << lay <<
" has " << (*imol).second.size() <<
" measurements";
98 vector<TrajectoryMeasurementGroup> currentLayerMeas;
100 currentLayerMeas = theLM.groupedMeasurements(*lay, current, *forwardPropagator, *(getEstimator()));
103 buildMultiRecHits(currentLayerMeas,
result, theMTE);
104 current = (*imol).second.front().updatedState();
108 LogTrace(
"MultiRecHitCollector") <<
" Ending GroupedDAFHitCollector::recHits >> Original Measurement size "
110 <<
"\n >> GroupedDAFHitCollector returned "
111 <<
result.size() <<
" measurements";
118 for (vector<TrajectoryMeasurement>::const_iterator iimeas =
result.begin(); iimeas !=
result.end(); ++iimeas) {
119 if (iimeas->recHit()->isValid())
123 if (hitcounter > 2) {
128 return vector<TrajectoryMeasurement>();
132 return vector<TrajectoryMeasurement>();
137 vector<TrajectoryMeasurement>&
result,
139 unsigned int initial_size =
result.size();
142 if (measgroup.empty()) {
143 LogTrace(
"MultiRecHitCollector") <<
"No TrajectoryMeasurementGroups found for this layer\n";
152 LogTrace(
"MultiRecHitCollector") <<
"Found " << measgroup.size() <<
" groups for this layer";
156 for (vector<TrajectoryMeasurementGroup>::const_iterator igroup = measgroup.begin(); igroup != measgroup.end();
160 if (!
state.isValid()) {
161 LogTrace(
"MultiRecHitCollector") <<
"Something wrong! no valid TSOS found in current group ";
165 LogTrace(
"MultiRecHitCollector") <<
"This group has " << igroup->measurements().size() <<
" measurements";
166 LogTrace(
"MultiRecHitCollector") <<
"This group has the following " << igroup->detGroup().size()
167 <<
" detector ids: " << endl;
168 for (DetGroup::const_iterator idet = igroup->detGroup().begin(); idet != igroup->detGroup().end(); ++idet) {
169 LogTrace(
"MultiRecHitCollector") << idet->det()->geographicalId().rawId();
172 vector<const TrackingRecHit*>
hits;
173 for (vector<TrajectoryMeasurement>::const_iterator imeas = igroup->measurements().begin();
174 imeas != igroup->measurements().end();
183 LogTrace(
"MultiRecHitCollector") <<
"This hit is valid ";
184 hits.push_back(imeas->recHit()->hit());
186 LogTrace(
"MultiRecHitCollector") <<
" This hit is not valid and will not enter in the MRH. ";
191 LogTrace(
"MultiRecHitCollector") <<
"No valid hits found in current group ";
195 LogTrace(
"MultiRecHitCollector") <<
"The best TSOS in this group is " <<
state <<
" it lays on surface located at "
196 <<
state.surface().position();
198 LogTrace(
"MultiRecHitCollector") <<
"For the MRH on this group the following hits will be used";
199 for (vector<const TrackingRecHit*>::iterator iter =
hits.begin(); iter !=
hits.end(); iter++) {
200 string validity =
"valid";
202 validity =
"missing !should not happen!";
204 validity =
"inactive";
208 <<
"DetId " << (*iter)->geographicalId().rawId() <<
" validity: " << validity <<
" surface position "
209 << getMeasurementTracker()->geomTracker()->idToDet((*iter)->geographicalId())->
position()
210 <<
" hit local position " << (*iter)->localPosition();
217 if (
result.size() == initial_size) {
218 LogTrace(
"MultiRecHitCollector") <<
"no valid measuremnt or no valid TSOS in none of the groups";
220 if (!measgroup.back().measurements().empty()) {
221 result.push_back(measgroup.back().measurements().back());