Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
/** \file AlignableDetOrUnitPtr
 *
 *  Original author: Gero Flucke, April 2007
 *
 *  $Date: 2009/02/28 21:05:00 $
 *  $Revision: 1.3 $
 *  (last update by $Author: flucke $)
 */

#include "Alignment/CommonAlignment/interface/AlignableDetOrUnitPtr.h"
#include "Alignment/CommonAlignment/interface/AlignableBeamSpot.h"
#include "Alignment/CommonAlignment/interface/AlignableDet.h"
#include "Alignment/CommonAlignment/interface/AlignableDetUnit.h"

// Due to some implications with includes
// (needed for converison from AlignableDet(Unit)* to Alignable*)
// it is currently not possible to inline the following methods in the header...

///////////////////////////////////////////////////////////////////////////////////////////////////
AlignableDetOrUnitPtr::operator Alignable*() {
  if (theAliBeamSpot)
    return theAliBeamSpot;
  else if (theAliDet)
    return theAliDet;
  else
    return theAliDetUnit;
}

///////////////////////////////////////////////////////////////////////////////////////////////////
AlignableDetOrUnitPtr::operator const Alignable*() const {
  if (theAliBeamSpot)
    return theAliBeamSpot;
  else if (theAliDet)
    return theAliDet;
  else
    return theAliDetUnit;
}

///////////////////////////////////////////////////////////////////////////////////////////////////
const AlignmentPositionError* AlignableDetOrUnitPtr::alignmentPositionError() const {
  if (theAliBeamSpot)
    return theAliBeamSpot->alignmentPositionError();
  else if (theAliDet)
    return theAliDet->alignmentPositionError();
  else if (theAliDetUnit)
    return theAliDetUnit->alignmentPositionError();
  else
    return nullptr;
}