33 #define DPRINT(x) std::cout << x << ": "
35 #define DPRINT(x) LogTrace(x)
41 long long totTrack = 0;
42 long long totLoop = 0;
43 long long totGsfTrack = 0;
44 long long totFound = 0;
45 long long totLost = 0;
46 long long totAlgo[15];
57 void gsf() { ++totGsfTrack; }
64 std::cout <<
"TrackProducer stat\nTrack/Loop/Gsf/FoundHits/LostHits//algos " << totTrack <<
'/' << totLoop <<
'/'
65 << totGsfTrack <<
'/' << totFound <<
'/' << totLost <<
'/';
66 for (
auto a : totAlgo)
71 ~StatCount() {
print(); }
78 void hits(
int,
int) {}
90 AlgoProductCollection& algoResults,
107 DPRINT(
"TrackFitters") <<
"fit failed " <<
algo_ <<
": " <<
hits.size() <<
'|' <<
int(nLoops) <<
' ' << std::endl;
112 theTraj->setSeedRef(seedRef);
114 statCount.hits(theTraj->foundHits(), theTraj->lostHits());
115 statCount.algo(
int(
algo_));
125 for (
auto const& tm : theTraj->measurements()) {
126 auto const&
h = tm.recHitR();
128 ndof =
ndof +
float(
h.dimension()) *
h.weight();
135 #if defined(VI_DEBUG) || defined(EDM_ML_DEBUG)
138 for (
auto const& tm : theTraj->measurements()) {
140 auto const&
hit = tm.recHitR();
143 if (
hit.det() ==
nullptr)
148 std::cout <<
"h " <<
kk <<
": " <<
hit.localPosition() <<
' ' <<
hit.localPositionError() <<
' ' << tm.estimate()
150 if (
hit.dimension() != 2) {
153 auto const& thit = static_cast<BaseTrackerRecHit const&>(
hit);
154 auto const& clus = thit.firstClusterRef();
157 else if (thit.isMatched()) {
159 }
else if (thit.isProjected()) {
167 std::ostringstream
ss;
168 ss <<
algo_ <<
": " <<
hits.size() <<
'|' << theTraj->measurements().size() <<
'|' <<
int(nLoops) <<
' ';
172 DPRINT(
"TrackProducer") <<
ss.str();
181 stateForProjectionToBeamLineOnSurface =
182 theTraj->closestMeasurement(
GlobalPoint(
bs.x0(),
bs.y0(),
bs.z0())).updatedState();
185 stateForProjectionToBeamLineOnSurface = theTraj->firstMeasurement().updatedState();
187 stateForProjectionToBeamLineOnSurface = theTraj->lastMeasurement().updatedState();
192 edm::LogError(
"CannotPropagateToBeamLine") <<
"the state on the closest measurement isnot valid. skipping track.";
198 LogDebug(
"TrackProducer") <<
"stateForProjectionToBeamLine=" << stateForProjectionToBeamLine;
207 tscbl = tscblBuilder(stateForProjectionToBeamLine,
bs);
210 tscbl = tscblBuilder(stateForProjectionToBeamLine,
bs);
223 LogDebug(
"TrackProducer") <<
"pos=" <<
v <<
" mom=" <<
p <<
" pt=" <<
p.perp() <<
" mag=" <<
p.mag();
225 auto theTrack =
new reco::Track(theTraj->chiSquared(),
237 theTrack->setQualityMask(qualityMask);
238 theTrack->setNLoops(nLoops);
241 LogDebug(
"TrackProducer") <<
"theTrack->pt()=" << theTrack->pt();
243 LogDebug(
"TrackProducer") <<
"track done\n";
245 AlgoProduct aProduct{theTraj, theTrack, seedDir, 0};
246 algoResults.push_back(aProduct);
248 statCount.track(nLoops);
256 AlgoProductCollection& algoResults,
264 signed char nLoops) {
273 theTraj->setSeedRef(seedRef);
280 innertsos = theTraj->firstMeasurement().updatedState();
281 outertsos = theTraj->lastMeasurement().updatedState();
283 innertsos = theTraj->lastMeasurement().updatedState();
284 outertsos = theTraj->firstMeasurement().updatedState();
286 std::ostringstream
ss;
288 std::vector<TrajectoryStateOnSurface>
const&
components = tsos.components();
289 auto sinTheta =
std::sin(tsos.globalMomentum().theta());
291 ss << ic.weight() <<
"/";
294 ss << ic.localParameters().vector()[0] / sinTheta <<
"/";
297 ss <<
std::sqrt(ic.localError().matrix()(0, 0)) / sinTheta <<
"/";
299 ss <<
"\ninner comps\n";
301 ss <<
"\nouter comps\n";
303 LogDebug(
"TrackProducer") <<
"Nr. of first / last states = " << innertsos.
components().size() <<
" "
308 for (
auto const& tm : theTraj->measurements()) {
309 auto const&
h = tm.recHitR();
323 stateForProjectionToBeamLineOnSurface =
324 theTraj->closestMeasurement(
GlobalPoint(
bs.x0(),
bs.y0(),
bs.z0())).updatedState();
327 stateForProjectionToBeamLineOnSurface = theTraj->firstMeasurement().updatedState();
329 stateForProjectionToBeamLineOnSurface = theTraj->lastMeasurement().updatedState();
333 if UNLIKELY (!stateForProjectionToBeamLineOnSurface.isValid()) {
334 edm::LogError(
"CannotPropagateToBeamLine") <<
"the state on the closest measurement isnot valid. skipping track.";
339 const FreeTrajectoryState& stateForProjectionToBeamLine = *stateForProjectionToBeamLineOnSurface.freeState();
341 LogDebug(
"GsfTrackProducer") <<
"stateForProjectionToBeamLine=" << stateForProjectionToBeamLine;
349 tscbl = tscblBuilder(stateForProjectionToBeamLine,
bs);
352 tscbl = tscblBuilder(stateForProjectionToBeamLine,
bs);
365 LogDebug(
"GsfTrackProducer") <<
"pos=" <<
v <<
" mom=" <<
p <<
" pt=" <<
p.perp() <<
" mag=" <<
p.mag();
385 LogDebug(
"GsfTrackProducer") <<
"track done\n";
387 AlgoProduct aProduct{theTraj, theTrack, seedDir, 0};
389 LogDebug(
"GsfTrackProducer") <<
"track done1\n";
390 algoResults.push_back(aProduct);
391 LogDebug(
"GsfTrackProducer") <<
"track done2\n";