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 }
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:58
virtual AlignmentParameters * readOne(Alignable *ali, int &ierr)=0
read AlignmentParameters of one Alignable
const AlgebraicSymMatrix & covariance(void) const
Get parameter covariance matrix.
int write(const align::Alignables &alivec, bool validCheck)
write AlignmentParameters of many Alignables
const AlgebraicVector & parameters(void) const
Get alignment parameters.
virtual int writeOneOrigRigidBody(Alignable *ali)
write original RigidBodyAlignmentParameters (i.e. 3 shifts and 3 rotation)
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Definition: Alignable.cc:123
int writeOrigRigidBody(const align::Alignables &alivec, bool validCheck)
write original RigidBodyAlignmentParameters of many Alignables
align::Parameters read(const align::Alignables &alivec, int &ierr)
read AlignmentParameters of many Alignables
Log< level::Info, false > LogInfo
virtual AlignmentParameters * clone(const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
Enforce clone methods in derived classes.
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
std::vector< AlignmentParameters * > Parameters
Definition: Utilities.h:32
virtual int writeOne(Alignable *ali)=0
write AlignmentParameters of one Alignable