CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
AlignmentParameterBuilder Class Reference

#include <AlignmentParameterBuilder.h>

Public Member Functions

unsigned int add (const align::Alignables &alignables, AlignmentParametersFactory::ParametersType parType, const std::vector< bool > &sel)
 Add arbitrary selection of Alignables, return number of higher level Alignables. More...
 
bool add (Alignable *alignable, AlignmentParametersFactory::ParametersType parType, const std::vector< bool > &sel)
 Add a single Alignable, true if it is higher level, false if it is an AlignableDet. More...
 
void addAllSelections (const edm::ParameterSet &pSet)
 master initialisation method, PSet must have form as constructor wants it More...
 
unsigned int addSelections (const edm::ParameterSet &pset, AlignmentParametersFactory::ParametersType parType)
 
const align::Alignablesalignables () const
 Get list of alignables for which AlignmentParameters are built. More...
 
const AlignableTrackeralignableTracker () const
 Alignable tracker. More...
 
 AlignmentParameterBuilder (AlignableTracker *alignableTracker, AlignableExtras *alignableExtras)
 Constructor from tracker only. More...
 
 AlignmentParameterBuilder (AlignableTracker *alignableTracker, AlignableMuon *alignableMuon, AlignableExtras *alignableExtras)
 Constructor from tracker and muon. More...
 
 AlignmentParameterBuilder (AlignableTracker *alignableTracker, AlignableExtras *alignableExtras, const edm::ParameterSet &pSet)
 
 AlignmentParameterBuilder (AlignableTracker *alignableTracker, AlignableMuon *alignableMuon, AlignableExtras *alignableExtras, const edm::ParameterSet &pSet)
 Constructor from tracker and muon, plus selection. More...
 
void fixAlignables (int n)
 Remove n Alignables from list. More...
 
virtual ~AlignmentParameterBuilder ()
 destructor More...
 

Private Member Functions

bool addFullParamSel (AlignmentParameters *aliPar, const std::vector< char > &fullSel) const
 add SelectionUserVariables corresponding to fullSel More...
 
bool decodeParamSel (std::vector< char > &paramSelChar, std::vector< bool > &result) const
 

Private Attributes

AlignableExtrastheAlignableExtras
 extra Alignables More...
 
AlignableMuontheAlignableMuon
 Alignable muon. More...
 
align::Alignables theAlignables
 Vector of alignables. More...
 
AlignableTrackertheAlignableTracker
 Alignable tracker. More...
 

Detailed Description

Build Alignment Parameter Structure

Date:
2010/10/26 20:01:51
Revision:
1.11

(last update by

Author:
flucke

)

Definition at line 25 of file AlignmentParameterBuilder.h.

Constructor & Destructor Documentation

AlignmentParameterBuilder::AlignmentParameterBuilder ( AlignableTracker alignableTracker,
AlignableExtras alignableExtras 
)
explicit

Constructor from tracker only.

Definition at line 28 of file AlignmentParameterBuilder.cc.

30  : theAlignables(),
31  theAlignableTracker(alignableTracker),
32  theAlignableMuon(nullptr),
33  theAlignableExtras(alignableExtras) {}
AlignableExtras * theAlignableExtras
extra Alignables
AlignableMuon * theAlignableMuon
Alignable muon.
align::Alignables theAlignables
Vector of alignables.
AlignableTracker * theAlignableTracker
Alignable tracker.
AlignmentParameterBuilder::AlignmentParameterBuilder ( AlignableTracker alignableTracker,
AlignableMuon alignableMuon,
AlignableExtras alignableExtras 
)

Constructor from tracker and muon.

Definition at line 36 of file AlignmentParameterBuilder.cc.

39  : theAlignables(),
40  theAlignableTracker(alignableTracker),
41  theAlignableMuon(alignableMuon),
42  theAlignableExtras(alignableExtras) {}
AlignableExtras * theAlignableExtras
extra Alignables
AlignableMuon * theAlignableMuon
Alignable muon.
align::Alignables theAlignables
Vector of alignables.
AlignableTracker * theAlignableTracker
Alignable tracker.
AlignmentParameterBuilder::AlignmentParameterBuilder ( AlignableTracker alignableTracker,
AlignableExtras alignableExtras,
const edm::ParameterSet pSet 
)

Constructor adding selections by passing the ParameterSet named 'AlignmentParameterSelector' (expected in pSet) to addSelections(..)

