CMS 3D CMS Logo

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