CMS 3D CMS Logo

AlignableGEMEndcap.cc
Go to the documentation of this file.
1 /* AlignableGEMEndcap
2  * \author Hyunyong Kim - TAMU
3  */
4 #include <memory>
5 
10 
11 AlignableGEMEndcap::AlignableGEMEndcap(const std::vector<AlignableGEMStation*>& GEMStations)
12  : AlignableComposite(GEMStations[0]->id(), align::AlignableGEMEndcap) {
13  theGEMStations.insert(theGEMStations.end(), GEMStations.begin(), GEMStations.end());
14 
15  for (const auto& station : GEMStations) {
16  const auto mother = station->mother();
17  this->addComponent(station);
19  }
20 
23 }
24 
26  if (i >= size())
27  throw cms::Exception("LogicError") << "Station index (" << i << ") out of range";
28 
29  return *theGEMStations[i];
30 }
31 
34 }
35 
37  float zz = 0.;
38 
39  for (std::vector<AlignableGEMStation*>::iterator ilayer = theGEMStations.begin(); ilayer != theGEMStations.end();
40  ilayer++)
41  zz += (*ilayer)->globalPosition().z();
42 
43  zz /= static_cast<float>(theGEMStations.size());
44 
45  return PositionType(0.0, 0.0, zz);
46 }
47 
49 
50 std::ostream& operator<<(std::ostream& os, const AlignableGEMEndcap& b) {
51  os << "This EndCap contains " << b.theGEMStations.size() << " GEM stations" << std::endl;
52  os << "(phi, r, z) = (" << b.globalPosition().phi() << "," << b.globalPosition().perp() << ","
53  << b.globalPosition().z();
54  os << "), orientation:" << std::endl << b.globalRotation() << std::endl;
55  return os;
56 }
57 
58 void AlignableGEMEndcap::dump(void) const {
59  edm::LogInfo("AlignableDump") << (*this);
60  for (std::vector<AlignableGEMStation*>::const_iterator iLayer = theGEMStations.begin();
61  iLayer != theGEMStations.end();
62  iLayer++)
63  (*iLayer)->dump();
64 }
65 
67  Alignments* m_alignments = new Alignments();
68 
69  for (const auto& i : this->components()) {
70  std::unique_ptr<Alignments> tmpAlignments{i->alignments()};
71  std::copy(tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(), std::back_inserter(m_alignments->m_align));
72  }
73 
74  std::sort(m_alignments->m_align.begin(), m_alignments->m_align.end());
75 
76  return m_alignments;
77 }
78 
80  AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
81 
82  for (const auto& i : this->components()) {
83  std::unique_ptr<AlignmentErrorsExtended> tmpAlignmentErrorsExtended{i->alignmentErrors()};
84  std::copy(tmpAlignmentErrorsExtended->m_alignError.begin(),
85  tmpAlignmentErrorsExtended->m_alignError.end(),
86  std::back_inserter(m_alignmentErrors->m_alignError));
87  }
88 
89  std::sort(m_alignmentErrors->m_alignError.begin(), m_alignmentErrors->m_alignError.end());
90 
91  return m_alignmentErrors;
92 }
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91
Alignments * alignments() const override
Return alignment data.
AlignableGEMEndcap(const std::vector< AlignableGEMStation *> &GEMStations)
std::vector< AlignableGEMStation * > theGEMStations
RotationType computeOrientation()
const Alignables & components() const override
Return vector of direct components.
PositionType computePosition()
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
AlignmentErrorsExtended * alignmentErrors() const override
Return vector of alignment errors.
AlignableSurface computeSurface()
void setSurface(const AlignableSurface &s)
AlignableGEMStation & station(int i)
std::ostream & operator<<(std::ostream &os, const AlignableGEMEndcap &b)
Log< level::Info, false > LogInfo
void setMother(Alignable *mother)
Assign mother to alignable.
Definition: Alignable.h:94
std::vector< AlignTransformErrorExtended > m_alignError
double b
Definition: hdecay.h:120
align::RotationType RotationType
Definition: Alignable.h:31
int size() const
Return number of direct components.
Definition: Alignable.h:68
align::PositionType PositionType
Definition: Alignable.h:30
CompConstraintType compConstraintType_
Definition: Alignable.h:246
void dump(void) const override
Recursive printout of alignable structure.
void addComponent(Alignable *component) final