CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions
BeamSpotAlignmentParameters Class Reference

#include <BeamSpotAlignmentParameters.h>

Inheritance diagram for BeamSpotAlignmentParameters:
AlignmentParameters

Public Types

enum  AlignmentParameterName {
  dx = 0, dy, dxslope, dyslope,
  N_PARAM
}
 Give parameters a name. More...
 
- Public Types inherited from AlignmentParameters
typedef AlignmentParametersData::DataContainer DataContainer
 

Public Member Functions

void apply () override
 apply parameters to alignable More...
 
 BeamSpotAlignmentParameters (Alignable *alignable, bool calcMis)
 
 BeamSpotAlignmentParameters (Alignable *alignable, const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix)
 Constructor for full set of parameters. More...
 
 BeamSpotAlignmentParameters (Alignable *alignable, const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix, const std::vector< bool > &selection)
 Constructor for selection. More...
 
BeamSpotAlignmentParametersclone (const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const override
 Clone all parameters (for update of parameters) More...
 
BeamSpotAlignmentParameterscloneFromSelected (const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const override
 Clone selected parameters (for update of parameters) More...
 
AlgebraicMatrix derivatives (const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &) const override
 Get all derivatives. More...
 
AlgebraicVector globalParameters (void) const
 calculate and return parameters in global frame More...
 
void print (void) const
 print parameters to screen More...
 
AlgebraicVector rotation (void) const
 Get rotation parameters. More...
 
AlgebraicMatrix selectedDerivatives (const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &) const override
 Get selected derivatives. More...
 
AlgebraicVector translation (void) const
 Get translation parameters. More...
 
int type () const override
 tell type (AlignmentParametersFactory::ParametersType - but no circular dependency) More...
 
 ~BeamSpotAlignmentParameters () override
 Destructor. More...
 
- Public Member Functions inherited from AlignmentParameters
Alignablealignable (void) const
 Get pointer to corresponding alignable. More...
 
 AlignmentParameters ()
 Default constructor. More...
 
 AlignmentParameters (Alignable *object, const AlgebraicVector &par, const AlgebraicSymMatrix &cov)
 Constructor from given input. More...
 
 AlignmentParameters (Alignable *object, const AlgebraicVector &par, const AlgebraicSymMatrix &cov, const std::vector< bool > &sel)
 Constructor including selection of active parameters. More...
 
 AlignmentParameters (Alignable *object, const DataContainer &data)
 Constructor. More...
 
const AlgebraicSymMatrixcovariance (void) const
 Get parameter covariance matrix. More...
 
virtual unsigned int hierarchyLevel () const
 
bool isValid (void) const
 Get validity flag. More...
 
int numSelected (void) const
 Get number of selected parameters. More...
 
const AlgebraicVectorparameters (void) const
 Get alignment parameters. More...
 
AlgebraicSymMatrix selectedCovariance (void) const
 Get covariance matrix of selected parameters. More...
 
AlgebraicVector selectedParameters (void) const
 Get selected parameters. More...
 
const std::vector< bool > & selector (void) const
 Get alignment parameter selector vector. More...
 
void setUserVariables (AlignmentUserVariables *auv)
 Set pointer to user variables. More...
 
void setValid (bool v)
 Set validity flag. More...
 
int size (void) const
 Get number of parameters. More...
 
AlignmentUserVariablesuserVariables (void) const
 Get pointer to user variables. More...
 
virtual ~AlignmentParameters ()
 Destructor. More...
 

Static Public Member Functions

static AlgebraicVector displacementFromAlignable (const Alignable *ali)
 

Additional Inherited Members

- Protected Member Functions inherited from AlignmentParameters
AlgebraicSymMatrix collapseSymMatrix (const AlgebraicSymMatrix &m, const std::vector< bool > &sel) const
 
AlgebraicVector collapseVector (const AlgebraicVector &m, const std::vector< bool > &sel) const
 
AlgebraicSymMatrix expandSymMatrix (const AlgebraicSymMatrix &m, const std::vector< bool > &sel) const
 
AlgebraicVector expandVector (const AlgebraicVector &m, const std::vector< bool > &sel) const
 
- Protected Attributes inherited from AlignmentParameters
bool bValid
 True if parameters are valid. More...
 
AlignabletheAlignable
 
DataContainer theData
 
AlignmentUserVariablestheUserVariables
 

Detailed Description

Concrete class for alignment parameters and associated quantities [derived from AlignmentParameters]. The number of parameters N_PARAM is fixed to 4 (2 translations in x & y, and 2 slopes)

Date
2008/09/02 15:08:12
Revision
1.13

(last update by

Author
flucke

)

Definition at line 21 of file BeamSpotAlignmentParameters.h.

Member Enumeration Documentation

◆ AlignmentParameterName

Give parameters a name.

Enumerator
dx 
dy 
dxslope 
dyslope 
N_PARAM 

Definition at line 24 of file BeamSpotAlignmentParameters.h.

24 { dx = 0, dy, dxslope, dyslope, N_PARAM };

Constructor & Destructor Documentation

◆ BeamSpotAlignmentParameters() [1/3]

BeamSpotAlignmentParameters::BeamSpotAlignmentParameters ( Alignable alignable,
bool  calcMis 
)

Constructor with empty parameters/covariance (if calcMis = false) or with parameters (no covariance) created from current (mis-)placement of alignable (if calcMis = true).

Definition at line 21 of file BeamSpotAlignmentParameters.cc.

22  : AlignmentParameters(ali, displacementFromAlignable(calcMis ? ali : nullptr), AlgebraicSymMatrix(N_PARAM, 0)) {}

Referenced by clone(), and cloneFromSelected().

◆ BeamSpotAlignmentParameters() [2/3]

BeamSpotAlignmentParameters::BeamSpotAlignmentParameters ( Alignable alignable,
const AlgebraicVector parameters,
const AlgebraicSymMatrix covMatrix 
)

Constructor for full set of parameters.

Definition at line 25 of file BeamSpotAlignmentParameters.cc.

29  if (parameters.num_row() != N_PARAM) {
30  throw cms::Exception("BadParameters")
31  << "in BeamSpotAlignmentParameters(): " << parameters.num_row() << " instead of " << N_PARAM << " parameters.";
32  }
33 }

References Exception, and N_PARAM.

◆ BeamSpotAlignmentParameters() [3/3]

BeamSpotAlignmentParameters::BeamSpotAlignmentParameters ( Alignable alignable,
const AlgebraicVector parameters,
const AlgebraicSymMatrix covMatrix,
const std::vector< bool > &  selection 
)

Constructor for selection.

Definition at line 36 of file BeamSpotAlignmentParameters.cc.

41  if (parameters.num_row() != N_PARAM) {
42  throw cms::Exception("BadParameters")
43  << "in BeamSpotAlignmentParameters(): " << parameters.num_row() << " instead of " << N_PARAM << " parameters.";
44  }
45 }

