40 : mySteerer(steerer), myLabels(
labels), myRunRange(runrange) {
42 if (pedeResultFile.empty())
44 else if (pedeResultFile.find_last_of(
'/') != pedeResultFile.size() - 1) {
45 pedeResultFile +=
'/';
52 <<
"Problem opening pede output file " << pedeResultFile;
62 std::set<Alignable *> uniqueList;
68 unsigned int nParam = 0, nParamCalib = 0, nParamUnknown = 0;
77 unsigned int bufferPos = 0;
87 if (calibParam.first) {
92 <<
"Problems setting results of " 93 <<
"parameter " << calibParam.second <<
" to calibration '" 94 << calibParam.first->name() <<
"' (" << calibParam.first <<
").";
110 uniqueList.insert(alignable);
115 alignables.insert(alignables.end(), uniqueList.begin(), uniqueList.end());
117 std::stringstream
out;
118 out <<
nParam <<
" parameters for " << alignables.size() <<
" alignables and " << nParamCalib <<
" for calibrations, " 119 << nParamUnknown <<
" parameters are unknown.\n";
126 return isAllOk && (
nParam + nParamCalib);
133 const int aChar = aStream.get();
146 if (aStream.fail()) {
148 while (aStream.good() && aStream.get() !=
'\n')
157 edm::LogError(
"Alignment") <<
"@SUB=PedeReader::readIfSameLine" 158 <<
"Should never come here!";
164 unsigned int bufLength,
166 bool setUserVars)
const {
176 edm::LogError(
"Alignment") <<
"@SUB=PedeReader::setParameter" 177 <<
"Label mismatch: paramLabel " <<
paramLabel <<
" for alignableLabel " 178 << userParams->
label();
194 userParams->
sigma()[paramNum] =
buf[3] / cmsToPede;
195 covMat[paramNum][paramNum] =
buf[3] *
buf[3] / (cmsToPede * cmsToPede);
205 userParams->
parameter()[paramNum] = parVec[paramNum];
207 if (!userParams->
isFixed(paramNum)) {
208 userParams->
preSigma()[paramNum] /= cmsToPede;
209 if (bufLength == 2) {
213 userParams->
isValid()[paramNum] =
false;
222 edm::LogError(
"Alignment") <<
"@SUB=PedeReader::setParameter" 223 <<
"Expect 2 to 5 values, got " << bufLength <<
" for label " <<
paramLabel;
229 edm::LogError(
"Alignment") <<
"@SUB=PedeReader::setParameter" 230 <<
"No alignable for paramLabel " <<
paramLabel <<
", probably LasBeam with Id " 231 << lasBeamId <<
",\nparam " << paramNum <<
": " 233 <<
" += " << (bufLength >= 4 ?
buf[3] / cmsToPede : -99.);
241 unsigned int paramNum,
242 unsigned int bufLength,
243 const float *
buf)
const {
252 calib->setParameterError(paramNum,
buf[3]);
256 if (bufLength == 2 &&
buf[1] >= 0.) {
257 edm::LogWarning(
"Alignment") <<
"@SUB=PedeReader::setCalibrationParameter" 258 <<
"Param " << paramNum <<
" of calibration '" <<
calib->name()
259 <<
"' without result!";
265 edm::LogError(
"Alignment") <<
"@SUB=PedeReader::setCalibrationParameter" 266 <<
"Expect 2 to 5 values, got " << bufLength <<
".";
276 throw cms::Exception(
"BadConfig") <<
"PedeReader::checkAliParams: " 277 <<
"Alignable without parameters.";
281 if (createUserVars && !dynamic_cast<MillePedeVariables *>(
params->userVariables())) {
282 edm::LogInfo(
"Alignment") <<
"@SUB=PedeReader::checkAliParams" bool readIfSameLine(std::ifstream &aStream, T &outValue) const
virtual Alignable * alignableFromLabel(unsigned int label) const =0
virtual std::pair< IntegratedCalibrationBase *, unsigned int > calibrationParamFromLabel(unsigned int label) const
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
PedeReader(const edm::ParameterSet &config, const PedeSteerer &steerer, const PedeLabelerBase &labels, const RunRange &runrange)
const std::vector< float > & preSigma() const
get array of presigmas (<= 0: means fixed)
const PedeSteerer & mySteerer
std::ifstream myPedeResult
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
const std::vector< bool > & isValid() const
get valid flag array
Log< level::Error, false > LogError
bool isFixed(unsigned int nParam) const
true if parameter is fixed
int parameterSign() const
results from pede (and start values for pede) might need a sign flip
unsigned int label() const
get alignable label as used by pede
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
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.
AlignmentParameters * checkAliParams(Alignable *alignable, bool createUserVars) const
const std::vector< float > & diffBefore() const
get array of differences to start value
Log< level::Info, false > LogInfo
CLHEP::HepVector AlgebraicVector
virtual unsigned int alignableLabel(const Alignable *alignable) const =0
const std::vector< float > & sigma() const
get array of sigmas
std::string typeDemangle(char const *mangledName)
PedeLabelerBase::RunRange RunRange
const std::string & directory() const
directory from constructor input, '/' is attached if needed
std::vector< Alignable * > Alignables
const AlignableTracker * alignableTracker() const
virtual const RunRange & runRangeFromLabel(unsigned int label) const
CLHEP::HepSymMatrix AlgebraicSymMatrix
static const unsigned int myMaxNumValPerParam
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
const std::vector< float > & parameter() const
get array of parameters
Log< level::Warning, false > LogWarning
bool read(align::Alignables &alignables, bool setUserVars)
const std::vector< float > & globalCor() const
get global correlation array
const PedeLabelerBase & myLabels
const RunRange myRunRange
bool setAllDefault(unsigned int nParam)
set default values for all data concerning nParam (false if nParam out of range)
double cmsToPedeFactor(unsigned int parNum) const
virtual unsigned int lasBeamIdFromLabel(unsigned int label) const =0