39 #define DPRINT(x) std::cout << x << ": " 41 #define DPRINT(x) LogTrace(x) 50 long long totGsfTrack=0;
53 long long totAlgo[15];
55 if (l>0) ++totLoop;
else ++totTrack;
57 void hits(
int f,
int l) { totFound+=
f; totLost+=
l;}
58 void gsf() {++totGsfTrack;}
59 void algo(
int a) {
if (a>=0 && a<15) ++totAlgo[
a];}
63 std::cout <<
"TrackProducer stat\nTrack/Loop/Gsf/FoundHits/LostHits//algos " 64 << totTrack <<
'/'<< totLoop <<
'/'<< totGsfTrack <<
'/'<< totFound <<
'/'<< totLost<<
'/';
69 ~StatCount() {
print();}
80 [[cms::thread_safe]] StatCount statCount;
99 int qualityMask,
signed char nLoops)
108 DPRINT(
"TrackFitters") <<
"fit failed " << algo_ <<
": " << hits.size() <<
'|' <<
int(nLoops) <<
' ' << std::endl;
114 theTraj->setSeedRef(seedRef);
116 statCount.hits(theTraj->foundHits(),theTraj->lostHits());
117 statCount.algo(
int(algo_));
127 for (
auto const & tm : theTraj->measurements()) {
128 auto const &
h = tm.recHitR();
129 if (
h.isValid()) 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();
142 if (!
hit.isValid()) ++chit[0];
143 if (
hit.det()==
nullptr) ++chit[1];
145 if(0)
std::cout <<
"h " << kk <<
": "<<
hit.localPosition() <<
' ' <<
hit.localPositionError() <<
' ' << tm.estimate() << std::endl;
146 if (
hit.dimension()!=2 ) {
151 if (clus.isPixel()) ++chit[3];
152 else if (thit.isMatched()) {
154 }
else if (thit.isProjected()) {
162 std::ostringstream ss;
163 ss << algo_ <<
": " << hits.size() <<
'|' <<theTraj->measurements().size()<<
'|' <<
int(nLoops) <<
' ';
for (
auto c:chit) ss <<
c <<
'/'; ss << std::endl;
164 DPRINT(
"TrackProducer") << ss.str();
172 if (geometricInnerState_) {
173 stateForProjectionToBeamLineOnSurface = theTraj->closestMeasurement(
GlobalPoint(bs.
x0(),bs.
y0(),bs.
z0())).updatedState();
176 stateForProjectionToBeamLineOnSurface = theTraj->firstMeasurement().updatedState();
178 stateForProjectionToBeamLineOnSurface = theTraj->lastMeasurement().updatedState();
183 edm::LogError(
"CannotPropagateToBeamLine")<<
"the state on the closest measurement isnot valid. skipping track.";
189 LogDebug(
"TrackProducer") <<
"stateForProjectionToBeamLine=" << stateForProjectionToBeamLine;
195 if (usePropagatorForPCA_){
198 tscbl = tscblBuilder(stateForProjectionToBeamLine,bs);
201 tscbl = tscblBuilder(stateForProjectionToBeamLine,bs);
215 LogDebug(
"TrackProducer") <<
"pos=" << v <<
" mom=" << p <<
" pt=" << p.
perp() <<
" mag=" << p.mag();
217 auto theTrack =
new reco::Track(theTraj->chiSquared(),
224 if(algoMask_.any()) theTrack->setAlgoMask(algoMask_);
225 theTrack->setQualityMask(qualityMask);
226 theTrack->setNLoops(nLoops);
227 theTrack->setStopReason(stopReason_);
229 LogDebug(
"TrackProducer") <<
"theTrack->pt()=" << theTrack->pt();
231 LogDebug(
"TrackProducer") <<
"track done\n";
233 AlgoProduct aProduct{theTraj,theTrack,seedDir,0};
234 algoResults.push_back(aProduct);
236 statCount.track(nLoops);
251 int qualityMask,
signed char nLoops)
261 theTraj->setSeedRef(seedRef);
268 innertsos = theTraj->firstMeasurement().updatedState();
269 outertsos = theTraj->lastMeasurement().updatedState();
271 innertsos = theTraj->lastMeasurement().updatedState();
272 outertsos = theTraj->firstMeasurement().updatedState();
274 std::ostringstream ss;
276 std::vector<TrajectoryStateOnSurface>
const &
components = tsos.components();
277 auto sinTheta =
std::sin(tsos.globalMomentum().theta());
278 for (
auto const & ic : components) ss << ic.weight() <<
"/"; ss <<
"\n";
279 for (
auto const & ic : components) ss << ic.localParameters().vector()[0]/sinTheta <<
"/"; ss <<
"\n";
280 for (
auto const & ic : components) ss <<
std::sqrt(ic.localError().matrix()(0,0))/sinTheta <<
"/";
282 ss <<
"\ninner comps\n";
284 ss <<
"\nouter comps\n";
287 <<
"Nr. of first / last states = " 293 for (
auto const & tm : theTraj->measurements()) {
294 auto const &
h = tm.recHitR();
295 if (
h.isValid()) ndof = ndof +
h.dimension()*
h.weight();
306 if (geometricInnerState_) {
307 stateForProjectionToBeamLineOnSurface = theTraj->closestMeasurement(
GlobalPoint(bs.
x0(),bs.
y0(),bs.
z0())).updatedState();
310 stateForProjectionToBeamLineOnSurface = theTraj->firstMeasurement().updatedState();
312 stateForProjectionToBeamLineOnSurface = theTraj->lastMeasurement().updatedState();
317 edm::LogError(
"CannotPropagateToBeamLine")<<
"the state on the closest measurement isnot valid. skipping track.";
324 LogDebug(
"GsfTrackProducer") <<
"stateForProjectionToBeamLine=" << stateForProjectionToBeamLine;
330 if (usePropagatorForPCA_){
332 tscbl = tscblBuilder(stateForProjectionToBeamLine,bs);
335 tscbl = tscblBuilder(stateForProjectionToBeamLine,bs);
349 LogDebug(
"GsfTrackProducer") <<
"pos=" << v <<
" mom=" << p <<
" pt=" << p.
perp() <<
" mag=" << p.mag();
359 if(algoMask_.any()) theTrack->setAlgoMask(algoMask_);
361 theTrack->setStopReason(stopReason_);
363 LogDebug(
"GsfTrackProducer") <<
"track done\n";
365 AlgoProduct aProduct{theTraj,theTrack,seedDir,0};
367 LogDebug(
"GsfTrackProducer") <<
"track done1\n";
368 algoResults.push_back(aProduct);
369 LogDebug(
"GsfTrackProducer") <<
"track done2\n";
PropagationDirection direction() const
double z0() const
z coordinate
int nominalValue() const
The nominal field value for this map in kGauss.
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
Sin< T >::type sin(const T &t)
Global3DPoint GlobalPoint
std::vector< ConstRecHitPointer > RecHitContainer
TrackCharge charge() const
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
XYZPointD XYZPoint
point in space with cartesian internal representation
void setAlgorithm(const TrackAlgorithm a)
Track algorithm.
std::vector< AlgoProduct > AlgoProductCollection
virtual OmniClusterRef const & firstClusterRef() const =0
double y0() const
y coordinate
bool isUndef(TrackingRecHit const &hit)
Components const & components() const
double x0() const
x coordinate