References Exception, and N_PARAM.

◆ ~BeamSpotAlignmentParameters()

BeamSpotAlignmentParameters::~BeamSpotAlignmentParameters ( )
override

Destructor.

Definition at line 48 of file BeamSpotAlignmentParameters.cc.

48 {}

Member Function Documentation

◆ apply()

void BeamSpotAlignmentParameters::apply ( )
overridevirtual

apply parameters to alignable

Implements AlignmentParameters.

Definition at line 147 of file BeamSpotAlignmentParameters.cc.

147  {
148  Alignable *alignable = this->alignable();
149  if (!alignable) {
150  throw cms::Exception("BadParameters") << "BeamSpotAlignmentParameters::apply: parameters without alignable";
151  }
152 
153  // Translation in local frame
154  AlgebraicVector shift = this->translation(); // fixme: should be LocalVector
155 
156  // Translation local->global
157  align::GlobalVector gv(shift[0], shift[1], shift[2]);
158  alignable->move(gv);
159 
160  // Rotation in local frame
162  // original code:
163  // alignable->rotateInLocalFrame( align::toMatrix(angles) );
164  // correct for rounding errors:
168 }

References AlignmentParameters::alignable(), particleFlowDisplacedVertex_cfi::angles, Exception, Alignable::move(), align::rectify(), makeMuonMisalignmentScenario::rot, Alignable::rotateInGlobalFrame(), rotation(), edm::shift, Alignable::surface(), AlignableSurface::toGlobal(), align::toMatrix(), and translation().

