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 }
AlignmentErrorsExtended.h
AlignableCSCEndcap::computeSurface
AlignableSurface computeSurface()
Definition: AlignableCSCEndcap.cc:41
TkRotation< Scalar >
AlignableCSCEndcap::AlignableCSCEndcap
AlignableCSCEndcap(const std::vector< AlignableCSCStation * > &cscStations)
The constructor simply copies the vector of stations and computes the surface from them.
Definition: AlignableCSCEndcap.cc:16
mps_fire.i
i
Definition: mps_fire.py:428
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
MessageLogger.h
align
Definition: AlignableIndexer.h:30
AlignableCSCStation
Definition: AlignableCSCStation.h:28
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
AlignableComposite::components
const Alignables & components() const override
Return vector of direct components.
Definition: AlignableComposite.h:45
AlignableComposite
Definition: AlignableComposite.h:25
Alignments.h
Alignable::CompConstraintType::POSITION_Z
AlignableCSCEndcap::alignmentErrors
AlignmentErrorsExtended * alignmentErrors() const override
Return vector of alignment errors.
Definition: AlignableCSCEndcap.cc:98
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
AlignableCSCEndcap::computePosition
PositionType computePosition()
Compute average z position from all components (x and y forced to 0)
Definition: AlignableCSCEndcap.cc:46
AlignableComposite::setSurface
void setSurface(const AlignableSurface &s)
Definition: AlignableComposite.h:112
AlignableCSCEndcap::computeOrientation
RotationType computeOrientation()
Just initialize to default given by default constructor of a RotationType.
Definition: AlignableCSCEndcap.cc:59
Alignable::PositionType
align::PositionType PositionType
Definition: Alignable.h:30
Alignable::compConstraintType_
CompConstraintType compConstraintType_
Definition: Alignable.h:246
AlignableComposite::addComponent
void addComponent(Alignable *component) final
Definition: AlignableComposite.cc:53
Point3DBase< Scalar, GlobalTag >
AlignableCSCEndcap::dump
void dump(void) const override
Recursive printout of the muon End Cap structure.
Definition: AlignableCSCEndcap.cc:71
b
double b
Definition: hdecay.h:118
AlignableCSCEndcap::station
AlignableCSCStation & station(int i)
Return AlignableCSCEndcap station at given index.
Definition: AlignableCSCEndcap.cc:32
Alignable::RotationType
align::RotationType RotationType
Definition: Alignable.h:31
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
AlignableCSCEndcap.h
Alignable::setMother
void setMother(Alignable *mother)
Assign mother to alignable.
Definition: Alignable.h:94
AlignableCSCEndcap::theCSCStations
std::vector< AlignableCSCStation * > theCSCStations
Definition: AlignableCSCEndcap.h:53
AlignableSurface
Definition: AlignableSurface.h:20
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
Exception
Definition: hltDiff.cc:246
AlignableCSCEndcap::alignments
Alignments * alignments() const override
Return alignment data.
Definition: AlignableCSCEndcap.cc:81
AlignableCSCEndcap
Definition: AlignableCSCEndcap.h:27
Alignments::m_align
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
AlignmentErrorsExtended::m_alignError
std::vector< AlignTransformErrorExtended > m_alignError
Definition: AlignmentErrorsExtended.h:19
operator<<
std::ostream & operator<<(std::ostream &os, const AlignableCSCEndcap &b)
Output Half Barrel information.
Definition: AlignableCSCEndcap.cc:62
Alignments
Definition: Alignments.h:10
Alignable::mother
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91
Alignable::size
int size() const
Return number of direct components.
Definition: Alignable.h:68