CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PlotRecHits Class Reference

#include <PlotRecHits.h>

Public Member Functions

 PlotRecHits (const edm::EventSetup &es, std::ofstream &file_)
 
void printPixelRecHit (const SiPixelRecHit *recHit)
 
void printRecHits (const edm::Event &ev)
 
void printStripRecHit (const SiStripRecHit2D *recHit)
 
 ~PlotRecHits ()
 

Private Member Functions

void printPixelRecHits (const edm::Event &ev)
 
void printStripRecHits (const edm::Event &ev)
 

Private Attributes

std::ofstream & file
 
const TrackerGeometrytheTracker
 

Detailed Description

Definition at line 11 of file PlotRecHits.h.

Constructor & Destructor Documentation

PlotRecHits::PlotRecHits ( const edm::EventSetup es,
std::ofstream &  file_ 
)
explicit

Definition at line 21 of file PlotRecHits.cc.

References edm::EventSetup::get(), and edm::ESHandle< class >::product().

21  : file(file_)
22 {
23  // Get tracker geometry
24  edm::ESHandle<TrackerGeometry> trackerHandle;
25  es.get<TrackerDigiGeometryRecord>().get(trackerHandle);
26  theTracker = trackerHandle.product();
27 }
std::ofstream & file
Definition: PlotRecHits.h:24
const TrackerGeometry * theTracker
Definition: PlotRecHits.h:25
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
PlotRecHits::~PlotRecHits ( )

Definition at line 30 of file PlotRecHits.cc.

31 {
32 }

Member Function Documentation

void PlotRecHits::printPixelRecHit ( const SiPixelRecHit recHit)

Definition at line 35 of file PlotRecHits.cc.

References mergeVDriftHistosByStation::file, AlCaHLTBitMon_ParallelJobs::p, x, PV3DBase< T, PVType, FrameType >::x(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by PlotRecTracks::printRecTracks().

36 {
37  DetId id = recHit->geographicalId();
38 
39  // DetUnit
40  double x = theTracker->idToDet(id)->surface().bounds().width() /2;
41  double y = theTracker->idToDet(id)->surface().bounds().length()/2;
42  double z = 0.;
43 
44  GlobalPoint p00 = theTracker->idToDet(id)->toGlobal(LocalPoint(-x,-y,z));
45  GlobalPoint p01 = theTracker->idToDet(id)->toGlobal(LocalPoint(-x, y,z));
46  GlobalPoint p10 = theTracker->idToDet(id)->toGlobal(LocalPoint( x,-y,z));
47  GlobalPoint p11 = theTracker->idToDet(id)->toGlobal(LocalPoint( x, y,z));
48 
49  file << ", If[sd, {RGBColor[0.4,0.4,0.4], "
50  <<"Line[{{"<<p00.x()<<","<<p00.y()<<",("<<p00.z()<<"-zs)*mz}, "
51  <<"{"<<p01.x()<<","<<p01.y()<<",("<<p01.z()<<"-zs)*mz}, "
52  <<"{"<<p11.x()<<","<<p11.y()<<",("<<p11.z()<<"-zs)*mz}, "
53  <<"{"<<p10.x()<<","<<p10.y()<<",("<<p10.z()<<"-zs)*mz}, "
54  <<"{"<<p00.x()<<","<<p00.y()<<",("<<p00.z()<<"-zs)*mz}}]}]"
55  << std::endl;
56 
57  // RecHit
58  LocalPoint lpos; GlobalPoint p;
59 
60  lpos = LocalPoint(recHit->localPosition().x(),
61  recHit->localPosition().y(),
62  recHit->localPosition().z());
63 
64  p = theTracker->idToDet(id)->toGlobal(lpos);
65  file << ", Point[{"<<p.x()<<","<<p.y()<<",("<<p.z()<<"-zs)*mz}]" << std::endl;
66 
67  // Cluster details
68  SiPixelRecHit::ClusterRef const& cluster = recHit->cluster();
69  std::vector<SiPixelCluster::Pixel> pixels = cluster->pixels();
70 
71  file << ", Text[StyleForm[\"r\", FontFamily->\"Helvetica\", URL -> \"RecHit |";
72  for(std::vector<SiPixelCluster::Pixel>::const_iterator
73  pixel = pixels.begin(); pixel!= pixels.end(); pixel++)
74  {
75  file << " [" << int(pixel->x)
76  << " " << int(pixel->y)
77  << " " << int(pixel->adc/135) << "]";
78  }
79  file << "\"]";
80 
81  file << ", {"<< p.x()<<","<<p.y()<<",("<<p.z()<<"-zs)*mz}"
82  << ", {-1,1}]" << std::endl;
83 }
virtual float length() const =0
std::ofstream & file
Definition: PlotRecHits.h:24
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
T y() const
Definition: PV3DBase.h:62
const TrackerGeometry * theTracker
Definition: PlotRecHits.h:25
double double double z
T z() const
Definition: PV3DBase.h:63
virtual const GeomDet * idToDet(DetId) const
Definition: DetId.h:20
const Bounds & bounds() const
Definition: BoundSurface.h:89
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
Definition: DDAxes.h:10
T x() const
Definition: PV3DBase.h:61
virtual float width() const =0
void PlotRecHits::printPixelRecHits ( const edm::Event ev)
private

Definition at line 123 of file PlotRecHits.cc.

References edmNew::DetSetVector< T >::data(), edm::Event::getByLabel(), and edm::Handle< T >::product().

124 {
125  // Get pixel hit collections
126 /*
127  std::vector<edm::Handle<SiPixelRecHitCollection> > pixelColls;
128  ev.getManyByType(pixelColls);
129 
130  for(std::vector<edm::Handle<SiPixelRecHitCollection> >::const_iterator
131  pixelColl = pixelColls.begin();
132  pixelColl!= pixelColls.end(); pixelColl++)
133  {
134  const SiPixelRecHitCollection* thePixelHits = (*pixelColl).product();
135 
136  for(SiPixelRecHitCollection::DataContainer::const_iterator
137  recHit = thePixelHits->data().begin();
138  recHit!= thePixelHits->data().end(); recHit++)
139  {
140  if(recHit->isValid())
141  printPixelRecHit(&(*recHit));
142  }
143  }
144 */
145 
147  ev.getByLabel("siPixelRecHits", pixelColl);
148  const SiPixelRecHitCollection* thePixelHits = pixelColl.product();
149 
151  recHit = thePixelHits->data().begin();
152  recHit!= thePixelHits->data().end(); recHit++)
153  {
154  if(recHit->isValid())
155  printPixelRecHit(&(*recHit));
156  }
157 
158 }
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
void printPixelRecHit(const SiPixelRecHit *recHit)
Definition: PlotRecHits.cc:35
data_type const * data(size_t cell) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
T const * product() const
Definition: Handle.h:74
void PlotRecHits::printRecHits ( const edm::Event ev)

