CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
12 {
13 
15  AlignmentParameters *parBack = (par ? par->clone(par->parameters(), par->covariance()) : 0);
16 
18  int iret = this->writeOne(ali);
19 
20  ali->setAlignmentParameters(parBack); // deletes the above created RigidBodyAlignmentParameters
21 
22  return iret;
23 }
24 
25 
26 //-----------------------------------------------------------------------------
27 // write many parameters
28 int
30  bool validCheck)
31 {
32  int icount=0;
33  for(align::Alignables::const_iterator it=alivec.begin();
34  it!=alivec.end(); ++it) {
35  if ((*it)->alignmentParameters()->isValid() || !(validCheck)) {
36  icount++;
37  int iret=writeOne(*it);
38  if (iret!=0) return iret;
39  }
40  }
41  edm::LogInfo("Alignment") << "@SUB=AlignmentParametersIO::write"
42  << "Wrote " << icount << " out of " << alivec.size() << " parameters";
43  return 0;
44 }
45 
46 
47 //-----------------------------------------------------------------------------
48 // write many original parameters
49 int
51 {
52  int icount = 0;
53  for(align::Alignables::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
54  if (!validCheck || (*it)->alignmentParameters()->isValid()) {
55  ++icount;
56  int iret = this->writeOneOrigRigidBody(*it);
57  if (iret != 0) return iret;
58  }
59  }
60  edm::LogInfo("Alignment") << "@SUB=AlignmentParametersIO::writeOrigRigidBody"
61  << "Wrote " << icount << " out of " << alivec.size()
62  << " original parameters.";
63  return 0;
64 }
65 
66 //-----------------------------------------------------------------------------
67 // read many parameters
68 
71 {
72  align::Parameters retvec;
73  int ierr2;
74  int icount=0;
75  for(align::Alignables::const_iterator it=alivec.begin();
76  it!=alivec.end(); ++it) {
77  AlignmentParameters* ad=readOne(*it, ierr2);
78  if (ad!=0 && ierr2==0) { retvec.push_back(ad); icount++; }
79  }
80  edm::LogInfo("Alignment") << "@SUB-AlignmentParametersIO::write"
81  << "Read " << icount << " out of " << alivec.size() << " parameters";
82  return retvec;
83 }
virtual AlignmentParameters * readOne(Alignable *ali, int &ierr)=0
read AlignmentParameters of one Alignable
int write(const align::Alignables &alivec, bool validCheck)
write AlignmentParameters of many Alignables
virtual int writeOneOrigRigidBody(Alignable *ali)
write original RigidBodyAlignmentParameters (i.e. 3 shifts and 3 rotation)
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:57
const AlgebraicVector & parameters(void) const
Get alignment parameters.
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Definition: Alignable.cc:81
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
virtual AlignmentParameters * clone(const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
Enforce clone methods in derived classes.
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
std::vector< AlignmentParameters * > Parameters
Definition: Utilities.h:29
const AlgebraicSymMatrix & covariance(void) const
Get parameter covariance matrix.
virtual int writeOne(Alignable *ali)=0
write AlignmentParameters of one Alignable