Definition at line 45 of file AlignmentParameterBuilder.cc.

References addAllSelections().

48  : theAlignables(),
49  theAlignableTracker(alignableTracker),
50  theAlignableMuon(nullptr),
51  theAlignableExtras(alignableExtras) {
52  this->addAllSelections(pSet);
53 }
AlignableExtras * theAlignableExtras
extra Alignables
AlignableMuon * theAlignableMuon
Alignable muon.
align::Alignables theAlignables
Vector of alignables.
AlignableTracker * theAlignableTracker
Alignable tracker.
void addAllSelections(const edm::ParameterSet &pSet)
master initialisation method, PSet must have form as constructor wants it
AlignmentParameterBuilder::AlignmentParameterBuilder ( AlignableTracker alignableTracker,
AlignableMuon alignableMuon,
AlignableExtras alignableExtras,
const edm::ParameterSet pSet 
)

Constructor from tracker and muon, plus selection.

Definition at line 56 of file AlignmentParameterBuilder.cc.

References addAllSelections().

60  : theAlignables(),
61  theAlignableTracker(alignableTracker),
62  theAlignableMuon(alignableMuon),
63  theAlignableExtras(alignableExtras) {
64  this->addAllSelections(pSet);
65 }
AlignableExtras * theAlignableExtras
extra Alignables
AlignableMuon * theAlignableMuon
Alignable muon.
align::Alignables theAlignables
Vector of alignables.
AlignableTracker * theAlignableTracker
Alignable tracker.
void addAllSelections(const edm::ParameterSet &pSet)
master initialisation method, PSet must have form as constructor wants it
virtual AlignmentParameterBuilder::~AlignmentParameterBuilder ( )
inlinevirtual

destructor

Definition at line 48 of file AlignmentParameterBuilder.h.

48 {};

Member Function Documentation

unsigned int AlignmentParameterBuilder::add ( const align::Alignables alignables,
AlignmentParametersFactory::ParametersType  parType,
const std::vector< bool > &  sel 
)

Add arbitrary selection of Alignables, return number of higher level Alignables.

Definition at line 134 of file AlignmentParameterBuilder.cc.

