CMS 3D CMS Logo

AlignableExtras.cc
Go to the documentation of this file.
1 
12 
13 // Alignment
15 
18 
20 
21 //__________________________________________________________________________________________________
23  align::Alignables& alis = alignableLists_.get("BeamSpot");
24  alis.push_back(new AlignableBeamSpot());
25  components_.push_back(alis.back());
26 }
27 
28 //__________________________________________________________________________________________________
29 void AlignableExtras::dump(void) const {
30  Alignables comp = this->components();
31 
32  // Dump this
33  edm::LogInfo("AlignableDump") << " AlignableExtras knows " << comp.size() << " alignable(s)" << std::endl;
34 
35  // Dump components
36  for (Alignables::iterator i = comp.begin(); i != comp.end(); ++i)
37  (*i)->dump();
38 }
39 
40 //__________________________________________________________________________________________________
43  Alignments* m_alignments = new Alignments();
44  // Add components recursively
45  for (align::Alignables::iterator i = comp.begin(); i != comp.end(); ++i) {
46  Alignments* tmpAlignments = (*i)->alignments();
47  std::copy(tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(), std::back_inserter(m_alignments->m_align));
48  delete tmpAlignments;
49  }
50 
51  // sort by rawId
52  std::sort(m_alignments->m_align.begin(), m_alignments->m_align.end());
53 
54  return m_alignments;
55 }
56 
57 //__________________________________________________________________________________________________
60  AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
61 
62  // Add components recursively
63  for (align::Alignables::iterator i = comp.begin(); i != comp.end(); ++i) {
64  AlignmentErrorsExtended* tmpAlignmentErrorsExtended = (*i)->alignmentErrors();
65  std::copy(tmpAlignmentErrorsExtended->m_alignError.begin(),
66  tmpAlignmentErrorsExtended->m_alignError.end(),
67  std::back_inserter(m_alignmentErrors->m_alignError));
68  delete tmpAlignmentErrorsExtended;
69  }
70 
71  // sort by rawId
72  std::sort(m_alignmentErrors->m_alignError.begin(), m_alignmentErrors->m_alignError.end());
73 
74  return m_alignmentErrors;
75 }
76 
77 //______________________________________________________________________________
78 void AlignableExtras::initializeBeamSpot(double x, double y, double z, double dxdz, double dydz) {
79  align::Alignables& alis = beamSpot();
80  AlignableBeamSpot* aliBS = dynamic_cast<AlignableBeamSpot*>(alis.back());
81  if (aliBS) {
82  aliBS->initialize(x, y, z, dxdz, dydz);
83  } else {
84  edm::LogError("AlignableExtras") << " AlignableBeamSpot not available. Cannot initialize!" << std::endl;
85  }
86 }
87 
88 //______________________________________________________________________________
90  align::Alignables& alis = beamSpot();
91  AlignableBeamSpot* aliBS = dynamic_cast<AlignableBeamSpot*>(alis.back());
92  if (aliBS) {
93  aliBS->reset();
94  } else {
95  edm::LogWarning("AlignableExtras") << "@SUB=AlignableExtras::resetBeamSpot"
96  << "AlignableBeamSpot not available. Cannot reset!" << std::endl;
97  }
98 }
void initialize(double x, double y, double z, double dxdz, double dydz)
initialize the alignable with the passed beam spot parameters
float dydz
align::Alignables & get(const std::string &name="")
Definition: AlignableMap.cc:7
Alignables components_
void dump(void) const
AlignableExtras()
Constructor (builds all alignables)
const Alignables & components() const
float dxdz
Log< level::Error, false > LogError
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.
Alignments * alignments() const
Return alignments, sorted by DetId.
Log< level::Info, false > LogInfo
std::vector< AlignTransformErrorExtended > m_alignError
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
align::Alignables Alignables
void reset()
reset beam spot to the uninitialized state
float x
AlignmentErrorsExtended * alignmentErrors() const
Return alignment errors, sorted by DetId.
Log< level::Warning, false > LogWarning
Alignables & beamSpot()
Return beam spot alignable as a vector with one element.