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

enum AlignableDataIO::PosType
protected
Enumerator
Abs 
Org 
Rel 

Definition at line 17 of file AlignableDataIO.h.

Constructor & Destructor Documentation

AlignableDataIO::AlignableDataIO ( PosType  p)
inlineprotected

Constructor.

Definition at line 20 of file AlignableDataIO.h.

virtual AlignableDataIO::~AlignableDataIO ( )
inlineprotectedvirtual

Member Function Documentation

virtual int AlignableDataIO::close ( void  )
protectedpure virtual
virtual int AlignableDataIO::open ( const char *  filename,
int  iteration,
bool  writemode 
)
protectedpure virtual
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(), AlignmentIORoot::readAlignableAbsolutePositions(), and ~AlignableDataIO().

11 {
12  return readAbsRaw(ali,ierr);
13 }
virtual AlignableAbsData readAbsRaw(Alignable *ali, int &ierr)=0
Read absolute positions.
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().

124 {
125 
126  AlignablePositions retvec;
127  int ierr2=0;
128  ierr=0;
129  for( align::Alignables::const_iterator it=alivec.begin();
130  it!=alivec.end(); ++it )
131  {
132  AlignableAbsData ad=readAbsPos(*it, ierr2);
133  if (ierr2==0) retvec.push_back(ad);
134  }
135 
136  LogDebug("ReadAbsPos") << "all,written: " << alivec.size() <<"," << retvec.size();
137 
138  return retvec;
139 
140 }
#define LogDebug(id)
AlignableAbsData readAbsPos(Alignable *ali, int &ierr)
Read absolute positions of one Alignable.
std::vector< AlignableAbsData > AlignablePositions
Definition: AlignableData.h:51
virtual AlignableAbsData AlignableDataIO::readAbsRaw ( Alignable ali,
int &  ierr 
)
protectedpure virtual

Read absolute positions.

Implemented in AlignableDataIORoot.

Referenced by readAbsPos(), readOrgPos(), and ~AlignableDataIO().

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(), readOrgPos(), and ~AlignableDataIO().

18 {
19  return readAbsRaw(ali,ierr);
20 }
virtual AlignableAbsData readAbsRaw(Alignable *ali, int &ierr)=0
Read absolute positions.
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().

165 {
166 
167  AlignablePositions retvec;
168  int ierr2=0;
169  ierr=0;
170  for( align::Alignables::const_iterator it=alivec.begin();
171  it!=alivec.end(); ++it )
172  {
173  AlignableAbsData ad=readOrgPos(*it, ierr2);
174  if (ierr2==0) retvec.push_back(ad);
175  }
176 
177  LogDebug("ReadOrgPos") << "all,read: " << alivec.size() <<", "<< retvec.size();
178 
179  return retvec;
180 
181 }
#define LogDebug(id)
AlignableAbsData readOrgPos(Alignable *ali, int &ierr)
Read original positions of one Alignable.
std::vector< AlignableAbsData > AlignablePositions
Definition: AlignableData.h:51
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(), readRelPos(), and ~AlignableDataIO().

25 {
26  return readRelRaw(ali,ierr);
27 }
virtual AlignableRelData readRelRaw(Alignable *ali, int &ierr)=0
Read relative positions.
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().

204 {
205 
206  AlignableShifts retvec;
207  int ierr2=0;
208  ierr=0;
209  for( align::Alignables::const_iterator it=alivec.begin();
210  it!=alivec.end(); ++it )
211  {
212  AlignableRelData ad=readRelPos(*it, ierr2);
213  if (ierr2==0) retvec.push_back(ad);
214  }
215  LogDebug("ReadRelPos") << "all,read: " << alivec.size() <<", "<< retvec.size();
216 
217  return retvec;
218 
219 }
#define LogDebug(id)
std::vector< AlignableRelData > AlignableShifts
Definition: AlignableData.h:52
AlignableRelData readRelPos(Alignable *ali, int &ierr)
Read relative positions of one Alignable.
virtual AlignableRelData AlignableDataIO::readRelRaw ( Alignable ali,
int &  ierr 
)
protectedpure virtual

Read relative positions.

Implemented in AlignableDataIORoot.

Referenced by readRelPos(), and ~AlignableDataIO().

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(), GloballyPositioned< T >::position(), mps_fire::result, makeMuonMisalignmentScenario::rot, GloballyPositioned< T >::rotation(), Alignable::surface(), Alignable::surfaceDeformationIdPairs(), and writeAbsRaw().

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

