CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PlotRecHits Class Reference

#include <PlotRecHits.h>

List of all members.

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

                                             : file(file_)
{
  // Get tracker geometry
  edm::ESHandle<TrackerGeometry> trackerHandle;
  es.get<TrackerDigiGeometryRecord>().get(trackerHandle);
  theTracker = trackerHandle.product();
}
PlotRecHits::~PlotRecHits ( )

Definition at line 30 of file PlotRecHits.cc.

{
}

Member Function Documentation

void PlotRecHits::printPixelRecHit ( const SiPixelRecHit recHit)

Definition at line 35 of file PlotRecHits.cc.

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

Referenced by PlotRecTracks::printRecTracks().

{
  DetId id = recHit->geographicalId();

  // DetUnit
  double x = theTracker->idToDet(id)->surface().bounds().width() /2;
  double y = theTracker->idToDet(id)->surface().bounds().length()/2;
  double z = 0.;

  GlobalPoint p00 =  theTracker->idToDet(id)->toGlobal(LocalPoint(-x,-y,z));
  GlobalPoint p01 =  theTracker->idToDet(id)->toGlobal(LocalPoint(-x, y,z));
  GlobalPoint p10 =  theTracker->idToDet(id)->toGlobal(LocalPoint( x,-y,z));
  GlobalPoint p11 =  theTracker->idToDet(id)->toGlobal(LocalPoint( x, y,z));

  file << ", If[sd, {RGBColor[0.4,0.4,0.4], "
             <<"Line[{{"<<p00.x()<<","<<p00.y()<<",("<<p00.z()<<"-zs)*mz}, "
                   <<"{"<<p01.x()<<","<<p01.y()<<",("<<p01.z()<<"-zs)*mz}, "
                   <<"{"<<p11.x()<<","<<p11.y()<<",("<<p11.z()<<"-zs)*mz}, "
                   <<"{"<<p10.x()<<","<<p10.y()<<",("<<p10.z()<<"-zs)*mz}, "
                   <<"{"<<p00.x()<<","<<p00.y()<<",("<<p00.z()<<"-zs)*mz}}]}]"
       << std::endl;
  
  // RecHit
  LocalPoint lpos; GlobalPoint p;
  
  lpos = LocalPoint(recHit->localPosition().x(),
                    recHit->localPosition().y(),
                    recHit->localPosition().z());

  p = theTracker->idToDet(id)->toGlobal(lpos);
  file << ", Point[{"<<p.x()<<","<<p.y()<<",("<<p.z()<<"-zs)*mz}]" << std::endl;

  // Cluster details
  SiPixelRecHit::ClusterRef const& cluster = recHit->cluster();
  std::vector<SiPixelCluster::Pixel> pixels = cluster->pixels();

  file << ", Text[StyleForm[\"r\", FontFamily->\"Helvetica\", URL -> \"RecHit |";
  for(std::vector<SiPixelCluster::Pixel>::const_iterator
    pixel = pixels.begin(); pixel!= pixels.end(); pixel++)
  {
    file << " [" << int(pixel->x)
         << " " << int(pixel->y)
         << " " << int(pixel->adc/135) << "]";
  }
  file << "\"]";

  file << ", {"<< p.x()<<","<<p.y()<<",("<<p.z()<<"-zs)*mz}"
       << ", {-1,1}]" << std::endl;
}
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().

{
  // Get pixel hit collections
/*
  std::vector<edm::Handle<SiPixelRecHitCollection> > pixelColls;
  ev.getManyByType(pixelColls);

  for(std::vector<edm::Handle<SiPixelRecHitCollection> >::const_iterator
      pixelColl = pixelColls.begin();
      pixelColl!= pixelColls.end(); pixelColl++)
  {
    const SiPixelRecHitCollection* thePixelHits = (*pixelColl).product();

    for(SiPixelRecHitCollection::DataContainer::const_iterator
            recHit = thePixelHits->data().begin();
            recHit!= thePixelHits->data().end(); recHit++)
    {
      if(recHit->isValid())
        printPixelRecHit(&(*recHit));
    }
  }
*/

  edm::Handle<SiPixelRecHitCollection> pixelColl;
  ev.getByLabel("siPixelRecHits", pixelColl);
  const SiPixelRecHitCollection* thePixelHits = pixelColl.product();

  for(SiPixelRecHitCollection::DataContainer::const_iterator
          recHit = thePixelHits->data().begin();
          recHit!= thePixelHits->data().end(); recHit++)
  {
    if(recHit->isValid())
      printPixelRecHit(&(*recHit));
  }

}
void PlotRecHits::printRecHits ( const edm::Event ev)

Definition at line 215 of file PlotRecHits.cc.

