CMS 3D CMS Logo

List of all members | Protected Types | Protected Member Functions | Protected Attributes
AlignableDataIO Class Referenceabstract

#include <AlignableDataIO.h>

Inheritance diagram for AlignableDataIO:
AlignableDataIORoot

Protected Types

enum  PosType { Abs, Org, Rel }
 

Protected Member Functions

 AlignableDataIO (PosType p)
 Constructor. More...
 
virtual int close (void)=0
 Close IO handle. More...
 
virtual int open (const char *filename, int iteration, bool writemode)=0
 Open IO handle. More...
 
AlignableAbsData readAbsPos (Alignable *ali, int &ierr)
 Read absolute positions of one Alignable. More...
 
AlignablePositions readAbsPos (const align::Alignables &alivec, int &ierr)
 Read absolute positions of many Alignables. More...
 
virtual AlignableAbsData readAbsRaw (Alignable *ali, int &ierr)=0
 Read absolute positions. More...
 
AlignableAbsData readOrgPos (Alignable *ali, int &ierr)
 Read original positions of one Alignable. More...
 
AlignablePositions readOrgPos (const align::Alignables &alivec, int &ierr)
 Read original positions of many Alignables. More...
 
AlignableRelData readRelPos (Alignable *ali, int &ierr)
 Read relative positions of one Alignable. More...
 
AlignableShifts readRelPos (const align::Alignables &alivec, int &ierr)
 Read relative positions of many Alignables. More...
 
virtual AlignableRelData readRelRaw (Alignable *ali, int &ierr)=0
 Read relative positions. More...
 
int writeAbsPos (Alignable *ali, bool validCheck)
 Write absolute positions of one Alignable. More...
 
int writeAbsPos (const align::Alignables &alivec, bool validCheck)
 Write absolute positions of many Alignables. More...
 
virtual int writeAbsRaw (const AlignableAbsData &ad)=0
 Write absolute positions. More...
 
int writeOrgPos (Alignable *ali, bool validCheck)
 Write original positions of one Alignable. More...
 
int writeOrgPos (const align::Alignables &alivec, bool validCheck)
 Write original positions of many Alignables. More...
 
int writeRelPos (Alignable *ali, bool validCheck)
 Write relative positions of one Alignable. More...
 
int writeRelPos (const align::Alignables &alivec, bool validCheck)
 Write relative positions of many Alignables. More...
 
virtual int writeRelRaw (const AlignableRelData &ad)=0
 Write relative positions. More...
 
virtual ~AlignableDataIO ()
 Destructor. More...
 

Protected Attributes

PosType thePosType
 

Detailed Description

Abstract base class for IO of alignable positions/shifts. Derived concrete class must implement raw read/write methods

Definition at line 12 of file AlignableDataIO.h.

Member Enumeration Documentation

◆ PosType

enum AlignableDataIO::PosType
protected
Enumerator
Abs 
Org 
Rel 

Definition at line 14 of file AlignableDataIO.h.

14 { Abs, Org, Rel };

Constructor & Destructor Documentation

◆ AlignableDataIO()

AlignableDataIO::AlignableDataIO ( PosType  p)
inlineprotected

Constructor.

Definition at line 17 of file AlignableDataIO.h.

17 : thePosType(p){};

◆ ~AlignableDataIO()

virtual AlignableDataIO::~AlignableDataIO ( )
inlineprotectedvirtual

Destructor.

Definition at line 20 of file AlignableDataIO.h.

20 {};

Member Function Documentation

◆ close()

virtual int AlignableDataIO::close ( void  )
protectedpure virtual

◆ open()

virtual int AlignableDataIO::open ( const char *  filename,
int  iteration,
bool  writemode 
)
protectedpure virtual

Open IO handle.

Implemented in AlignableDataIORoot.

◆ readAbsPos() [1/2]

AlignableAbsData AlignableDataIO::readAbsPos ( Alignable ali,
int &  ierr 
)
protected

Read absolute positions of one Alignable.

Definition at line 10 of file AlignableDataIO.cc.

10 { return readAbsRaw(ali, ierr); }

References readAbsRaw().

Referenced by readAbsPos(), and AlignmentIORoot::readAlignableAbsolutePositions().

◆ readAbsPos() [2/2]

AlignablePositions AlignableDataIO::readAbsPos ( const align::Alignables alivec,
int &  ierr 
)
protected

Read absolute positions of many Alignables.

Definition at line 87 of file AlignableDataIO.cc.

