34 #define DPRINT(x) std::cout << x << ": " 36 #define DPRINT(x) LogTrace(x) 42 long long totTrack = 0;
43 long long totLoop = 0;
44 long long totGsfTrack = 0;
45 long long totFound = 0;
46 long long totLost = 0;
47 long long totAlgo[15];
58 void gsf() { ++totGsfTrack; }
65 std::cout <<
"TrackProducer stat\nTrack/Loop/Gsf/FoundHits/LostHits//algos " << totTrack <<
'/' << totLoop <<
'/' 66 << totGsfTrack <<
'/' << totFound <<
'/' << totLost <<
'/';
67 for (
auto a : totAlgo)
72 ~StatCount() {
print(); }
79 void hits(
int,
int) {}
91 AlgoProductCollection& algoResults,
108 DPRINT(
"TrackFitters") <<
"fit failed " <<
algo_ <<
": " <<
hits.size() <<
'|' <<
int(nLoops) <<
' ' << std::endl;
113 theTraj->setSeedRef(seedRef);
115 statCount.hits(theTraj->foundHits(), theTraj->lostHits());
116 statCount.algo(
int(
algo_));
126 for (
auto const& tm : theTraj->measurements()) {
127 auto const&
h = tm.recHitR();
129 ndof =
ndof +
float(
h.dimension()) *
h.weight();
136 #if defined(VI_DEBUG) || defined(EDM_ML_DEBUG) 139 for (
auto const& tm : theTraj->measurements()) {
141 auto const&
hit = tm.recHitR();
144 if (
hit.det() ==
nullptr)
149 std::cout <<
"h " <<
kk <<
": " <<
hit.localPosition() <<
' ' <<
hit.localPositionError() <<
' ' << tm.estimate()
151 if (
hit.dimension() != 2) {
155 auto const& clus = thit.firstClusterRef();
158 else if (thit.isMatched()) {
160 }
else if (thit.isProjected()) {
168 std::ostringstream
ss;
169 ss <<
algo_ <<
": " <<
hits.size() <<
'|' << theTraj->measurements().size() <<
'|' <<
int(nLoops) <<
' ';
173 DPRINT(
"TrackProducer") <<
ss.str();
182 stateForProjectionToBeamLineOnSurface =
183 theTraj->closestMeasurement(
GlobalPoint(
bs.x0(),
bs.y0(),
bs.z0())).updatedState();
186 stateForProjectionToBeamLineOnSurface = theTraj->firstMeasurement().updatedState();
188 stateForProjectionToBeamLineOnSurface = theTraj->lastMeasurement().updatedState();
193 edm::LogError(
"CannotPropagateToBeamLine") <<
"the state on the closest measurement isnot valid. skipping track.";
199 LogDebug(
"TrackProducer") <<
"stateForProjectionToBeamLine=" << stateForProjectionToBeamLine;
208 tscbl = tscblBuilder(stateForProjectionToBeamLine,
bs);
211 tscbl = tscblBuilder(stateForProjectionToBeamLine,
bs);
224 LogDebug(
"TrackProducer") <<
"pos=" <<
v <<
" mom=" <<
p <<
" pt=" <<
p.perp() <<
" mag=" <<
p.mag();
226 auto theTrack =
new reco::Track(theTraj->chiSquared(),
238 theTrack->setQualityMask(qualityMask);
239 theTrack->setNLoops(nLoops);
242 LogDebug(
"TrackProducer") <<
"theTrack->pt()=" << theTrack->pt();
244 LogDebug(
"TrackProducer") <<
"track done\n";
246 AlgoProduct aProduct{theTraj, theTrack, seedDir, 0};
247 algoResults.push_back(aProduct);
249 statCount.track(nLoops);
257 AlgoProductCollection& algoResults,
265 signed char nLoops) {
274 theTraj->setSeedRef(seedRef);
281 innertsos = theTraj->firstMeasurement().updatedState();
282 outertsos = theTraj->lastMeasurement().updatedState();
284 innertsos = theTraj->lastMeasurement().updatedState();
285 outertsos = theTraj->firstMeasurement().updatedState();
287 std::ostringstream
ss;
291 auto sinTheta =
std::sin(tsos.globalMomentum().theta());
293 ss << ic.weight() <<
"/";
296 ss << ic.localParameters().vector()[0] / sinTheta <<
"/";
299 ss <<
std::sqrt(ic.localError().matrix()(0, 0)) / sinTheta <<
"/";
301 ss <<
"\ninner comps\n";
304 auto const& tsosComponentsInner = icomps();
306 ss <<
"\nouter comps\n";
309 auto const& tsosComponentsOuter = ocomps();
311 LogDebug(
"TrackProducer") <<
"Nr. of first / last states = " << tsosComponentsInner.size() <<
" " 312 << tsosComponentsOuter.size() <<
ss.str();
316 for (
auto const& tm : theTraj->measurements()) {
317 auto const&
h = tm.recHitR();
331 stateForProjectionToBeamLineOnSurface =
332 theTraj->closestMeasurement(
GlobalPoint(
bs.x0(),
bs.y0(),
bs.z0())).updatedState();
335 stateForProjectionToBeamLineOnSurface = theTraj->firstMeasurement().updatedState();
337 stateForProjectionToBeamLineOnSurface = theTraj->lastMeasurement().updatedState();
341 if UNLIKELY (!stateForProjectionToBeamLineOnSurface.isValid()) {
342 edm::LogError(
"CannotPropagateToBeamLine") <<
"the state on the closest measurement isnot valid. skipping track.";
347 const FreeTrajectoryState& stateForProjectionToBeamLine = *stateForProjectionToBeamLineOnSurface.freeState();
349 LogDebug(
"GsfTrackProducer") <<
"stateForProjectionToBeamLine=" << stateForProjectionToBeamLine;
357 tscbl = tscblBuilder(stateForProjectionToBeamLine,
bs);
360 tscbl = tscblBuilder(stateForProjectionToBeamLine,
bs);
373 LogDebug(
"GsfTrackProducer") <<
"pos=" <<
v <<
" mom=" <<
p <<
" pt=" <<
p.perp() <<
" mag=" <<
p.mag();
393 LogDebug(
"GsfTrackProducer") <<
"track done\n";
395 AlgoProduct aProduct{theTraj, theTrack, seedDir, 0};
397 LogDebug(
"GsfTrackProducer") <<
"track done1\n";
398 algoResults.push_back(aProduct);
399 LogDebug(
"GsfTrackProducer") <<
"track done2\n";
bool geometricInnerState_
reco::TrackBase::AlgoMask algoMask_
const CurvilinearTrajectoryError & curvilinearError() const
bool isFromDet(TrackingRecHit const &hit)
reco::TrackBase::TrackAlgorithm originalAlgo_
Sin< T >::type sin(const T &t)
Global3DPoint GlobalPoint
std::vector< ConstRecHitPointer > RecHitContainer
Log< level::Error, false > LogError
bool buildTrack(const TrajectoryFitter *, const Propagator *, AlgoProductCollection &, TransientTrackingRecHit::RecHitContainer &, TrajectoryStateOnSurface &, const TrajectorySeed &, float, const reco::BeamSpot &, SeedRef seedRef=SeedRef(), int qualityMask=0, signed char nLoops=0)
Construct Tracks to be put in the event.
GlobalPoint position() const
void setOriginalAlgorithm(const TrackAlgorithm a)
TrackCharge charge() const
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
GlobalVector momentum() const
FTS const & trackStateAtPCA() const
virtual Trajectory fitOne(const Trajectory &traj, fitType type=standard) const =0
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
reco::TrackBase::TrackAlgorithm algo_
void setAlgorithm(const TrackAlgorithm a)
Track algorithm.
FreeTrajectoryState const * freeState(bool withErrors=true) const
bool isUndef(TrackingRecHit const &hit)
int nominalValue() const
The nominal field value for this map in kGauss.
const MagneticField * magneticField() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
bool usePropagatorForPCA_