References mergeVDriftHistosByStation::file.

{
  file << "AbsolutePointSize[5]";
  file << ", If[pr, {RGBColor[0.4,0.4,1.0]";
  printPixelRecHits(ev);
  file << "}]";

  file << ", If[sr, {RGBColor[0.6,0.6,1.0]";
  printStripRecHits(ev);
  file << "}]";
}
void PlotRecHits::printStripRecHit ( const SiStripRecHit2D *  recHit)

Definition at line 86 of file PlotRecHits.cc.

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

Referenced by PlotRecTracks::printRecTracks().

{
  DetId id = recHit->geographicalId();

  // DetUnit
  double x = theTracker->idToDet(id)->surface().bounds().width() /2;
  double y = theTracker->idToDet(id)->surface().bounds().length()/2;
  double z = 0.;

  GlobalPoint p00 =  theTracker->idToDet(id)->toGlobal(LocalPoint(-x,-y,z));
  GlobalPoint p01 =  theTracker->idToDet(id)->toGlobal(LocalPoint(-x, y,z));
  GlobalPoint p10 =  theTracker->idToDet(id)->toGlobal(LocalPoint( x,-y,z));
  GlobalPoint p11 =  theTracker->idToDet(id)->toGlobal(LocalPoint( x, y,z));

  file << ", If[sd, {RGBColor[0.6,0.6,0.6], "
             <<"Line[{{"<<p00.x()<<","<<p00.y()<<",("<<p00.z()<<"-zs)*mz}, "
                   <<"{"<<p01.x()<<","<<p01.y()<<",("<<p01.z()<<"-zs)*mz}, "
                   <<"{"<<p11.x()<<","<<p11.y()<<",("<<p11.z()<<"-zs)*mz}, "
                   <<"{"<<p10.x()<<","<<p10.y()<<",("<<p10.z()<<"-zs)*mz}, "
                   <<"{"<<p00.x()<<","<<p00.y()<<",("<<p00.z()<<"-zs)*mz}}]}]"
       << std::endl;

  // RecHit
  LocalPoint lpos; GlobalPoint p;

  lpos = LocalPoint(recHit->localPosition().x(),
                 y, recHit->localPosition().z());
  p = theTracker->idToDet(id)->toGlobal(lpos);
  file << ", Line[{{"<<p.x()<<","<<p.y()<<",("<<p.z()<<"-zs)*mz}, {";

  lpos = LocalPoint(recHit->localPosition().x(),
                -y, recHit->localPosition().z());
  p = theTracker->idToDet(id)->toGlobal(lpos);
  file << ""<<p.x()<<","<<p.y()<<",("<<p.z()<<"-zs)*mz}}]" << std::endl;
}
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().

{
  {
  // Get strip hit collections
  std::vector<edm::Handle<SiStripRecHit2DCollection> > stripColls;
  ev.getManyByType(stripColls);
  
  for(std::vector<edm::Handle<SiStripRecHit2DCollection> >::const_iterator
      stripColl = stripColls.begin();
      stripColl!= stripColls.end(); stripColl++)
  {
    const SiStripRecHit2DCollection* theStripHits = (*stripColl).product();
    
    for(SiStripRecHit2DCollection::DataContainer::const_iterator
            recHit = theStripHits->data().begin();
            recHit!= theStripHits->data().end(); recHit++)
    {
      if(recHit->isValid())
        printStripRecHit(&(*recHit));
    }
  } 
  }

  // Get matched strip hit collections
  {
  std::vector<edm::Handle<SiStripMatchedRecHit2DCollection> > stripColls;
  ev.getManyByType(stripColls);

  for(std::vector<edm::Handle<SiStripMatchedRecHit2DCollection> >::const_iterator
      stripColl = stripColls.begin();
      stripColl!= stripColls.end(); stripColl++)
  {
    const SiStripMatchedRecHit2DCollection* theStripHits = (*stripColl).product();

    for(SiStripMatchedRecHit2DCollection::DataContainer::const_iterator
            recHit = theStripHits->data().begin();
            recHit!= theStripHits->data().end(); recHit++)
      {
          auto m = recHit->monoHit();
          auto s = recHit->stereoHit();
          printStripRecHit(&m);
          printStripRecHit(&s);

        DetId id = recHit->geographicalId();
        LocalPoint lpos = recHit->localPosition();
        GlobalPoint p = theTracker->idToDet(id)->toGlobal(lpos);

        file << ", Point[{"<< p.x()<<","<<p.y()<<",("<<p.z()<<"-zs)*mz}]" << std::endl;
      }
    }
  }
}

Member Data Documentation

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

Definition at line 24 of file PlotRecHits.h.

Definition at line 25 of file PlotRecHits.h.