87  {
88  AlignablePositions retvec;
89  int ierr2 = 0;
90  ierr = 0;
91  for (align::Alignables::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
92  AlignableAbsData ad = readAbsPos(*it, ierr2);
93  if (ierr2 == 0)
94  retvec.push_back(ad);
95  }
96 
97  LogDebug("ReadAbsPos") << "all,written: " << alivec.size() << "," << retvec.size();
98 
99  return retvec;
100 }

References LogDebug, and readAbsPos().

◆ readAbsRaw()

virtual AlignableAbsData AlignableDataIO::readAbsRaw ( Alignable ali,
int &  ierr 
)
protectedpure virtual

Read absolute positions.

Implemented in AlignableDataIORoot.

Referenced by readAbsPos(), and readOrgPos().

◆ readOrgPos() [1/2]

AlignableAbsData AlignableDataIO::readOrgPos ( Alignable ali,
int &  ierr 
)
protected

Read original positions of one Alignable.

Definition at line 13 of file AlignableDataIO.cc.

13 { return readAbsRaw(ali, ierr); }

References readAbsRaw().

Referenced by AlignmentIORoot::readAlignableOriginalPositions(), and readOrgPos().

◆ readOrgPos() [2/2]

AlignablePositions AlignableDataIO::readOrgPos ( const align::Alignables alivec,
int &  ierr 
)
protected

Read original positions of many Alignables.

Definition at line 116 of file AlignableDataIO.cc.

116  {
117  AlignablePositions retvec;
118  int ierr2 = 0;
119  ierr = 0;
120  for (align::Alignables::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
121  AlignableAbsData ad = readOrgPos(*it, ierr2);
122  if (ierr2 == 0)
123  retvec.push_back(ad);
124  }
125 
126  LogDebug("ReadOrgPos") << "all,read: " << alivec.size() << ", " << retvec.size();
127 
128  return retvec;
129 }

References LogDebug, and readOrgPos().

◆ readRelPos() [1/2]

AlignableRelData AlignableDataIO::readRelPos ( Alignable ali,
int &  ierr 
)
protected

Read relative positions of one Alignable.

Definition at line 16 of file AlignableDataIO.cc.

16 { return readRelRaw(ali, ierr); }

References readRelRaw().

Referenced by AlignmentIORoot::readAlignableRelativePositions(), and readRelPos().

◆ readRelPos() [2/2]

AlignableShifts AlignableDataIO::readRelPos ( const align::Alignables alivec,
int &  ierr 
)
protected

Read relative positions of many Alignables.

Definition at line 144 of file AlignableDataIO.cc.

144  {
145  AlignableShifts retvec;
146  int ierr2 = 0;
147  ierr = 0;
148  for (align::Alignables::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
149  AlignableRelData ad = readRelPos(*it, ierr2);
150  if (ierr2 == 0)
151  retvec.push_back(ad);
152  }
153  LogDebug("ReadRelPos") << "all,read: " << alivec.size() << ", " << retvec.size();
154 
155  return retvec;
156 }

References LogDebug, and readRelPos().

◆ readRelRaw()

virtual AlignableRelData AlignableDataIO::readRelRaw ( Alignable ali,
int &  ierr 
)
protectedpure virtual

Read relative positions.

Implemented in AlignableDataIORoot.

Referenced by readRelPos().

◆ writeAbsPos() [1/2]

int AlignableDataIO::writeAbsPos ( Alignable ali,
bool  validCheck 
)
protected

Write absolute positions of one Alignable.

Definition at line 19 of file AlignableDataIO.cc.

19  {
20  if (!(validCheck) || ali->alignmentParameters()->isValid()) {
21  // position in global frame
23  // global rotation
25  // if a unit: store surface deformation (little kind of hack)...
26  std::vector<double> pars;
27  if (ali->alignableObjectId() == align::AlignableDetUnit) { // only detunits have them
28  std::vector<std::pair<int, SurfaceDeformation*> > result;
29  if (1 == ali->surfaceDeformationIdPairs(result)) { // might not have any...
30  pars = result[0].second->parameters();
31  }
32  }
33 
34  // write
35  return writeAbsRaw(AlignableAbsData(pos, rot, ali->id(), ali->alignableObjectId(), pars));
36  }
37 
38  return 1;
39 }

References align::AlignableDetUnit, Alignable::alignableObjectId(), Alignable::alignmentParameters(), Alignable::id(), AlignmentParameters::isValid(), GloballyPositioned< T >::position(), mps_fire::result, makeMuonMisalignmentScenario::rot, GloballyPositioned< T >::rotation(), Alignable::surface(), Alignable::surfaceDeformationIdPairs(), and writeAbsRaw().

