CMS 3D CMS Logo

AlignableDTStation.cc
Go to the documentation of this file.
1 
10 
12 AlignableDTStation::AlignableDTStation(const std::vector<AlignableDTChamber*>& dtChambers)
13  : AlignableComposite(dtChambers[0]->id(), align::AlignableDTStation) {
14  theDTChambers.insert(theDTChambers.end(), dtChambers.begin(), dtChambers.end());
15 
16  // maintain also list of components
17  for (const auto& chamber : dtChambers) {
18  const auto mother = chamber->mother();
19  this->addComponent(chamber); // components will be deleted by dtor of AlignableComposite
20  chamber->setMother(mother); // restore previous behaviour where mother is not set
21  }
22 
25 }
26 
29  if (i >= size())
30  throw cms::Exception("LogicError") << "DT Chamber index (" << i << ") out of range";
31 
32  return *theDTChambers[i];
33 }
34 
39 }
40 
43  float zz = 0.;
44 
45  for (std::vector<AlignableDTChamber*>::iterator ilayer = theDTChambers.begin(); ilayer != theDTChambers.end();
46  ilayer++)
47  zz += (*ilayer)->globalPosition().z();
48 
49  zz /= static_cast<float>(theDTChambers.size());
50 
51  return PositionType(0.0, 0.0, zz);
52 }
53 
56 
58 std::ostream& operator<<(std::ostream& os, const AlignableDTStation& b) {
59  os << "This DT Station contains " << b.theDTChambers.size() << " DT chambers" << std::endl;
60  os << "(phi, r, z) = (" << b.globalPosition().phi() << "," << b.globalPosition().perp() << ","
61  << b.globalPosition().z();
62  os << "), orientation:" << std::endl << b.globalRotation() << std::endl;
63  return os;
64 }
65 
67 void AlignableDTStation::dump(void) const {
68  edm::LogInfo("AlignableDump") << (*this);
69  for (std::vector<AlignableDTChamber*>::const_iterator iChamber = theDTChambers.begin();
70  iChamber != theDTChambers.end();
71  iChamber++)
72  edm::LogInfo("AlignableDump") << (**iChamber);
73 }
A muon DT Chamber( an AlignableDet )
AlignableSurface computeSurface()
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91
RotationType computeOrientation()
Just initialize to default given by default constructor of a RotationType.
AlignableDTChamber & chamber(int i)
Return Alignable DT Chamber at given index.
void setSurface(const AlignableSurface &s)
std::vector< AlignableDTChamber * > theDTChambers
Log< level::Info, false > LogInfo
void setMother(Alignable *mother)
Assign mother to alignable.
Definition: Alignable.h:94
PositionType computePosition()
Compute average z position from all components (x and y forced to 0)
double b
Definition: hdecay.h:118
align::RotationType RotationType
Definition: Alignable.h:31
int size() const
Return number of direct components.
Definition: Alignable.h:68
AlignableDTStation(const std::vector< AlignableDTChamber *> &dtChambers)
The constructor simply copies the vector of DT Chambers and computes the surface from them...
align::PositionType PositionType
Definition: Alignable.h:30
std::ostream & operator<<(std::ostream &os, const AlignableDTStation &b)
Output Station information.
CompConstraintType compConstraintType_
Definition: Alignable.h:246
void addComponent(Alignable *component) final
void dump(void) const override
Recursive printout of the muon DT Station structure.