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
PlotEcalRecHits Class Reference

#include <PlotEcalRecHits.h>

Public Member Functions

 PlotEcalRecHits (const edm::EventSetup &es, std::ofstream &file_)
 
void printEcalRecHits (const edm::Event &ev)
 
 ~PlotEcalRecHits ()
 

Private Member Functions

void printEcalRecHit (const CaloCellGeometry *cell, float energy)
 

Private Attributes

std::ofstream & file
 
const CaloGeometrytheCaloGeometry
 

Detailed Description

Definition at line 10 of file PlotEcalRecHits.h.

Constructor & Destructor Documentation

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

Definition at line 27 of file PlotEcalRecHits.cc.

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

27  : file(file_)
28 {
29  // Get calorimetry
31  es.get<CaloGeometryRecord>().get(calo);
32  theCaloGeometry = (const CaloGeometry*)calo.product();
33 }
const CaloGeometry * theCaloGeometry
std::ofstream & file
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
PlotEcalRecHits::~PlotEcalRecHits ( )

Definition at line 36 of file PlotEcalRecHits.cc.

37 {
38 }

Member Function Documentation

void PlotEcalRecHits::printEcalRecHit ( const CaloCellGeometry cell,
float  energy 
)
private

Definition at line 42 of file PlotEcalRecHits.cc.

References funct::cos(), relval_parameters_module::energy, mergeVDriftHistosByStation::file, CaloCellGeometry::getCorners(), CaloCellGeometry::getPosition(), cmsRelvalreport::green(), AlCaHLTBitMon_ParallelJobs::p, cmsRelvalreport::red(), funct::sin(), PV3DBase< T, PVType, FrameType >::x(), vdt::x, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

