103{
104 using std::setw;
106 const G4bool confirm =
true;
107 G4int oldprc = os.precision(prec);
108
109 std::vector<G4LocatorChangeRecord>::const_iterator itrecA, itrecB;
110 itrecA= startA.begin();
111 itrecB= endB.begin();
112
113 os << "====================================================================="
115 os << " Size of individual change record: startA : " << startA.size()
116 <<
" endB : " << endB.size() <<
G4endl;
117 os << "====================================================================="
119
120 os << setw( 7 ) << "Change#" << " "
121 << setw( 4 ) << "Iter" << " "
122 << setw( 20 ) << "CodeLocation" << " "
123 << setw( prec+9 ) << "Length-A (start)" << " "
124 << setw( prec+9 ) << "Length-B (end)" << " "
126 os << "=====================================================================";
127
128
129 auto eventA = (*itrecA).GetCount();
130 auto eventB = (*itrecB).GetCount();
131
134
136
137 G4int maxEvent = std::max( startA[ startA.size() - 1 ].GetCount() ,
138 endB[ endB.size() - 1 ].GetCount() );
141
142 G4bool advanceA=
false, advanceB=
false;
143 do
144 {
145 advanceA= false;
146 advanceB= false;
147
148 if( ((
G4int)eventA>prevA) && ((
G4int)eventB>prevB) )
149 {
150 auto codeLocA= (*itrecA).GetLocation();
151
153 os << setw( 7 ) << eventA << " "
154 << setw( 4 ) << (*itrecA).GetIteration() << " "
155 << setw( 3 ) << codeLocA << " "
157 << setw( prec+9 ) << (*itrecA).GetLength() << " "
158 << setw( prec+9 ) << (*itrecB).GetLength() << " ";
159 if( confirm )
160 {
161 os << setw( 4 ) << (*itrecB).GetIteration() << " "
162 << setw( 15 ) << (*itrecB).GetLocation();
163 }
164 }
165 else
166 {
167 if ( (
G4int)eventA > prevA )
168 {
169 auto codeLocA = (*itrecA).GetLocation();
171 os << setw( 7 ) << (*itrecA).GetCount() << " "
172 << setw( 4 ) << (*itrecA).GetIteration() << " "
173 << setw( 3 ) << codeLocA << " "
175 << setw( prec+9 ) << (*itrecA).GetLength() << " "
176 << setw( prec+9 ) << " " << " ";
177 }
178 else
179 {
180
181 auto codeLocB = (*itrecB).GetLocation();
182
184 os << setw( 7 ) << eventB << " "
185 << setw( 4 ) << (*itrecB).GetIteration() << " "
186 << setw( 3 ) << codeLocB << " "
188 << setw( prec+9 ) << " " << " "
189 << setw( prec+9 ) << (*itrecB).GetLength() << " " ;
190 }
191 }
192
193 prevA= eventA;
194 prevB= eventB;
195
196 auto nextA= itrecA;
197 auto nextB= itrecB;
198
199 G4int nextAct = maxEvent, nextBct = maxEvent;
200 ++nextA;
201 ++nextB;
202 if ( nextA != startA.end() ) { nextAct = (*nextA).GetCount(); }
203 if ( nextB != endB.end() ) { nextBct = (*nextB).GetCount(); }
204
205 isLastA= ( nextA >= startA.end() );
206 isLastB= ( nextB >= endB.end() );
207
208 advanceA= ( nextAct <= nextBct ) && !isLastA;
209 advanceB= ( nextBct <= nextAct ) && !isLastB;
210
211 if( advanceA )
212 {
213 ++itrecA;
214 if( !isLastA ) { ++jA; eventA = (*itrecA).GetCount(); }
215 else { eventA = maxEvent; }
216 }
217
218 if( advanceB )
219 {
220 ++itrecB;
221 if( !isLastB ) { ++jB; eventB = (*itrecB).GetCount(); }
222 else { eventB = maxEvent; }
223 }
224
225
226 if( isLastA != ( nextA == startA.end() ) )
227 {
229 os << " Checking isLastA= " << isLastA << " vs expected : "
230 << ( itrecA == startA.end() );
231 os <<
" BAD --- ERROR " <<
G4endl;
232 }
233 if( isLastB != ( nextB == endB.end() ) )
234 {
236 os << " Checking isLastB= " << isLastB << " vs expected : "
237 << ( itrecB == endB.end() );
238 os <<
" BAD --- ERROR " <<
G4endl;
239 }
240
241 } while ( ! ( isLastA && isLastB ) );
242
244 os.precision(oldprc);
245 return os;
246}