CMS 3D CMS Logo

AlignmentParametersIO.cc
Go to the documentation of this file.
2 
5 
6 // this class's header
8 
9 //--------------------------------------------------------------------------------------------------
10 // write one set of original parameters
13  AlignmentParameters* parBack = (par ? par->clone(par->parameters(), par->covariance()) : nullptr);
14 
16  int iret = this->writeOne(ali);
17 
18  ali->setAlignmentParameters(parBack); // deletes the above created RigidBodyAlignmentParameters
19 
20  return iret;
21 }
22 
23 //-----------------------------------------------------------------------------
24 // write many parameters
25 int AlignmentParametersIO::write(const align::Alignables& alivec, bool validCheck) {
26  int icount = 0;
27  for (align::Alignables::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
28  if ((*it)->alignmentParameters()->isValid() || !(validCheck)) {
29  icount++;
30  int iret = writeOne(*it);
31  if (iret != 0)
32  return iret;
33  }
34  }
35  edm::LogInfo("Alignment") << "@SUB=AlignmentParametersIO::write"
36  << "Wrote " << icount << " out of " << alivec.size() << " parameters";
37  return 0;
38 }
39 
40 //-----------------------------------------------------------------------------
41 // write many original parameters
42 int AlignmentParametersIO::writeOrigRigidBody(const align::Alignables& alivec, bool validCheck) {
43  int icount = 0;
44  for (align::Alignables::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
45  if (!validCheck || (*it)->alignmentParameters()->isValid()) {
46  ++icount;
47  int iret = this->writeOneOrigRigidBody(*it);
48  if (iret != 0)
49  return iret;
50  }
51  }
52  edm::LogInfo("Alignment") << "@SUB=AlignmentParametersIO::writeOrigRigidBody"
53  << "Wrote " << icount << " out of " << alivec.size() << " original parameters.";
54  return 0;
55 }
56 
57 //-----------------------------------------------------------------------------
58 // read many parameters
59 
61  align::Parameters retvec;
62  int ierr2;
63  int icount = 0;
64  for (align::Alignables::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
65  AlignmentParameters* ad = readOne(*it, ierr2);
66  if (ad != nullptr && ierr2 == 0) {
67  retvec.push_back(ad);
68  icount++;
69  }
70  }
71  edm::LogInfo("Alignment") << "@SUB-AlignmentParametersIO::write"
72  << "Read " << icount << " out of " << alivec.size() << " parameters";
73  return retvec;
74 }
AlignmentParametersIO.h
MessageLogger.h
AlignmentParametersIO::read
align::Parameters read(const align::Alignables &alivec, int &ierr)
read AlignmentParameters of many Alignables
Definition: AlignmentParametersIO.cc:60
Alignable::setAlignmentParameters
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Definition: Alignable.cc:123
Alignable
Definition: Alignable.h:27
AlignmentParametersIO::writeOrigRigidBody
int writeOrigRigidBody(const align::Alignables &alivec, bool validCheck)
write original RigidBodyAlignmentParameters of many Alignables
Definition: AlignmentParametersIO.cc:42
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
RigidBodyAlignmentParameters.h
AlignmentParameters
Definition: AlignmentParameters.h:35
AlignmentParametersIO::write
int write(const align::Alignables &alivec, bool validCheck)
write AlignmentParameters of many Alignables
Definition: AlignmentParametersIO.cc:25
AlignmentParametersIO::writeOne
virtual int writeOne(Alignable *ali)=0
write AlignmentParameters of one Alignable
AlignmentParametersIO::readOne
virtual AlignmentParameters * readOne(Alignable *ali, int &ierr)=0
read AlignmentParameters of one Alignable
RigidBodyAlignmentParameters
Definition: RigidBodyAlignmentParameters.h:21
AlignmentParameters::clone
virtual AlignmentParameters * clone(const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
Enforce clone methods in derived classes.
align::Parameters
std::vector< AlignmentParameters * > Parameters
Definition: Utilities.h:32
align::Alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
AlignmentParameters::covariance
const AlgebraicSymMatrix & covariance(void) const
Get parameter covariance matrix.
Definition: AlignmentParameters.cc:67
Alignable.h
AlignmentParameters::parameters
const AlgebraicVector & parameters(void) const
Get alignment parameters.
Definition: AlignmentParameters.cc:64
AlignmentParametersIO::writeOneOrigRigidBody
virtual int writeOneOrigRigidBody(Alignable *ali)
write original RigidBodyAlignmentParameters (i.e. 3 shifts and 3 rotation)
Definition: AlignmentParametersIO.cc:11
Alignable::alignmentParameters
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:58