Referenced by writeAbsPos(), and AlignmentIORoot::writeAlignableAbsolutePositions().

◆ writeAbsPos() [2/2]

int AlignableDataIO::writeAbsPos ( const align::Alignables alivec,
bool  validCheck 
)
protected

Write absolute positions of many Alignables.

Definition at line 74 of file AlignableDataIO.cc.

74  {
75  int icount = 0;
76  for (align::Alignables::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
77  int iret = writeAbsPos(*it, validCheck);
78  if (iret == 0)
79  icount++;
80  }
81  LogDebug("WriteAbsPos") << "all,written: " << alivec.size() << "," << icount;
82 
83  return 0;
84 }

References LogDebug, and writeAbsPos().

◆ writeAbsRaw()

virtual int AlignableDataIO::writeAbsRaw ( const AlignableAbsData ad)
protectedpure virtual

Write absolute positions.

Implemented in AlignableDataIORoot.

Referenced by writeAbsPos(), and writeOrgPos().

◆ writeOrgPos() [1/2]

int AlignableDataIO::writeOrgPos ( Alignable ali,
bool  validCheck 
)
protected

Write original positions of one Alignable.

Definition at line 58 of file AlignableDataIO.cc.

58  {
59  if (!(validCheck) || ali->alignmentParameters()->isValid()) {
60  // orig position
62  // orig rotation
64  // FIXME: should add something to store changes of surface deformations...
65  std::vector<double> pars;
66  // write
67  return writeAbsRaw(AlignableAbsData(pos, rot, ali->id(), ali->alignableObjectId(), pars));
68  }
69 
70  return 1;
71 }

References Alignable::alignableObjectId(), Alignable::alignmentParameters(), Alignable::displacement(), Alignable::globalPosition(), Alignable::globalRotation(), Alignable::id(), AlignmentParameters::isValid(), makeMuonMisalignmentScenario::rot, Alignable::rotation(), TkRotation< T >::transposed(), and writeAbsRaw().

Referenced by AlignmentIORoot::writeAlignableOriginalPositions(), and writeOrgPos().

◆ writeOrgPos() [2/2]

int AlignableDataIO::writeOrgPos ( const align::Alignables alivec,
bool  validCheck 
)
protected

Write original positions of many Alignables.

Definition at line 103 of file AlignableDataIO.cc.

103  {
104  int icount = 0;
105  for (align::Alignables::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
106  int iret = writeOrgPos(*it, validCheck);
107  if (iret == 0)
108  icount++;
109  }
110 
111  LogDebug("WriteOrgPos") << "all,written: " << alivec.size() << "," << icount;
112  return 0;
113 }

References LogDebug, and writeOrgPos().

◆ writeRelPos() [1/2]

int AlignableDataIO::writeRelPos ( Alignable ali,
bool  validCheck 
)
protected

Write relative positions of one Alignable.

Definition at line 42 of file AlignableDataIO.cc.

42  {
43  if (!(validCheck) || ali->alignmentParameters()->isValid()) {
44  // rel. shift in global frame
45  const align::GlobalVector& pos = ali->displacement();
46  // rel. rotation in global frame
48  // FIXME: should add something to store changes of surface deformations...
49  std::vector<double> pars;
50  // write
51  return writeRelRaw(AlignableRelData(pos, rot, ali->id(), ali->alignableObjectId(), pars));
52  }
53 
54  return 1;
55 }

References Alignable::alignableObjectId(), Alignable::alignmentParameters(), Alignable::displacement(), Alignable::id(), AlignmentParameters::isValid(), makeMuonMisalignmentScenario::rot, Alignable::rotation(), and writeRelRaw().

Referenced by AlignmentIORoot::writeAlignableRelativePositions(), and writeRelPos().

◆ writeRelPos() [2/2]

int AlignableDataIO::writeRelPos ( const align::Alignables alivec,
bool  validCheck 
)
protected

Write relative positions of many Alignables.

Definition at line 132 of file AlignableDataIO.cc.

132  {
133  int icount = 0;
134  for (align::Alignables::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
135  int iret = writeRelPos(*it, validCheck);
136  if (iret == 0)
137  icount++;
138  }
139  LogDebug("WriteRelPos") << "all,written: " << alivec.size() << ", " << icount;
140  return 0;
141 }

