CMS 3D CMS Logo

AlignableExtras.cc
Go to the documentation of this file.
1 
12 
13 // Geometry
16 
17 // Alignment
19 
23 
25 
26 //__________________________________________________________________________________________________
28 {
29  align::Alignables& alis = alignableLists_.get("BeamSpot");
30  alis.push_back(new AlignableBeamSpot());
31  components_.push_back(alis.back());
32 }
33 
34 //__________________________________________________________________________________________________
35 void AlignableExtras::dump( void ) const
36 {
37  Alignables comp = this->components();
38 
39  // Dump this
40  edm::LogInfo("AlignableDump")
41  << " AlignableExtras knows " << comp.size() << " alignable(s)" << std::endl;
42 
43  // Dump components
44  for ( Alignables::iterator i=comp.begin(); i!=comp.end(); ++i )
45  (*i)->dump();
46 }
47 
48 //__________________________________________________________________________________________________
50 {
52  Alignments* m_alignments = new Alignments();
53  // Add components recursively
54  for ( align::Alignables::iterator i=comp.begin(); i!=comp.end(); ++i )
55  {
56  Alignments* tmpAlignments = (*i)->alignments();
57  std::copy( tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(),
58  std::back_inserter(m_alignments->m_align) );
59  delete tmpAlignments;
60  }
61 
62  std::sort( m_alignments->m_align.begin(), m_alignments->m_align.end(),
64 
65  return m_alignments;
66 }
67 
68 //__________________________________________________________________________________________________
70 {
72  AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
73 
74  // Add components recursively
75  for ( align::Alignables::iterator i=comp.begin(); i!=comp.end(); ++i )
76  {
77  AlignmentErrorsExtended* tmpAlignmentErrorsExtended = (*i)->alignmentErrors();
78  std::copy( tmpAlignmentErrorsExtended->m_alignError.begin(), tmpAlignmentErrorsExtended->m_alignError.end(),
79  std::back_inserter(m_alignmentErrors->m_alignError) );
80  delete tmpAlignmentErrorsExtended;
81  }
82 
83  std::sort( m_alignmentErrors->m_alignError.begin(), m_alignmentErrors->m_alignError.end(),
85 
86  return m_alignmentErrors;
87 }
88 
89 //______________________________________________________________________________
90 void AlignableExtras::initializeBeamSpot(double x, double y, double z,
91  double dxdz, double dydz)
92 {
93  align::Alignables& alis = beamSpot();
94  AlignableBeamSpot * aliBS = dynamic_cast<AlignableBeamSpot*>(alis.back());
95  if (aliBS) {
96  aliBS->initialize(x, y, z, dxdz, dydz);
97  } else {
98  edm::LogError("AlignableExtras")
99  << " AlignableBeamSpot not available. Cannot initialize!" << std::endl;
100  }
101 }
102 
103 //______________________________________________________________________________
105 {
106  align::Alignables& alis = beamSpot();
107  AlignableBeamSpot * aliBS = dynamic_cast<AlignableBeamSpot*>(alis.back());
108  if (aliBS) {
109  aliBS->reset();
110  } else {
111  edm::LogWarning("AlignableExtras")
112  << "@SUB=AlignableExtras::resetBeamSpot"
113  << "AlignableBeamSpot not available. Cannot reset!" << std::endl;
114  }
115 }
void initialize(double x, double y, double z, double dxdz, double dydz)
initialize the alignable with the passed beam spot parameters
Alignables components_
AlignableExtras()
Constructor (builds all alignables)
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
AlignableMap alignableLists_
Alignables & get(const std::string &name="")
Definition: AlignableMap.cc:9
void initializeBeamSpot(double x, double y, double z, double dxdz, double dydz)
Initialize the alignable beam spot with the given parameters.
void resetBeamSpot()
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:31
align::Alignables Alignables
AlignmentErrorsExtended * alignmentErrors() const
Return alignment errors, sorted by DetId.
void reset()
reset beam spot to the uninitialized state
Alignments * alignments() const
Return alignments, sorted by DetId.
Alignables & beamSpot()
Return beam spot alignable as a vector with one element.