CMS 3D CMS Logo

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