CMS 3D CMS Logo

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