CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
AlignmentParameterBuilder Class Reference

#include <AlignmentParameterBuilder.h>

Public Member Functions

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...
 
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...
 
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, AlignableExtras *alignableExtras, const edm::ParameterSet &pSet)
 
 AlignmentParameterBuilder (AlignableTracker *alignableTracker, AlignableMuon *alignableMuon, AlignableExtras *alignableExtras)
 Constructor from tracker and muon. More...
 
 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() [1/4]

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

Constructor from tracker only.

Definition at line 28 of file AlignmentParameterBuilder.cc.

30  : theAlignables(),
32  theAlignableMuon(nullptr),
33  theAlignableExtras(alignableExtras) {}

◆ AlignmentParameterBuilder() [2/4]

AlignmentParameterBuilder::AlignmentParameterBuilder ( AlignableTracker alignableTracker,
AlignableMuon alignableMuon,
AlignableExtras alignableExtras 
)

Constructor from tracker and muon.

Definition at line 36 of file AlignmentParameterBuilder.cc.

39  : theAlignables(),
41  theAlignableMuon(alignableMuon),
42  theAlignableExtras(alignableExtras) {}

◆ AlignmentParameterBuilder() [3/4]

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.

48  : theAlignables(),
50  theAlignableMuon(nullptr),
51  theAlignableExtras(alignableExtras) {
52  this->addAllSelections(pSet);
53 }

References addAllSelections().

◆ AlignmentParameterBuilder() [4/4]

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.

60  : theAlignables(),
62  theAlignableMuon(alignableMuon),
63  theAlignableExtras(alignableExtras) {
64  this->addAllSelections(pSet);
65 }

References addAllSelections().

◆ ~AlignmentParameterBuilder()

virtual AlignmentParameterBuilder::~AlignmentParameterBuilder ( )
inlinevirtual

destructor

Definition at line 48 of file AlignmentParameterBuilder.h.

48 {};

Member Function Documentation

◆ add() [1/2]

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.

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 }

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

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

◆ add() [2/2]

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.

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 }

References alignables(), and EgammaValidation_Wenu_cff::sel.

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

◆ addAllSelections()

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.

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 }

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

Referenced by AlignmentParameterBuilder().

◆ addFullParamSel()

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.

201  {
202  if (!aliParams)
203  return false;
204 
205  aliParams->setUserVariables(new SelectionUserVariables(fullSel));
206 
207  return true;
208 }

References AlignmentParameters::setUserVariables().

Referenced by addSelections().

◆ addSelections()

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.

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 }

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

Referenced by addAllSelections().

◆ alignables()

const align::Alignables& AlignmentParameterBuilder::alignables ( ) const
inline

Get list of alignables for which AlignmentParameters are built.

Definition at line 68 of file AlignmentParameterBuilder.h.

68 { return theAlignables; };

References theAlignables.

Referenced by add(), and addSelections().

◆ alignableTracker()

const AlignableTracker * AlignmentParameterBuilder::alignableTracker ( ) const

Alignable tracker.

Definition at line 67 of file AlignmentParameterBuilder.cc.

67 { return theAlignableTracker; }

References theAlignableTracker.

◆ decodeParamSel()

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.

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 }

References MatrixUtil::remove(), and mps_fire::result.

Referenced by addSelections().

◆ fixAlignables()

void AlignmentParameterBuilder::fixAlignables ( int  n)

Remove n Alignables from list.

Definition at line 148 of file AlignmentParameterBuilder.cc.

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 }

References mps_fire::i, dqmiodumpmetadata::n, and theAlignables.

Member Data Documentation

◆ theAlignableExtras

AlignableExtras* AlignmentParameterBuilder::theAlignableExtras
private

extra Alignables

Definition at line 96 of file AlignmentParameterBuilder.h.

Referenced by addSelections().

◆ theAlignableMuon

AlignableMuon* AlignmentParameterBuilder::theAlignableMuon
private

Alignable muon.

Definition at line 93 of file AlignmentParameterBuilder.h.

