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];
53 void hits(
int f,
int l) {
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) {}
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) {
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);
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());
290 for (
auto const& ic : components)
291 ss << ic.weight() <<
"/";
293 for (
auto const& ic : components)
294 ss << ic.localParameters().vector()[0] / sinTheta <<
"/";
296 for (
auto const& ic : components)
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();
311 ndof = ndof +
h.dimension() *
h.weight();
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";
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.
Components const & components() const
bool usePropagatorForPCA_
double x0() const
x coordinate