46 ofstream& file_) : es(es_), trackProducer(trackProducer_),
file(file_)
51 theTracker = trackerHandle.
product();
56 theMagField = magField.
product();
62 thePropagator = thePropagatorHandle.
product();
87 SiPixelRecHit::ClusterRef
const& cluster = pixelRecHit->cluster();
88 std::vector<SiPixelCluster::Pixel> pixels = cluster->pixels();
90 std::vector<PSimHit>
simHits = theHitAssociator->associateHit(*recHit);
92 std::string info =
", Text[StyleForm[\"" + o.str() +
"\", URL->\"Track " + o.str()
97 o <<
"simTrack (trackId=" << simHits[0].trackId()
98 <<
" pid=" << simHits[0].particleType()
99 <<
" proc=" << simHits[0].processType() <<
")";
101 info +=
" | " + o.str();
106 o << theTracker->idToDet(
id)->subDetector();
108 info +=
" | " + o.str();
117 o <<
", {" << p.
x() <<
"," << p.
y() <<
",(" << p.
z() <<
"-zs)*mz},"
118 <<
" {" << 0 <<
"," << -1 <<
"}]";
132 GlobalPoint p = theTracker->idToDet(
id)->toGlobal(lpos);
134 std::vector<PSimHit>
simHits = theHitAssociator->associateHit(*recHit);
136 std::string info =
", Text[StyleForm[\"" + o.str() +
"\", URL->\"Track " + o.str() + d.str();
137 const SiStripMatchedRecHit2D* stripMatchedRecHit =
138 dynamic_cast<const SiStripMatchedRecHit2D *
>(recHit);
141 const SiStripRecHit2D* stripRecHit =
142 dynamic_cast<const SiStripRecHit2D *
>(recHit);
146 o <<
"simTrackId=" << simHits[0].trackId() ;
148 info +=
" | " + o.str();
153 o << theTracker->idToDet(
id)->subDetector();
155 info +=
" | " + o.str();
160 if(stripMatchedRecHit != 0) info +=
" matched";
161 if(stripProjectedRecHit != 0) info +=
" projected";
162 if(stripRecHit != 0) info +=
" single";
169 o <<
", {" << p.
x() <<
"," << p.
y() <<
",(" << p.
z() <<
"-zs)*mz},"
170 <<
" {" << 0 <<
"," << -1 <<
"}]";
191 track.
charge(),theMagField);
208 file <<
", If[rt, {AbsolutePointSize[6]";
214 ev.
getByLabel(trackProducer, trajectoryHandle);
217 const std::vector<Trajectory>* trajectories = trajectoryHandle.
product();
220 <<
" [EventPlotter] recTracks (" << trackProducer <<
") "
221 << recTracks->size();
225 file <<
", RGBColor[0,0,0.4]";
226 reco::TrackCollection::const_iterator recTrack = recTracks->begin();
229 for(std::vector<Trajectory>::const_iterator it = trajectories->begin();
230 it!= trajectories->end();
231 it++, i++, recTrack++)
239 ostringstream
o; o <<
i;
241 ostringstream d; d << fixed << std::setprecision(2)
242 <<
" | d0=" << recTrack->d0() <<
" cm"
243 <<
" | z0=" << recTrack->dz() <<
" cm"
244 <<
" | pt=" << recTrack->pt() <<
" GeV/c";
248 for(std::vector<TrajectoryMeasurement>::const_reverse_iterator
258 if(theTracker->idToDet(
id)->subDetector() ==
260 theTracker->idToDet(
id)->subDetector() ==
270 file << getPixelInfo(recHit, tTopo, o, d);
276 const SiStripMatchedRecHit2D* stripMatchedRecHit =
277 dynamic_cast<const SiStripMatchedRecHit2D *
>(recHit);
280 const SiStripRecHit2D* stripRecHit =
281 dynamic_cast<const SiStripRecHit2D *
>(recHit);
283 if(stripMatchedRecHit != 0)
285 auto m = stripMatchedRecHit->monoHit();
286 auto s = stripMatchedRecHit->stereoHit();
290 DetId id = stripMatchedRecHit->geographicalId();
291 LocalPoint lpos = stripMatchedRecHit->localPosition();
292 GlobalPoint p = theTracker->idToDet(
id)->toGlobal(lpos);
294 file <<
", Point[{"<< p.
x()<<
","<<p.
y()<<
",("<<p.
z()<<
"-zs)*mz}]" << std::endl;
297 if(stripProjectedRecHit != 0)
303 if(stripMatchedRecHit != 0 ||
304 stripProjectedRecHit != 0 ||
306 file << getStripInfo(recHit, tTopo, o,d);
315 recTrack = recTracks->begin();
317 for(std::vector<Trajectory>::const_iterator it = trajectories->begin();
318 it!= trajectories->end();
322 switch(recTrack->algo())
330 if(algo == 0)
file <<
", RGBColor[1,0,0]";
331 if(algo == 1)
file <<
", RGBColor[0.2,0.6,0.2]";
332 if(algo == 2)
file <<
", RGBColor[0.2,0.2,0.6]";
334 std::vector<TrajectoryMeasurement> meas = it->measurements();
336 for(std::vector<TrajectoryMeasurement>::reverse_iterator im = meas.rbegin();
337 im!= meas.rend(); im++)
339 if(im == meas.rbegin())
342 GlobalVector v2 = (*(im )).updatedState().globalDirection();
344 recTrack->vertex().y(),
345 recTrack->vertex().z());
350 if(im+1 != meas.rend())
354 GlobalVector v2 = (*(im+1)).updatedState().globalDirection();
361 GlobalPoint p1 = (*(meas.rend()-1)).forwardPredictedState().globalPosition();
367 Cylinder::ConstCylinderPointer theCylinder =
369 tsos = thePropagator->propagate(fts,*theCylinder);
383 tsos = thePropagator->propagate(fts,*thePlanePos);
396 tsos = thePropagator->propagate(fts,*thePlaneNeg);
410 delete theHitAssociator;
PlotRecTracks(const edm::EventSetup &es_, std::string trackProducer_, std::ofstream &file_)
void printHelix(const GlobalPoint &p1, const GlobalPoint &p2, const GlobalVector &n2, std::ofstream &outFile, int charge)
double outerPy() const
y coordinate of momentum vector at the outermost hit position
void printRecTracks(const edm::Event &ev, const edm::EventSetup &es)
Global3DPoint GlobalPoint
std::vector< Track > TrackCollection
collection of Tracks
GlobalPoint globalPosition() const
static int position[TOTALCHAMBERS][3]
double outerZ() const
z coordinate of the outermost hit position
DataContainer const & measurements() const
void printPixelRecHit(const SiPixelRecHit *recHit)
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
static PlanePointer build(Args &&...args)
double outerX() const
x coordinate of the outermost hit position
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double outerPz() const
z coordinate of momentum vector at the outermost hit position
void printStripRecHit(const SiStripRecHit2D *recHit)
std::string getStripInfo(const TrackingRecHit *recHit, const TrackerTopology *tTopo, const std::ostringstream &o, const std::ostringstream &d)
T const * product() const
T const * product() const
double outerY() const
y coordinate of the outermost hit position
int charge() const
track electric charge
FreeTrajectoryState getTrajectoryAtOuterPoint(const reco::Track &track)
std::string getPixelInfo(const TrackingRecHit *recHit, const TrackerTopology *tTopo, const std::ostringstream &o, const std::ostringstream &d)
DetId geographicalId() const
static std::string getInfo(const DetId &id, const TrackerTopology *tTopo)
virtual LocalPoint localPosition() const =0
const SiStripRecHit2D & originalHit() const
double outerPx() const
x coordinate of momentum vector at the outermost hit position
GlobalVector globalDirection() const