CMS 3D CMS Logo

Classes | Typedefs | Enumerations | Functions
align Namespace Reference

Classes

class  TrackerNameSpace
 

Typedefs

typedef std::vector< Alignable * > Alignables
 
typedef std::vector< std::unique_ptr< AlignmentLevel > > AlignmentLevels
 
typedef math::Vector< 6 >::type AlignParams
 
typedef std::map< std::pair< Alignable *, Alignable * >, AlgebraicMatrixCorrelations
 
using Counter = std::function< unsigned int(align::ID)>
 
typedef AlgebraicMatrix Derivatives
 
typedef math::Error< 6 >::type ErrorMatrix
 
typedef AlgebraicVector EulerAngles
 
typedef Point3DBase< Scalar, GlobalTagGlobalPoint
 
typedef std::vector< GlobalPointGlobalPoints
 
typedef Vector3DBase< Scalar, GlobalTagGlobalVector
 
typedef std::vector< GlobalVectorGlobalVectors
 
typedef uint32_t ID
 
typedef Point3DBase< Scalar, LocalTagLocalPoint
 
typedef std::vector< LocalPointLocalPoints
 
typedef Vector3DBase< Scalar, LocalTagLocalVector
 
typedef std::vector< LocalVectorLocalVectors
 
typedef std::vector< AlignmentParameters * > Parameters
 
typedef Point3DBase< Scalar, GlobalTagPositionType
 
typedef TkRotation< ScalarRotationType
 
using RunNumber = cond::RealTimeType< cond::runnumber >::type
 
using RunRange = std::pair< RunNumber, RunNumber >
 
using RunRanges = std::vector< RunRange >
 
typedef double Scalar
 
typedef std::vector< ScalarScalars
 

Enumerations

enum  StructureType {
  notfound = -1, invalid = 0, AlignableDetUnit, AlignableDet,
  TPBModule, TPBLadder, TPBLayer, TPBHalfBarrel,
  TPBBarrel, TPEModule, TPEPanel, TPEBlade,
  TPEHalfDisk, TPEHalfCylinder, TPEEndcap, TIBModule,
  TIBString, TIBSurface, TIBHalfShell, TIBLayer,
  TIBHalfBarrel, TIBBarrel, TIDModule, TIDSide,
  TIDRing, TIDDisk, TIDEndcap, TOBModule,
  TOBRod, TOBLayer, TOBHalfBarrel, TOBBarrel,
  TECModule, TECRing, TECPetal, TECSide,
  TECDisk, TECEndcap, Pixel, Strip,
  Tracker, AlignableDTBarrel = 100, AlignableDTWheel, AlignableDTStation,
  AlignableDTChamber, AlignableDTSuperLayer, AlignableDTLayer, AlignableCSCEndcap,
  AlignableCSCStation, AlignableCSCRing, AlignableCSCChamber, AlignableCSCLayer,
  AlignableMuon, Detector, Extras = 1000, BeamSpot
}
 

Functions

GlobalVector centerOfMass (const GlobalVectors &theVs)
 Find the CM of a set of points. More...
 
void createPoints (GlobalVectors *Vs, Alignable *ali, const std::string &weightBy, bool weightById, const std::vector< unsigned int > &weightByIdVector)
 
const AlignTransformDetectorGlobalPosition (const Alignments &allGlobals, const DetId &id)
 
AlgebraicVector diffAlignables (Alignable *refAli, Alignable *curAli, const std::string &weightBy, bool weightById, const std::vector< unsigned int > &weightByIdVector)
 
GlobalVector diffR (const GlobalVectors &current, const GlobalVectors &nominal)
 
RotationType diffRot (const GlobalVectors &current, const GlobalVectors &nominal)
 
RunRanges makeNonOverlappingRunRanges (const edm::VParameterSet &runRanges, const RunNumber &defaultRun)
 
RunRanges makeUniqueRunRanges (const edm::VParameterSet &runRanges, const RunNumber &defaultRun)
 
PositionType motherPosition (const std::vector< const PositionType * > &dauPos)
 Find mother's position from the average of its daughters' positions. More...
 
void moveAlignable (Alignable *ali, AlgebraicVector diff)
 Moves the alignable by the AlgebraicVector. More...
 
bool readModuleList (unsigned int, unsigned int, const std::vector< unsigned int > &)
 
void rectify (RotationType &)
 Correct a rotation matrix for rounding errors. More...
 
EulerAngles toAngles (const RotationType &)
 Convert rotation matrix to angles about x-, y-, z-axes (frame rotation). More...
 
RotationType toMatrix (const EulerAngles &)
 Convert rotation angles about x-, y-, z-axes to matrix. More...
 

Detailed Description

Tools for comparing alignables

Date
2008/06/17 12:46:54
Revision
1.5
Author
Nhan Tran

Namespace for common calculations in alignment.

Date
2007/10/08 15:22:08
Revision
1.10
Author
Chung Khim Lae

Namespace for common type definitions used in alignment.

Date
2007/04/09 00:26:08
Revision
1.2
Author
Chung Khim Lae

Typedef Documentation

◆ Alignables

typedef std::vector<Alignable*> align::Alignables

Definition at line 31 of file Utilities.h.

◆ AlignmentLevels

