25 const vector<TrajectoryMeasurement>& meas = traj.
measurements();
26 const Propagator* forwardPropagator = getPropagator();
27 const Propagator* backwardPropagator = getReversePropagator();
29 forwardPropagator = getReversePropagator();
30 backwardPropagator = getPropagator();
33 return vector<TrajectoryMeasurement>();
36 vector<pair<const DetLayer*, vector<TrajectoryMeasurement> > > mol;
39 vector<TrajectoryMeasurement>
result;
42 if(mol.size()<2)
return vector<TrajectoryMeasurement>();
55 LogDebug(
"MultiRecHitCollector") <<
"Layer " << mol.back().first <<
" has " << mol.back().second.size() <<
" measurements";
56 LogTrace(
"MultiRecHitCollector") <<
"Original measurements are:";
57 for(
unsigned int iLay = 0; iLay < mol.size(); iLay++){
58 LogTrace(
"MultiRecHitCollector") <<
" Layer " << mol.at(iLay).first <<
" has " << mol.at(iLay).second.size() <<
" measurements:";
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,
76 *backwardPropagator, *(getEstimator()));
80 vector<TrajectoryMeasurementGroup> sortedgroupedMeas;
81 for (vector<TrajectoryMeasurementGroup>::reverse_iterator iter = groupedMeas.rbegin();
82 iter != groupedMeas.rend(); iter++){
84 sortedgroupedMeas.push_back(*iter);
89 buildMultiRecHits(sortedgroupedMeas, result, theMTE);
93 current = mol.back().second.front().updatedState();
96 for( vector<pair<
const DetLayer*, vector<TrajectoryMeasurement> > >::reverse_iterator imol =
97 mol.rbegin() + 1; imol != mol.rend(); imol++) {
100 LogDebug(
"MultiRecHitCollector") <<
"Layer " << lay <<
" has " << (*imol).second.size() <<
" measurements";
102 vector<TrajectoryMeasurementGroup> currentLayerMeas;
104 currentLayerMeas = theLM.groupedMeasurements(*lay, current, *forwardPropagator, *(getEstimator()));
107 buildMultiRecHits(currentLayerMeas, result, theMTE);
108 current = (*imol).second.front().updatedState();
112 LogTrace(
"MultiRecHitCollector") <<
" Ending GroupedDAFHitCollector::recHits >> Original Measurement size " << meas.size()
113 <<
"\n >> GroupedDAFHitCollector returned " << result.size() <<
" measurements";
121 for (vector<TrajectoryMeasurement>::const_iterator iimeas = result.begin(); iimeas != result.end(); ++iimeas)
123 if(iimeas->recHit()->isValid()) hitcounter++;
131 else return vector<TrajectoryMeasurement>();
134 else{
return vector<TrajectoryMeasurement>();}
140 unsigned int initial_size = result.size();
143 if (measgroup.empty()) {
144 LogTrace(
"MultiRecHitCollector") <<
"No TrajectoryMeasurementGroups found for this layer\n" ;
153 LogTrace(
"MultiRecHitCollector") <<
"Found " << measgroup.size() <<
" groups for this layer";
157 for ( vector<TrajectoryMeasurementGroup>::const_iterator igroup = measgroup.begin();
158 igroup != measgroup.end(); igroup++ ){
163 LogTrace(
"MultiRecHitCollector") <<
"Something wrong! no valid TSOS found in current group ";
167 LogTrace(
"MultiRecHitCollector") <<
"This group has " << igroup->measurements().size() <<
" measurements";
168 LogTrace(
"MultiRecHitCollector") <<
"This group has the following " << igroup->detGroup().size()
169 <<
" detector ids: " << endl;
170 for (DetGroup::const_iterator idet = igroup->detGroup().begin(); idet != igroup->detGroup().end(); ++idet){
171 LogTrace(
"MultiRecHitCollector") << idet->det()->geographicalId().rawId();
174 vector<const TrackingRecHit*> hits;
175 for (vector<TrajectoryMeasurement>::const_iterator imeas = igroup->measurements().begin();
176 imeas != igroup->measurements().end(); imeas++){
185 LogTrace(
"MultiRecHitCollector") <<
"This hit is valid ";
186 hits.push_back(imeas->recHit()->hit());
189 LogTrace(
"MultiRecHitCollector") <<
" This hit is not valid and will not enter in the MRH. " ;
194 LogTrace(
"MultiRecHitCollector") <<
"No valid hits found in current group ";
198 LogTrace(
"MultiRecHitCollector") <<
"The best TSOS in this group is " << state <<
" it lays on surface located at " << state.
surface().
position();
200 LogTrace(
"MultiRecHitCollector") <<
"For the MRH on this group the following hits will be used";
201 for (vector<const TrackingRecHit*>::iterator iter = hits.begin(); iter != hits.end(); iter++){
202 string validity =
"valid";
206 LogTrace(
"MultiRecHitCollector") <<
"DetId " << (*iter)->geographicalId().rawId()
207 <<
" validity: " << validity
208 <<
" surface position " << getMeasurementTracker()->geomTracker()->idToDet((*iter)->geographicalId())->
position()
209 <<
" hit local position " << (*iter)->localPosition();
216 if (result.size() == initial_size){
217 LogTrace(
"MultiRecHitCollector") <<
"no valid measuremnt or no valid TSOS in none of the groups";
219 if (measgroup.back().measurements().size() != 0){
220 result.push_back(measgroup.back().measurements().back());
virtual std::vector< TrajectoryMeasurement > recHits(const Trajectory &, const MeasurementTrackerEvent *theMT) const override
PropagationDirection const & direction() const
U second(std::pair< T, U > const &p)
DataContainer const & measurements() const
const SurfaceType & surface() const
void buildMultiRecHits(const std::vector< TrajectoryMeasurementGroup > &measgroup, std::vector< TrajectoryMeasurement > &result, const MeasurementTrackerEvent *&theMTE) const
tuple MeasurementTrackerEvent
static int position[264][3]
const PositionType & position() const