Referenced by addSelections(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

136  {
137  unsigned int nHigherLevel = 0;
138 
139  for (align::Alignables::const_iterator iAli = alignables.begin(); iAli != alignables.end(); ++iAli) {
140  if (this->add(*iAli, parType, sel))
141  ++nHigherLevel;
142  }
143 
144  return nHigherLevel;
145 }
unsigned int add(const align::Alignables &alignables, AlignmentParametersFactory::ParametersType parType, const std::vector< bool > &sel)
Add arbitrary selection of Alignables, return number of higher level Alignables.
const align::Alignables & alignables() const
Get list of alignables for which AlignmentParameters are built.
bool AlignmentParameterBuilder::add ( Alignable alignable,
AlignmentParametersFactory::ParametersType  parType,
const std::vector< bool > &  sel 
)

Add a single Alignable, true if it is higher level, false if it is an AlignableDet.

Definition at line 123 of file AlignmentParameterBuilder.cc.

References align::AlignableDet, align::AlignableDetUnit, Alignable::alignableObjectId(), AlignmentParametersFactory::createParameters(), Alignable::setAlignmentParameters(), and theAlignables.

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

123  {
125  alignable->setAlignmentParameters(paras);
126  theAlignables.push_back(alignable);
127 
128  const int aliTypeId = alignable->alignableObjectId();
129  const bool isHigherLevel = (aliTypeId != align::AlignableDet && aliTypeId != align::AlignableDetUnit);
130  return isHigherLevel;
131 }
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Definition: Alignable.cc:123
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
AlignmentParameters * createParameters(Alignable *ali, ParametersType parType, const std::vector< bool > &sel)
align::Alignables theAlignables
Vector of alignables.
void AlignmentParameterBuilder::addAllSelections ( const edm::ParameterSet pSet)

master initialisation method, PSet must have form as constructor wants it

Definition at line 70 of file AlignmentParameterBuilder.cc.

References addSelections(), AlignmentParameterSelector::decompose(), Exception, edm::ParameterSet::getParameter(), mps_fire::i, and AlignmentParametersFactory::parametersType().

Referenced by AlignmentParameterBuilder().

70  {
71  AlignmentParameterSelector selector(nullptr);
72  std::vector<std::string> selsTypes(pSet.getParameter<std::vector<std::string> >("parameterTypes"));
73 
74  for (unsigned int i = 0; i < selsTypes.size(); ++i) {
75  std::vector<std::string> selSetType(selector.decompose(selsTypes[i], ','));
76  if (selSetType.size() != 2) {
77  throw cms::Exception("BadConfig") << "AlignmentParameterBuilder"
78  << "parameterTypes should contain 2 comma separated strings"
79  << ", but found '" << selsTypes[i] << "'.";
80  }
81  this->addSelections(pSet.getParameter<edm::ParameterSet>(selSetType[0]),
83  }
84 }
unsigned int addSelections(const edm::ParameterSet &pset, AlignmentParametersFactory::ParametersType parType)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ParametersType parametersType(const std::string &typeString)
convert string to ParametersType - exception if not known
bool AlignmentParameterBuilder::addFullParamSel ( AlignmentParameters aliPar,
const std::vector< char > &  fullSel 
) const
private

add SelectionUserVariables corresponding to fullSel

Definition at line 200 of file AlignmentParameterBuilder.cc.

References AlignmentParameters::setUserVariables().

Referenced by addSelections().

201  {
202  if (!aliParams)
203  return false;
204 
205  aliParams->setUserVariables(new SelectionUserVariables(fullSel));
206 
207  return true;
208 }
unsigned int AlignmentParameterBuilder::addSelections ( const edm::ParameterSet pset,
AlignmentParametersFactory::ParametersType  parType 
)

Add selections of Alignables, using AlignmenParameterSelector::addSelections. For each Alignable, AlignmentParameters of type parType will be attached using the selection of active parameters done in AlignmenParameterSelector, e.g. for RigidBody a selection string '11100' selects the degrees of freedom in (x,y,z), but not (alpha,beta,gamma). Returns number of added selections

Definition at line 87 of file AlignmentParameterBuilder.cc.

References add(), addFullParamSel(), AlignmentParameterSelector::addSelections(), alignables(), decodeParamSel(), AlignmentParametersFactory::parametersTypeName(), AlignmentParameterSelector::selectedAlignables(), AlignmentParameterSelector::selectedParameters(), theAlignableExtras, theAlignableMuon, theAlignables, and theAlignableTracker.

Referenced by addAllSelections().

87  {
88  const unsigned int oldAliSize = theAlignables.size();
89 
91  const unsigned int addedSets = selector.addSelections(pSet);
92 
93  const align::Alignables &alignables = selector.selectedAlignables();
94  const std::vector<std::vector<char> > &paramSels = selector.selectedParameters();
95 
96  align::Alignables::const_iterator iAli = alignables.begin();
97  std::vector<std::vector<char> >::const_iterator iParamSel = paramSels.begin();
98  unsigned int nHigherLevel = 0;
99 
100  while (iAli != alignables.end() && iParamSel != paramSels.end()) {
101  std::vector<bool> boolParSel;
102  std::vector<char> parSel(*iParamSel); // copy, since decodeParamSel may manipulate
103  bool charSelIsGeneral = this->decodeParamSel(parSel, boolParSel);
104  if (this->add(*iAli, parType, boolParSel))
105  ++nHigherLevel;
106  if (charSelIsGeneral)
107  this->addFullParamSel((*iAli)->alignmentParameters(), parSel);
108 
109  ++iAli;
110  ++iParamSel;
111  }
112 
113  edm::LogInfo("Alignment") << "@SUB=AlignmentParameterBuilder::addSelections"
114  << " Added " << addedSets << " set(s) of alignables with "
115  << theAlignables.size() - oldAliSize << " alignables in total,"
116  << " of which " << nHigherLevel << " are higher level "
117  << "(using " << parametersTypeName(parType) << "AlignmentParameters).";
118 
119  return addedSets;
120 }
std::string parametersTypeName(ParametersType parType)
bool decodeParamSel(std::vector< char > &paramSelChar, std::vector< bool > &result) const
AlignableExtras * theAlignableExtras
extra Alignables
bool addFullParamSel(AlignmentParameters *aliPar, const std::vector< char > &fullSel) const
add SelectionUserVariables corresponding to fullSel
AlignableMuon * theAlignableMuon
Alignable muon.
unsigned int add(const align::Alignables &alignables, AlignmentParametersFactory::ParametersType parType, const std::vector< bool > &sel)
Add arbitrary selection of Alignables, return number of higher level Alignables.
Log< level::Info, false > LogInfo
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
align::Alignables theAlignables
Vector of alignables.
AlignableTracker * theAlignableTracker
Alignable tracker.
const align::Alignables & alignables() const
Get list of alignables for which AlignmentParameters are built.
const align::Alignables& AlignmentParameterBuilder::alignables ( ) const
inline

Get list of alignables for which AlignmentParameters are built.

Definition at line 68 of file AlignmentParameterBuilder.h.

References theAlignables.

Referenced by addSelections().

68 { return theAlignables; };
align::Alignables theAlignables
Vector of alignables.
const AlignableTracker * AlignmentParameterBuilder::alignableTracker ( ) const

Alignable tracker.

Definition at line 67 of file AlignmentParameterBuilder.cc.

References theAlignableTracker.

67 { return theAlignableTracker; }
AlignableTracker * theAlignableTracker
Alignable tracker.
bool AlignmentParameterBuilder::decodeParamSel ( std::vector< char > &  paramSelChar,
std::vector< bool > &  result 
) const
private

First remove all spaces (' ') from char selection 'paramSelChar' (coming from ParameterSelector) and then convert the selection to bool (for AlignmentParameters). True if (after removal of spaces) anything else than 0 and 1 is found in vector<char>.

Definition at line 175 of file AlignmentParameterBuilder.cc.

References MatrixUtil::remove().

Referenced by addSelections().

175  {
176  result.clear();
177  // remove all spaces from paramSelChar - useful to group the parameters if they are many
178  paramSelChar.erase(std::remove(paramSelChar.begin(), paramSelChar.end(), ' '), paramSelChar.end());
179 
180  bool anyNon01 = false;
181 
182  for (unsigned int pos = 0; pos < paramSelChar.size(); ++pos) {
183  switch (paramSelChar[pos]) {
184  default:
185  anyNon01 = true;
186  [[fallthrough]];
187  case '1':
188  result.push_back(true);
189  break;
190  case '0':
191  result.push_back(false);
192  break;
193  }
194  }
195 
196  return anyNon01;
197 }
tuple result
Definition: mps_fire.py:311
void AlignmentParameterBuilder::fixAlignables ( int  n)

Remove n Alignables from list.

Definition at line 148 of file AlignmentParameterBuilder.cc.

References mps_fire::i, and theAlignables.

148  {
149  if (n < 1 || n > 3) {
150  edm::LogError("BadArgument") << " n = " << n << " is not in [1,3]";
151  return;
152  }
153 
154  align::Alignables theNewAlignables;
155  int i = 0;
156  int imax = theAlignables.size();
157  for (align::Alignables::const_iterator ia = theAlignables.begin(); ia != theAlignables.end(); ++ia) {
158  i++;
159  if (n == 1 && i > 1)
160  theNewAlignables.push_back(*ia);
161  else if (n == 2 && i > 1 && i < imax)
162  theNewAlignables.push_back(*ia);
163  else if (n == 3 && i > 2 && i < imax)
164  theNewAlignables.push_back(*ia);
165  }
166 
167  theAlignables = theNewAlignables;
168 
169  edm::LogInfo("Alignment") << "@SUB=AlignmentParameterBuilder::fixAlignables"
170  << "removing " << n << " alignables, so that " << theAlignables.size()
171  << " alignables left";
172 }
Log< level::Error, false > LogError
Log< level::Info, false > LogInfo
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
align::Alignables theAlignables
Vector of alignables.

Member Data Documentation

AlignableExtras* AlignmentParameterBuilder::theAlignableExtras
private

extra Alignables

Definition at line 96 of file AlignmentParameterBuilder.h.

Referenced by addSelections().

AlignableMuon* AlignmentParameterBuilder::theAlignableMuon
private

Alignable muon.

Definition at line 93 of file AlignmentParameterBuilder.h.

Referenced by addSelections().

align::Alignables AlignmentParameterBuilder::theAlignables
private

Vector of alignables.

Definition at line 87 of file AlignmentParameterBuilder.h.

Referenced by add(), addSelections(), alignables(), and fixAlignables().

AlignableTracker* AlignmentParameterBuilder::theAlignableTracker
private

Alignable tracker.

Definition at line 90 of file AlignmentParameterBuilder.h.

Referenced by addSelections(), and alignableTracker().