33 #define DPRINT(x) std::cout << x << ": " 35 #define DPRINT(x) LogTrace(x) 44 long long totGsfTrack=0;
47 long long totAlgo[15];
49 if (l>0) ++totLoop;
else ++totTrack;
51 void hits(
int f,
int l) { totFound+=
f; totLost+=
l;}
52 void gsf() {++totGsfTrack;}
53 void algo(
int a) {
if (a>=0 && a<15) ++totAlgo[
a];}
57 std::cout <<
"TrackProducer stat\nTrack/Loop/Gsf/FoundHits/LostHits//algos " 58 << totTrack <<
'/'<< totLoop <<
'/'<< totGsfTrack <<
'/'<< totFound <<
'/'<< totLost<<
'/';
63 ~StatCount() {
print();}
93 int qualityMask,
signed char nLoops)
102 DPRINT(
"TrackFitters") <<
"fit failed " << algo_ <<
": " << hits.size() <<
'|' <<
int(nLoops) <<
' ' << std::endl;
108 theTraj->setSeedRef(seedRef);
110 statCount.hits(theTraj->foundHits(),theTraj->lostHits());
111 statCount.algo(
int(algo_));
121 for (
auto const & tm : theTraj->measurements()) {
122 auto const &
h = tm.recHitR();
123 if (
h.isValid()) ndof = ndof +
float(
h.dimension())*
h.weight();
130 #if defined(VI_DEBUG) || defined(EDM_ML_DEBUG) 133 for (
auto const & tm : theTraj->measurements()) {
135 auto const &
hit = tm.recHitR();
136 if (!
hit.isValid()) ++chit[0];
137 if (
hit.det()==
nullptr) ++chit[1];
139 if(0)
std::cout <<
"h " << kk <<
": "<<
hit.localPosition() <<
' ' <<
hit.localPositionError() <<
' ' << tm.estimate() << std::endl;
140 if (
hit.dimension()!=2 ) {
145 if (clus.isPixel()) ++chit[3];
146 else if (thit.isMatched()) {
148 }
else if (thit.isProjected()) {
156 std::ostringstream ss;
157 ss << algo_ <<
": " << hits.size() <<
'|' <<theTraj->measurements().size()<<
'|' <<
int(nLoops) <<
' ';
for (
auto c:chit) ss <<
c <<
'/'; ss << std::endl;
158 DPRINT(
"TrackProducer") << ss.str();
166 if (geometricInnerState_) {
167 stateForProjectionToBeamLineOnSurface = theTraj->closestMeasurement(
GlobalPoint(bs.
x0(),bs.
y0(),bs.
z0())).updatedState();
170 stateForProjectionToBeamLineOnSurface = theTraj->firstMeasurement().updatedState();
172 stateForProjectionToBeamLineOnSurface = theTraj->lastMeasurement().updatedState();
177 edm::LogError(
"CannotPropagateToBeamLine")<<
"the state on the closest measurement isnot valid. skipping track.";
183 LogDebug(
"TrackProducer") <<
"stateForProjectionToBeamLine=" << stateForProjectionToBeamLine;
189 if (usePropagatorForPCA_){
192 tscbl = tscblBuilder(stateForProjectionToBeamLine,bs);
195 tscbl = tscblBuilder(stateForProjectionToBeamLine,bs);
209 LogDebug(
"TrackProducer") <<
"pos=" << v <<
" mom=" << p <<
" pt=" << p.
perp() <<
" mag=" << p.mag();
211 auto theTrack =
new reco::Track(theTraj->chiSquared(),
218 if(algoMask_.any()) theTrack->setAlgoMask(algoMask_);
219 theTrack->setQualityMask(qualityMask);
220 theTrack->setNLoops(nLoops);
221 theTrack->setStopReason(stopReason_);
223 LogDebug(
"TrackProducer") <<
"theTrack->pt()=" << theTrack->pt();
225 LogDebug(
"TrackProducer") <<
"track done\n";
227 AlgoProduct aProduct{theTraj,theTrack,seedDir,0};
228 algoResults.push_back(aProduct);
230 statCount.track(nLoops);
245 int qualityMask,
signed char nLoops)
255 theTraj->setSeedRef(seedRef);
262 innertsos = theTraj->firstMeasurement().updatedState();
263 outertsos = theTraj->lastMeasurement().updatedState();
265 innertsos = theTraj->lastMeasurement().updatedState();
266 outertsos = theTraj->firstMeasurement().updatedState();
268 std::ostringstream ss;
270 std::vector<TrajectoryStateOnSurface>
const &
components = tsos.components();
271 auto sinTheta =
std::sin(tsos.globalMomentum().theta());
272 for (
auto const & ic : components) ss << ic.weight() <<
"/"; ss <<
"\n";
273 for (
auto const & ic : components) ss << ic.localParameters().vector()[0]/sinTheta <<
"/"; ss <<
"\n";
274 for (
auto const & ic : components) ss <<
std::sqrt(ic.localError().matrix()(0,0))/sinTheta <<
"/";
276 ss <<
"\ninner comps\n";
278 ss <<
"\nouter comps\n";
281 <<
"Nr. of first / last states = " 287 for (
auto const & tm : theTraj->measurements()) {
288 auto const &
h = tm.recHitR();
289 if (
h.isValid()) ndof = ndof +
h.dimension()*
h.weight();
300 if (geometricInnerState_) {
301 stateForProjectionToBeamLineOnSurface = theTraj->closestMeasurement(
GlobalPoint(bs.
x0(),bs.
y0(),bs.
z0())).updatedState();
304 stateForProjectionToBeamLineOnSurface = theTraj->firstMeasurement().updatedState();
306 stateForProjectionToBeamLineOnSurface = theTraj->lastMeasurement().updatedState();
311 edm::LogError(
"CannotPropagateToBeamLine")<<
"the state on the closest measurement isnot valid. skipping track.";
318 LogDebug(
"GsfTrackProducer") <<
"stateForProjectionToBeamLine=" << stateForProjectionToBeamLine;
324 if (usePropagatorForPCA_){
326 tscbl = tscblBuilder(stateForProjectionToBeamLine,bs);
329 tscbl = tscblBuilder(stateForProjectionToBeamLine,bs);
343 LogDebug(
"GsfTrackProducer") <<
"pos=" << v <<
" mom=" << p <<
" pt=" << p.
perp() <<
" mag=" << p.mag();
353 if(algoMask_.any()) theTrack->setAlgoMask(algoMask_);
355 theTrack->setStopReason(stopReason_);
357 LogDebug(
"GsfTrackProducer") <<
"track done\n";
359 AlgoProduct aProduct{theTraj,theTrack,seedDir,0};
361 LogDebug(
"GsfTrackProducer") <<
"track done1\n";
362 algoResults.push_back(aProduct);
363 LogDebug(
"GsfTrackProducer") <<
"track done2\n";
PropagationDirection direction() const
double z0() const
z coordinate
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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
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