typedef std::vector<std::unique_ptr<AlignmentLevel> > align::AlignmentLevels

Definition at line 33 of file Utilities.h.

◆ AlignParams

Definition at line 36 of file Definitions.h.

◆ Correlations

typedef std::map<std::pair<Alignable*, Alignable*>, AlgebraicMatrix> align::Correlations

Definition at line 35 of file Utilities.h.

◆ Counter

using align::Counter = typedef std::function<unsigned int(align::ID)>

Definition at line 31 of file AlignableIndexer.h.

◆ Derivatives

Definition at line 35 of file Definitions.h.

◆ ErrorMatrix

Definition at line 37 of file Definitions.h.

◆ EulerAngles

Definition at line 34 of file Definitions.h.

◆ GlobalPoint

Definition at line 29 of file Definitions.h.

◆ GlobalPoints

typedef std::vector<GlobalPoint> align::GlobalPoints

Definition at line 27 of file Utilities.h.

◆ GlobalVector

Definition at line 31 of file Definitions.h.

◆ GlobalVectors

typedef std::vector<GlobalVector> align::GlobalVectors

Definition at line 28 of file Utilities.h.

◆ ID

typedef uint32_t align::ID

Definition at line 24 of file Definitions.h.

◆ LocalPoint

Definition at line 30 of file Definitions.h.

◆ LocalPoints

typedef std::vector<LocalPoint> align::LocalPoints

Definition at line 29 of file Utilities.h.

◆ LocalVector

Definition at line 32 of file Definitions.h.

◆ LocalVectors

typedef std::vector<LocalVector> align::LocalVectors

Definition at line 30 of file Utilities.h.

◆ Parameters

typedef std::vector<AlignmentParameters*> align::Parameters

Definition at line 32 of file Utilities.h.

◆ PositionType

Definition at line 28 of file Definitions.h.

◆ RotationType

Definition at line 27 of file Definitions.h.

◆ RunNumber

Definition at line 37 of file Utilities.h.

◆ RunRange

using align::RunRange = typedef std::pair<RunNumber, RunNumber>

Definition at line 38 of file Utilities.h.

◆ RunRanges

using align::RunRanges = typedef std::vector<RunRange>

Definition at line 39 of file Utilities.h.

◆ Scalar

typedef double align::Scalar

Definition at line 25 of file Definitions.h.

◆ Scalars

typedef std::vector<Scalar> align::Scalars

Definition at line 26 of file Utilities.h.

Enumeration Type Documentation

◆ StructureType

Enumerate the types of structure an alignable can be.

Basically list the levels in the detector's hierarchy.

Date
2010/09/10 10:28:38
Revision
1.5
Author
Chung Khim Lae
Enumerator
notfound 
invalid 
AlignableDetUnit 
AlignableDet 
TPBModule 
TPBLadder 
TPBLayer 
TPBHalfBarrel 
TPBBarrel 
TPEModule 
TPEPanel 
TPEBlade 
TPEHalfDisk 
TPEHalfCylinder 
TPEEndcap 
TIBModule 
TIBString 
TIBSurface 
TIBHalfShell 
TIBLayer 
TIBHalfBarrel 
TIBBarrel 
TIDModule 
TIDSide 
TIDRing 
TIDDisk 
TIDEndcap 
TOBModule 
TOBRod 
TOBLayer 
TOBHalfBarrel 
TOBBarrel 
TECModule 
TECRing 
TECPetal 
TECSide 
TECDisk 
TECEndcap 
Pixel 
Strip 
Tracker 
AlignableDTBarrel 
AlignableDTWheel 
AlignableDTStation 
AlignableDTChamber 
AlignableDTSuperLayer 
AlignableDTLayer 
AlignableCSCEndcap 
AlignableCSCStation 
AlignableCSCRing 
AlignableCSCChamber 
AlignableCSCLayer 
AlignableMuon 
Detector 
Extras 
BeamSpot 

Definition at line 16 of file StructureType.h.

16  {
17  notfound = -1,
18  invalid = 0,
21 
22  // Barrel Pixel
23  TPBModule,
24  TPBLadder,
25  TPBLayer, // = 5
27  TPBBarrel,
28 
29  // Forward Pixel
30  TPEModule,
31  TPEPanel,
32  TPEBlade, // = 10
35  TPEEndcap,
36 
37  // Tracker Inner Barrel
38  TIBModule,
39  TIBString, // = 15
40  TIBSurface,
42  TIBLayer,
44  TIBBarrel, // = 20
45 
46  // Tracker Inner Disks
47  TIDModule,
48  TIDSide,
49  TIDRing,
50  TIDDisk,
51  TIDEndcap, // = 25
52 
53  // Tracker Outer Barrel
54  TOBModule,
55  TOBRod,
56  TOBLayer,
58  TOBBarrel, // = 30
59 
60  // Tracker Endcaps
61  TECModule,
62  TECRing,
63  TECPetal,
64  TECSide,
65  TECDisk, // = 35
66  TECEndcap,
67 
68  Pixel,
69  Strip,
70  Tracker, // = 39
71 
72  // Muon Detector, not touching these now
73  AlignableDTBarrel = 100,
78  AlignableDTLayer, // = 105
83  AlignableCSCLayer, // = 110
85 
86  Detector, // = 112 (what for?)
87 
88  Extras = 1000,
89  BeamSpot
90  };

