49 ofstream& file_) : es(es_), trackProducer(trackProducer_),
file(file_)
54 theTracker = trackerHandle.
product();
59 theMagField = magField.
product();
65 thePropagator = thePropagatorHandle.
product();
91 SiPixelRecHit::ClusterRef
const& cluster = pixelRecHit->cluster();
92 std::vector<SiPixelCluster::Pixel> pixels = cluster->pixels();
94 std::vector<PSimHit>
simHits = theHitAssociator->associateHit(*recHit);
96 std::string
info =
", Text[StyleForm[\"" + o.str() +
"\", URL->\"Track " + o.str()
101 o <<
"simTrack (trackId=" << simHits[0].trackId()
102 <<
" pid=" << simHits[0].particleType()
103 <<
" proc=" << simHits[0].processType() <<
")";
105 info +=
" | " + o.str();
110 o << theTracker->idToDet(
id)->subDetector();
112 info +=
" | " + o.str();
121 o <<
", {" << p.
x() <<
"," << p.
y() <<
",(" << p.
z() <<
"-zs)*mz},"
122 <<
" {" << 0 <<
"," << -1 <<
"}]";
136 GlobalPoint p = theTracker->idToDet(
id)->toGlobal(lpos);
138 std::vector<PSimHit>
simHits = theHitAssociator->associateHit(*recHit);
140 std::string
info =
", Text[StyleForm[\"" + o.str() +
"\", URL->\"Track " + o.str() + d.str();
141 const SiStripMatchedRecHit2D* stripMatchedRecHit =
142 dynamic_cast<const SiStripMatchedRecHit2D *
>(recHit);
145 const SiStripRecHit2D* stripRecHit =
146 dynamic_cast<const SiStripRecHit2D *
>(recHit);
150 o <<
"simTrackId=" << simHits[0].trackId() ;
152 info +=
" | " + o.str();
157 o << theTracker->idToDet(
id)->subDetector();
159 info +=
" | " + o.str();
164 if(stripMatchedRecHit != 0) info +=
" matched";
165 if(stripProjectedRecHit != 0) info +=
" projected";
166 if(stripRecHit != 0) info +=
" single";
173 o <<
", {" << p.
x() <<
"," << p.
y() <<
",(" << p.
z() <<
"-zs)*mz},"
174 <<
" {" << 0 <<
"," << -1 <<
"}]";
195 track.
charge(),theMagField);
207 file <<
", If[rt, {AbsolutePointSize[6]";
213 ev.
getByLabel(trackProducer, trajectoryHandle);
216 const std::vector<Trajectory>* trajectories = trajectoryHandle.
product();
219 <<
" [EventPlotter] recTracks (" << trackProducer <<
") "
220 << recTracks->size();
224 file <<
", RGBColor[0,0,0.4]";
225 reco::TrackCollection::const_iterator recTrack = recTracks->begin();
228 for(std::vector<Trajectory>::const_iterator it = trajectories->begin();
229 it!= trajectories->end();
230 it++, i++, recTrack++)
238 ostringstream
o; o <<
i;
240 ostringstream d; d << fixed << std::setprecision(2)
241 <<
" | d0=" << recTrack->d0() <<
" cm"
242 <<
" | z0=" << recTrack->dz() <<
" cm"
243 <<
" | pt=" << recTrack->pt() <<
" GeV/c";
247 for(std::vector<TrajectoryMeasurement>::const_reverse_iterator
257 if(theTracker->idToDet(
id)->subDetector() ==
259 theTracker->idToDet(
id)->subDetector() ==
269 file << getPixelInfo(recHit, o,d);
275 const SiStripMatchedRecHit2D* stripMatchedRecHit =
276 dynamic_cast<const SiStripMatchedRecHit2D *
>(recHit);
279 const SiStripRecHit2D* stripRecHit =
280 dynamic_cast<const SiStripRecHit2D *
>(recHit);
282 if(stripMatchedRecHit != 0)
284 auto m = stripMatchedRecHit->monoHit();
285 auto s = stripMatchedRecHit->stereoHit();
289 DetId id = stripMatchedRecHit->geographicalId();
290 LocalPoint lpos = stripMatchedRecHit->localPosition();
291 GlobalPoint p = theTracker->idToDet(
id)->toGlobal(lpos);
293 file <<
", Point[{"<< p.
x()<<
","<<p.
y()<<
",("<<p.
z()<<
"-zs)*mz}]" << std::endl;
296 if(stripProjectedRecHit != 0)
302 if(stripMatchedRecHit != 0 ||
303 stripProjectedRecHit != 0 ||
305 file << getStripInfo(recHit, o,d);
314 recTrack = recTracks->begin();
316 for(std::vector<Trajectory>::const_iterator it = trajectories->begin();
317 it!= trajectories->end();
321 switch(recTrack->algo())
329 if(algo == 0)
file <<
", RGBColor[1,0,0]";
330 if(algo == 1)
file <<
", RGBColor[0.2,0.6,0.2]";
331 if(algo == 2)
file <<
", RGBColor[0.2,0.2,0.6]";
333 std::vector<TrajectoryMeasurement> meas = it->measurements();
335 for(std::vector<TrajectoryMeasurement>::reverse_iterator im = meas.rbegin();
336 im!= meas.rend(); im++)
338 if(im == meas.rbegin())
341 GlobalVector v2 = (*(im )).updatedState().globalDirection();
343 recTrack->vertex().y(),
344 recTrack->vertex().z());
349 if(im+1 != meas.rend())
353 GlobalVector v2 = (*(im+1)).updatedState().globalDirection();
360 GlobalPoint p1 = (*(meas.rend()-1)).forwardPredictedState().globalPosition();
368 tsos = thePropagator->propagate(fts,*theCylinder);
382 tsos = thePropagator->propagate(fts,*thePlanePos);
395 tsos = thePropagator->propagate(fts,*thePlaneNeg);
409 delete theHitAssociator;
PlotRecTracks(const edm::EventSetup &es_, std::string trackProducer_, std::ofstream &file_)
static std::string getInfo(const DetId &id)
void printHelix(const GlobalPoint &p1, const GlobalPoint &p2, const GlobalVector &n2, std::ofstream &outFile, int charge)
std::string getPixelInfo(const TrackingRecHit *recHit, const std::ostringstream &o, const std::ostringstream &d)
void printRecTracks(const edm::Event &ev)
double outerPy() const
y coordinate of momentum vector at the outermost hit position
Global3DPoint GlobalPoint
std::vector< Track > TrackCollection
collection of Tracks
GlobalPoint globalPosition() const
static PlanePointer build(const PositionType &pos, const RotationType &rot, MediumProperties *mp=0)
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
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)
T const * product() const
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, MediumProperties *mp=0)
T const * product() const
std::string getStripInfo(const TrackingRecHit *recHit, const std::ostringstream &o, const std::ostringstream &d)
double outerY() const
y coordinate of the outermost hit position
int charge() const
track electric charge
FreeTrajectoryState getTrajectoryAtOuterPoint(const reco::Track &track)
DetId geographicalId() const
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