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 }
AlignableGEMEndcap::theGEMStations
std::vector< AlignableGEMStation * > theGEMStations
Definition: AlignableGEMEndcap.h:39
AlignmentErrorsExtended.h
TkRotation< Scalar >
mps_fire.i
i
Definition: mps_fire.py:428
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
MessageLogger.h
align
Definition: AlignableIndexer.h:30
AlignableGEMEndcap::computeOrientation
RotationType computeOrientation()
Definition: AlignableGEMEndcap.cc:48
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
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
AlignableComposite::setSurface
void setSurface(const AlignableSurface &s)
Definition: AlignableComposite.h:112
AlignableGEMEndcap::computeSurface
AlignableSurface computeSurface()
Definition: AlignableGEMEndcap.cc:32
Alignable::PositionType
align::PositionType PositionType
Definition: Alignable.h:30
AlignableGEMEndcap::dump
void dump(void) const override
Recursive printout of alignable structure.
Definition: AlignableGEMEndcap.cc:58
Alignable::compConstraintType_
CompConstraintType compConstraintType_
Definition: Alignable.h:246
AlignableGEMEndcap::alignments
Alignments * alignments() const override
Return alignment data.
Definition: AlignableGEMEndcap.cc:66
AlignableComposite::addComponent
void addComponent(Alignable *component) final
Definition: AlignableComposite.cc:53
operator<<
std::ostream & operator<<(std::ostream &os, const AlignableGEMEndcap &b)
Definition: AlignableGEMEndcap.cc:50
Point3DBase< Scalar, GlobalTag >
b
double b
Definition: hdecay.h:118
AlignableGEMEndcap::AlignableGEMEndcap
AlignableGEMEndcap(const std::vector< AlignableGEMStation * > &GEMStations)
Definition: AlignableGEMEndcap.cc:11
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
AlignableGEMStation
Definition: AlignableGEMStation.h:19
Alignable::RotationType
align::RotationType RotationType
Definition: Alignable.h:31
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
Alignable::setMother
void setMother(Alignable *mother)
Assign mother to alignable.
Definition: Alignable.h:94
AlignableGEMEndcap::alignmentErrors
AlignmentErrorsExtended * alignmentErrors() const override
Return vector of alignment errors.
Definition: AlignableGEMEndcap.cc:79
AlignableGEMEndcap
Definition: AlignableGEMEndcap.h:18
AlignableSurface
Definition: AlignableSurface.h:20
AlignableGEMEndcap::computePosition
PositionType computePosition()
Definition: AlignableGEMEndcap.cc:36
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
Exception
Definition: hltDiff.cc:245
Alignments::m_align
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
AlignmentErrorsExtended::m_alignError
std::vector< AlignTransformErrorExtended > m_alignError
Definition: AlignmentErrorsExtended.h:19
AlignableGEMEndcap.h
AlignableGEMEndcap::station
AlignableGEMStation & station(int i)
Definition: AlignableGEMEndcap.cc:25
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