24 #define _debug_SimpleDAFHitCollector_ 30 LogTrace(
"MultiRecHitCollector") <<
" Calling SimpleDAFHitCollector::recHits" << std::endl;
34 const vector<TrajectoryMeasurement> meas = traj.
measurements();
35 unsigned int hitcounter = 1;
37 if (meas.empty())
return vector<TrajectoryMeasurement>();
39 LogTrace(
"MultiRecHitCollector") <<
" Original measurements are:";
44 vector<TrajectoryMeasurement>
result;
45 for(vector<TrajectoryMeasurement>::const_reverse_iterator itrajmeas = meas.rbegin(); itrajmeas < meas.rend();
46 itrajmeas++, hitcounter++) {
48 DetId id = itrajmeas->recHit()->geographicalId();
52 std::vector<const TrackingRecHit*>
hits;
53 std::vector<std::unique_ptr<const TrackingRecHit>> hitsOwner;
62 LogTrace(
"MultiRecHitCollector") <<
"Something wrong! no valid TSOS found in current group ";
68 if (hitcounter == meas.size()) combtsos = predtsos_fwd;
69 else if (hitcounter == 1) combtsos = predtsos_bwd;
70 else combtsos = combiner(predtsos_bwd, predtsos_fwd);
73 if( measDet.
measurements(smoothtsos, *(getEstimator()), tmps)){
75 LogTrace(
"MultiRecHitCollector") <<
" Found " << tmps.
size() <<
" compatible measurements";
77 for (std::size_t
i=0;
i!=tmps.
size(); ++
i){
79 DetId idtemps = tmps.
hits[
i]->geographicalId();
81 if( idtemps ==
id && tmps.
hits[
i]->hit()->isValid() ) {
82 LogTrace(
"MultiRecHitCollector") <<
" This is valid with position " << tmps.
hits[
i]->hit()->localPosition() <<
" and error " << tmps.
hits[
i]->hit()->localPositionError();
85 theUpdator->getBuilder()->build(tmps.
hits[
i]->hit());
87 auto righthit = rightdimension(*preciseHit);
89 hits.push_back(hitsOwner.back().get());
99 LogTrace(
"MultiRecHitCollector") <<
" -> but no valid hits found in current group.";
101 if( result.empty() )
continue;
108 if(!itrajmeas->recHit()->isValid())
109 LogTrace(
"MultiRecHitCollector") <<
" -> " << hits.size() <<
" valid hits for this sensor. (IT WAS INVALID!!!)";
110 else LogTrace(
"MultiRecHitCollector") <<
" -> " << hits.size() <<
" valid hits for this sensor.";
113 result.push_back(
TrajectoryMeasurement(predtsos_fwd,theUpdator->buildMultiRecHit(hits, combtsos, measDet)));
116 LogTrace(
"MultiRecHitCollector") <<
" No measurements found in current group.";
120 if( result.empty() )
continue;
129 LogTrace(
"MultiRecHitCollector") <<
" Ending SimpleDAFHitCollector::recHits >> " << result.size();
140 for (vector<TrajectoryMeasurement>::const_iterator iimeas = result.begin(); iimeas != result.end(); ++iimeas) {
141 if(iimeas->recHit()->isValid()) hitcounter++;
146 else return vector<TrajectoryMeasurement>();
149 else{
return vector<TrajectoryMeasurement>();}
157 for(vector<TrajectoryMeasurement>::const_iterator itrajmeas = TM.begin(); itrajmeas < TM.end();
159 if (itrajmeas->recHit()->isValid()){
161 LogTrace(
"MultiRecHitCollector") <<
" Valid Hit with DetId " << itrajmeas->recHit()->geographicalId().rawId() <<
" and dim:" << itrajmeas->recHit()->dimension()
163 <<
" local position " << itrajmeas->recHit()->hit()->localPosition()
164 <<
" global position " << itrajmeas->recHit()->hit()->globalPosition()
165 <<
" and r " << itrajmeas->recHit()->hit()->globalPosition().perp() ;
167 DetId hitId = itrajmeas->recHit()->geographicalId();
170 switch (hitId.subdetid()) {
172 LogTrace(
"MultiRecHitCollector") <<
" I am TIB " << theTopology->tibLayer(hitId);
break;
174 LogTrace(
"MultiRecHitCollector") <<
" I am TOB " << theTopology->tobLayer(hitId);
break;
176 LogTrace(
"MultiRecHitCollector") <<
" I am TEC " << theTopology->tecWheel(hitId);
break;
178 LogTrace(
"MultiRecHitCollector") <<
" I am TID " << theTopology->tidWheel(hitId);
break;
180 LogTrace(
"MultiRecHitCollector") <<
" I am PixBar " << theTopology->pxbLayer(hitId);
break;
182 LogTrace(
"MultiRecHitCollector") <<
" I am PixFwd " << theTopology->pxfDisk(hitId);
break;
184 LogTrace(
"MultiRecHitCollector") <<
" UNKNOWN TRACKER HIT TYPE ";
break;
195 LogTrace(
"MultiRecHitCollector") <<
" UNKNOWN MUON HIT TYPE ";
198 LogTrace(
"MultiRecHitCollector") <<
" UNKNOWN HIT TYPE ";
201 LogTrace(
"MultiRecHitCollector") <<
" TSOS predicted_fwd " << itrajmeas->predictedState().localPosition() ;
202 LogTrace(
"MultiRecHitCollector") <<
" TSOS predicted_bwd " << itrajmeas->backwardPredictedState().localPosition() ;
203 LogTrace(
"MultiRecHitCollector") <<
" TSOS smoothtsos " << itrajmeas->updatedState().localPosition() ;
205 LogTrace(
"MultiRecHitCollector") <<
" Invalid Hit with DetId " << itrajmeas->recHit()->geographicalId().rawId();
207 LogTrace(
"MultiRecHitCollector") <<
"\n";
void Debug(const std::vector< TrajectoryMeasurement > TM) const
virtual const GeomDet & geomDet() const
DataContainer const & measurements() const
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
const MeasurementDet & mdet() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::shared_ptr< TrackingRecHit const > RecHitPointer
virtual std::vector< TrajectoryMeasurement > recHits(const Trajectory &, const MeasurementTrackerEvent *theMTE) const override
Detector det() const
get the detector field from this detid
bool measurements(const TrajectoryStateOnSurface &stateOnThisDet, const MeasurementEstimator &est, TempMeasurements &result) const