test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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.

29  :
30  theAlignables(),
31  theAlignableTracker(alignableTracker),
33  theAlignableExtras(alignableExtras)
34 {
35 }
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 38 of file AlignmentParameterBuilder.cc.

40  :
41  theAlignables(),
42  theAlignableTracker(alignableTracker),
43  theAlignableMuon(alignableMuon),
44  theAlignableExtras(alignableExtras)
45 {
46 }
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 50 of file AlignmentParameterBuilder.cc.

References addAllSelections().

52  :
53  theAlignables(),
54  theAlignableTracker(alignableTracker),
56  theAlignableExtras(alignableExtras)
57 {
58  this->addAllSelections(pSet);
59 }
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 62 of file AlignmentParameterBuilder.cc.

References addAllSelections().

65  :
66  theAlignables(),
67  theAlignableTracker(alignableTracker),
68  theAlignableMuon(alignableMuon),
69  theAlignableExtras(alignableExtras)
70 {
71  this->addAllSelections(pSet);
72 }
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 49 of file AlignmentParameterBuilder.h.

49 {};

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 151 of file AlignmentParameterBuilder.cc.

Referenced by addSelections(), and counter.Counter::register().

153 {
154 
155  unsigned int nHigherLevel = 0;
156 
157  for (align::Alignables::const_iterator iAli = alignables.begin();
158  iAli != alignables.end(); ++iAli) {
159  if (this->add(*iAli, parType, sel)) ++nHigherLevel;
160  }
161 
162  return nHigherLevel;
163 }
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 135 of file AlignmentParameterBuilder.cc.

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

Referenced by counter.Counter::register().

138 {
140  alignable->setAlignmentParameters(paras);
141  theAlignables.push_back(alignable);
142 
143  const int aliTypeId = alignable->alignableObjectId();
144  const bool isHigherLevel = (aliTypeId != align::AlignableDet
145  && aliTypeId != align::AlignableDetUnit);
146  return isHigherLevel;
147 }
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Definition: Alignable.cc:110
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 80 of file AlignmentParameterBuilder.cc.

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

Referenced by AlignmentParameterBuilder().

