CMS 3D CMS Logo

AlignableCSCEndcap.cc
Go to the documentation of this file.
1 
8 #include <memory>
9 
14 
16 AlignableCSCEndcap::AlignableCSCEndcap(const std::vector<AlignableCSCStation*>& cscStations)
17  : AlignableComposite(cscStations[0]->id(), align::AlignableCSCEndcap) {
18  theCSCStations.insert(theCSCStations.end(), cscStations.begin(), cscStations.end());
19 
20  // maintain also list of components
21  for (const auto& station : cscStations) {
22  const auto mother = station->mother();
23  this->addComponent(station); // components will be deleted by dtor of AlignableComposite
24  station->setMother(mother); // restore previous behaviour where mother is not set
25  }
26 
29 }
30 
33  if (i >= size())
34  throw cms::Exception("LogicError") << "Station index (" << i << ") out of range";
35 
36  return *theCSCStations[i];
37 }
38 
43 }
44 
47  float zz = 0.;
48 
49  for (std::vector<AlignableCSCStation*>::iterator ilayer = theCSCStations.begin(); ilayer != theCSCStations.end();
50  ilayer++)
51  zz += (*ilayer)->globalPosition().z();
52 
53  zz /= static_cast<float>(theCSCStations.size());
54 
55  return PositionType(0.0, 0.0, zz);
56 }
57 
60 
62 std::ostream& operator<<(std::ostream& os, const AlignableCSCEndcap& b) {
63  os << "This EndCap contains " << b.theCSCStations.size() << " CSC stations" << std::endl;
64  os << "(phi, r, z) = (" << b.globalPosition().phi() << "," << b.globalPosition().perp() << ","
65  << b.globalPosition().z();
66  os << "), orientation:" << std::endl << b.globalRotation() << std::endl;
67  return os;
68 }
69 
71 void AlignableCSCEndcap::dump(void) const {
72  edm::LogInfo("AlignableDump") << (*this);
73  for (std::vector<AlignableCSCStation*>::const_iterator iLayer = theCSCStations.begin();
74  iLayer != theCSCStations.end();
75  iLayer++)
76  (*iLayer)->dump();
77 }
78 
79 //__________________________________________________________________________________________________
80 
82  Alignments* m_alignments = new Alignments();
83 
84  // Add components recursively
85  for (const auto& i : this->components()) {
86  std::unique_ptr<Alignments> tmpAlignments{i->alignments()};
87  std::copy(tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(), std::back_inserter(m_alignments->m_align));
88  }
89 
90  // sort by rawId
91  std::sort(m_alignments->m_align.begin(), m_alignments->m_align.end());
92 
93  return m_alignments;
94 }
95 
96 //__________________________________________________________________________________________________
97 
99  AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
100 
101  // Add components recursively
102  for (const auto& i : this->components()) {
103  std::unique_ptr<AlignmentErrorsExtended> tmpAlignmentErrorsExtended{i->alignmentErrors()};
104  std::copy(tmpAlignmentErrorsExtended->m_alignError.begin(),
105  tmpAlignmentErrorsExtended->m_alignError.end(),
106  std::back_inserter(m_alignmentErrors->m_alignError));
107  }
108 
109  // sort by rawId
110  std::sort(m_alignmentErrors->m_alignError.begin(), m_alignmentErrors->m_alignError.end());
111 
112  return m_alignmentErrors;
113 }
std::ostream & operator<<(std::ostream &os, const AlignableCSCEndcap &b)
Output Half Barrel information.
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91
const Alignables & components() const override
Return vector of direct components.
Alignments * alignments() const override
Return alignment data.
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
AlignableCSCEndcap(const std::vector< AlignableCSCStation *> &cscStations)
The constructor simply copies the vector of stations and computes the surface from them...
AlignmentErrorsExtended * alignmentErrors() const override
Return vector of alignment errors.
void setSurface(const AlignableSurface &s)
AlignableSurface computeSurface()
RotationType computeOrientation()
Just initialize to default given by default constructor of a RotationType.
void dump(void) const override
Recursive printout of the muon End Cap structure.
Log< level::Info, false > LogInfo
void setMother(Alignable *mother)
Assign mother to alignable.
Definition: Alignable.h:94
std::vector< AlignableCSCStation * > theCSCStations
std::vector< AlignTransformErrorExtended > m_alignError
double b
Definition: hdecay.h:118
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
PositionType computePosition()
Compute average z position from all components (x and y forced to 0)
CompConstraintType compConstraintType_
Definition: Alignable.h:246
void addComponent(Alignable *component) final
AlignableCSCStation & station(int i)
Return AlignableCSCEndcap station at given index.