CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

AlignableSiStripDet Class Reference

#include <AlignableSiStripDet.h>

Inheritance diagram for AlignableSiStripDet:
AlignableDet AlignableComposite Alignable

List of all members.

Public Member Functions

 AlignableSiStripDet (const GluedGeomDet *geomDet)
 Constructor.
virtual Alignmentsalignments () const
 first consistify with component detunits, then call method from AlignableDet
virtual ~AlignableSiStripDet ()
 reduntantly make destructor virtual

Private Member Functions

void consistifyAlignments ()
 make alignments consistent with daughters

Private Attributes

const BoundstheMonoBounds
StripGeomDetTypetheMonoType
const BoundstheStereoBounds
StripGeomDetTypetheStereoType

Detailed Description

An alignable for GluedDets in Strip tracker, taking care of consistency with AlignableDet components.

First implementation April/May 2008

Author:
Gero Flucke, Hamburg University
Date:
2009/04/16 16:53:06
Revision:
1.5

Definition at line 23 of file AlignableSiStripDet.h.


Constructor & Destructor Documentation

AlignableSiStripDet::AlignableSiStripDet ( const GluedGeomDet geomDet)

Constructor.

Definition at line 26 of file AlignableSiStripDet.cc.

References AlignableComposite::components(), Exception, GeomDet::geographicalId(), GluedGeomDet::monoDet(), and GluedGeomDet::stereoDet().

  : AlignableDet(gluedDet, true), // true: adding DetUnits
    theMonoBounds  (gluedDet->monoDet()  ->surface().bounds().clone()),
    theStereoBounds(gluedDet->stereoDet()->surface().bounds().clone()),
    theMonoType  (static_cast<const StripGeomDetUnit*>(gluedDet->monoDet())  ->specificType()),
    theStereoType(static_cast<const StripGeomDetUnit*>(gluedDet->stereoDet())->specificType())
{
  // It is not allowed to store a pointer to GeomDet within objects with a life time
  // longer than an Event: 
  // GeomDet comes from TrackerGeometry that is created from GeometricDet that depends on
  // IdealGeometryRecord from EventSetup, so it could change in next event!
  //  ==> Need to store directly what I need from it. 
  // Unfortunately the current way with references for the type does not solve that,
  // either. But currently no way out, see header file.

  // check order mono/stereo
  const Alignables units(this->components());
  if (units.size() != 2
      || gluedDet->monoDet()->geographicalId() != units[0]->geomDetId()
      || gluedDet->stereoDet()->geographicalId() != units[1]->geomDetId()) {
    throw cms::Exception("LogicError")
      << "[AlignableSiStripDet] " << "Either != 2 components or "
      << "mono/stereo in wrong order for consistifyAlignments.";
  }
}
AlignableSiStripDet::~AlignableSiStripDet ( ) [virtual]

reduntantly make destructor virtual

Definition at line 53 of file AlignableSiStripDet.cc.

References theMonoBounds, and theStereoBounds.

{
  delete theMonoBounds;
  delete theStereoBounds;
}

Member Function Documentation

Alignments * AlignableSiStripDet::alignments ( void  ) const [virtual]

first consistify with component detunits, then call method from AlignableDet

Reimplemented from AlignableDet.

Definition at line 60 of file AlignableSiStripDet.cc.

References consistifyAlignments().

{
  const_cast<AlignableSiStripDet*>(this)->consistifyAlignments();

  return this->AlignableDet::alignments();
}
void AlignableSiStripDet::consistifyAlignments ( ) [private]

make alignments consistent with daughters

Definition at line 68 of file AlignableSiStripDet.cc.

References Alignable::addDisplacement(), Alignable::addRotation(), PV3DBase< T, PVType, FrameType >::basicVector(), newFWLiteAna::build, AlignableComposite::components(), Alignable::globalPosition(), Alignable::globalRotation(), GloballyPositioned< T >::position(), Alignable::rotation(), GloballyPositioned< T >::rotation(), theMonoBounds, theMonoType, theStereoBounds, theStereoType, and Alignable::theSurface.

Referenced by alignments().

{
  // make alignments consistent with daughters, calling method from geometry

  // The aim of all this gymnastics is to have the alignments calculated by
  // PlaneBuilderForGluedDet::plane(const std::vector<const GeomDetUnit*> &detComps);
  // 
  // So we take the (new) position and orientation from the AligableDetUnits,
  // but bounds and GeomDetType from original GeomDetUnits to create new GeomDetUnits
  // that are passed to that routine.

  const Alignables aliUnits(this->components()); // order mono==0, stereo==1 checked in ctr.

  BoundPlane::BoundPlanePointer monoPlane
    = BoundPlane::build(aliUnits[0]->globalPosition(), aliUnits[0]->globalRotation(),
                        *theMonoBounds);
  // Fortunately we do not seem to need a GeometricDet pointer and can use 0:
  const StripGeomDetUnit monoDet(&(*monoPlane), &theMonoType, 0);

  BoundPlane::BoundPlanePointer stereoPlane
    = BoundPlane::build(aliUnits[1]->globalPosition(), aliUnits[1]->globalRotation(),
                        *theStereoBounds);
  // Fortunately we do not seem to need a GeometricDet pointer and can use 0:
  const StripGeomDetUnit stereoDet(&(*stereoPlane), &theStereoType, 0);

  std::vector<const GeomDetUnit*> detComps;
  detComps.push_back(&monoDet);   // order mono first, stereo second should be as in...
  detComps.push_back(&stereoDet); // ...TrackerGeomBuilderFromGeometricDet::buildGeomDet

  // Now we have all to calculate new position and rotation via PlaneBuilderForGluedDet.
  const PositionType oldPos(theSurface.position()); // From old surface for keeping...
  const RotationType oldRot(theSurface.rotation()); // ...track of changes.

  PlaneBuilderForGluedDet planeBuilder;
  theSurface = AlignableSurface(*planeBuilder.plane(detComps));

  // But do not forget to keep track of movements/rotations:
  const GlobalVector movement(theSurface.position().basicVector() - oldPos.basicVector());
  // Seems to be correct down to delta angles 4.*1e-8:
  const RotationType rotation(oldRot.multiplyInverse(theSurface.rotation()));
  this->addDisplacement(movement);
  this->addRotation(rotation);

//   this->dumpCompareEuler(oldRot, theSurface.rotation());

//   if (movement.mag2()) { // > 1.e-10) { 
//     edm::LogWarning("Alignment") << "@SUB=consistifyAlignments" 
//                               << "Delta: " << movement.x() << " " << movement.y() << " " << movement.z()
//                               << "\nPos: " << oldPos.perp() << " " << oldPos.phi() << " " << oldPos.z();
//   }

}

Member Data Documentation

The following four members are needed to recalculate the surface in consistifyAlignments, to get rid of a GluedDet* which is disregarded since it could become an invalid pointer in the next event (theoretically...). But this solution is not better, the references for the types would become invalid together with the GeomDets they are taken from. StripGeomDetType has neither clone() and nor a decent copy constructor, so I cannot go the the same way as for the bounds. Sigh!

Definition at line 45 of file AlignableSiStripDet.h.

Referenced by consistifyAlignments(), and ~AlignableSiStripDet().

Definition at line 47 of file AlignableSiStripDet.h.

Referenced by consistifyAlignments().

Definition at line 46 of file AlignableSiStripDet.h.

Referenced by consistifyAlignments(), and ~AlignableSiStripDet().

Definition at line 48 of file AlignableSiStripDet.h.

Referenced by consistifyAlignments().