32 {
33 
34  if ( !(validCheck) || ali->alignmentParameters()->isValid() )
35  {
36  // position in global frame
38  // global rotation
40  // if a unit: store surface deformation (little kind of hack)...
41  std::vector<double> pars;
42  if (ali->alignableObjectId() == align::AlignableDetUnit) { // only detunits have them
43  std::vector<std::pair<int,SurfaceDeformation*> > result;
44  if (1 == ali->surfaceDeformationIdPairs(result)) { // might not have any...
45  pars = result[0].second->parameters();
46  }
47  }
48 
49  // write
50  return writeAbsRaw(
51  AlignableAbsData( pos,rot,
52  ali->id(),
53  ali->alignableObjectId(),
54  pars)
55  );
56  }
57 
58  return 1;
59 }
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
virtual int writeAbsRaw(const AlignableAbsData &ad)=0
Write absolute positions.
virtual int surfaceDeformationIdPairs(std::vector< std::pair< int, SurfaceDeformation * > > &) const =0
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:61
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:135
AlignableData< align::GlobalPoint > AlignableAbsData
Absolute position/rotation.
Definition: AlignableData.h:47
bool isValid(void) const
Get validity flag.
const RotationType & rotation() const
const PositionType & position() const
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().

105 {
106 
107  int icount=0;
108  for( align::Alignables::const_iterator it=alivec.begin();
109  it!=alivec.end(); ++it )
110  {
111  int iret = writeAbsPos(*it,validCheck);
112  if (iret==0) icount++;
113  }
114  LogDebug("WriteAbsPos") << "all,written: " << alivec.size() <<","<< icount;
115 
116  return 0;
117 
118 }
#define LogDebug(id)
int writeAbsPos(Alignable *ali, bool validCheck)
Write absolute positions of one Alignable.
virtual int AlignableDataIO::writeAbsRaw ( const AlignableAbsData ad)
protectedpure virtual

Write absolute positions.

Implemented in AlignableDataIORoot.

Referenced by writeAbsPos(), writeOrgPos(), and ~AlignableDataIO().

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(), makeMuonMisalignmentScenario::rot, Alignable::rotation(), TkRotation< T >::transposed(), and writeAbsRaw().

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

84 {
85  if ( !(validCheck) || ali->alignmentParameters()->isValid() )
86  {
87  // orig position
89  // orig rotation
91  // FIXME: should add something to store changes of surface deformations...
92  std::vector<double> pars;
93  // write
94  return writeAbsRaw(AlignableAbsData(pos,rot,ali->id(),
95  ali->alignableObjectId(), pars));
96  }
97 
98  return 1;
99 }
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
virtual int writeAbsRaw(const AlignableAbsData &ad)=0
Write absolute positions.
const GlobalVector & displacement() const
Return change of the global position since the creation of the object.
Definition: Alignable.h:144
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:141
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:61
const RotationType & rotation() const
Return change of orientation since the creation of the object.
Definition: Alignable.h:147
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
AlignableData< align::GlobalPoint > AlignableAbsData
Absolute position/rotation.
Definition: AlignableData.h:47
bool isValid(void) const
Get validity flag.
TkRotation transposed() const
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:138
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().

146 {
147 
148  int icount=0;
149  for( align::Alignables::const_iterator it=alivec.begin();
150  it!=alivec.end(); ++it )
151  {
152  int iret=writeOrgPos(*it,validCheck);
153  if (iret==0) icount++;
154  }
155 
156  LogDebug("WriteOrgPos") << "all,written: " << alivec.size() <<"," << icount;
157  return 0;
158 
159 }
#define LogDebug(id)
int writeOrgPos(Alignable *ali, bool validCheck)
Write original positions of one Alignable.
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(), makeMuonMisalignmentScenario::rot, Alignable::rotation(), and writeRelRaw().

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

64 {
65  if ( !(validCheck) || ali->alignmentParameters()->isValid() )
66  {
67  // rel. shift in global frame
68  const align::GlobalVector& pos = ali->displacement();
69  // rel. rotation in global frame
71  // FIXME: should add something to store changes of surface deformations...
72  std::vector<double> pars;
73  // write
74  return writeRelRaw(AlignableRelData(pos,rot,ali->id(),
75  ali->alignableObjectId(), pars));
76  }
77 
78  return 1;
79 }
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
const GlobalVector & displacement() const
Return change of the global position since the creation of the object.
Definition: Alignable.h:144
AlignableData< align::GlobalVector > AlignableRelData
relative position/rotation
Definition: AlignableData.h:49
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:61
const RotationType & rotation() const
Return change of orientation since the creation of the object.
Definition: Alignable.h:147
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
bool isValid(void) const
Get validity flag.
virtual int writeRelRaw(const AlignableRelData &ad)=0
Write relative positions.
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().

187 {
188 
189  int icount=0;
190  for( align::Alignables::const_iterator it=alivec.begin();
191  it!=alivec.end(); ++it ) {
192  int iret=writeRelPos(*it,validCheck);
193  if (iret==0) icount++;
194  }
195  LogDebug("WriteRelPos") << "all,written: " << alivec.size() <<", "<< icount;
196  return 0;
197 
198 }
#define LogDebug(id)
int writeRelPos(Alignable *ali, bool validCheck)
Write relative positions of one Alignable.
virtual int AlignableDataIO::writeRelRaw ( const AlignableRelData ad)
protectedpure virtual

Write relative positions.

Implemented in AlignableDataIORoot.

Referenced by writeRelPos(), and ~AlignableDataIO().

Member Data Documentation

PosType AlignableDataIO::thePosType
protected

Definition at line 82 of file AlignableDataIO.h.

Referenced by AlignableDataIORoot::AlignableDataIORoot().