CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MuonGeometrySVGTemplate Class Reference

#include <Alignment/MuonAlignment/plugins/MuonGeometrySVGTemplate.cc>

Inheritance diagram for MuonGeometrySVGTemplate:
edm::EDAnalyzer

List of all members.

Public Member Functions

 MuonGeometrySVGTemplate (const edm::ParameterSet &iConfig)
 ~MuonGeometrySVGTemplate ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &iConfig)

Private Attributes

std::string m_wheelTemplateName

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 47 of file MuonGeometrySVGTemplate.cc.


Constructor & Destructor Documentation

MuonGeometrySVGTemplate::MuonGeometrySVGTemplate ( const edm::ParameterSet iConfig) [explicit]

Definition at line 74 of file MuonGeometrySVGTemplate.cc.

   : m_wheelTemplateName(iConfig.getParameter<std::string>("wheelTemplateName"))
{}
MuonGeometrySVGTemplate::~MuonGeometrySVGTemplate ( )

Definition at line 78 of file MuonGeometrySVGTemplate.cc.

{}

Member Function Documentation

void MuonGeometrySVGTemplate::analyze ( const edm::Event iEvent,
const edm::EventSetup iConfig 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 82 of file MuonGeometrySVGTemplate.cc.

References AlignableNavigator::alignableFromDetId(), trackerHits::c, edm::FileInPath::fullPath(), MuonAlignment::getAlignableNavigator(), errorMatrix2Lands_multiChannel::id, M_PI, m_wheelTemplateName, CSCOverlapsAlignmentAlgorithm_cff::muonAlignment, dbtoconf::out, phi, GloballyPositioned< T >::position(), relativeConstraints::station, Alignable::surface(), AlignableSurface::toGlobal(), AlignableSurface::width(), tablePrinter::width, PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), and detailsBasic3DVector::y.

                                                                                    {
   // loads ideal geometry
   MuonAlignmentInputMethod inputMethod;
   MuonAlignment muonAlignment(iSetup, inputMethod);
   AlignableNavigator *alignableNavigator = muonAlignment.getAlignableNavigator();

   edm::FileInPath fip_BEGINNING("Alignment/MuonAlignment/data/wheel_template.svg_BEGINNING");
   std::ifstream in_BEGINNING(fip_BEGINNING.fullPath().c_str());
   edm::FileInPath fip_END("Alignment/MuonAlignment/data/wheel_template.svg_END");
   std::ifstream in_END(fip_END.fullPath().c_str());

   const double height = 45.;  // assume all chambers are 45 cm tall (local z)
   std::ofstream out(m_wheelTemplateName.c_str());

   while (in_BEGINNING.good()) {
      char c = (char) in_BEGINNING.get();
      if (in_BEGINNING.good()) out << c;
   }

   for (int station = 1;  station <= 4;  station++) {
      int numSectors = 12;
      if (station == 4) numSectors = 14;
      for (int sector = 1;  sector <= numSectors;  sector++) {
         DTChamberId id(-2, station, sector);  // wheel -2 has a +1 signConvention for x
         Alignable *chamber = &*(alignableNavigator->alignableFromDetId(id));

         // different stations, sectors have different widths (*very* fortunate that Alignment software provides this)
         double width = chamber->surface().width();
         
         // lower-left corner of chamber in the chamber's coordinates
         double x = -width/2.;
         double y = -height/2.;

         // phi position of chamber
         align::GlobalVector direction = chamber->surface().toGlobal(LocalVector(1., 0., 0.));
         double phi = atan2(direction.y(), direction.x());
         
         // we'll apply a translation to put the chamber in its place
         double tx = chamber->surface().position().x();
         double ty = chamber->surface().position().y();

         out << "    <rect id=\"MB_" << station << "_" << sector << "\" x=\"" << x << "\" y=\"" << y << "\" width=\"" << width << "\" height=\"" << height << "\" transform=\"translate(" << tx << ", " << ty << ") rotate(" << phi*180./M_PI << ")\" style=\"fill:#e1e1e1;fill-opacity:1;stroke:#000000;stroke-width:5.0;stroke-dasharray:1, 1;stroke-dashoffset:0\" />" << std::endl;
      }
   }

   while (in_END.good()) {
      char c = (char) in_END.get();
      if (in_END.good()) out << c;
   }
}

Member Data Documentation

Definition at line 55 of file MuonGeometrySVGTemplate.cc.

Referenced by analyze().