CMS 3D CMS Logo

AlignmentParameterBuilder Class Reference

Build Alignment Parameter Structure. More...

#include <Alignment/CommonAlignmentAlgorithm/interface/AlignmentParameterBuilder.h>

List of all members.

Public Member Functions

bool add (Alignable *alignable, const std::vector< bool > &sel)
 Add a single Alignable, true if it is higher level, false if it is an AlignableDet.
unsigned int add (const align::Alignables &alignables, const std::vector< bool > &sel)
 Add arbitrary selection of Alignables, return number of higher level Alignables.
unsigned int addSelections (const edm::ParameterSet &pset)
 Add selections of Alignables, using AlignmenParameterSelector::addSelections.
const align::Alignablesalignables () const
 Get list of alignables for which AlignmentParameters are built.
 AlignmentParameterBuilder (AlignableTracker *alignableTracker, AlignableMuon *alignableMuon, const edm::ParameterSet &pSet)
 Constructor from tracker and muon, plus selection.
 AlignmentParameterBuilder (AlignableTracker *alignableTracker, const edm::ParameterSet &pSet)
 Constructor adding selections by passing the ParameterSet named 'AlignmentParameterSelector' (expected in pSet) to addSelections(.
 AlignmentParameterBuilder (AlignableTracker *alignableTracker, AlignableMuon *alignableMuon)
 Constructor from tracker and muon.
 AlignmentParameterBuilder (AlignableTracker *alignableTracker)
 Constructor from tracker only.
void fixAlignables (int n)
 Remove n Alignables from list.
virtual ~AlignmentParameterBuilder ()
 destructor

Private Member Functions

bool addFullParamSel (AlignmentParameters *aliPar, const std::vector< char > &fullSel) const
 add SelectionUserVariables corresponding to fullSel
bool decodeParamSel (const std::vector< char > &paramSelChar, std::vector< bool > &result) const
 convert char selection (from ParameterSelector) to bool (for AlignmentParameters) true if anything else than 0 and 1 is found in vector<char>

Private Attributes

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


Detailed Description

Build Alignment Parameter Structure.

Date
2007/10/08 14:38:15
Revision
1.8
(last update by
Author
cklae
)

Definition at line 22 of file AlignmentParameterBuilder.h.


Constructor & Destructor Documentation

AlignmentParameterBuilder::AlignmentParameterBuilder ( AlignableTracker alignableTracker  )  [explicit]

Constructor from tracker only.

Definition at line 24 of file AlignmentParameterBuilder.cc.

00024                                                                                        :
00025   theAlignables(), theAlignableTracker(alignableTracker), theAlignableMuon(0)
00026 {
00027 }

AlignmentParameterBuilder::AlignmentParameterBuilder ( AlignableTracker alignableTracker,
AlignableMuon alignableMuon 
)

Constructor from tracker and muon.

Definition at line 30 of file AlignmentParameterBuilder.cc.

00031                                                                                    :
00032   theAlignables(), theAlignableTracker(alignableTracker), theAlignableMuon(alignableMuon)
00033 {
00034 }

AlignmentParameterBuilder::AlignmentParameterBuilder ( AlignableTracker alignableTracker,
const edm::ParameterSet pSet 
)

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

.)

Definition at line 38 of file AlignmentParameterBuilder.cc.

References addSelections(), and edm::ParameterSet::getParameter().

00039                                                                                   :
00040   theAlignables(), theAlignableTracker(alignableTracker), theAlignableMuon(0)
00041 {
00042   this->addSelections(pSet.getParameter<edm::ParameterSet>("Selector"));
00043 }

AlignmentParameterBuilder::AlignmentParameterBuilder ( AlignableTracker alignableTracker,
AlignableMuon alignableMuon,
const edm::ParameterSet pSet 
)

Constructor from tracker and muon, plus selection.

Definition at line 47 of file AlignmentParameterBuilder.cc.

References addSelections(), and edm::ParameterSet::getParameter().

00049                                                                                   :
00050   theAlignables(), theAlignableTracker(alignableTracker), theAlignableMuon(alignableMuon)
00051 {
00052   this->addSelections(pSet.getParameter<edm::ParameterSet>("Selector"));
00053 }

virtual AlignmentParameterBuilder::~AlignmentParameterBuilder (  )  [inline, virtual]

destructor

Definition at line 42 of file AlignmentParameterBuilder.h.

00042 {};


Member Function Documentation

bool AlignmentParameterBuilder::add ( Alignable alignable,
const std::vector< bool > &  sel 
)

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

Definition at line 89 of file AlignmentParameterBuilder.cc.

References align::AlignableDet, align::AlignableDetUnit, Alignable::alignableObjectId(), RigidBodyAlignmentParameters::N_PARAM, Alignable::setAlignmentParameters(), and theAlignables.

00090 { 
00091 
00092   const AlgebraicVector par(RigidBodyAlignmentParameters::N_PARAM, 0);
00093   const AlgebraicSymMatrix cov(RigidBodyAlignmentParameters::N_PARAM, 0);
00094 
00095   // Which kind of AlignmentParameters must be selectable once we have other parametrisations:
00096   AlignmentParameters *paras = new RigidBodyAlignmentParameters(alignable, par, cov, sel);
00097   alignable->setAlignmentParameters(paras);
00098   theAlignables.push_back(alignable);
00099 
00100   const int aliTypeId = alignable->alignableObjectId();
00101   const bool isHigherLevel = (aliTypeId != align::AlignableDet
00102                               && aliTypeId != align::AlignableDetUnit);
00103   return isHigherLevel;
00104 }

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

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

Definition at line 108 of file AlignmentParameterBuilder.cc.