Function Documentation

◆ centerOfMass()

align::GlobalVector align::centerOfMass ( const GlobalVectors theVs)

Find the CM of a set of points.

Definition at line 174 of file Utilities.cc.

174  {
175  unsigned int nPoints = theVs.size();
176 
177  GlobalVector CM(0, 0, 0);
178 
179  for (unsigned int j = 0; j < nPoints; ++j)
180  CM += theVs[j];
181 
182  return CM /= static_cast<Scalar>(nPoints);
183 }

References dqmiolumiharvest::j.

Referenced by MuonGeometryArrange::compareGeometries(), and diffAlignables().

◆ createPoints()

void align::createPoints ( align::GlobalVectors Vs,
Alignable ali,
const std::string &  weightBy,
bool  weightById,
const std::vector< unsigned int > &  weightByIdVector 
)

Creates the points which are used in diffAlignables A set of points corresponding to lowest daughters

Definition at line 96 of file AlignTools.cc.

100  {
101  std::string copy = weightBy;
102  std::transform(copy.begin(), copy.end(), copy.begin(), (int (*)(int))toupper);
103  if (copy != "SELF") {
104  const auto& comp = ali->components();
105  unsigned int nComp = comp.size();
106  for (unsigned int i = 0; i < nComp; ++i)
107  align::createPoints(Vs, comp[i], weightBy, weightById, weightByIdVector);
108  // double the weight for SS modules if weight by Det
109  if ((ali->alignableObjectId() == align::AlignableDet) && (weightBy == "Det")) {
110  for (unsigned int i = 0; i < nComp; ++i)
111  align::createPoints(Vs, comp[i], weightBy, weightById, weightByIdVector);
112  }
113 
114  //only create points for lowest hiearchical level
116  //check if the raw id or the mother's raw id is on the list
117  bool createPointsForDetUnit = true;
118  if (weightById)
119  createPointsForDetUnit = align::readModuleList(ali->id(), ali->mother()->id(), weightByIdVector);
120  if (createPointsForDetUnit) {
121  //if no survey information, create local points
122  if (!(ali->survey())) {
124  ali->setSurvey(new SurveyDet(ali->surface(), error * 1e-6));
125  }
126  const align::GlobalPoints& points = ali->surface().toGlobal(ali->survey()->localPoints());
127  for (unsigned int j = 0; j < points.size(); ++j) {
129  Vs->push_back(dummy);
130  }
131  }
132  }
133  } else {
134  bool createPointsForDetUnit = true;
135  if (weightById)
136  createPointsForDetUnit = align::readModuleList(ali->id(), ali->mother()->id(), weightByIdVector);
137  if (createPointsForDetUnit) {
138  //if no survey information, create local points
139  if (!(ali->survey())) {
141  ali->setSurvey(new SurveyDet(ali->surface(), error * 1e-6));
142  }
143  const align::GlobalPoints& points = ali->surface().toGlobal(ali->survey()->localPoints());
144  for (unsigned int j = 0; j < points.size(); ++j) {
146  Vs->push_back(dummy);
147  }
148  }
149  }
150 }

References AlignableDet, AlignableDetUnit, Alignable::alignableObjectId(), AlCaHLTBitMon_QueryRunRegistry::comp, Alignable::components(), filterCSVwithJSON::copy, MillePedeFileConverter_cfg::e, relativeConstraints::error, mps_fire::i, Alignable::id(), createfilelist::int, dqmiolumiharvest::j, SurveyDet::localPoints(), Alignable::mother(), HLT_FULL_cff::points, readModuleList(), Alignable::setSurvey(), AlCaHLTBitMon_QueryRunRegistry::string, Alignable::surface(), Alignable::survey(), AlignableSurface::toGlobal(), HcalDetIdTransform::transform(), genVertex_cff::x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

Referenced by MuonGeometryArrange::compareGeometries(), and diffAlignables().

◆ DetectorGlobalPosition()

const AlignTransform & align::DetectorGlobalPosition ( const Alignments allGlobals,
const DetId id 
)

Definition at line 10 of file DetectorGlobalPosition.cc.

10  {
11  for (std::vector<AlignTransform>::const_iterator iter = allGlobals.m_align.begin();
12  iter != allGlobals.m_align.end();
13  ++iter) {
14  if (iter->rawId() == id.rawId()) {
15  return *iter;
16  }
17  }
18 
19  throw cms::Exception("RecordNotFound") << "DetId(" << id.rawId() << ") not found in GlobalPositionRcd" << std::endl;
20  }

References Exception, and Alignments::m_align.

Referenced by TrackerSystematicMisalignments::analyze(), AlignmentMonitorAsAnalyzer::analyze(), TrackerGeometryIntoNtuples::analyze(), AlignmentProducerBase::applyAlignmentsToDB(), MuonAlignmentInputDB::newAlignableMuon(), TrackerDigiGeometryESModule::produce(), MTDDigiGeometryESModule::produce(), GEMGeometryESModule::produce(), CSCGeometryESModule::produce(), DTGeometryESModule::produce(), DTGeometryESProducer::produce(), and AlignmentProducerBase::writeForRunRange().

◆ diffAlignables()

