33 : mySteerer(steerer), myLabels(labels), myRunRange(runrange)
36 if (pedeResultFile.empty()) pedeResultFile = steerer.
directory();
37 else if (pedeResultFile.find_last_of(
'/') != pedeResultFile.size() - 1) {
38 pedeResultFile +=
'/';
41 pedeResultFile += config.
getParameter<std::string>(
"readFile");
45 <<
"Problem opening pede output file " << pedeResultFile;
56 std::map<Alignable*,Alignable*> uniqueList;
59 <<
"will read parameters for run range "
63 unsigned int nParam = 0;
66 unsigned int paramLabel = 0;
67 if (!this->readIfSameLine<unsigned int>(
myPedeResult, paramLabel))
continue;
71 unsigned int bufferPos = 0;
73 if (!this->readIfSameLine<float>(
myPedeResult, buffer[bufferPos]))
break;
84 uniqueList[alignable] = alignable;
89 for ( std::map<Alignable*,Alignable*>::const_iterator iAli = uniqueList.begin();
90 iAli != uniqueList.end(); ++iAli) {
91 alignables.push_back((*iAli).first);
94 edm::LogInfo(
"Alignment") <<
"@SUB=PedeReader::read" << nParam <<
" parameters for "
95 << alignables.size() <<
" alignables";
97 return isAllOk && nParam;
107 const int aChar = aStream.get();
108 if (!aStream.good())
return false;
119 if (aStream.fail()) {
121 while (aStream.good() && aStream.get() !=
'\n');
129 edm::LogError(
"Alignment") <<
"@SUB=PedeReader::readIfSameLine" <<
"Should never come here!";
135 unsigned int bufLength,
float *buf,
bool setUserVars)
const
146 edm::LogError(
"Alignment") <<
"@SUB=PedeReader::setParameter"
147 <<
"Label mismatch: paramLabel " << paramLabel
148 <<
" for alignableLabel " << userParams->
label();
158 if (userParams) userParams->
globalCor()[paramNum] = buf[4];
160 if (userParams) userParams->
sigma()[paramNum] = buf[3] / cmsToPede;
161 covMat[paramNum][paramNum] = buf[3]*buf[3] / (cmsToPede*cmsToPede);
164 if (userParams) userParams->
diffBefore()[paramNum] = buf[2] / cmsToPede;
170 userParams->
parameter()[paramNum] = parVec[paramNum];
171 userParams->
preSigma()[paramNum] = buf[1];
172 if (!userParams->
isFixed(paramNum)) {
173 userParams->
preSigma()[paramNum] /= cmsToPede;
174 if (bufLength == 2) {
176 <<
"Param " << paramLabel <<
" (from "
177 <<
typeid(*alignable).name() <<
") without result!";
178 userParams->
isValid()[paramNum] =
false;
187 edm::LogError(
"Alignment") <<
"@SUB=PedeReader::setParameter"
188 <<
"Expect 2 to 5 values, got " << bufLength
189 <<
" for label " << paramLabel;
195 edm::LogError(
"Alignment") <<
"@SUB=PedeReader::setParameter"
196 <<
"No alignable for paramLabel " << paramLabel
197 <<
", probably LasBeam with Id " << lasBeamId
198 <<
",\nparam " << paramNum <<
": "
200 <<
" += " << (bufLength >= 4 ? buf[3] / cmsToPede : -99.);
213 <<
"Alignable without parameters.";
218 if (createUserVars && !dynamic_cast<MillePedeVariables*>(params->
userVariables())) {
219 edm::LogInfo(
"Alignment") <<
"@SUB=PedeReader::checkAliParams"
220 <<
"Add user variables for alignable with label "
unsigned int label() const
get alignable label as used by pede
const std::vector< float > & globalCor() const
get global correlation array
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual const RunRange & runRangeFromLabel(unsigned int label) const
virtual Alignable * alignableFromLabel(unsigned int label) const =0
PedeReader(const edm::ParameterSet &config, const PedeSteerer &steerer, const PedeLabelerBase &labels, const RunRange &runrange)
AlignmentParameters * checkAliParams(Alignable *alignable, bool createUserVars) const
bool read(std::vector< Alignable * > &alignables, bool setUserVars)
bool isFixed(unsigned int nParam) const
true if parameter is fixed
const PedeSteerer & mySteerer
virtual unsigned int alignableLabel(Alignable *alignable) const =0
std::ifstream myPedeResult
const std::vector< float > & parameter() const
get array of parameters
virtual unsigned int paramNumFromLabel(unsigned int paramLabel) const =0
parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
const AlgebraicVector & parameters(void) const
Get alignment parameters.
AlignmentUserVariables * userVariables(void) const
Get pointer to user variables.
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
void setValid(bool v)
Set validity flag.
const std::vector< float > & preSigma() const
get array of presigmas (<= 0: means fixed)
const std::vector< float > & sigma() const
get array of sigmas
bool readIfSameLine(std::ifstream &aStream, T &outValue) const
const std::vector< float > & diffBefore() const
get array of differences to start value
CLHEP::HepVector AlgebraicVector
void setUserVariables(AlignmentUserVariables *auv)
Set pointer to user variables.
int size(void) const
Get number of parameters.
virtual AlignmentParameters * clone(const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
Enforce clone methods in derived classes.
double cmsToPedeFactor(unsigned int parNum) const
PedeLabelerBase::RunRange RunRange
const std::vector< bool > & isValid() const
get valid flag array
CLHEP::HepSymMatrix AlgebraicSymMatrix
static const unsigned int myMaxNumValPerParam
const std::string & directory() const
directory from constructor input, '/' is attached if needed
const AlgebraicSymMatrix & covariance(void) const
Get parameter covariance matrix.
Alignable * setParameter(unsigned int paramLabel, unsigned int bufLength, float *buf, bool setUserVars) const
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)
int parameterSign() const
results from pede (and start values for pede) might need a sign flip
virtual unsigned int lasBeamIdFromLabel(unsigned int label) const =0