Referenced by addSelections().

◆ theAlignables

align::Alignables AlignmentParameterBuilder::theAlignables
private

Vector of alignables.

Definition at line 87 of file AlignmentParameterBuilder.h.

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

◆ theAlignableTracker

AlignableTracker* AlignmentParameterBuilder::theAlignableTracker
private

Alignable tracker.

Definition at line 90 of file AlignmentParameterBuilder.h.

Referenced by addSelections(), and alignableTracker().

AlignmentParameterBuilder::addFullParamSel
bool addFullParamSel(AlignmentParameters *aliPar, const std::vector< char > &fullSel) const
add SelectionUserVariables corresponding to fullSel
Definition: AlignmentParameterBuilder.cc:200
AlignmentParametersFactory::createParameters
AlignmentParameters * createParameters(Alignable *ali, ParametersType parType, const std::vector< bool > &sel)
Definition: AlignmentParametersFactory.cc:83
mps_fire.i
i
Definition: mps_fire.py:355
AlignmentParametersFactory::parametersTypeName
std::string parametersTypeName(ParametersType parType)
Definition: AlignmentParametersFactory.cc:63
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
Alignable::setAlignmentParameters
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Definition: Alignable.cc:123
pos
Definition: PixelAliasList.h:18
SelectionUserVariables
Definition: SelectionUserVariables.h:22
edm::LogInfo
Definition: MessageLogger.h:254
AlignmentParameterBuilder::addAllSelections
void addAllSelections(const edm::ParameterSet &pSet)
master initialisation method, PSet must have form as constructor wants it
Definition: AlignmentParameterBuilder.cc:70
AlignmentParameters
Definition: AlignmentParameters.h:35
AlignmentParameterBuilder::theAlignables
align::Alignables theAlignables
Vector of alignables.
Definition: AlignmentParameterBuilder.h:87
AlignmentParameterBuilder::theAlignableTracker
AlignableTracker * theAlignableTracker
Alignable tracker.
Definition: AlignmentParameterBuilder.h:90
Alignable::alignableObjectId
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
AlignmentParameterBuilder::addSelections
unsigned int addSelections(const edm::ParameterSet &pset, AlignmentParametersFactory::ParametersType parType)
Definition: AlignmentParameterBuilder.cc:87
AlignmentParameterBuilder::alignables
const align::Alignables & alignables() const
Get list of alignables for which AlignmentParameters are built.
Definition: AlignmentParameterBuilder.h:68
align::AlignableDetUnit
Definition: StructureType.h:19
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
AlignmentParameterBuilder::theAlignableMuon
AlignableMuon * theAlignableMuon
Alignable muon.
Definition: AlignmentParameterBuilder.h:93
AlignmentParameterBuilder::decodeParamSel
bool decodeParamSel(std::vector< char > &paramSelChar, std::vector< bool > &result) const
Definition: AlignmentParameterBuilder.cc:175
AlignmentParameterBuilder::alignableTracker
const AlignableTracker * alignableTracker() const
Alignable tracker.
Definition: AlignmentParameterBuilder.cc:67
align::AlignableDet
Definition: StructureType.h:20
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
align::Alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
Exception
Definition: hltDiff.cc:246
MatrixUtil.remove
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:212
AlignmentParameterBuilder::theAlignableExtras
AlignableExtras * theAlignableExtras
extra Alignables
Definition: AlignmentParameterBuilder.h:96
mps_fire.result
result
Definition: mps_fire.py:303
EgammaValidation_Wenu_cff.sel
sel
Definition: EgammaValidation_Wenu_cff.py:33
AlignmentParameterBuilder::add
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.
Definition: AlignmentParameterBuilder.cc:134
AlignmentParametersFactory::parametersType
ParametersType parametersType(const std::string &typeString)
convert string to ParametersType - exception if not known
Definition: AlignmentParametersFactory.cc:22
AlignmentParameterSelector
Definition: AlignmentParameterSelector.h:26