AlgebraicVector align::diffAlignables ( Alignable refAli,
Alignable curAli,
const std::string &  weightBy,
bool  weightById,
const std::vector< unsigned int > &  weightByIdVector 
)

Finds the TR between two alignables - first alignable is reference. Returns a vector with 12 components. First six are global, second six are local.

Definition at line 10 of file AlignTools.cc.

14  {
15  //check they are the same
16  if (refAli->alignableObjectId() != curAli->alignableObjectId()) {
17  if (refAli->id() != curAli->id()) {
18  throw cms::Exception("Geometry Error") << "[AlignTools] Error, Alignables do not match";
19  }
20  }
21 
22  //create points
25  align::createPoints(&refVs, refAli, weightBy, weightById, weightByIdVector);
26  align::createPoints(&curVs, curAli, weightBy, weightById, weightByIdVector);
27 
28  //redefine the set of points
29  //find the translational difference
30  align::GlobalVector theR = align::diffR(curVs, refVs);
31 
32  //CM difference (needed below in rotational transformation)
33  align::GlobalVector pointsCM = align::centerOfMass(curVs);
34  align::PositionType alignableCM = curAli->globalPosition();
35  align::GlobalVector cmdiff(
36  alignableCM.x() - pointsCM.x(), alignableCM.y() - pointsCM.y(), alignableCM.z() - pointsCM.z());
37 
38  //readjust points before finding rotation
41  for (unsigned int k = 0; k < refVs.size(); ++k) {
42  refVs[k] -= CMref;
43  curVs[k] -= CMcur;
44  }
45 
46  //find rotational difference (global)
47  align::RotationType rot = align::diffRot(curVs, refVs);
49  //convert to local rotation
50  align::RotationType localrot = refAli->surface().toLocal(rot);
51  align::EulerAngles theLocalW = align::toAngles(localrot);
52 
53  //adjust translational difference factoring in different rotational CM
54  //needed because rotateInGlobalFrame is about CM of alignable, not points
55  const align::GlobalVector::BasicVectorType& lpvgf = cmdiff.basicVector();
56  align::GlobalVector moveV(rot.multiplyInverse(lpvgf) - lpvgf);
57  align::GlobalVector theRprime(theR + moveV);
58  //convert to local movement
59  align::LocalVector theLocalRprime = refAli->surface().toLocal(theRprime);
60 
61  AlgebraicVector deltaRW(12);
62  // global values
63  deltaRW(1) = theRprime.x();
64  deltaRW(2) = theRprime.y();
65  deltaRW(3) = theRprime.z();
66  deltaRW(4) = theW(1);
67  deltaRW(5) = theW(2);
68  deltaRW(6) = theW(3);
69  // local values
70  deltaRW(7) = theLocalRprime.x();
71  deltaRW(8) = theLocalRprime.y();
72  deltaRW(9) = theLocalRprime.z();
73  deltaRW(10) = theLocalW(1);
74  deltaRW(11) = theLocalW(2);
75  deltaRW(12) = theLocalW(3);
76 
77  refVs.clear();
78  curVs.clear();
79 
80  return deltaRW;
81 }

References Alignable::alignableObjectId(), centerOfMass(), createPoints(), diffR(), diffRot(), Exception, Alignable::globalPosition(), Alignable::id(), dqmdumpme::k, makeMuonMisalignmentScenario::rot, Alignable::surface(), theW, toAngles(), AlignableSurface::toLocal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by MuonGeometryArrange::compareGeometries(), TrackerGeometryCompare::compareGeometries(), and TrackerGeometryCompare::diffCommonTrackerSystem().

◆ diffR()

align::GlobalVector align::diffR ( const GlobalVectors current,
const GlobalVectors nominal 
)

Definition at line 158 of file Utilities.cc.

158  {
159  GlobalVector nCM(0, 0, 0);
160  GlobalVector cCM(0, 0, 0);
161 
162  unsigned int nPoints = nominal.size();
163 
164  for (unsigned int j = 0; j < nPoints; ++j) {
165  nCM += nominal[j];
166  cCM += current[j];
167  }
168 
169  nCM -= cCM;
170 
171  return nCM /= static_cast<Scalar>(nPoints);
172 }

References dqmiolumiharvest::j.

Referenced by diffAlignables(), and CreateSurveyRcds::setGeometry().

◆ diffRot()

align::RotationType align::diffRot ( const GlobalVectors current,
const GlobalVectors nominal 
)

Find matrix to rotate from nominal to current vectors. Assume both sets of vectors have the same size and order.

Definition at line 68 of file Utilities.cc.

