CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PlotEcalRecHits Class Reference

#include <PlotEcalRecHits.h>

List of all members.

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< T >::product().

                                             : file(file_)
{
  // Get calorimetry
  edm::ESHandle<CaloGeometry> calo;
  es.get<CaloGeometryRecord>().get(calo);
  theCaloGeometry = (const CaloGeometry*)calo.product();
}
PlotEcalRecHits::~PlotEcalRecHits ( )

Definition at line 36 of file PlotEcalRecHits.cc.

{
}

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(), L1TEmulatorMonitor_cff::p, cmsRelvalreport::red(), funct::sin(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

{ 
  float x = energy;
  if(x > 1) x = 1.;
  float red   = fabs(2*x-0.5);
  float green = sin(180*x);
  float blue  = cos( 90*x);
  
  file << ", PointSize[" << energy*0.01 << "]";
  file << ", RGBColor[" << red << "," << green << "," << blue << "]";
  file << ", Point[{" << cell->getPosition().x() << ","
                      << cell->getPosition().y() << ",("
                      << cell->getPosition().z() << "-zs)*mz}]" << std::endl;

  const CaloCellGeometry::CornersVec & p(cell->getCorners()) ;

  file << ", If[sd, {RGBColor[0.5,0.5,0.5]";

  file << ", Line[{";
  file << "{" << p[0].x() << "," <<p[0].y() << ",(" << p[0].z() << "-zs)*mz}, ";
  file << "{" << p[1].x() << "," <<p[1].y() << ",(" << p[1].z() << "-zs)*mz}, ";
  file << "{" << p[2].x() << "," <<p[2].y() << ",(" << p[2].z() << "-zs)*mz}, ";
  file << "{" << p[3].x() << "," <<p[3].y() << ",(" << p[3].z() << "-zs)*mz}, ";
  file << "{" << p[0].x() << "," <<p[0].y() << ",(" << p[0].z() << "-zs)*mz}";
  file << "}]" << std::endl;

  file << ", Line[{";
  file << "{" << p[4].x() << "," <<p[4].y() << ",(" << p[4].z() << "-zs)*mz}, ";
  file << "{" << p[5].x() << "," <<p[5].y() << ",(" << p[5].z() << "-zs)*mz}, ";
  file << "{" << p[6].x() << "," <<p[6].y() << ",(" << p[6].z() << "-zs)*mz}, ";
  file << "{" << p[7].x() << "," <<p[7].y() << ",(" << p[7].z() << "-zs)*mz}, ";
  file << "{" << p[4].x() << "," <<p[4].y() << ",(" << p[4].z() << "-zs)*mz}";
  file << "}]" << std::endl;
  
  file << ", Line[{";
  file << "{" << p[0].x() << "," <<p[0].y() << ",(" << p[0].z() << "-zs)*mz}, ";
  file << "{" << p[4].x() << "," <<p[4].y() << ",(" << p[4].z() << "-zs)*mz}";
  file << "}]" << std::endl;
  
  file << ", Line[{";
  file << "{" << p[1].x() << "," <<p[1].y() << ",(" << p[1].z() << "-zs)*mz}, ";
  file << "{" << p[5].x() << "," <<p[5].y() << ",(" << p[5].z() << "-zs)*mz}";
  file << "}]" << std::endl;
  
  file << ", Line[{";
  file << "{" << p[2].x() << "," <<p[2].y() << ",(" << p[2].z() << "-zs)*mz}, ";
  file << "{" << p[6].x() << "," <<p[6].y() << ",(" << p[6].z() << "-zs)*mz}";
  file << "}]" << std::endl;
  
  file << ", Line[{";
  file << "{" << p[3].x() << "," <<p[3].y() << ",(" << p[3].z() << "-zs)*mz}, ";
  file << "{" << p[7].x() << "," <<p[7].y() << ",(" << p[7].z() << "-zs)*mz}";
  file << "}]" << std::endl;

  file << "}]" << std::endl;
}
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.

{
//  const float minEnergy = 0.060;

  edm::Handle<EBRecHitCollection>              recHitsBarrel;
  ev.getByLabel("ecalRecHit", "EcalRecHitsEB", recHitsBarrel);
  edm::Handle<EERecHitCollection>              recHitsEndcap;
  ev.getByLabel("ecalRecHit", "EcalRecHitsEE", recHitsEndcap);
/*
  edm::Handle<ESRecHitCollection>              recHitsPreshower;
  ev.getByLabel("ecalPreshowerRecHit", "EcalRecHitsES", recHitsPreshower);
*/

  LogTrace("MinBiasTracking")
       << " [EventPlotter] ecal barrel/endcap :"
       << " " << recHitsBarrel->size()
       << "/" << recHitsEndcap->size();
//       << "/" << recHitsPreshower->size() << std::endl;

  const CaloSubdetectorGeometry * geom;

  file << ", If[er, {RGBColor[0.0,0.0,0.0]";

  // Barrel
  geom = theCaloGeometry->getSubdetectorGeometry(DetId::Ecal,EcalBarrel);
  for(EBRecHitCollection::const_iterator recHit = recHitsBarrel->begin();
                                         recHit!= recHitsBarrel->end();
                                         recHit++)
  {
    EBDetId detId(recHit->id());
    const CaloCellGeometry* cell = geom->getGeometry(detId);
    if(cell != 0)
      printEcalRecHit(cell, recHit->energy());
  }

  // Endcap
  geom = theCaloGeometry->getSubdetectorGeometry(DetId::Ecal,EcalEndcap);
  for(EERecHitCollection::const_iterator recHit = recHitsEndcap->begin();
                                         recHit!= recHitsEndcap->end();
                                         recHit++)
  {
    EEDetId detId(recHit->id());
    const CaloCellGeometry* cell = geom->getGeometry(detId);
    if(cell != 0)
      printEcalRecHit(cell, recHit->energy());
  }

  // Preshower
/*
  geom = theCaloGeometry->getSubdetectorGeometry(DetId::Ecal,EcalPreshower);
  for(ESRecHitCollection::const_iterator recHit = recHitsPreshower->begin();
                                         recHit!= recHitsPreshower->end();
                                         recHit++)
  {
    ESDetId detId(recHit->id()); 
    const CaloCellGeometry* cell = geom->getGeometry(detId);
    printEcalRecHit(cell, recHit->energy() * 1e+3);
  }
*/
  file << "}]";
}

Member Data Documentation

std::ofstream& PlotEcalRecHits::file [private]

Definition at line 21 of file PlotEcalRecHits.h.

Definition at line 22 of file PlotEcalRecHits.h.