References LogDebug, and writeRelPos().

◆ writeRelRaw()

virtual int AlignableDataIO::writeRelRaw ( const AlignableRelData ad)
protectedpure virtual

Write relative positions.

Implemented in AlignableDataIORoot.

Referenced by writeRelPos().

Member Data Documentation

◆ thePosType

PosType AlignableDataIO::thePosType
protected

Definition at line 77 of file AlignableDataIO.h.

Referenced by AlignableDataIORoot::AlignableDataIORoot().

Vector3DBase< Scalar, GlobalTag >
TkRotation< Scalar >
AlignableDataIO::readOrgPos
AlignableAbsData readOrgPos(Alignable *ali, int &ierr)
Read original positions of one Alignable.
Definition: AlignableDataIO.cc:13
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
pos
Definition: PixelAliasList.h:18
Alignable::surfaceDeformationIdPairs
virtual int surfaceDeformationIdPairs(std::vector< std::pair< int, SurfaceDeformation * > > &) const =0
AlignableDataIO::Org
Definition: AlignableDataIO.h:14
AlignableDataIO::writeRelRaw
virtual int writeRelRaw(const AlignableRelData &ad)=0
Write relative positions.
AlignableDataIO::writeOrgPos
int writeOrgPos(Alignable *ali, bool validCheck)
Write original positions of one Alignable.
Definition: AlignableDataIO.cc:58
AlignableDataIO::writeAbsPos
int writeAbsPos(Alignable *ali, bool validCheck)
Write absolute positions of one Alignable.
Definition: AlignableDataIO.cc:19
AlignableRelData
AlignableData< align::GlobalVector > AlignableRelData
relative position/rotation
Definition: AlignableData.h:45
AlignableDataIO::Abs
Definition: AlignableDataIO.h:14
AlignableShifts
std::vector< AlignableRelData > AlignableShifts
Definition: AlignableData.h:48
AlignmentParameters::isValid
bool isValid(void) const
Get validity flag.
Definition: AlignmentParameters.cc:134
AlignableDataIO::writeAbsRaw
virtual int writeAbsRaw(const AlignableAbsData &ad)=0
Write absolute positions.
AlignableDataIO::readAbsRaw
virtual AlignableAbsData readAbsRaw(Alignable *ali, int &ierr)=0
Read absolute positions.
AlignableDataIO::Rel
Definition: AlignableDataIO.h:14
Alignable::alignableObjectId
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
AlignableDataIO::readRelRaw
virtual AlignableRelData readRelRaw(Alignable *ali, int &ierr)=0
Read relative positions.
Alignable::surface
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
Point3DBase< Scalar, GlobalTag >
Alignable::displacement
const GlobalVector & displacement() const
Return change of the global position since the creation of the object.
Definition: Alignable.h:141
AlignableDataIO::readAbsPos
AlignableAbsData readAbsPos(Alignable *ali, int &ierr)
Read absolute positions of one Alignable.
Definition: AlignableDataIO.cc:10
align::AlignableDetUnit
Definition: StructureType.h:19
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
Alignable::rotation
const RotationType & rotation() const
Return change of orientation since the creation of the object.
Definition: Alignable.h:144
Alignable::id
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
Definition: Alignable.h:180
AlignableDataIO::writeRelPos
int writeRelPos(Alignable *ali, bool validCheck)
Write relative positions of one Alignable.
Definition: AlignableDataIO.cc:42
AlignableData
Definition: AlignableData.h:14
AlignableAbsData
AlignableData< align::GlobalPoint > AlignableAbsData
Absolute position/rotation.
Definition: AlignableData.h:43
GloballyPositioned::position
const PositionType & position() const
Definition: GloballyPositioned.h:36
AlignableDataIO::thePosType
PosType thePosType
Definition: AlignableDataIO.h:77
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
TkRotation::transposed
TkRotation transposed() const
Definition: extTkRotation.h:161
mps_fire.result
result
Definition: mps_fire.py:311
AlignableDataIO::readRelPos
AlignableRelData readRelPos(Alignable *ali, int &ierr)
Read relative positions of one Alignable.
Definition: AlignableDataIO.cc:16
GloballyPositioned::rotation
const RotationType & rotation() const
Definition: GloballyPositioned.h:38
Alignable::globalPosition
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:135
AlignablePositions
std::vector< AlignableAbsData > AlignablePositions
Definition: AlignableData.h:47
Alignable::alignmentParameters
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:58
Alignable::globalRotation
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:138