68  {
69  // Find the matrix needed to rotate the nominal surface to the current one
70  // using small angle approximation through the equation:
71  //
72  // I * dOmega = dr * r (sum over points)
73  //
74  // where dOmega is a vector of small rotation angles about (x, y, z)-axes,
75  // and I is the inertia tensor defined as
76  //
77  // I_ij = delta_ij * r^2 - r_i * r_j (sum over points)
78  //
79  // delta_ij is the identity matrix. i, j are indices for (x, y, z).
80  //
81  // On the rhs of the first eq, r * dr is the cross product of r and dr.
82  // In this case, r is the nominal vector and dr is the displacement of the
83  // current point from its nominal point (current vector - nominal vector).
84  //
85  // Since the solution of dOmega (by inverting I) gives angles that are small,
86  // we rotate the current surface by -dOmega and repeat the process until the
87  // dOmega^2 is less than a certain tolerance value.
88  // (In other words, we move the current surface by small angular steps till
89  // it matches the nominal surface.)
90  // The full rotation is found by adding up the rotations (given by dOmega)
91  // in each step. (More precisely, the product of all the matrices.)
92  //
93  // Note that, in some cases, if the angular displacement between current and
94  // nominal is pi, the algorithm can return an identity (no rotation).
95  // This is because dr = -r and r * dr is all zero.
96  // This is not a problem since we are dealing with small angles in alignment.
97 
98  static const double tolerance = 1e-12;
99 
100  RotationType rot; // rotation from nominal to current; init to identity
101 
102  // Initial values for dr and I; I is always the same in each step
103 
104  AlgebraicSymMatrix I(3); // inertia tensor
105 
106  GlobalVectors rotated = current; // rotated current vectors in each step
107 
108  unsigned int nPoints = nominal.size();
109 
110  for (unsigned int j = 0; j < nPoints; ++j) {
111  const GlobalVector& r = nominal[j];
112  // Inertial tensor: I_ij = delta_ij * r^2 - r_i * r_j (sum over points)
113 
114  I.fast(1, 1) += r.y() * r.y() + r.z() * r.z();
115  I.fast(2, 2) += r.x() * r.x() + r.z() * r.z();
116  I.fast(3, 3) += r.y() * r.y() + r.x() * r.x();
117  I.fast(2, 1) -= r.x() * r.y(); // row index must be >= col index
118  I.fast(3, 1) -= r.x() * r.z();
119  I.fast(3, 2) -= r.y() * r.z();
120  }
121  int count = 0;
122  while (true) {
123  AlgebraicVector rhs(3); // sum of dr * r
124 
125  for (unsigned int j = 0; j < nPoints; ++j) {
126  const GlobalVector& r = nominal[j];
127  const GlobalVector& c = rotated[j];
128 
129  // Cross product of dr * r = c * r (sum over points)
130 
131  rhs(1) += c.y() * r.z() - c.z() * r.y();
132  rhs(2) += c.z() * r.x() - c.x() * r.z();
133  rhs(3) += c.x() * r.y() - c.y() * r.x();
134  }
135 
136  EulerAngles dOmega = CLHEP::solve(I, rhs);
137 
138  rot *= toMatrix(dOmega); // add to rotation
139 
140  if (dOmega.normsq() < tolerance)
141  break; // converges, so exit loop
142  count++;
143  if (count > 100000) {
144  std::cout << "diffRot infinite loop: dOmega is " << dOmega.normsq() << "\n";
145  break;
146  }
147 
148  // Not yet converge; move current vectors to new positions and find dr
149 
150  for (unsigned int j = 0; j < nPoints; ++j) {
151  rotated[j] = GlobalVector(rot.multiplyInverse(current[j].basicVector()));
152  }
153  }
154 
155  return rot;
156 }

References HltBtagPostValidation_cff::c, submitPVResolutionJobs::count, gather_cfg::cout, MillePedeFileConverter_cfg::e, Exhume::I, dqmiolumiharvest::j, alignCSCRings::r, makeMuonMisalignmentScenario::rot, tolerance, and toMatrix().

Referenced by SurveyResidual::calculate(), MuonGeometryArrange::compareGeometries(), diffAlignables(), and SurveyResidual::sensorResidual().

◆ makeNonOverlappingRunRanges()

align::RunRanges align::makeNonOverlappingRunRanges ( const edm::VParameterSet runRanges,
const RunNumber defaultRun 
)

Definition at line 202 of file Utilities.cc.

202  {
203  const auto beginValue = cond::timeTypeSpecs[cond::runnumber].beginValue;
204  const auto endValue = cond::timeTypeSpecs[cond::runnumber].endValue;
205  RunRanges uniqueRunRanges;
206  if (!runRanges.empty()) {
207  std::map<RunNumber, RunNumber> uniqueFirstRunNumbers;
208  for (const auto& ipset : runRanges) {
209  const auto RunRangeStrings = ipset.getParameter<std::vector<std::string> >("RunRanges");
210  for (const auto& irange : RunRangeStrings) {
211  if (irange.find(':') == std::string::npos) {
212  long int temp{strtol(irange.c_str(), nullptr, 0)};
213  auto first = (temp != -1) ? temp : beginValue;
214  uniqueFirstRunNumbers[first] = first;
215  } else {
216  edm::LogWarning("BadConfig") << "@SUB=align::makeNonOverlappingRunRanges"
217  << "Config file contains old format for 'RunRangeSelection'. Only "
218  << "the start run number is used internally. The number of the last"
219  << " run is ignored and can besafely removed from the config file.";
220  auto tokens = edm::tokenize(irange, ":");
221  long int temp{strtol(tokens[0].c_str(), nullptr, 0)};
222  auto first = (temp != -1) ? temp : beginValue;
223  uniqueFirstRunNumbers[first] = first;
224  }
225  }
226  }
227 
228  for (const auto& iFirst : uniqueFirstRunNumbers) {
229  uniqueRunRanges.push_back(std::make_pair(iFirst.first, endValue));
230  }
231  for (unsigned int i = 0; i < uniqueRunRanges.size() - 1; ++i) {
232  uniqueRunRanges[i].second = uniqueRunRanges[i + 1].first - 1;
233  }
234  } else {
235  uniqueRunRanges.push_back(std::make_pair(defaultRun, endValue));
236  }
237 
238  return uniqueRunRanges;
239 }