Referenced by heavyIonTools.ConfigureHeavyIons::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), cmsswVersionTools.PickRelValInputFiles::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::__call__(), heavyIonTools.SelectionDefaults::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), tauTools.AddTauCollection::__call__(), trackTools.MakeTrackCandidates::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.AddJetCollection::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), and jetTools.SetTagInfos::__call__().

◆ clone()

BeamSpotAlignmentParameters * BeamSpotAlignmentParameters::clone ( const AlgebraicVector parameters,
const AlgebraicSymMatrix covMatrix 
) const
overridevirtual

◆ cloneFromSelected()

BeamSpotAlignmentParameters * BeamSpotAlignmentParameters::cloneFromSelected ( const AlgebraicVector parameters,
const AlgebraicSymMatrix covMatrix 
) const
overridevirtual

◆ derivatives()

AlgebraicMatrix BeamSpotAlignmentParameters::derivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alidet 
) const
overridevirtual

Get all derivatives.

Implements AlignmentParameters.

Definition at line 76 of file BeamSpotAlignmentParameters.cc.

77  {
78  const Alignable *ali = this->alignable(); // Alignable of these parameters
79 
80  if (ali == alidet) { // same alignable => same frame
81  return BeamSpotAlignmentDerivatives()(tsos);
82  } else {
83  throw cms::Exception("MisMatch") << "BeamSpotAlignmentParameters::derivatives: The hit alignable must "
84  "match the "
85  << "aligned one, i.e. these parameters make only sense for "
86  "AlignableBeamSpot.\n";
87  return AlgebraicMatrix(N_PARAM, 2); // please compiler
88  }
89 }

References AlignmentParameters::alignable(), Exception, and N_PARAM.

Referenced by selectedDerivatives().

◆ displacementFromAlignable()

AlgebraicVector BeamSpotAlignmentParameters::displacementFromAlignable ( const Alignable ali)
static

Calculate parameter vector of misplacements (shift+rotation) from alignable. (If ali=0, return empty AlgebraicVector of proper length.)

Definition at line 203 of file BeamSpotAlignmentParameters.cc.

203  {
204  AlgebraicVector displacement(N_PARAM);
205 
206  if (ali) {
207  const align::RotationType &dR = ali->rotation();
208 
209  const align::LocalVector shifts(ali->globalRotation() * (dR.transposed() * ali->displacement().basicVector()));
210 
211  align::GlobalVector gv(0.0, 0.0, 1.0);
212  align::LocalVector lv(dR.transposed() * gv.basicVector());
213 
214  displacement[0] = shifts.x();
215  displacement[1] = shifts.y();
216  displacement[2] = lv.x() / lv.z();
217  displacement[3] = lv.y() / lv.z();
218  }
219 
220  return displacement;
221 }

