1 |
fronga |
1.1 |
#include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentParametersIORoot.h"
|
2 |
|
|
#include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentCorrelationsIORoot.h"
|
3 |
|
|
#include "Alignment/CommonAlignmentAlgorithm/interface/AlignableDataIORoot.h"
|
4 |
|
|
|
5 |
|
|
// this class's header
|
6 |
|
|
#include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentIORoot.h"
|
7 |
|
|
|
8 |
|
|
// ----------------------------------------------------------------------------
|
9 |
|
|
// write alignment parameters
|
10 |
|
|
|
11 |
|
|
void
|
12 |
|
|
AlignmentIORoot::writeAlignmentParameters(const Alignables& alivec,
|
13 |
flucke |
1.2 |
const char* filename, int iter,
|
14 |
|
|
bool validCheck, int& ierr)
|
15 |
fronga |
1.1 |
{
|
16 |
|
|
AlignmentParametersIORoot theIO;
|
17 |
|
|
ierr=0;
|
18 |
|
|
int iret;
|
19 |
|
|
iret = theIO.open(filename,iter,true);
|
20 |
|
|
if (iret!=0) { ierr=-1; return;}
|
21 |
|
|
iret = theIO.write(alivec,validCheck);
|
22 |
|
|
if (iret!=0) { ierr=-2; return;}
|
23 |
|
|
iret = theIO.close();
|
24 |
|
|
if (iret!=0) { ierr=-3; return;}
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
// ----------------------------------------------------------------------------
|
28 |
|
|
// read alignment parameters
|
29 |
|
|
AlignmentIO::Parameters
|
30 |
|
|
AlignmentIORoot::readAlignmentParameters(const Alignables& alivec,
|
31 |
flucke |
1.2 |
const char* filename, int iter, int& ierr)
|
32 |
fronga |
1.1 |
{
|
33 |
|
|
Parameters result;
|
34 |
|
|
|
35 |
|
|
AlignmentParametersIORoot theIO;
|
36 |
|
|
ierr=0;
|
37 |
|
|
int iret;
|
38 |
|
|
iret = theIO.open(filename,iter,false);
|
39 |
|
|
if (iret!=0) { ierr=-1; return result;}
|
40 |
|
|
result = theIO.read(alivec,iret);
|
41 |
|
|
if (iret!=0) { ierr=-2; return result;}
|
42 |
|
|
iret = theIO.close();
|
43 |
|
|
if (iret!=0) { ierr=-3; return result;}
|
44 |
|
|
|
45 |
|
|
return result;
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
// ----------------------------------------------------------------------------
|
49 |
|
|
// write correlations
|
50 |
|
|
|
51 |
|
|
void
|
52 |
|
|
AlignmentIORoot::writeCorrelations (const Correlations& cormap,
|
53 |
flucke |
1.2 |
const char* filename, int iter, bool validCheck, int& ierr)
|
54 |
fronga |
1.1 |
{
|
55 |
|
|
AlignmentCorrelationsIORoot theIO;
|
56 |
|
|
ierr=0;
|
57 |
|
|
int iret;
|
58 |
|
|
iret = theIO.open(filename,iter,true);
|
59 |
|
|
if (iret!=0) { ierr=-1; return;}
|
60 |
|
|
iret = theIO.write(cormap,validCheck);
|
61 |
|
|
if (iret!=0) { ierr=-2; return;}
|
62 |
|
|
iret = theIO.close();
|
63 |
|
|
if (iret!=0) { ierr=-3; return;}
|
64 |
|
|
}
|
65 |
|
|
|
66 |
|
|
// ----------------------------------------------------------------------------
|
67 |
|
|
// read correlations
|
68 |
|
|
|
69 |
|
|
AlignmentIO::Correlations
|
70 |
flucke |
1.2 |
AlignmentIORoot::readCorrelations (const Alignables& alivec, const char* filename,
|
71 |
|
|
int iter, int& ierr)
|
72 |
fronga |
1.1 |
{
|
73 |
|
|
Correlations result;
|
74 |
|
|
|
75 |
|
|
AlignmentCorrelationsIORoot theIO;
|
76 |
|
|
ierr=0;
|
77 |
|
|
int iret;
|
78 |
|
|
iret = theIO.open(filename,iter,false);
|
79 |
|
|
if (iret!=0) { ierr=-1; return result;}
|
80 |
|
|
result = theIO.read(alivec,iret);
|
81 |
|
|
if (iret!=0) { ierr=-2; return result;}
|
82 |
|
|
iret = theIO.close();
|
83 |
|
|
if (iret!=0) { ierr=-3; return result;}
|
84 |
|
|
|
85 |
|
|
return result;
|
86 |
|
|
}
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
// ----------------------------------------------------------------------------
|
90 |
|
|
// write absolute position of alignable
|
91 |
|
|
|
92 |
|
|
void AlignmentIORoot::writeAlignableAbsolutePositions ( const Alignables& alivec,
|
93 |
flucke |
1.2 |
const char* filename, int iter,
|
94 |
|
|
bool validCheck, int& ierr)
|
95 |
fronga |
1.1 |
{
|
96 |
|
|
AlignableDataIORoot theIO(AlignableDataIORoot::Abs);
|
97 |
|
|
ierr=0;
|
98 |
|
|
int iret;
|
99 |
|
|
iret = theIO.open(filename,iter,true);
|
100 |
|
|
if (iret!=0) { ierr=-1; return;}
|
101 |
|
|
iret = theIO.writeAbsPos(alivec,validCheck);
|
102 |
|
|
if (iret!=0) { ierr=-2; return;}
|
103 |
|
|
iret = theIO.close();
|
104 |
|
|
if (iret!=0) { ierr=-3; return;}
|
105 |
|
|
}
|
106 |
|
|
|
107 |
|
|
// ----------------------------------------------------------------------------
|
108 |
|
|
// read absolute position of alignable
|
109 |
|
|
|
110 |
|
|
AlignablePositions
|
111 |
|
|
AlignmentIORoot::readAlignableAbsolutePositions (const Alignables& alivec,
|
112 |
flucke |
1.2 |
const char* filename, int iter, int& ierr)
|
113 |
fronga |
1.1 |
{
|
114 |
|
|
AlignablePositions result;
|
115 |
|
|
|
116 |
|
|
AlignableDataIORoot theIO(AlignableDataIORoot::Abs);
|
117 |
|
|
ierr=0;
|
118 |
|
|
int iret;
|
119 |
|
|
iret = theIO.open(filename,iter,false);
|
120 |
|
|
if (iret!=0) { ierr=-1; return result;}
|
121 |
|
|
result = theIO.readAbsPos(alivec,iret);
|
122 |
|
|
if (iret!=0) { ierr=-2; return result;}
|
123 |
|
|
iret = theIO.close();
|
124 |
|
|
if (iret!=0) { ierr=-3; return result;}
|
125 |
|
|
|
126 |
|
|
return result;
|
127 |
|
|
}
|
128 |
|
|
|
129 |
|
|
// ----------------------------------------------------------------------------
|
130 |
|
|
// write original position of alignable
|
131 |
|
|
|
132 |
|
|
void AlignmentIORoot::writeAlignableOriginalPositions ( const Alignables& alivec,
|
133 |
flucke |
1.2 |
const char* filename, int iter,
|
134 |
|
|
bool validCheck, int& ierr)
|
135 |
fronga |
1.1 |
{
|
136 |
|
|
AlignableDataIORoot theIO(AlignableDataIORoot::Org);
|
137 |
|
|
ierr=0;
|
138 |
|
|
int iret;
|
139 |
|
|
iret = theIO.open(filename,iter,true);
|
140 |
|
|
if (iret!=0) { ierr=-1; return;}
|
141 |
|
|
iret = theIO.writeOrgPos(alivec,validCheck);
|
142 |
|
|
if (iret!=0) { ierr=-2; return;}
|
143 |
|
|
iret = theIO.close();
|
144 |
|
|
if (iret!=0) { ierr=-3; return;}
|
145 |
|
|
}
|
146 |
|
|
|
147 |
|
|
// ----------------------------------------------------------------------------
|
148 |
|
|
// read original position of alignable
|
149 |
|
|
|
150 |
|
|
AlignablePositions
|
151 |
|
|
AlignmentIORoot::readAlignableOriginalPositions (const Alignables& alivec,
|
152 |
flucke |
1.2 |
const char* filename, int iter, int& ierr)
|
153 |
fronga |
1.1 |
{
|
154 |
|
|
AlignablePositions result;
|
155 |
|
|
|
156 |
|
|
AlignableDataIORoot theIO(AlignableDataIORoot::Org);
|
157 |
|
|
ierr=0;
|
158 |
|
|
int iret;
|
159 |
|
|
iret = theIO.open(filename,iter,false);
|
160 |
|
|
if (iret!=0) { ierr=-1; return result;}
|
161 |
|
|
result = theIO.readOrgPos(alivec,iret);
|
162 |
|
|
if (iret!=0) { ierr=-2; return result;}
|
163 |
|
|
iret = theIO.close();
|
164 |
|
|
if (iret!=0) { ierr=-3; return result;}
|
165 |
|
|
|
166 |
|
|
return result;
|
167 |
|
|
}
|
168 |
|
|
|
169 |
|
|
// ----------------------------------------------------------------------------
|
170 |
|
|
// write relative position of alignable
|
171 |
|
|
|
172 |
|
|
void AlignmentIORoot::writeAlignableRelativePositions( const Alignables& alivec,
|
173 |
flucke |
1.2 |
const char* filename,
|
174 |
|
|
int iter, bool validCheck, int& ierr)
|
175 |
fronga |
1.1 |
{
|
176 |
|
|
AlignableDataIORoot theIO(AlignableDataIORoot::Rel);
|
177 |
|
|
ierr=0;
|
178 |
|
|
int iret;
|
179 |
|
|
iret = theIO.open(filename,iter,true);
|
180 |
|
|
if (iret!=0) { ierr=-1; return;}
|
181 |
|
|
iret = theIO.writeRelPos(alivec,validCheck);
|
182 |
|
|
if (iret!=0) { ierr=-2; return;}
|
183 |
|
|
iret = theIO.close();
|
184 |
|
|
if (iret!=0) { ierr=-3; return;}
|
185 |
|
|
}
|
186 |
|
|
|
187 |
|
|
// ----------------------------------------------------------------------------
|
188 |
|
|
// read relative position of alignable
|
189 |
|
|
|
190 |
|
|
AlignableShifts
|
191 |
|
|
AlignmentIORoot::readAlignableRelativePositions (const Alignables& alivec,
|
192 |
flucke |
1.2 |
const char* filename, int iter, int& ierr)
|
193 |
fronga |
1.1 |
{
|
194 |
|
|
AlignableShifts result;
|
195 |
|
|
|
196 |
|
|
AlignableDataIORoot theIO(AlignableDataIORoot::Rel);
|
197 |
|
|
ierr=0;
|
198 |
|
|
int iret;
|
199 |
|
|
iret = theIO.open(filename,iter,false);
|
200 |
|
|
if (iret!=0) { ierr=-1; return result;}
|
201 |
|
|
result = theIO.readRelPos(alivec,iret);
|
202 |
|
|
if (iret!=0) { ierr=-2; return result;}
|
203 |
|
|
iret = theIO.close();
|
204 |
|
|
if (iret!=0) { ierr=-3; return result;}
|
205 |
|
|
|
206 |
|
|
return result;
|
207 |
|
|
}
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
|