References cond::TimeTypeSpecs::beginValue, cond::TimeTypeSpecs::endValue, dqmdumpme::first, mps_fire::i, cond::runnumber, groupFilesInBlocks::temp, cond::timeTypeSpecs, and edm::tokenize().

Referenced by MillePedeAlignmentAlgorithm::areIOVsSpecified(), and makeUniqueRunRanges().

◆ makeUniqueRunRanges()

align::RunRanges align::makeUniqueRunRanges ( const edm::VParameterSet runRanges,
const RunNumber defaultRun 
)

Definition at line 241 of file Utilities.cc.

241  {
242  auto uniqueRunRanges = align::makeNonOverlappingRunRanges(runRanges, defaultRun);
243  if (uniqueRunRanges.empty()) { // create dummy IOV
244  const RunRange runRange(defaultRun, cond::timeTypeSpecs[cond::runnumber].endValue);
245  uniqueRunRanges.push_back(runRange);
246  }
247  return uniqueRunRanges;
248 }

References makeNonOverlappingRunRanges(), cond::runnumber, and cond::timeTypeSpecs.

Referenced by AlignmentProducerBase::storeAlignmentsToDB().

◆ motherPosition()

align::PositionType align::motherPosition ( const std::vector< const PositionType * > &  dauPos)

Find mother's position from the average of its daughters' positions.

Definition at line 50 of file Utilities.cc.

50  {
51  unsigned int nDau = dauPos.size();
52 
53  Scalar posX(0.), posY(0.), posZ(0.); // position of mother
54 
55  for (unsigned int i = 0; i < nDau; ++i) {
56  const PositionType* point = dauPos[i];
57 
58  posX += point->x();
59  posY += point->y();
60  posZ += point->z();
61  }
62 
63  Scalar inv = 1. / static_cast<Scalar>(nDau);
64 
65  return PositionType(posX *= inv, posY *= inv, posZ *= inv);
66 }

References mps_fire::i, point, RecoTauValidation_cfi::posX, and RecoTauValidation_cfi::posY.

Referenced by SurveyResidual::calculate().

◆ moveAlignable()

void align::moveAlignable ( Alignable ali,
AlgebraicVector  diff 
)

Moves the alignable by the AlgebraicVector.

Finds the TR between 2 sets of alignables For example, if TIB/TID were to move as one unit

Definition at line 84 of file AlignTools.cc.

84  {
85  GlobalVector dR(diff[0], diff[1], diff[2]);
86  align::EulerAngles dOmega(3);
87  dOmega[0] = diff[3];
88  dOmega[1] = diff[4];
89  dOmega[2] = diff[5];
90  align::RotationType dRot = align::toMatrix(dOmega);
91  ali->move(dR);
92  ali->rotateInGlobalFrame(dRot);
93 }

References change_name::diff, HGC3DClusterGenMatchSelector_cfi::dR, Alignable::move(), Alignable::rotateInGlobalFrame(), and toMatrix().

Referenced by MuonGeometryArrange::compareGeometries(), TrackerGeometryCompare::compareGeometries(), and TrackerGeometryCompare::setCommonTrackerSystem().

◆ readModuleList()

bool align::readModuleList ( unsigned int  aliId,
unsigned int  motherId,
const std::vector< unsigned int > &  weightByIdVector 
)

Definition at line 152 of file AlignTools.cc.

154  {
155  bool foundId = false;
156 
157  unsigned int sizeVector = weightByIdVector.size();
158 
159  for (unsigned int i = 0; i < sizeVector; ++i) {
160  unsigned int listId = weightByIdVector[i];
161 
162  if (listId == aliId) {
163  foundId = true;
164  break;
165  }
166  if (listId == motherId) {
167  foundId = true;
168  break;
169  }
170  }
171 
172  return foundId;
173 }

References mps_fire::i, and objects.autophobj::motherId.

Referenced by MuonGeometryArrange::compareGeometries(), and createPoints().

◆ rectify()

void align::rectify ( RotationType rot)

Correct a rotation matrix for rounding errors.

Definition at line 185 of file Utilities.cc.

185  {
186  // Use ROOT for better numerical precision but slower.
187 
188  // ROOT::Math::Rotation3D temp( rot.xx(), rot.xy(), rot.xz(),
189  // rot.yx(), rot.yy(), rot.yz(),
190  // rot.zx(), rot.zy(), rot.zz() );
191  //
192  // temp.Rectify();
193  //
194  // Scalar elems[9];
195  //
196  // temp.GetComponents(elems);
197  // rot = RotationType(elems);
198 
199  rot = toMatrix(toAngles(rot)); // fast rectification but less precise
200 }

References makeMuonMisalignmentScenario::rot, toAngles(), and toMatrix().

