CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
22  compConstraintType_ = Alignable::CompConstraintType::POSITION_Z;
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 }
T perp() const
Definition: PV3DBase.h:69
uint16_t *__restrict__ id
AlignableGEMEndcap(const std::vector< AlignableGEMStation * > &GEMStations)
Alignments * alignments() const override
Return alignment data.
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
std::vector< AlignableGEMStation * > theGEMStations
RotationType computeOrientation()
const Alignables & components() const override
Return vector of direct components.
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:138
PositionType computePosition()
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
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)
T z() const
Definition: PV3DBase.h:61
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:118
align::RotationType RotationType
Definition: Alignable.h:31
align::PositionType PositionType
Definition: Alignable.h:30
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:135
void dump(void) const override
Recursive printout of alignable structure.
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91
void addComponent(Alignable *component) final
int size() const
Return number of direct components.
Definition: Alignable.h:68