Definition at line 215 of file PlotRecHits.cc.

References mergeVDriftHistosByStation::file.

216 {
217  file << "AbsolutePointSize[5]";
218  file << ", If[pr, {RGBColor[0.4,0.4,1.0]";
219  printPixelRecHits(ev);
220  file << "}]";
221 
222  file << ", If[sr, {RGBColor[0.6,0.6,1.0]";
223  printStripRecHits(ev);
224  file << "}]";
225 }
std::ofstream & file
Definition: PlotRecHits.h:24
void printPixelRecHits(const edm::Event &ev)
Definition: PlotRecHits.cc:123
void printStripRecHits(const edm::Event &ev)
Definition: PlotRecHits.cc:161
void PlotRecHits::printStripRecHit ( const SiStripRecHit2D *  recHit)

Definition at line 86 of file PlotRecHits.cc.

References mergeVDriftHistosByStation::file, AlCaHLTBitMon_ParallelJobs::p, x, PV3DBase< T, PVType, FrameType >::x(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by PlotRecTracks::printRecTracks().

87 {
88  DetId id = recHit->geographicalId();
89 
90  // DetUnit
91  double x = theTracker->idToDet(id)->surface().bounds().width() /2;
92  double y = theTracker->idToDet(id)->surface().bounds().length()/2;
93  double z = 0.;
94 
95  GlobalPoint p00 = theTracker->idToDet(id)->toGlobal(LocalPoint(-x,-y,z));
96  GlobalPoint p01 = theTracker->idToDet(id)->toGlobal(LocalPoint(-x, y,z));
97  GlobalPoint p10 = theTracker->idToDet(id)->toGlobal(LocalPoint( x,-y,z));
98  GlobalPoint p11 = theTracker->idToDet(id)->toGlobal(LocalPoint( x, y,z));
99 
100  file << ", If[sd, {RGBColor[0.6,0.6,0.6], "
101  <<"Line[{{"<<p00.x()<<","<<p00.y()<<",("<<p00.z()<<"-zs)*mz}, "
102  <<"{"<<p01.x()<<","<<p01.y()<<",("<<p01.z()<<"-zs)*mz}, "
103  <<"{"<<p11.x()<<","<<p11.y()<<",("<<p11.z()<<"-zs)*mz}, "
104  <<"{"<<p10.x()<<","<<p10.y()<<",("<<p10.z()<<"-zs)*mz}, "
105  <<"{"<<p00.x()<<","<<p00.y()<<",("<<p00.z()<<"-zs)*mz}}]}]"
106  << std::endl;
107 
108  // RecHit
109  LocalPoint lpos; GlobalPoint p;
110 
111  lpos = LocalPoint(recHit->localPosition().x(),
112  y, recHit->localPosition().z());
113  p = theTracker->idToDet(id)->toGlobal(lpos);
114  file << ", Line[{{"<<p.x()<<","<<p.y()<<",("<<p.z()<<"-zs)*mz}, {";
115 
116  lpos = LocalPoint(recHit->localPosition().x(),
117  -y, recHit->localPosition().z());
118  p = theTracker->idToDet(id)->toGlobal(lpos);
119  file << ""<<p.x()<<","<<p.y()<<",("<<p.z()<<"-zs)*mz}}]" << std::endl;
120 }
virtual float length() const =0
std::ofstream & file
Definition: PlotRecHits.h:24
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
T y() const
Definition: PV3DBase.h:62
const TrackerGeometry * theTracker
Definition: PlotRecHits.h:25
double double double z
T z() const
Definition: PV3DBase.h:63
virtual const GeomDet * idToDet(DetId) const
Definition: DetId.h:20
const Bounds & bounds() const
Definition: BoundSurface.h:89
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
Definition: DDAxes.h:10
T x() const
Definition: PV3DBase.h:61
virtual float width() const =0
void PlotRecHits::printStripRecHits ( const edm::Event ev)
private

Definition at line 161 of file PlotRecHits.cc.

References edmNew::DetSetVector< T >::data(), mergeVDriftHistosByStation::file, edm::Event::getManyByType(), m, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::s, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

162 {
163  {
164  // Get strip hit collections
165  std::vector<edm::Handle<SiStripRecHit2DCollection> > stripColls;
166  ev.getManyByType(stripColls);
167 
168  for(std::vector<edm::Handle<SiStripRecHit2DCollection> >::const_iterator
169  stripColl = stripColls.begin();
170  stripColl!= stripColls.end(); stripColl++)
171  {
172  const SiStripRecHit2DCollection* theStripHits = (*stripColl).product();
173 
175  recHit = theStripHits->data().begin();
176  recHit!= theStripHits->data().end(); recHit++)
177  {
178  if(recHit->isValid())
179  printStripRecHit(&(*recHit));
180  }
181  }
182  }
183 
184  // Get matched strip hit collections
185  {
186  std::vector<edm::Handle<SiStripMatchedRecHit2DCollection> > stripColls;
187  ev.getManyByType(stripColls);
188 
189  for(std::vector<edm::Handle<SiStripMatchedRecHit2DCollection> >::const_iterator
190  stripColl = stripColls.begin();
191  stripColl!= stripColls.end(); stripColl++)
192  {
193  const SiStripMatchedRecHit2DCollection* theStripHits = (*stripColl).product();
194 
196  recHit = theStripHits->data().begin();
197  recHit!= theStripHits->data().end(); recHit++)
198  {
199  auto m = recHit->monoHit();
200  auto s = recHit->stereoHit();
203 
204  DetId id = recHit->geographicalId();
205  LocalPoint lpos = recHit->localPosition();
206  GlobalPoint p = theTracker->idToDet(id)->toGlobal(lpos);
207 
208  file << ", Point[{"<< p.x()<<","<<p.y()<<",("<<p.z()<<"-zs)*mz}]" << std::endl;
209  }
210  }
211  }
212 }
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:408
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
std::ofstream & file
Definition: PlotRecHits.h:24
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
T y() const
Definition: PV3DBase.h:62
const TrackerGeometry * theTracker
Definition: PlotRecHits.h:25
T z() const
Definition: PV3DBase.h:63
data_type const * data(size_t cell) const
virtual const GeomDet * idToDet(DetId) const
void printStripRecHit(const SiStripRecHit2D *recHit)
Definition: PlotRecHits.cc:86
Definition: DetId.h:20
T x() const
Definition: PV3DBase.h:61

Member Data Documentation

std::ofstream& PlotRecHits::file
private

Definition at line 24 of file PlotRecHits.h.

const TrackerGeometry* PlotRecHits::theTracker
private

Definition at line 25 of file PlotRecHits.h.