Referenced by BeamSpotAlignmentParameters::apply(), RigidBodyAlignmentParameters::apply(), BowedSurfaceAlignmentParameters::apply(), TwoBowedSurfacesAlignmentParameters::apply(), AlignmentParameterStore::applyAlignableAbsolutePositions(), MuonAlignmentInputXML::set_one_position(), and SurveyAlignment::shiftSensors().

◆ toAngles()

align::EulerAngles align::toAngles ( const RotationType rot)

Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).

Definition at line 8 of file Utilities.cc.

8  {
9  const Scalar one = 1; // to ensure same precison is used in comparison
10 
12 
13  if (std::abs(rot.zx()) > one) {
14  edm::LogWarning("Alignment") << "Rounding errors in\n" << rot;
15  }
16 
17  if (std::abs(rot.zx()) < one) {
18  angles(1) = -std::atan2(rot.zy(), rot.zz());
19  angles(2) = std::asin(rot.zx());
20  angles(3) = -std::atan2(rot.yx(), rot.xx());
21  } else if (rot.zx() >= one) {
22  angles(1) = std::atan2(rot.xy() + rot.yz(), rot.yy() - rot.xz());
23  angles(2) = std::asin(one);
24  angles(3) = 0;
25  } else if (rot.zx() <= -one) {
26  angles(1) = std::atan2(rot.xy() - rot.yz(), rot.yy() + rot.xz());
27  angles(2) = std::asin(-one);
28  angles(3) = 0;
29  }
30 
31  return angles;
32 }

References funct::abs(), particleFlowDisplacedVertex_cfi::angles, SiPixelPI::one, and makeMuonMisalignmentScenario::rot.

Referenced by AlignmentParameterStore::acquireRelativeParameters(), MuonGeometryArrange::compareGeometries(), diffAlignables(), RigidBodyAlignmentParameters::displacementFromAlignable(), MuonAlignmentInputXML::do_setposition(), MuonGeometryArrange::fillTree(), TrackerGeometryCompare::fillTree(), rectify(), BeamSpotAlignmentParameters::rotation(), SurveyResidual::sensorResidual(), AlignableSurface::toGlobal(), AlignableSurface::toLocal(), SurveyOutput::write(), and MuonAlignmentOutputXML::writeComponents().

◆ toMatrix()