References PV3DBase< T, PVType, FrameType >::basicVector(), Alignable::displacement(), HGC3DClusterGenMatchSelector_cfi::dR, Alignable::globalRotation(), N_PARAM, Alignable::rotation(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

◆ globalParameters()

AlgebraicVector BeamSpotAlignmentParameters::globalParameters ( void  ) const

calculate and return parameters in global frame

Definition at line 174 of file BeamSpotAlignmentParameters.cc.

174  {
175  AlgebraicVector m_GlobalParameters(N_PARAM, 0);
176 
177  const AlgebraicVector shift = translation(); // fixme: should return LocalVector
178 
179  const align::GlobalVector dg(shift[0], shift[1], 0);
180 
181  m_GlobalParameters[0] = dg.x();
182  m_GlobalParameters[1] = dg.y();
183 
184  align::LocalVector lv(0.0, 0.0, 1.0);
186 
187  double dxdz = gv.x() / gv.z();
188  double dydz = gv.x() / gv.z();
189 
190  m_GlobalParameters[2] = dxdz;
191  m_GlobalParameters[3] = dydz;
192 
193  return m_GlobalParameters;
194 }

References BeamSpotFakeParameters_cfi::dxdz, BeamSpotFakeParameters_cfi::dydz, N_PARAM, edm::shift, Alignable::surface(), AlignmentParameters::theAlignable, AlignableSurface::toGlobal(), translation(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

◆ print()

void BeamSpotAlignmentParameters::print ( void  ) const

print parameters to screen

Definition at line 197 of file BeamSpotAlignmentParameters.cc.

197  {
198  std::cout << "Contents of BeamSpotAlignmentParameters:"
199  << "\nParameters: " << theData->parameters() << "\nCovariance: " << theData->covariance() << std::endl;
200 }

References gather_cfg::cout, and AlignmentParameters::theData.

◆ rotation()

AlgebraicVector BeamSpotAlignmentParameters::rotation ( void  ) const

Get rotation parameters.

Definition at line 125 of file BeamSpotAlignmentParameters.cc.

125  {
126  AlgebraicVector rot(3);
127 
128  double dxdz = theData->parameters()[2];
129  double dydz = theData->parameters()[3];
130  double angleY = std::atan(dxdz);
131  double angleX = -std::atan(dydz);
132 
133  align::RotationType rotY(std::cos(angleY), 0., -std::sin(angleY), 0., 1., 0., std::sin(angleY), 0., std::cos(angleY));
134 
135  align::RotationType rotX(1., 0., 0., 0., std::cos(angleX), std::sin(angleX), 0., -std::sin(angleX), std::cos(angleX));
136 
138 
139  rot[0] = angles(1);
140  rot[1] = angles(2);
141  rot[2] = angles(3);
142 
143  return rot;
144 }

References particleFlowDisplacedVertex_cfi::angles, funct::cos(), BeamSpotFakeParameters_cfi::dxdz, BeamSpotFakeParameters_cfi::dydz, makeMuonMisalignmentScenario::rot, funct::sin(), AlignmentParameters::theData, and align::toAngles().

Referenced by apply().

◆ selectedDerivatives()

AlgebraicMatrix BeamSpotAlignmentParameters::selectedDerivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alignableDet 
) const
overridevirtual

Get selected derivatives.

Reimplemented from AlignmentParameters.

Definition at line 92 of file BeamSpotAlignmentParameters.cc.

93  {
94  const AlgebraicMatrix dev = this->derivatives(tsos, alignableDet);
95 
96  int ncols = dev.num_col();
97  int nrows = dev.num_row();
98  int nsel = numSelected();
99 
100  AlgebraicMatrix seldev(nsel, ncols);
101 
102  int ir2 = 0;
103  for (int irow = 0; irow < nrows; ++irow) {
104  if (selector()[irow]) {
105  for (int icol = 0; icol < ncols; ++icol)
106  seldev[ir2][icol] = dev[irow][icol];
107  ++ir2;
108  }
109  }
110 
111  return seldev;
112 }

References derivatives(), hgcalPlots::ncols, AlignmentParameters::numSelected(), and AlignmentParameters::selector().

◆ translation()

AlgebraicVector BeamSpotAlignmentParameters::translation ( void  ) const

Get translation parameters.

Definition at line 115 of file BeamSpotAlignmentParameters.cc.

115  {
117  for (int i = 0; i < 2; ++i)
118  shift[i] = theData->parameters()[i];
119  shift[2] = 0.0;
120 
121  return shift;
122 }

References mps_fire::i, edm::shift, and AlignmentParameters::theData.

Referenced by apply(), and globalParameters().

◆ type()

int BeamSpotAlignmentParameters::type ( ) const
overridevirtual

tell type (AlignmentParametersFactory::ParametersType - but no circular dependency)

Implements AlignmentParameters.

Definition at line 171 of file BeamSpotAlignmentParameters.cc.

References AlignmentParametersFactory::kBeamSpot.

Vector3DBase< Scalar, GlobalTag >
AlignmentParameters::theAlignable
Alignable * theAlignable
Definition: AlignmentParameters.h:121
align::toAngles
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
Definition: Utilities.cc:8
BeamSpotAlignmentParameters::rotation
AlgebraicVector rotation(void) const
Get rotation parameters.
Definition: BeamSpotAlignmentParameters.cc:125
AlignmentParameters::expandVector
AlgebraicVector expandVector(const AlgebraicVector &m, const std::vector< bool > &sel) const
Definition: AlignmentParameters.cc:215
TkRotation< Scalar >
hgcalPlots.ncols
ncols
Definition: hgcalPlots.py:105
BeamSpotFakeParameters_cfi.dxdz
dxdz
Definition: BeamSpotFakeParameters_cfi.py:12
mps_fire.i
i
Definition: mps_fire.py:355
AlignmentParameters::theData
DataContainer theData
Definition: AlignmentParameters.h:123
BeamSpotAlignmentParameters::translation
AlgebraicVector translation(void) const
Get translation parameters.
Definition: BeamSpotAlignmentParameters.cc:115
BeamSpotAlignmentParameters::derivatives
AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &) const override
Get all derivatives.
Definition: BeamSpotAlignmentParameters.cc:76
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
Alignable::rotateInGlobalFrame
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
BeamSpotAlignmentDerivatives
Definition: BeamSpotAlignmentDerivatives.h:16
Alignable
Definition: Alignable.h:27
gather_cfg.cout
cout
Definition: gather_cfg.py:144
BeamSpotAlignmentParameters::dxslope
Definition: BeamSpotAlignmentParameters.h:24
AlignmentParameters::userVariables
AlignmentUserVariables * userVariables(void) const
Get pointer to user variables.
Definition: AlignmentParameters.cc:101
BeamSpotAlignmentParameters::BeamSpotAlignmentParameters
BeamSpotAlignmentParameters(Alignable *alignable, bool calcMis)
Definition: BeamSpotAlignmentParameters.cc:21
BeamSpotAlignmentParameters::clone
BeamSpotAlignmentParameters * clone(const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const override
Clone all parameters (for update of parameters)
Definition: BeamSpotAlignmentParameters.cc:51
AlignmentParameters::isValid
bool isValid(void) const
Get validity flag.
Definition: AlignmentParameters.cc:134
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
BeamSpotAlignmentParameters::dy
Definition: BeamSpotAlignmentParameters.h:24
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
corrVsCorr.selection
selection
main part
Definition: corrVsCorr.py:100
align::rectify
void rectify(RotationType &)
Correct a rotation matrix for rounding errors.
Definition: Utilities.cc:185
AlignableSurface::toGlobal
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
Definition: AlignableSurface.cc:15
Alignable::surface
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
BeamSpotAlignmentParameters::N_PARAM
Definition: BeamSpotAlignmentParameters.h:24
Alignable::displacement
const GlobalVector & displacement() const
Return change of the global position since the creation of the object.
Definition: Alignable.h:141
BeamSpotAlignmentParameters::dx
Definition: BeamSpotAlignmentParameters.h:24
BeamSpotAlignmentParameters::dyslope
Definition: BeamSpotAlignmentParameters.h:24
Alignable::rotation
const RotationType & rotation() const
Return change of orientation since the creation of the object.
Definition: Alignable.h:144
AlignmentParameters::AlignmentParameters
AlignmentParameters()
Default constructor.
Definition: AlignmentParameters.cc:9
BeamSpotAlignmentParameters
Definition: BeamSpotAlignmentParameters.h:21
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
AlignmentParameters::expandSymMatrix
AlgebraicSymMatrix expandSymMatrix(const AlgebraicSymMatrix &m, const std::vector< bool > &sel) const
Definition: AlignmentParameters.cc:190
align::EulerAngles
AlgebraicVector EulerAngles
Definition: Definitions.h:34
BeamSpotFakeParameters_cfi.dydz
dydz
Definition: BeamSpotFakeParameters_cfi.py:13
Alignable::move
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
PV3DBase::basicVector
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
particleFlowDisplacedVertex_cfi.angles
angles
Definition: particleFlowDisplacedVertex_cfi.py:84
AlignmentParameters::setValid
void setValid(bool v)
Set validity flag.
Definition: AlignmentParameters.cc:137
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
Exception
Definition: hltDiff.cc:246
AlignmentParameters::numSelected
int numSelected(void) const
Get number of selected parameters.
Definition: AlignmentParameters.cc:51
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
align::toMatrix
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:34
AlignmentParameters::alignable
Alignable * alignable(void) const
Get pointer to corresponding alignable.
Definition: AlignmentParameters.cc:104
AlignmentParameters::selector
const std::vector< bool > & selector(void) const
Get alignment parameter selector vector.
Definition: AlignmentParameters.cc:48
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
BeamSpotAlignmentParameters::displacementFromAlignable
static AlgebraicVector displacementFromAlignable(const Alignable *ali)
Definition: BeamSpotAlignmentParameters.cc:203
AlignmentParametersFactory::kBeamSpot
Definition: AlignmentParametersFactory.h:26
Alignable::globalRotation
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:138
AlignmentParameters::setUserVariables
void setUserVariables(AlignmentUserVariables *auv)
Set pointer to user variables.
Definition: AlignmentParameters.cc:94