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];
54 void hits(
int f,
int l) {
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) {}
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);
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() <<
"/";
295 for (
auto const& ic : components)
296 ss << ic.localParameters().vector()[0] / sinTheta <<
"/";
298 for (
auto const& ic : components)
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();
319 ndof = ndof +
h.dimension() *
h.weight();
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";
PropagationDirection direction() const
double z0() const
z coordinate
bool geometricInnerState_
const edm::EventSetup & c
reco::TrackBase::AlgoMask algoMask_
bool isFromDet(TrackingRecHit const &hit)
int nominalValue() const
The nominal field value for this map in kGauss.
reco::TrackBase::TrackAlgorithm originalAlgo_
Sin< T >::type sin(const T &t)
Global3DPoint GlobalPoint
std::vector< ConstRecHitPointer > RecHitContainer
TrackCharge charge() const
Log< level::Error, false > LogError
const MagneticField * magneticField() const
const CurvilinearTrajectoryError & curvilinearError() const
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.
void setOriginalAlgorithm(const TrackAlgorithm a)
FreeTrajectoryState const * freeState(bool withErrors=true) const
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
virtual Trajectory fitOne(const Trajectory &traj, fitType type=standard) const =0
GlobalVector momentum() const
FTS const & trackStateAtPCA() const
GlobalPoint position() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
std::vector< AlgoProduct > AlgoProductCollection
XYZPointD XYZPoint
point in space with cartesian internal representation
reco::TrackBase::TrackAlgorithm algo_
void setAlgorithm(const TrackAlgorithm a)
Track algorithm.
double y0() const
y coordinate
bool isUndef(TrackingRecHit const &hit)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
bool usePropagatorForPCA_
double x0() const
x coordinate