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) {}
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();
181 if (geometricInnerState_) {
182 stateForProjectionToBeamLineOnSurface =
183 theTraj->closestMeasurement(
GlobalPoint(bs.
x0(), bs.
y0(), bs.
z0())).updatedState();
186 stateForProjectionToBeamLineOnSurface = theTraj->firstMeasurement().updatedState();
188 stateForProjectionToBeamLineOnSurface = theTraj->lastMeasurement().updatedState();
194 edm::LogError(
"CannotPropagateToBeamLine") <<
"the state on the closest measurement isnot valid. skipping track.";
200 LogDebug(
"TrackProducer") <<
"stateForProjectionToBeamLine=" << stateForProjectionToBeamLine;
206 if (usePropagatorForPCA_) {
209 tscbl = tscblBuilder(stateForProjectionToBeamLine, bs);
212 tscbl = tscblBuilder(stateForProjectionToBeamLine, bs);
226 LogDebug(
"TrackProducer") <<
"pos=" << v <<
" mom=" << p <<
" pt=" << p.
perp() <<
" mag=" << p.mag();
228 auto theTrack =
new reco::Track(theTraj->chiSquared(),
239 theTrack->setAlgoMask(algoMask_);
240 theTrack->setQualityMask(qualityMask);
241 theTrack->setNLoops(nLoops);
242 theTrack->setStopReason(stopReason_);
244 LogDebug(
"TrackProducer") <<
"theTrack->pt()=" << theTrack->pt();
246 LogDebug(
"TrackProducer") <<
"track done\n";
248 AlgoProduct aProduct{theTraj, theTrack, seedDir, 0};
249 algoResults.push_back(aProduct);
251 statCount.track(nLoops);
267 signed char nLoops) {
276 theTraj->setSeedRef(seedRef);
283 innertsos = theTraj->firstMeasurement().updatedState();
284 outertsos = theTraj->lastMeasurement().updatedState();
286 innertsos = theTraj->lastMeasurement().updatedState();
287 outertsos = theTraj->firstMeasurement().updatedState();
289 std::ostringstream
ss;
291 std::vector<TrajectoryStateOnSurface>
const&
components = tsos.components();
292 auto sinTheta =
std::sin(tsos.globalMomentum().theta());
293 for (
auto const& ic : components)
294 ss << ic.weight() <<
"/";
296 for (
auto const& ic : components)
297 ss << ic.localParameters().vector()[0] / sinTheta <<
"/";
299 for (
auto const& ic : components)
300 ss <<
std::sqrt(ic.localError().matrix()(0, 0)) / sinTheta <<
"/";
302 ss <<
"\ninner comps\n";
304 ss <<
"\nouter comps\n";
306 LogDebug(
"TrackProducer") <<
"Nr. of first / last states = " << innertsos.
components().size() <<
" " 311 for (
auto const& tm : theTraj->measurements()) {
312 auto const&
h = tm.recHitR();
314 ndof = ndof +
h.dimension() *
h.weight();
325 if (geometricInnerState_) {
326 stateForProjectionToBeamLineOnSurface =
327 theTraj->closestMeasurement(
GlobalPoint(bs.
x0(), bs.
y0(), bs.
z0())).updatedState();
330 stateForProjectionToBeamLineOnSurface = theTraj->firstMeasurement().updatedState();
332 stateForProjectionToBeamLineOnSurface = theTraj->lastMeasurement().updatedState();
338 edm::LogError(
"CannotPropagateToBeamLine") <<
"the state on the closest measurement isnot valid. skipping track.";
345 LogDebug(
"GsfTrackProducer") <<
"stateForProjectionToBeamLine=" << stateForProjectionToBeamLine;
351 if (usePropagatorForPCA_) {
353 tscbl = tscblBuilder(stateForProjectionToBeamLine, bs);
356 tscbl = tscblBuilder(stateForProjectionToBeamLine, bs);
370 LogDebug(
"GsfTrackProducer") <<
"pos=" << v <<
" mom=" << p <<
" pt=" << p.
perp() <<
" mag=" << p.mag();
384 theTrack->setOriginalAlgorithm(originalAlgo_);
386 theTrack->setAlgoMask(algoMask_);
388 theTrack->setStopReason(stopReason_);
390 LogDebug(
"GsfTrackProducer") <<
"track done\n";
392 AlgoProduct aProduct{theTraj, theTrack, seedDir, 0};
394 LogDebug(
"GsfTrackProducer") <<
"track done1\n";
395 algoResults.push_back(aProduct);
396 LogDebug(
"GsfTrackProducer") <<
"track done2\n";
PropagationDirection direction() const
double z0() const
z coordinate
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
bool isFromDet(TrackingRecHit const &hit)
int nominalValue() const
The nominal field value for this map in kGauss.
Sin< T >::type sin(const T &t)
Global3DPoint GlobalPoint
std::vector< ConstRecHitPointer > RecHitContainer
TrackCharge charge() const
S & print(S &os, JobReport::InputFile const &f)
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.
virtual Trajectory fitOne(const Trajectory &traj, fitType type=standard) const =0
void setOriginalAlgorithm(const TrackAlgorithm a)
FreeTrajectoryState const * freeState(bool withErrors=true) const
Abs< T >::type abs(const T &t)
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
void setAlgorithm(const TrackAlgorithm a)
Track algorithm.
double y0() const
y coordinate
bool isUndef(TrackingRecHit const &hit)
Components const & components() const
double x0() const
x coordinate