Skip to content

Commit

Permalink
Merge pull request #6254 from mschrode/mp_averaging_constraints
Browse files Browse the repository at this point in the history
Add option to switch between hierarchy and averaging constraints in MP-b...
  • Loading branch information
davidlange6 committed Nov 11, 2014
2 parents fe8eb7a + 19d89f2 commit 1d3e23f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
Expand Up @@ -152,11 +152,15 @@ class AlignmentParameterStore
AlignmentCorrelationsStore* theCorrelationsStore;

private:
enum TypeOfConstraints { NONE, HIERARCHY_CONSTRAINTS, APPROX_AVERAGING_CONSTRAINTS };

// data members

/// alignables
align::Alignables theAlignables;

/// type of constraints
TypeOfConstraints theTypeOfConstraints;
};

#endif
Expand Up @@ -7,7 +7,8 @@
Weight = cms.double(0.5),
MaxUpdates = cms.int32(5000)
),
UseExtendedCorrelations = cms.untracked.bool(False)
UseExtendedCorrelations = cms.untracked.bool(False),
TypeOfConstraints = cms.string('approximate_averaging'),
)
)

Expand Up @@ -36,6 +36,26 @@ AlignmentParameterStore::AlignmentParameterStore( const align::Alignables &alis,

edm::LogInfo("Alignment") << "@SUB=AlignmentParameterStore"
<< "Created with " << theAlignables.size() << " alignables.";

// set hierarchy vs averaging constraints
theTypeOfConstraints = NONE;
const std::string cfgStrTypeOfConstraints(config.getParameter<std::string>("TypeOfConstraints"));
if( cfgStrTypeOfConstraints == "hierarchy" ) {
theTypeOfConstraints = HIERARCHY_CONSTRAINTS;
edm::LogWarning("Alignment") << "@SUB=AlignmentParameterStore"
<< "\n\n\n******* WARNING ******************************************\n"
<< "Using hierarchy constraints that have a not-understood bug.\n"
<< "It is strongly recommended to use averaging constraints for\n"
<< "the time being!\n\n\n";

} else if( cfgStrTypeOfConstraints == "approximate_averaging" ) {
theTypeOfConstraints = APPROX_AVERAGING_CONSTRAINTS;
edm::LogWarning("Alignment") << "@SUB=AlignmentParameterStore"
<< "Using approximate implementation of averaging constraints";
} else {
edm::LogError("BadArgument") << "@SUB=AlignmentParameterStore"
<< "Unknown type of hierarchy constraints '" << cfgStrTypeOfConstraints << "'";
}
}

//__________________________________________________________________________________________________
Expand Down Expand Up @@ -682,7 +702,15 @@ ::hierarchyConstraints(const Alignable *ali, const align::Alignables &aliComps,
}
for (unsigned int iParComp = 0; iParComp < aliCompSel.size(); ++iParComp) {
if (aliCompSel[iParComp]) {
const double factor = p2pDerivs(iParMast, iParComp);
double factor = 0.;
if( theTypeOfConstraints == HIERARCHY_CONSTRAINTS ) {
// hierachy constraints
factor = p2pDerivs(iParMast, iParComp);
} else if( theTypeOfConstraints == APPROX_AVERAGING_CONSTRAINTS ) {
// CHK poor mans averaging constraints
factor = p2pDerivs(iParMast, iParComp);
if (iParMast < 3 && (iParComp % 9) >= 3) factor = 0.;
}
if (fabs(factor) > epsilon) {
paramIdsVecOut[iParMastUsed].push_back(ParameterId(*iComp, iParComp));
factorsVecOut[iParMastUsed].push_back(factor);
Expand Down

0 comments on commit 1d3e23f

Please sign in to comment.