CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MuonGeometrySVGTemplate Class Reference

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

Inheritance diagram for MuonGeometrySVGTemplate:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 MuonGeometrySVGTemplate (const edm::ParameterSet &iConfig)
 
 ~MuonGeometrySVGTemplate ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

std::string m_wheelTemplateName
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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.

75  : m_wheelTemplateName(iConfig.getParameter<std::string>("wheelTemplateName"))
76 {}
T getParameter(std::string const &) const
MuonGeometrySVGTemplate::~MuonGeometrySVGTemplate ( )

Definition at line 78 of file MuonGeometrySVGTemplate.cc.

78 {}

Member Function Documentation

void MuonGeometrySVGTemplate::analyze ( const edm::Event iEvent,
const edm::EventSetup iConfig 
)
overrideprivatevirtual

Definition at line 82 of file MuonGeometrySVGTemplate.cc.

References AlignableNavigator::alignableFromDetId(), EnergyCorrector::c, relativeConstraints::chamber, DEFINE_FWK_MODULE, edm::FileInPath::fullPath(), MuonAlignment::getAlignableNavigator(), hcalTTPDigis_cfi::id, M_PI, m_wheelTemplateName, CSCOverlapsAlignmentAlgorithm_cff::muonAlignment, MillePedeFileConverter_cfg::out, phi, GloballyPositioned< T >::position(), relativeConstraints::station, Alignable::surface(), AlignableSurface::toGlobal(), ApeEstimator_cff::width, AlignableSurface::width(), x, PV3DBase< T, PVType, FrameType >::x(), y, and PV3DBase< T, PVType, FrameType >::y().

82  {
83  // loads ideal geometry
84  MuonAlignmentInputMethod inputMethod;
85  MuonAlignment muonAlignment(iSetup, inputMethod);
86  AlignableNavigator *alignableNavigator = muonAlignment.getAlignableNavigator();
87 
88  edm::FileInPath fip_BEGINNING("Alignment/MuonAlignment/data/wheel_template.svg_BEGINNING");
89  std::ifstream in_BEGINNING(fip_BEGINNING.fullPath().c_str());
90  edm::FileInPath fip_END("Alignment/MuonAlignment/data/wheel_template.svg_END");
91  std::ifstream in_END(fip_END.fullPath().c_str());
92 
93  const double height = 45.; // assume all chambers are 45 cm tall (local z)
94  std::ofstream out(m_wheelTemplateName.c_str());
95 
96  while (in_BEGINNING.good()) {
97  char c = (char) in_BEGINNING.get();
98  if (in_BEGINNING.good()) out << c;
99  }
100 
101  for (int station = 1; station <= 4; station++) {
102  int numSectors = 12;
103  if (station == 4) numSectors = 14;
104  for (int sector = 1; sector <= numSectors; sector++) {
105  DTChamberId id(-2, station, sector); // wheel -2 has a +1 signConvention for x
106  Alignable *chamber = &*(alignableNavigator->alignableFromDetId(id));
107 
108  // different stations, sectors have different widths (*very* fortunate that Alignment software provides this)
109  double width = chamber->surface().width();
110 
111  // lower-left corner of chamber in the chamber's coordinates
112  double x = -width/2.;
113  double y = -height/2.;
114 
115  // phi position of chamber
116  align::GlobalVector direction = chamber->surface().toGlobal(LocalVector(1., 0., 0.));
117  double phi = atan2(direction.y(), direction.x());
118 
119  // we'll apply a translation to put the chamber in its place
120  double tx = chamber->surface().position().x();
121  double ty = chamber->surface().position().y();
122 
123  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;
124  }
125  }
126 
127  while (in_END.good()) {
128  char c = (char) in_END.get();
129  if (in_END.good()) out << c;
130  }
131 }
align::Scalar width() const
Local3DVector LocalVector
Definition: LocalVector.h:12
T y() const
Definition: PV3DBase.h:63
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:135
#define M_PI
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
T x() const
Definition: PV3DBase.h:62
const PositionType & position() const
AlignableDetOrUnitPtr alignableFromDetId(const DetId &detid)
Returns AlignableDetOrUnitPtr corresponding to given DetId.

Member Data Documentation

std::string MuonGeometrySVGTemplate::m_wheelTemplateName
private

Definition at line 55 of file MuonGeometrySVGTemplate.cc.

Referenced by analyze().