CMS 3D CMS Logo

AlignableCSCRing.cc
Go to the documentation of this file.
1 
11 
12 
13 
15 AlignableCSCRing::AlignableCSCRing( const std::vector<AlignableCSCChamber*>& cscChambers )
16  : AlignableComposite(cscChambers[0]->id(), align::AlignableCSCRing)
17 {
18 
19  theCSCChambers.insert( theCSCChambers.end(), cscChambers.begin(), cscChambers.end() );
20 
21  // maintain also list of components
22  for (const auto& chamber: cscChambers) {
23  const auto mother = chamber->mother();
24  this->addComponent(chamber); // components will be deleted by dtor of AlignableComposite
25  chamber->setMother(mother); // restore previous behaviour where mother is not set
26  }
27 
30 }
31 
32 
35 {
36 
37  if (i >= size() )
38  throw cms::Exception("LogicError") << "CSC Chamber index (" << i << ") out of range";
39 
40  return *theCSCChambers[i];
41 
42 }
43 
44 
48 {
49 
51 
52 }
53 
54 
55 
58 {
59 
60  float zz = 0.;
61 
62  for ( std::vector<AlignableCSCChamber*>::iterator ichamber = theCSCChambers.begin();
63  ichamber != theCSCChambers.end(); ichamber++ )
64  zz += (*ichamber)->globalPosition().z();
65 
66  zz /= static_cast<float>(theCSCChambers.size());
67 
68  return PositionType( 0.0, 0.0, zz );
69 
70 }
71 
72 
75 {
76  return RotationType();
77 }
78 
79 
80 // /// Twists all components by given angle
81 // void AlignableCSCRing::twist(float rad)
82 // {
83 // for ( std::vector<AlignableCSCChamber*>::iterator iter = theCSCChambers.begin();
84 // iter != theCSCChambers.end(); iter++ )
85 // (*iter)->twist(rad);
86 
87 // }
88 
89 
91 std::ostream &operator << (std::ostream& os, const AlignableCSCRing& b )
92 {
93 
94  os << "This CSC Ring contains " << b.theCSCChambers.size() << " CSC chambers" << std::endl;
95  os << "(phi, r, z) = (" << b.globalPosition().phi() << ","
96  << b.globalPosition().perp() << "," << b.globalPosition().z();
97  os << "), orientation:" << std::endl<< b.globalRotation() << std::endl;
98  return os;
99 
100 }
101 
102 
104 void AlignableCSCRing::dump( void ) const
105 {
106 
107  edm::LogInfo("AlignableDump") << (*this);
108  for ( std::vector<AlignableCSCChamber*>::const_iterator iChamber = theCSCChambers.begin();
109  iChamber != theCSCChambers.end(); iChamber++ )
110  edm::LogInfo("AlignableDump") << (**iChamber);
111 
112 }
T perp() const
Definition: PV3DBase.h:72
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
friend std::ostream & operator<<(std::ostream &, const AlignableCSCRing &)
Printout muon CSC Ring information (not recursive)
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:141
AlignableCSCRing(const std::vector< AlignableCSCChamber * > &cscChambers)
The constructor simply copies the vector of CSC Chambers and computes the surface from them...
PositionType computePosition()
Compute average z position from all components (x and y forced to 0)
void setSurface(const AlignableSurface &s)
T z() const
Definition: PV3DBase.h:64
std::vector< AlignableCSCChamber * > theCSCChambers
RotationType computeOrientation()
Just initialize to default given by default constructor of a RotationType.
void setMother(Alignable *mother)
Assign mother to alignable.
Definition: Alignable.h:97
double b
Definition: hdecay.h:120
align::RotationType RotationType
Definition: Alignable.h:34
align::PositionType PositionType
Definition: Alignable.h:33
AlignableSurface computeSurface()
CompConstraintType compConstraintType_
Definition: Alignable.h:255
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:138
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:94
AlignableCSCChamber & chamber(int i)
Return Alignable CSC Chamber at given index.
void addComponent(Alignable *component) final
int size() const
Return number of direct components.
Definition: Alignable.h:71
void dump(void) const override
Recursive printout of the muon CSC Ring structure.
A muon CSC Chamber( an AlignableDet )