#include <AlignableDataIO.h>
Protected Types | |
enum | PosType { Abs, Org, Rel } |
Protected Member Functions | |
AlignableDataIO (PosType p) | |
Constructor. | |
virtual int | close (void)=0 |
Close IO handle. | |
virtual int | open (const char *filename, int iteration, bool writemode)=0 |
Open IO handle. | |
AlignablePositions | readAbsPos (const align::Alignables &alivec, int &ierr) |
Read absolute positions of many Alignables. | |
AlignableAbsData | readAbsPos (Alignable *ali, int &ierr) |
Read absolute positions of one Alignable. | |
virtual AlignableAbsData | readAbsRaw (Alignable *ali, int &ierr)=0 |
Read absolute positions. | |
AlignableAbsData | readOrgPos (Alignable *ali, int &ierr) |
Read original positions of one Alignable. | |
AlignablePositions | readOrgPos (const align::Alignables &alivec, int &ierr) |
Read original positions of many Alignables. | |
AlignableShifts | readRelPos (const align::Alignables &alivec, int &ierr) |
Read relative positions of many Alignables. | |
AlignableRelData | readRelPos (Alignable *ali, int &ierr) |
Read relative positions of one Alignable. | |
virtual AlignableRelData | readRelRaw (Alignable *ali, int &ierr)=0 |
Read relative positions. | |
int | writeAbsPos (Alignable *ali, bool validCheck) |
Write absolute positions of one Alignable. | |
int | writeAbsPos (const align::Alignables &alivec, bool validCheck) |
Write absolute positions of many Alignables. | |
virtual int | writeAbsRaw (const AlignableAbsData &ad)=0 |
Write absolute positions. | |
int | writeOrgPos (const align::Alignables &alivec, bool validCheck) |
Write original positions of many Alignables. | |
int | writeOrgPos (Alignable *ali, bool validCheck) |
Write original positions of one Alignable. | |
int | writeRelPos (Alignable *ali, bool validCheck) |
Write relative positions of one Alignable. | |
int | writeRelPos (const align::Alignables &alivec, bool validCheck) |
Write relative positions of many Alignables. | |
virtual int | writeRelRaw (const AlignableRelData &ad)=0 |
Write relative positions. | |
virtual | ~AlignableDataIO () |
Destructor. | |
Protected Attributes | |
PosType | thePosType |
Abstract base class for IO of alignable positions/shifts. Derived concrete class must implement raw read/write methods
Definition at line 9 of file AlignableDataIO.h.
enum AlignableDataIO::PosType [protected] |
AlignableDataIO::AlignableDataIO | ( | PosType | p | ) | [inline, protected] |
virtual AlignableDataIO::~AlignableDataIO | ( | ) | [inline, protected, virtual] |
virtual int AlignableDataIO::close | ( | void | ) | [protected, pure virtual] |
Close IO handle.
Implemented in AlignableDataIORoot.
virtual int AlignableDataIO::open | ( | const char * | filename, |
int | iteration, | ||
bool | writemode | ||
) | [protected, pure virtual] |
Open IO handle.
Implemented in AlignableDataIORoot.
AlignableAbsData AlignableDataIO::readAbsPos | ( | Alignable * | ali, |
int & | ierr | ||
) | [protected] |
Read absolute positions of one Alignable.
Definition at line 10 of file AlignableDataIO.cc.
References readAbsRaw().
Referenced by readAbsPos(), and AlignmentIORoot::readAlignableAbsolutePositions().
{ return readAbsRaw(ali,ierr); }
AlignablePositions AlignableDataIO::readAbsPos | ( | const align::Alignables & | alivec, |
int & | ierr | ||
) | [protected] |
Read absolute positions of many Alignables.
Definition at line 123 of file AlignableDataIO.cc.
References LogDebug, and readAbsPos().
{ AlignablePositions retvec; int ierr2=0; ierr=0; for( align::Alignables::const_iterator it=alivec.begin(); it!=alivec.end(); it++ ) { AlignableAbsData ad=readAbsPos(*it, ierr2); if (ierr2==0) retvec.push_back(ad); } LogDebug("ReadAbsPos") << "all,written: " << alivec.size() <<"," << retvec.size(); return retvec; }
virtual AlignableAbsData AlignableDataIO::readAbsRaw | ( | Alignable * | ali, |
int & | ierr | ||
) | [protected, pure virtual] |
Read absolute positions.
Implemented in AlignableDataIORoot.
Referenced by readAbsPos(), and readOrgPos().
AlignableAbsData AlignableDataIO::readOrgPos | ( | Alignable * | ali, |
int & | ierr | ||
) | [protected] |
Read original positions of one Alignable.
Definition at line 17 of file AlignableDataIO.cc.
References readAbsRaw().
Referenced by AlignmentIORoot::readAlignableOriginalPositions(), and readOrgPos().
{ return readAbsRaw(ali,ierr); }
AlignablePositions AlignableDataIO::readOrgPos | ( | const align::Alignables & | alivec, |
int & | ierr | ||
) | [protected] |
Read original positions of many Alignables.
Definition at line 164 of file AlignableDataIO.cc.
References LogDebug, and readOrgPos().
{ AlignablePositions retvec; int ierr2=0; ierr=0; for( align::Alignables::const_iterator it=alivec.begin(); it!=alivec.end(); it++ ) { AlignableAbsData ad=readOrgPos(*it, ierr2); if (ierr2==0) retvec.push_back(ad); } LogDebug("ReadOrgPos") << "all,read: " << alivec.size() <<", "<< retvec.size(); return retvec; }
AlignableRelData AlignableDataIO::readRelPos | ( | Alignable * | ali, |
int & | ierr | ||
) | [protected] |
Read relative positions of one Alignable.
Definition at line 24 of file AlignableDataIO.cc.
References readRelRaw().
Referenced by AlignmentIORoot::readAlignableRelativePositions(), and readRelPos().
{ return readRelRaw(ali,ierr); }
AlignableShifts AlignableDataIO::readRelPos | ( | const align::Alignables & | alivec, |
int & | ierr | ||
) | [protected] |
Read relative positions of many Alignables.
Definition at line 203 of file AlignableDataIO.cc.
References LogDebug, and readRelPos().
{ AlignableShifts retvec; int ierr2=0; ierr=0; for( align::Alignables::const_iterator it=alivec.begin(); it!=alivec.end(); it++ ) { AlignableRelData ad=readRelPos(*it, ierr2); if (ierr2==0) retvec.push_back(ad); } LogDebug("ReadRelPos") << "all,read: " << alivec.size() <<", "<< retvec.size(); return retvec; }
virtual AlignableRelData AlignableDataIO::readRelRaw | ( | Alignable * | ali, |
int & | ierr | ||
) | [protected, pure virtual] |
int AlignableDataIO::writeAbsPos | ( | const align::Alignables & | alivec, |
bool | validCheck | ||
) | [protected] |
Write absolute positions of many Alignables.
Definition at line 103 of file AlignableDataIO.cc.
References LogDebug, and writeAbsPos().
{ int icount=0; for( align::Alignables::const_iterator it=alivec.begin(); it!=alivec.end(); it++ ) { int iret = writeAbsPos(*it,validCheck); if (iret==0) icount++; } LogDebug("WriteAbsPos") << "all,written: " << alivec.size() <<","<< icount; return 0; }
int AlignableDataIO::writeAbsPos | ( | Alignable * | ali, |
bool | validCheck | ||
) | [protected] |
Write absolute positions of one Alignable.
Definition at line 31 of file AlignableDataIO.cc.
References align::AlignableDetUnit, Alignable::alignableObjectId(), Alignable::alignmentParameters(), Alignable::id(), AlignmentParameters::isValid(), pos, GloballyPositioned< T >::position(), query::result, GloballyPositioned< T >::rotation(), Alignable::surface(), Alignable::surfaceDeformationIdPairs(), and writeAbsRaw().
Referenced by writeAbsPos(), and AlignmentIORoot::writeAlignableAbsolutePositions().
{ if ( !(validCheck) || ali->alignmentParameters()->isValid() ) { // position in global frame align::PositionType pos = ali->surface().position(); // global rotation align::RotationType rot = ali->surface().rotation(); // if a unit: store surface deformation (little kind of hack)... std::vector<double> pars; if (ali->alignableObjectId() == align::AlignableDetUnit) { // only detunits have them std::vector<std::pair<int,SurfaceDeformation*> > result; if (1 == ali->surfaceDeformationIdPairs(result)) { // might not have any... pars = result[0].second->parameters(); } } // write return writeAbsRaw( AlignableAbsData( pos,rot, ali->id(), ali->alignableObjectId(), pars) ); } return 1; }
virtual int AlignableDataIO::writeAbsRaw | ( | const AlignableAbsData & | ad | ) | [protected, pure virtual] |
Write absolute positions.
Implemented in AlignableDataIORoot.
Referenced by writeAbsPos(), and writeOrgPos().
int AlignableDataIO::writeOrgPos | ( | const align::Alignables & | alivec, |
bool | validCheck | ||
) | [protected] |
Write original positions of many Alignables.
Definition at line 144 of file AlignableDataIO.cc.
References LogDebug, and writeOrgPos().
{ int icount=0; for( align::Alignables::const_iterator it=alivec.begin(); it!=alivec.end(); it++ ) { int iret=writeOrgPos(*it,validCheck); if (iret==0) icount++; } LogDebug("WriteOrgPos") << "all,written: " << alivec.size() <<"," << icount; return 0; }
int AlignableDataIO::writeOrgPos | ( | Alignable * | ali, |
bool | validCheck | ||
) | [protected] |
Write original positions of one Alignable.
Definition at line 83 of file AlignableDataIO.cc.
References Alignable::alignableObjectId(), Alignable::alignmentParameters(), Alignable::displacement(), Alignable::globalPosition(), Alignable::globalRotation(), Alignable::id(), AlignmentParameters::isValid(), pos, Alignable::rotation(), and writeAbsRaw().
Referenced by AlignmentIORoot::writeAlignableOriginalPositions(), and writeOrgPos().
{ if ( !(validCheck) || ali->alignmentParameters()->isValid() ) { // orig position align::PositionType pos = ali->globalPosition() - ali->displacement(); // orig rotation align::RotationType rot = ali->globalRotation() * ali->rotation().transposed(); // FIXME: should add something to store changes of surface deformations... std::vector<double> pars; // write return writeAbsRaw(AlignableAbsData(pos,rot,ali->id(), ali->alignableObjectId(), pars)); } return 1; }
int AlignableDataIO::writeRelPos | ( | const align::Alignables & | alivec, |
bool | validCheck | ||
) | [protected] |
Write relative positions of many Alignables.
Definition at line 185 of file AlignableDataIO.cc.
References LogDebug, and writeRelPos().
{ int icount=0; for( align::Alignables::const_iterator it=alivec.begin(); it!=alivec.end(); it++ ) { int iret=writeRelPos(*it,validCheck); if (iret==0) icount++; } LogDebug("WriteRelPos") << "all,written: " << alivec.size() <<", "<< icount; return 0; }
int AlignableDataIO::writeRelPos | ( | Alignable * | ali, |
bool | validCheck | ||
) | [protected] |
Write relative positions of one Alignable.
Definition at line 63 of file AlignableDataIO.cc.
References Alignable::alignableObjectId(), Alignable::alignmentParameters(), Alignable::displacement(), Alignable::id(), AlignmentParameters::isValid(), pos, Alignable::rotation(), and writeRelRaw().
Referenced by AlignmentIORoot::writeAlignableRelativePositions(), and writeRelPos().
{ if ( !(validCheck) || ali->alignmentParameters()->isValid() ) { // rel. shift in global frame align::GlobalVector pos = ali->displacement(); // rel. rotation in global frame align::RotationType rot = ali->rotation(); // FIXME: should add something to store changes of surface deformations... std::vector<double> pars; // write return writeRelRaw(AlignableRelData(pos,rot,ali->id(), ali->alignableObjectId(), pars)); } return 1; }
virtual int AlignableDataIO::writeRelRaw | ( | const AlignableRelData & | ad | ) | [protected, pure virtual] |
PosType AlignableDataIO::thePosType [protected] |
Definition at line 79 of file AlignableDataIO.h.
Referenced by AlignableDataIORoot::AlignableDataIORoot().