43 {
44  float x = energy;
45  if(x > 1) x = 1.;
46  float red = fabs(2*x-0.5);
47  float green = sin(180*x);
48  float blue = cos( 90*x);
49 
50  file << ", PointSize[" << energy*0.01 << "]";
51  file << ", RGBColor[" << red << "," << green << "," << blue << "]";
52  file << ", Point[{" << cell->getPosition().x() << ","
53  << cell->getPosition().y() << ",("
54  << cell->getPosition().z() << "-zs)*mz}]" << std::endl;
55 
56  const CaloCellGeometry::CornersVec & p(cell->getCorners()) ;
57 
58  file << ", If[sd, {RGBColor[0.5,0.5,0.5]";
59 
60  file << ", Line[{";
61  file << "{" << p[0].x() << "," <<p[0].y() << ",(" << p[0].z() << "-zs)*mz}, ";
62  file << "{" << p[1].x() << "," <<p[1].y() << ",(" << p[1].z() << "-zs)*mz}, ";
63  file << "{" << p[2].x() << "," <<p[2].y() << ",(" << p[2].z() << "-zs)*mz}, ";
64  file << "{" << p[3].x() << "," <<p[3].y() << ",(" << p[3].z() << "-zs)*mz}, ";
65  file << "{" << p[0].x() << "," <<p[0].y() << ",(" << p[0].z() << "-zs)*mz}";
66  file << "}]" << std::endl;
67 
68  file << ", Line[{";
69  file << "{" << p[4].x() << "," <<p[4].y() << ",(" << p[4].z() << "-zs)*mz}, ";
70  file << "{" << p[5].x() << "," <<p[5].y() << ",(" << p[5].z() << "-zs)*mz}, ";
71  file << "{" << p[6].x() << "," <<p[6].y() << ",(" << p[6].z() << "-zs)*mz}, ";
72  file << "{" << p[7].x() << "," <<p[7].y() << ",(" << p[7].z() << "-zs)*mz}, ";
73  file << "{" << p[4].x() << "," <<p[4].y() << ",(" << p[4].z() << "-zs)*mz}";
74  file << "}]" << std::endl;
75 
76  file << ", Line[{";
77  file << "{" << p[0].x() << "," <<p[0].y() << ",(" << p[0].z() << "-zs)*mz}, ";
78  file << "{" << p[4].x() << "," <<p[4].y() << ",(" << p[4].z() << "-zs)*mz}";
79  file << "}]" << std::endl;
80 
81  file << ", Line[{";
82  file << "{" << p[1].x() << "," <<p[1].y() << ",(" << p[1].z() << "-zs)*mz}, ";
83  file << "{" << p[5].x() << "," <<p[5].y() << ",(" << p[5].z() << "-zs)*mz}";
84  file << "}]" << std::endl;
85 
86  file << ", Line[{";
87  file << "{" << p[2].x() << "," <<p[2].y() << ",(" << p[2].z() << "-zs)*mz}, ";
88  file << "{" << p[6].x() << "," <<p[6].y() << ",(" << p[6].z() << "-zs)*mz}";
89  file << "}]" << std::endl;
90 
91  file << ", Line[{";
92  file << "{" << p[3].x() << "," <<p[3].y() << ",(" << p[3].z() << "-zs)*mz}, ";
93  file << "{" << p[7].x() << "," <<p[7].y() << ",(" << p[7].z() << "-zs)*mz}";
94  file << "}]" << std::endl;
95 
96  file << "}]" << std::endl;
97 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T y() const
Definition: PV3DBase.h:62
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
T z() const
Definition: PV3DBase.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::ofstream & file
x
Definition: VDTMath.h:216
T x() const
Definition: PV3DBase.h:61
virtual const CornersVec & getCorners() const =0
Returns the corner points of this cell&#39;s volume.
void PlotEcalRecHits::printEcalRecHits ( const edm::Event ev)

Definition at line 100 of file PlotEcalRecHits.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, mergeVDriftHistosByStation::file, relativeConstraints::geom, edm::Event::getByLabel(), CaloSubdetectorGeometry::getGeometry(), and LogTrace.

101 {
102 // const float minEnergy = 0.060;
103 
104  edm::Handle<EBRecHitCollection> recHitsBarrel;
105  ev.getByLabel("ecalRecHit", "EcalRecHitsEB", recHitsBarrel);
106  edm::Handle<EERecHitCollection> recHitsEndcap;
107  ev.getByLabel("ecalRecHit", "EcalRecHitsEE", recHitsEndcap);
108 /*
109  edm::Handle<ESRecHitCollection> recHitsPreshower;
110  ev.getByLabel("ecalPreshowerRecHit", "EcalRecHitsES", recHitsPreshower);
111 */
112 
113  LogTrace("MinBiasTracking")
114  << " [EventPlotter] ecal barrel/endcap :"
115  << " " << recHitsBarrel->size()
116  << "/" << recHitsEndcap->size();
117 // << "/" << recHitsPreshower->size() << std::endl;
118 
120 
121  file << ", If[er, {RGBColor[0.0,0.0,0.0]";
122 
123  // Barrel
125  for(EBRecHitCollection::const_iterator recHit = recHitsBarrel->begin();
126  recHit!= recHitsBarrel->end();
127  recHit++)
128  {
129  EBDetId detId(recHit->id());
130  const CaloCellGeometry* cell = geom->getGeometry(detId);
131  if(cell != 0)
132  printEcalRecHit(cell, recHit->energy());
133  }
134 
135  // Endcap
137  for(EERecHitCollection::const_iterator recHit = recHitsEndcap->begin();
138  recHit!= recHitsEndcap->end();
139  recHit++)
140  {
141  EEDetId detId(recHit->id());
142  const CaloCellGeometry* cell = geom->getGeometry(detId);
143  if(cell != 0)
144  printEcalRecHit(cell, recHit->energy());
145  }
146 
147  // Preshower
148 /*
149  geom = theCaloGeometry->getSubdetectorGeometry(DetId::Ecal,EcalPreshower);
150  for(ESRecHitCollection::const_iterator recHit = recHitsPreshower->begin();
151  recHit!= recHitsPreshower->end();
152  recHit++)
153  {
154  ESDetId detId(recHit->id());
155  const CaloCellGeometry* cell = geom->getGeometry(detId);
156  printEcalRecHit(cell, recHit->energy() * 1e+3);
157  }
158 */
159  file << "}]";
160 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
std::vector< EcalRecHit >::const_iterator const_iterator
const CaloGeometry * theCaloGeometry
void printEcalRecHit(const CaloCellGeometry *cell, float energy)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::ofstream & file
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
#define LogTrace(id)

Member Data Documentation

std::ofstream& PlotEcalRecHits::file
private

Definition at line 21 of file PlotEcalRecHits.h.

const CaloGeometry* PlotEcalRecHits::theCaloGeometry
private

Definition at line 22 of file PlotEcalRecHits.h.