81 {
82  AlignmentParameterSelector selector(0);
83  std::vector<std::string> selsTypes(pSet.getParameter<std::vector<std::string> >("parameterTypes"));
84 
85  for (unsigned int i = 0; i < selsTypes.size(); ++i) {
86  std::vector<std::string> selSetType(selector.decompose(selsTypes[i], ','));
87  if (selSetType.size() != 2) {
88  throw cms::Exception("BadConfig") << "AlignmentParameterBuilder"
89  << "parameterTypes should contain 2 comma separated strings"
90  << ", but found '" << selsTypes[i] << "'.";
91  }
92  this->addSelections(pSet.getParameter<edm::ParameterSet>(selSetType[0]),
94  }
95 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
unsigned int addSelections(const edm::ParameterSet &pset, AlignmentParametersFactory::ParametersType parType)
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 227 of file AlignmentParameterBuilder.cc.

References AlignmentParameters::setUserVariables().

Referenced by addSelections().

229 {
230  if (!aliParams) return false;
231 
232  aliParams->setUserVariables(new SelectionUserVariables(fullSel));
233 
234  return true;
235 }
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 98 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().

100 {
101 
102  const unsigned int oldAliSize = theAlignables.size();
103 
105  const unsigned int addedSets = selector.addSelections(pSet);
106 
107  const align::Alignables &alignables = selector.selectedAlignables();
108  const std::vector<std::vector<char> > &paramSels = selector.selectedParameters();
109 
110  align::Alignables::const_iterator iAli = alignables.begin();
111  std::vector<std::vector<char> >::const_iterator iParamSel = paramSels.begin();
112  unsigned int nHigherLevel = 0;
113 
114  while (iAli != alignables.end() && iParamSel != paramSels.end()) {
115  std::vector<bool> boolParSel;
116  std::vector<char> parSel(*iParamSel); // copy, since decodeParamSel may manipulate
117  bool charSelIsGeneral = this->decodeParamSel(parSel, boolParSel);
118  if (this->add(*iAli, parType, boolParSel)) ++nHigherLevel;
119  if (charSelIsGeneral) this->addFullParamSel((*iAli)->alignmentParameters(), parSel);
120 
121  ++iAli;
122  ++iParamSel;
123  }
124 
125  edm::LogInfo("Alignment") << "@SUB=AlignmentParameterBuilder::addSelections"
126  << " Added " << addedSets << " set(s) of alignables with "
127  << theAlignables.size() - oldAliSize << " alignables in total,"
128  << " of which " << nHigherLevel << " are higher level "
129  << "(using " << parametersTypeName(parType) << "AlignmentParameters).";
130 
131  return addedSets;
132 }
std::string parametersTypeName(ParametersType parType)
convert ParametersType to string understood by parametersType(string &amp;typeString) ...
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.
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
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 71 of file AlignmentParameterBuilder.h.

References theAlignables.

Referenced by addSelections().

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

Alignable tracker.

Definition at line 74 of file AlignmentParameterBuilder.cc.

References theAlignableTracker.

75 {
76  return theAlignableTracker;
77 }
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 198 of file AlignmentParameterBuilder.cc.

References MatrixUtil::remove().

Referenced by addSelections().

200 {
201  result.clear();
202  // remove all spaces from paramSelChar - useful to group the parameters if they are many
203  paramSelChar.erase(std::remove(paramSelChar.begin(), paramSelChar.end(), ' '),
204  paramSelChar.end());
205 
206  bool anyNon01 = false;
207 
208  for (unsigned int pos = 0; pos < paramSelChar.size(); ++pos) {
209 
210  switch (paramSelChar[pos]) {
211  default:
212  anyNon01 = true;
213  // no break;
214  case '1':
215  result.push_back(true);
216  break;
217  case '0':
218  result.push_back(false);
219  break;
220  }
221  }
222 
223  return anyNon01;
224 }
tuple result
Definition: mps_fire.py:83
void AlignmentParameterBuilder::fixAlignables ( int  n)

Remove n Alignables from list.

Definition at line 167 of file AlignmentParameterBuilder.cc.

References i, and theAlignables.

168 {
169 
170  if (n<1 || n>3) {
171  edm::LogError("BadArgument") << " n = " << n << " is not in [1,3]";
172  return;
173  }
174 
175  align::Alignables theNewAlignables;
176  int i=0;
177  int imax = theAlignables.size();
178  for ( align::Alignables::const_iterator ia=theAlignables.begin();
179  ia!=theAlignables.end(); ++ia )
180  {
181  i++;
182  if ( n==1 && i>1 )
183  theNewAlignables.push_back(*ia);
184  else if ( n==2 && i>1 && i<imax )
185  theNewAlignables.push_back(*ia);
186  else if ( n==3 && i>2 && i<imax)
187  theNewAlignables.push_back(*ia);
188  }
189 
190  theAlignables = theNewAlignables;
191 
192  edm::LogInfo("Alignment") << "@SUB=AlignmentParameterBuilder::fixAlignables"
193  << "removing " << n << " alignables, so that "
194  << theAlignables.size() << " alignables left";
195 }
int i
Definition: DBlmapReader.cc:9
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
align::Alignables theAlignables
Vector of alignables.

Member Data Documentation

AlignableExtras* AlignmentParameterBuilder::theAlignableExtras
private

extra Alignables

Definition at line 99 of file AlignmentParameterBuilder.h.

Referenced by addSelections().

AlignableMuon* AlignmentParameterBuilder::theAlignableMuon
private

Alignable muon.

Definition at line 96 of file AlignmentParameterBuilder.h.

Referenced by addSelections().

align::Alignables AlignmentParameterBuilder::theAlignables
private

Vector of alignables.

Definition at line 90 of file AlignmentParameterBuilder.h.

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

AlignableTracker* AlignmentParameterBuilder::theAlignableTracker
private

Alignable tracker.

Definition at line 93 of file AlignmentParameterBuilder.h.

Referenced by addSelections(), and alignableTracker().