|
|
Go to the documentation of this file.
39 : mySteerer(steerer), myLabels(
labels), myRunRange(runrange) {
41 if (pedeResultFile.empty())
43 else if (pedeResultFile.find_last_of(
'/') != pedeResultFile.size() - 1) {
44 pedeResultFile +=
'/';
51 <<
"Problem opening pede output file " << pedeResultFile;
61 std::set<Alignable *> uniqueList;
67 unsigned int nParam = 0, nParamCalib = 0, nParamUnknown = 0;
76 unsigned int bufferPos = 0;
86 if (calibParam.first) {
91 <<
"Problems setting results of "
92 <<
"parameter " << calibParam.second <<
" to calibration '"
93 << calibParam.first->name() <<
"' (" << calibParam.first <<
").";
109 uniqueList.insert(alignable);
114 alignables.insert(alignables.end(), uniqueList.begin(), uniqueList.end());
116 std::stringstream
out;
117 out <<
nParam <<
" parameters for " << alignables.size() <<
" alignables and " << nParamCalib <<
" for calibrations, "
118 << nParamUnknown <<
" parameters are unknown.\n";
125 return isAllOk && (
nParam + nParamCalib);
132 const int aChar = aStream.get();
145 if (aStream.fail()) {
147 while (aStream.good() && aStream.get() !=
'\n')
156 edm::LogError(
"Alignment") <<
"@SUB=PedeReader::readIfSameLine"
157 <<
"Should never come here!";
163 unsigned int bufLength,
165 bool setUserVars)
const {
172 (setUserVars ? static_cast<MillePedeVariables *>(
params->userVariables()) :
nullptr);
175 edm::LogError(
"Alignment") <<
"@SUB=PedeReader::setParameter"
176 <<
"Label mismatch: paramLabel " <<
paramLabel <<
" for alignableLabel "
177 << userParams->
label();
193 userParams->
sigma()[paramNum] =
buf[3] / cmsToPede;
194 covMat[paramNum][paramNum] =
buf[3] *
buf[3] / (cmsToPede * cmsToPede);
204 userParams->
parameter()[paramNum] = parVec[paramNum];
206 if (!userParams->
isFixed(paramNum)) {
207 userParams->
preSigma()[paramNum] /= cmsToPede;
208 if (bufLength == 2) {
210 <<
"@SUB=PedeReader::setParameter"
211 <<
"Param " <<
paramLabel <<
" (from " <<
typeid(*alignable).name() <<
") without result!";
212 userParams->
isValid()[paramNum] =
false;
221 edm::LogError(
"Alignment") <<
"@SUB=PedeReader::setParameter"
222 <<
"Expect 2 to 5 values, got " << bufLength <<
" for label " <<
paramLabel;
228 edm::LogError(
"Alignment") <<
"@SUB=PedeReader::setParameter"
229 <<
"No alignable for paramLabel " <<
paramLabel <<
", probably LasBeam with Id "
230 << lasBeamId <<
",\nparam " << paramNum <<
": "
232 <<
" += " << (bufLength >= 4 ?
buf[3] / cmsToPede : -99.);
240 unsigned int paramNum,
241 unsigned int bufLength,
242 const float *
buf)
const {
251 calib->setParameterError(paramNum,
buf[3]);
255 if (bufLength == 2 &&
buf[1] >= 0.) {
256 edm::LogWarning(
"Alignment") <<
"@SUB=PedeReader::setCalibrationParameter"
257 <<
"Param " << paramNum <<
" of calibration '" <<
calib->name()
258 <<
"' without result!";
264 edm::LogError(
"Alignment") <<
"@SUB=PedeReader::setCalibrationParameter"
265 <<
"Expect 2 to 5 values, got " << bufLength <<
".";
275 throw cms::Exception(
"BadConfig") <<
"PedeReader::checkAliParams: "
276 <<
"Alignable without parameters.";
280 if (createUserVars && !dynamic_cast<MillePedeVariables *>(
params->userVariables())) {
281 edm::LogInfo(
"Alignment") <<
"@SUB=PedeReader::checkAliParams"
virtual Alignable * alignableFromLabel(unsigned int label) const =0
double cmsToPedeFactor(unsigned int parNum) const
std::string typeToName(align::StructureType type) const
Convert type to name.
virtual unsigned int paramNumFromLabel(unsigned int paramLabel) const =0
parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
const AlignableTracker * alignableTracker() const
virtual const RunRange & runRangeFromLabel(unsigned int label) const
AlignmentParameters * checkAliParams(Alignable *alignable, bool createUserVars) const
bool setCalibrationParameter(IntegratedCalibrationBase *calib, unsigned int paramNum, unsigned int bufLength, const float *buf) const
Set pede results stored in 'buf' to parameter 'paramNum' of IntegratedCalibrationBase.
const AlignableObjectId & objectIdProvider() const
Return tracker alignable object ID provider derived from the tracker's geometry.
Alignable * setParameter(unsigned int paramLabel, unsigned int bufLength, const float *buf, bool setUserVars) const
Log< level::Info, false > LogInfo
bool read(align::Alignables &alignables, bool setUserVars)
Log< level::Warning, false > LogWarning
static const unsigned int myMaxNumValPerParam
virtual unsigned int alignableLabel(Alignable *alignable) const =0
PedeLabelerBase::RunRange RunRange
unsigned int label() const
get alignable label as used by pede
const std::vector< bool > & isValid() const
get valid flag array
bool readIfSameLine(std::ifstream &aStream, T &outValue) const
CLHEP::HepVector AlgebraicVector
const PedeLabelerBase & myLabels
virtual unsigned int lasBeamIdFromLabel(unsigned int label) const =0
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
const RunRange myRunRange
const PedeSteerer & mySteerer
PedeReader(const edm::ParameterSet &config, const PedeSteerer &steerer, const PedeLabelerBase &labels, const RunRange &runrange)
bool setAllDefault(unsigned int nParam)
set default values for all data concerning nParam (false if nParam out of range)
int parameterSign() const
results from pede (and start values for pede) might need a sign flip
const std::string & directory() const
directory from constructor input, '/' is attached if needed
std::ifstream myPedeResult
const std::vector< float > & preSigma() const
get array of presigmas (<= 0: means fixed)
CLHEP::HepSymMatrix AlgebraicSymMatrix
Log< level::Error, false > LogError
const std::vector< float > & diffBefore() const
get array of differences to start value
std::vector< Alignable * > Alignables
const std::vector< float > & parameter() const
get array of parameters
bool isFixed(unsigned int nParam) const
true if parameter is fixed
const std::vector< float > & sigma() const
get array of sigmas
const std::vector< float > & globalCor() const
get global correlation array
virtual std::pair< IntegratedCalibrationBase *, unsigned int > calibrationParamFromLabel(unsigned int label) const
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.