00110 {
00111 
00112   unsigned int nHigherLevel = 0;
00113 
00114   for (align::Alignables::const_iterator iAli = alignables.begin();
00115        iAli != alignables.end(); ++iAli) {
00116     if (this->add(*iAli, sel)) ++nHigherLevel;
00117   }
00118 
00119   return nHigherLevel;
00120 }

bool AlignmentParameterBuilder::addFullParamSel ( AlignmentParameters aliPar,
const std::vector< char > &  fullSel 
) const [private]

add SelectionUserVariables corresponding to fullSel

Definition at line 180 of file AlignmentParameterBuilder.cc.

References AlignmentParameters::setUserVariables().

Referenced by addSelections().

00182 {
00183   if (!aliParams) return false;
00184 
00185   aliParams->setUserVariables(new SelectionUserVariables(fullSel));
00186 
00187   return true;
00188 }

unsigned int AlignmentParameterBuilder::addSelections ( const edm::ParameterSet pset  ) 

Add selections of Alignables, using AlignmenParameterSelector::addSelections.

For each Alignable, (Composite)RigidBodyAlignmentParameters will be attached using the selection of active parameters done in AlignmenParameterSelector, e.g. 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 57 of file AlignmentParameterBuilder.cc.

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

Referenced by AlignmentParameterBuilder().

00058 {
00059 
00060   AlignmentParameterSelector selector( theAlignableTracker, theAlignableMuon );
00061   const unsigned int addedSets = selector.addSelections(pSet);
00062 
00063   const align::Alignables &alignables = selector.selectedAlignables();
00064   const std::vector<std::vector<char> > &paramSels = selector.selectedParameters();
00065 
00066   align::Alignables::const_iterator iAli = alignables.begin();
00067   std::vector<std::vector<char> >::const_iterator iParamSel = paramSels.begin();
00068   unsigned int nHigherLevel = 0;
00069 
00070   while (iAli != alignables.end() && iParamSel != paramSels.end()) {
00071     std::vector<bool> boolParSel;
00072     bool charSelIsGeneral = this->decodeParamSel(*iParamSel, boolParSel);
00073     if (this->add(*iAli, boolParSel)) ++nHigherLevel;
00074     if (charSelIsGeneral) this->addFullParamSel((*iAli)->alignmentParameters(), *iParamSel);
00075 
00076     ++iAli;
00077     ++iParamSel;
00078   }
00079 
00080   edm::LogInfo("Alignment") << "@SUB=AlignmentParameterBuilder::addSelections"
00081                             << " Added " << addedSets << " set(s) of alignables with "
00082                             << theAlignables.size() << " alignables in total,"
00083                             << " of which " << nHigherLevel << " are higher level.";
00084    
00085   return addedSets;
00086 }

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

Get list of alignables for which AlignmentParameters are built.

Definition at line 58 of file AlignmentParameterBuilder.h.

References theAlignables.

Referenced by addSelections().

00058 { return theAlignables; };

bool AlignmentParameterBuilder::decodeParamSel ( const std::vector< char > &  paramSelChar,
std::vector< bool > &  result 
) const [private]

convert char selection (from ParameterSelector) to bool (for AlignmentParameters) true if anything else than 0 and 1 is found in vector<char>

Definition at line 155 of file AlignmentParameterBuilder.cc.

Referenced by addSelections().

00157 {
00158   result.clear();
00159   bool anyNon01 = false;
00160 
00161   for (unsigned int pos = 0; pos < paramSelChar.size(); ++pos) {
00162 
00163     switch (paramSelChar[pos]) {
00164     default:
00165       anyNon01 = true;
00166       // no break;
00167     case '1':
00168       result.push_back(true);
00169       break;
00170     case '0':
00171       result.push_back(false);
00172       break;
00173     }
00174   }
00175 
00176   return anyNon01;
00177 }

void AlignmentParameterBuilder::fixAlignables ( int  n  ) 

Remove n Alignables from list.

Definition at line 124 of file AlignmentParameterBuilder.cc.

References i, and theAlignables.

00125 {
00126 
00127   if (n<1 || n>3) {
00128     edm::LogError("BadArgument") << " n = " << n << " is not in [1,3]";
00129     return;
00130   }
00131 
00132   align::Alignables theNewAlignables;
00133   int i=0;
00134   int imax = theAlignables.size();
00135   for ( align::Alignables::const_iterator ia=theAlignables.begin();
00136         ia!=theAlignables.end();  ia++ ) 
00137         {
00138           i++;
00139           if ( n==1 && i>1 ) 
00140                 theNewAlignables.push_back(*ia);
00141           else if ( n==2 && i>1 && i<imax ) 
00142                 theNewAlignables.push_back(*ia);
00143           else if ( n==3 && i>2 && i<imax) 
00144                 theNewAlignables.push_back(*ia);
00145         }
00146 
00147   theAlignables = theNewAlignables;
00148 
00149   edm::LogInfo("Alignment") << "@SUB=AlignmentParameterBuilder::fixAlignables"
00150                             << "removing " << n << " alignables, so that " 
00151                             << theAlignables.size() << " alignables left";
00152 }


Member Data Documentation

AlignableMuon* AlignmentParameterBuilder::theAlignableMuon [private]

Alignable muon.

Definition at line 80 of file AlignmentParameterBuilder.h.

Referenced by addSelections().

align::Alignables AlignmentParameterBuilder::theAlignables [private]

Vector of alignables.

Definition at line 74 of file AlignmentParameterBuilder.h.

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

AlignableTracker* AlignmentParameterBuilder::theAlignableTracker [private]

Alignable tracker.

Definition at line 77 of file AlignmentParameterBuilder.h.

Referenced by addSelections().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:14:34 2009 for CMSSW by  doxygen 1.5.4