align::RotationType align::toMatrix ( const EulerAngles angles)
Vector3DBase
Definition: Vector3DBase.h:8
align::toAngles
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
Definition: Utilities.cc:8
change_name.diff
diff
Definition: change_name.py:13
TkRotation< Scalar >
align::TPBHalfBarrel
Definition: StructureType.h:26
align::TPEHalfDisk
Definition: StructureType.h:33
mps_fire.i
i
Definition: mps_fire.py:428
SiPixelPI::one
Definition: SiPixelPayloadInspectorHelper.h:39
align::TPBBarrel
Definition: StructureType.h:27
cond::TimeTypeSpecs::beginValue
Time_t beginValue
Definition: Time.h:41
align::TPEBlade
Definition: StructureType.h:32
align::TECEndcap
Definition: StructureType.h:66
align::RotationType
TkRotation< Scalar > RotationType
Definition: Definitions.h:27
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
align::BeamSpot
Definition: StructureType.h:89
HLT_FULL_cff.points
points
Definition: HLT_FULL_cff.py:21455
detailsBasic3DVector::z
float float float z
Definition: extBasic3DVector.h:14
align::RunRange
std::pair< RunNumber, RunNumber > RunRange
Definition: Utilities.h:38
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
align::TOBBarrel
Definition: StructureType.h:58
align::TPBLayer
Definition: StructureType.h:25
Alignable::rotateInGlobalFrame
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
TOBLayer
TBPLayer TOBLayer
Definition: TOBLayer.h:11
gather_cfg.cout
cout
Definition: gather_cfg.py:144
align::TIBSurface
Definition: StructureType.h:40
align::TOBModule
Definition: StructureType.h:54
align::TPEEndcap
Definition: StructureType.h:35
align::TIBModule
Definition: StructureType.h:38
align::PositionType
Point3DBase< Scalar, GlobalTag > PositionType
Definition: Definitions.h:28
align::TIBString
Definition: StructureType.h:39
align::Extras
Definition: StructureType.h:88
align::notfound
Definition: StructureType.h:17
align::readModuleList
bool readModuleList(unsigned int, unsigned int, const std::vector< unsigned int > &)
Definition: AlignTools.cc:152
align::ErrorMatrix
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37
align::diffR
GlobalVector diffR(const GlobalVectors &current, const GlobalVectors &nominal)
Definition: Utilities.cc:158
align::AlignableCSCStation
Definition: StructureType.h:80
indexGen.s2
s2
Definition: indexGen.py:107
AlignableSurface::toLocal
align::RotationType toLocal(const align::RotationType &) const
Return in local frame a rotation given in global frame.
Definition: AlignableSurface.cc:35
GlobalVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
CTPPSpixelLocalTrackReconstructionInfo::invalid
align::AlignableDTChamber
Definition: StructureType.h:76
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
relativeConstraints.error
error
Definition: relativeConstraints.py:53
dqmdumpme.first
first
Definition: dqmdumpme.py:55
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
AlCaHLTBitMon_QueryRunRegistry.comp
comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
align::Scalar
double Scalar
Definition: Definitions.h:25
edm::tokenize
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator
Definition: Parse.cc:52
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
align::Tracker
Definition: StructureType.h:70
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
SurveyDet
Definition: SurveyDet.h:15
align::AlignableMuon
Definition: StructureType.h:84
Alignable::setSurvey
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
align::AlignableCSCLayer
Definition: StructureType.h:83
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
cond::timeTypeSpecs
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:16
align::AlignableDTSuperLayer
Definition: StructureType.h:77
align::AlignableCSCEndcap
Definition: StructureType.h:79
Exhume::I
const std::complex< double > I
Definition: I.h:8
align::makeNonOverlappingRunRanges
RunRanges makeNonOverlappingRunRanges(const edm::VParameterSet &runRanges, const RunNumber &defaultRun)
Definition: Utilities.cc:202
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
TECPetal
CompositeTECPetal TECPetal
Definition: TECPetal.h:7
align::createPoints
void createPoints(GlobalVectors *Vs, Alignable *ali, const std::string &weightBy, bool weightById, const std::vector< unsigned int > &weightByIdVector)
Definition: AlignTools.cc:96
Alignable::alignableObjectId
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
align::TECSide
Definition: StructureType.h:64
align::TOBHalfBarrel
Definition: StructureType.h:57
align::TIBLayer
Definition: StructureType.h:42
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
RecoTauValidation_cfi.posX
posX
Definition: RecoTauValidation_cfi.py:288
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
align::TIBHalfBarrel
Definition: StructureType.h:43
AlignableSurface::toGlobal
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
Definition: AlignableSurface.cc:15
align::centerOfMass
GlobalVector centerOfMass(const GlobalVectors &theVs)
Find the CM of a set of points.
Definition: Utilities.cc:174
Alignable::surface
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
dqmdumpme.k
k
Definition: dqmdumpme.py:60
align::TIDRing
Definition: StructureType.h:49
Point3DBase< Scalar, GlobalTag >
align::TPBLadder
Definition: StructureType.h:24
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
align::AlignableDetUnit
Definition: StructureType.h:19
align::AlignableDTStation
Definition: StructureType.h:75
align::TPEHalfCylinder
Definition: StructureType.h:34
Alignable::id
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
Definition: Alignable.h:180
cond::runnumber
Definition: Time.h:19
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
createfilelist.int
int
Definition: createfilelist.py:10
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
tolerance
const double tolerance
Definition: HGCalGeomParameters.cc:26
cond::TimeTypeSpecs::endValue
Time_t endValue
Definition: Time.h:42
align::TIDModule
Definition: StructureType.h:47
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
align::AlignableCSCChamber
Definition: StructureType.h:82
align::TIDEndcap
Definition: StructureType.h:51
AlignableDTBarrel
Definition: AlignableDTBarrel.h:27
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
align::GlobalVectors
std::vector< GlobalVector > GlobalVectors
Definition: Utilities.h:28
align::EulerAngles
AlgebraicVector EulerAngles
Definition: Definitions.h:34
align::diffRot
RotationType diffRot(const GlobalVectors &current, const GlobalVectors &nominal)
Definition: Utilities.cc:68
SurveyDet::localPoints
const align::LocalPoints & localPoints() const
Definition: SurveyDet.h:64
Alignable::move
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
alignCSCRings.r
r
Definition: alignCSCRings.py:93
align::AlignableDet
Definition: StructureType.h:20
align::TIDDisk
Definition: StructureType.h:50
align::AlignableDTWheel
Definition: StructureType.h:74
align::Detector
Definition: StructureType.h:86
objects.autophobj.motherId
motherId
Definition: autophobj.py:237
particleFlowDisplacedVertex_cfi.angles
angles
Definition: particleFlowDisplacedVertex_cfi.py:84
align::TPEModule
Definition: StructureType.h:30
align::TIBBarrel
Definition: StructureType.h:44
Exception
Definition: hltDiff.cc:246
theW
T theW
Definition: Basic3DVectorLD.h:244
genVertex_cff.x
x
Definition: genVertex_cff.py:12
align::Strip
Definition: StructureType.h:69
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
align::AlignableDTLayer
Definition: StructureType.h:78
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
align::RunRanges
std::vector< RunRange > RunRanges
Definition: Utilities.h:39
align::toMatrix
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:34
align::Pixel
Definition: StructureType.h:68
align::GlobalPoints
std::vector< GlobalPoint > GlobalPoints
Definition: Utilities.h:27
Alignments::m_align
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
align::TECRing
Definition: StructureType.h:62
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
dummy
Definition: DummySelector.h:38
align::TIBHalfShell
Definition: StructureType.h:41
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
Alignable::globalPosition
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:135
align::AlignableCSCRing
Definition: StructureType.h:81
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
align::TECDisk
Definition: StructureType.h:65
Alignable::components
virtual const Alignables & components() const =0
Return vector of all direct components.
Alignable::survey
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:216
Basic3DVector< Scalar >
RecoTauValidation_cfi.posY
posY
Definition: RecoTauValidation_cfi.py:289
align::TIDSide
Definition: StructureType.h:48
align::TECModule
Definition: StructureType.h:61
align::TOBRod
Definition: StructureType.h:55
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
Alignable::mother
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91
align::TPBModule
Definition: StructureType.h:23
align::TPEPanel
Definition: StructureType.h:31