CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AlignableCSCEndcap.cc
Go to the documentation of this file.
1 
14 
15 
17 AlignableCSCEndcap::AlignableCSCEndcap( const std::vector<AlignableCSCStation*> cscStations )
18  : AlignableComposite(cscStations[0]->id(), align::AlignableCSCEndcap)
19 {
20 
21  theCSCStations.insert( theCSCStations.end(), cscStations.begin(), cscStations.end() );
22 
24 
25 }
26 
27 
30 {
31  for ( std::vector<AlignableCSCStation*>::iterator iter = theCSCStations.begin();
32  iter != theCSCStations.end(); iter++)
33  delete *iter;
34 
35 }
36 
39 {
40 
41  if (i >= size() )
42  throw cms::Exception("LogicError") << "Station index (" << i << ") out of range";
43 
44  return *theCSCStations[i];
45 
46 }
47 
48 
52 {
53 
55 
56 }
57 
58 
59 
62 {
63 
64  float zz = 0.;
65 
66  for ( std::vector<AlignableCSCStation*>::iterator ilayer = theCSCStations.begin();
67  ilayer != theCSCStations.end(); ilayer++ )
68  zz += (*ilayer)->globalPosition().z();
69 
70  zz /= static_cast<float>(theCSCStations.size());
71 
72  return PositionType( 0.0, 0.0, zz );
73 
74 }
75 
76 
79 {
80  return RotationType();
81 }
82 
83 
85 std::ostream &operator << (std::ostream& os, const AlignableCSCEndcap& b )
86 {
87 
88  os << "This EndCap contains " << b.theCSCStations.size() << " CSC stations" << std::endl;
89  os << "(phi, r, z) = (" << b.globalPosition().phi() << ","
90  << b.globalPosition().perp() << "," << b.globalPosition().z();
91  os << "), orientation:" << std::endl<< b.globalRotation() << std::endl;
92  return os;
93 
94 }
95 
96 
98 void AlignableCSCEndcap::dump( void ) const
99 {
100 
101  edm::LogInfo("AlignableDump") << (*this);
102  for ( std::vector<AlignableCSCStation*>::const_iterator iLayer = theCSCStations.begin();
103  iLayer != theCSCStations.end(); iLayer++ )
104  (*iLayer)->dump();
105 
106 }
107 
108 //__________________________________________________________________________________________________
109 
111 {
112 
113  std::vector<Alignable*> comp = this->components();
114  Alignments* m_alignments = new Alignments();
115  // Add components recursively
116  for ( std::vector<Alignable*>::iterator i=comp.begin(); i!=comp.end(); i++ )
117  {
118  Alignments* tmpAlignments = (*i)->alignments();
119  std::copy( tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(),
120  std::back_inserter(m_alignments->m_align) );
121  delete tmpAlignments;
122  }
123 
124  std::sort( m_alignments->m_align.begin(), m_alignments->m_align.end(),
126 
127  return m_alignments;
128 
129 }
130 
131 //__________________________________________________________________________________________________
132 
134 {
135 
136  std::vector<Alignable*> comp = this->components();
137  AlignmentErrors* m_alignmentErrors = new AlignmentErrors();
138 
139  // Add components recursively
140  for ( std::vector<Alignable*>::iterator i=comp.begin(); i!=comp.end(); i++ )
141  {
142  AlignmentErrors* tmpAlignmentErrors = (*i)->alignmentErrors();
143  std::copy( tmpAlignmentErrors->m_alignError.begin(), tmpAlignmentErrors->m_alignError.end(),
144  std::back_inserter(m_alignmentErrors->m_alignError) );
145  delete tmpAlignmentErrors;
146  }
147 
148  std::sort( m_alignmentErrors->m_alignError.begin(), m_alignmentErrors->m_alignError.end(),
150 
151  return m_alignmentErrors;
152 
153 }
154 
int i
Definition: DBlmapReader.cc:9
T perp() const
Definition: PV3DBase.h:72
AlignmentErrors * alignmentErrors() const
Return vector of alignment errors.
AlignableCSCEndcap(const std::vector< AlignableCSCStation * > cscStations)
The constructor simply copies the vector of stations and computes the surface from them...
std::vector< AlignTransformError > m_alignError
~AlignableCSCEndcap()
Clean delete of the vector and its elements.
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
virtual std::vector< Alignable * > components() const
Return vector of direct components.
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:132
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
std::vector< AlignTransform > m_align
Definition: Alignments.h:17
void setSurface(const AlignableSurface &s)
void dump(void) const
Recursive printout of the muon End Cap structure.
AlignableSurface computeSurface()
T z() const
Definition: PV3DBase.h:64
Alignments * alignments() const
Return alignment data.
RotationType computeOrientation()
Just initialize to default given by default constructor of a RotationType.
std::vector< AlignableCSCStation * > theCSCStations
double b
Definition: hdecay.h:120
align::RotationType RotationType
Definition: Alignable.h:36
align::PositionType PositionType
Definition: Alignable.h:35
PositionType computePosition()
Compute average z position from all components (x and y forced to 0)
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:129
int size() const
Return number of direct components.
Definition: Alignable.h:67
AlignableCSCStation & station(int i)
Return AlignableCSCEndcap station at given index.