CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AlignableExtras.cc
Go to the documentation of this file.
1 
11 
12 // Geometry
15 
16 // Alignment
18 
22 
24 
25 //__________________________________________________________________________________________________
27 {
28  align::Alignables& alis = alignableLists_.get("BeamSpot");
29  alis.push_back(new AlignableBeamSpot());
30  components_.push_back(alis.back());
31 }
32 
33 //__________________________________________________________________________________________________
34 void AlignableExtras::dump( void ) const
35 {
36  Alignables comp = this->components();
37 
38  // Dump this
39  edm::LogInfo("AlignableDump")
40  << " AlignableExtras knows " << comp.size() << " alignable(s)" << std::endl;
41 
42  // Dump components
43  for ( Alignables::iterator i=comp.begin(); i!=comp.end(); i++ )
44  (*i)->dump();
45 }
46 
47 //__________________________________________________________________________________________________
49 {
51  Alignments* m_alignments = new Alignments();
52  // Add components recursively
53  for ( align::Alignables::iterator i=comp.begin(); i!=comp.end(); i++ )
54  {
55  Alignments* tmpAlignments = (*i)->alignments();
56  std::copy( tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(),
57  std::back_inserter(m_alignments->m_align) );
58  delete tmpAlignments;
59  }
60 
61  std::sort( m_alignments->m_align.begin(), m_alignments->m_align.end(),
63 
64  return m_alignments;
65 }
66 
67 //__________________________________________________________________________________________________
69 {
71  AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
72 
73  // Add components recursively
74  for ( align::Alignables::iterator i=comp.begin(); i!=comp.end(); i++ )
75  {
76  AlignmentErrorsExtended* tmpAlignmentErrorsExtended = (*i)->alignmentErrors();
77  std::copy( tmpAlignmentErrorsExtended->m_alignError.begin(), tmpAlignmentErrorsExtended->m_alignError.end(),
78  std::back_inserter(m_alignmentErrors->m_alignError) );
79  delete tmpAlignmentErrorsExtended;
80  }
81 
82  std::sort( m_alignmentErrors->m_alignError.begin(), m_alignmentErrors->m_alignError.end(),
84 
85  return m_alignmentErrors;
86 }
87 
88 void AlignableExtras::initializeBeamSpot(double x, double y, double z,
89  double dxdz, double dydz)
90 {
91  align::Alignables& alis = beamSpot();
92  AlignableBeamSpot * aliBS = dynamic_cast<AlignableBeamSpot*>(alis.back());
93  if (aliBS) {
94  aliBS->initialize(x, y, z, dxdz, dydz);
95  } else {
96  edm::LogError("AlignableExtras")
97  << " AlignableBeamSpot not available. Cannot initialize!" << std::endl;
98  }
99 }
void initialize(double x, double y, double z, double dxdz, double dydz)
initialize the alignable with the passed beam spot parameters
int i
Definition: DBlmapReader.cc:9
Alignables components_
AlignableExtras()
Constructor (builds all alignables)
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
float float float z
T x() const
Cartesian x coordinate.
Type & get(const std::string &name="")
Definition: AlignSetup.h:52
AlignSetup< Alignables > alignableLists_
void initializeBeamSpot(double x, double y, double z, double dxdz, double dydz)
Initialize the alignable beam spot with the given parameters.
Alignables components() const
std::vector< AlignTransformErrorExtended > m_alignError
void dump(void) const
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
align::Alignables Alignables
AlignmentErrorsExtended * alignmentErrors() const
Return alignment errors, sorted by DetId.
Alignments * alignments() const
Return alignments, sorted by DetId.
Alignables & beamSpot()
Return beam spot alignable as a vector with one element.