24 std::vector< Alignable* >::const_iterator itA;
25 for ( itA = alignables.begin(); itA != alignables.end(); ++itA )
27 FullDistancesList::iterator itD =
theDistances.find( *itA );
31 currentDistances[*itA] = itD->second;
33 std::vector< Alignable* >::const_iterator itA2;
34 for ( itA2 = alignables.begin(); itA2 != alignables.end(); ++itA2 ) (*itD->second)[*itA2] = ( *itA == *itA2 ) ? 0 : 1;
40 currentDistances[*itA] = newEntry;
42 std::vector< Alignable* >::const_iterator itA2;
43 for ( itA2 = alignables.begin(); itA2 != alignables.end(); ++itA2 ) (*newEntry)[*itA2] = ( *itA == *itA2 ) ? 0 : 1;
48 FullDistancesList::iterator itC1;
49 FullDistancesList::iterator itC2;
50 for ( itC1 = currentDistances.begin(); itC1 != currentDistances.end(); ++itC1 )
54 for ( itC2 = currentDistances.begin(); itC2 != currentDistances.end(); ++itC2 )
56 if ( itC1->first != itC2->first )
updateList( updatedList, itC2->second );
60 updatedDistances[itC1->first] = updatedList;
77 FullDistancesList::const_iterator itD =
theDistances.find( i );
85 if ( i == j )
return 0;
87 FullDistancesList::const_iterator itD =
theDistances.find( i );
90 SingleDistancesList::const_iterator itL = itD->second->find( j );
91 if ( itL == itD->second->end() )
return -1;
101 FullDistancesList::const_iterator itD;
120 alignables.push_back( itL->first );
128 FullDistancesList::iterator itD;
129 for ( itD = dist.begin(); itD != dist.end(); ++itD )
delete itD->second;
137 SingleDistancesList::iterator itThis;
138 SingleDistancesList::iterator itOther;
141 for ( itThis = thisList->begin(), itOther = otherList->begin(); itOther != otherList->end(); ++itOther )
147 while ( itThis != thisList->end() && itThis->first < itOther->first ) ++itThis;
150 if ( itThis == thisList->end() || itThis->first > itOther->first ) {
151 (*thisList)[itOther->first] = itOther->second + 1;
153 }
else if ( itThis->second > itOther->second ) {
154 itThis->second = itOther->second + 1;
163 FullDistancesList::iterator itOld;
164 FullDistancesList::iterator itNew;
166 for ( itNew = updated.begin(); itNew != updated.end(); ++itNew )
169 delete itOld->second;
170 itOld->second = itNew->second;
177 FullDistancesList::iterator itOld;
178 FullDistancesList::iterator itNew;
180 for ( itNew = propagated.begin(); itNew != propagated.end(); ++itNew )
183 SingleDistancesList::iterator itL;
184 for ( itL = itNew->second->begin(); itL != itNew->second->end(); ++itL )
195 SingleDistancesList::iterator itOld;
196 SingleDistancesList::iterator itNew;
203 for ( itOld = oldList->begin(), itNew = newList->begin(); itNew != newList->end(); ++itNew )
206 if ( itOld == oldList->end() || itNew->first < itOld->first )
208 insertDistance( changes, itNew->first, alignable, itNew->second );
209 newConnections[itNew->first] = itNew->second;
211 }
else if ( itNew->first == itOld->first ) {
212 if ( itNew->second != itOld->second )
insertDistance( changes, itNew->first, alignable, itNew->second );
217 SingleDistancesList::iterator it;
218 for ( it = newConnections.begin(); it != newConnections.end(); ++it )
219 connect( changes, newList, it->first, it->second );
226 SingleDistancesList::iterator itL;
227 for ( itL = connection->begin(); itL != connection->end(); ++itL )
229 if ( itL->first != alignable )
insertDistance( changes, alignable, itL->first, value + itL->second );
237 FullDistancesList::iterator itD = dist.find( i );
238 if ( itD != dist.end() )
253 SingleDistancesList::iterator itL = distList->find( j );
254 if ( itL != distList->end() ) {
255 if ( itL->second > value ) itL->second =
value;
SingleDistancesList theDefaultReturnList
const std::vector< Alignable * > alignables(void) const
Return all known alignables.
void connect(FullDistancesList &changes, SingleDistancesList *connection, Alignable *alignable, short int value)
void insertPropagatedDistances(FullDistancesList &propagated)
Insert the 'propagated distances' into the lists of the remaining alignables.
FullDistancesList theDistances
void insertDistance(FullDistancesList &dist, Alignable *i, Alignable *j, short int value)
void setBranchAddresses(TTree *tree)
void updateList(SingleDistancesList *thisList, SingleDistancesList *otherList)
short int operator()(Alignable *i, Alignable *j) const
void createBranches(TTree *tree)
unsigned int nDistances(void) const
Number of stored distances.
KalmanAlignmentMetricsCalculator(void)
void readDistances(std::string filename)
void insertUpdatedDistances(FullDistancesList &updated)
Insert changes due to the update of the lists of the current alignables.
void updateDistances(const std::vector< Alignable * > &alignables)
Update list of distances with a set Alignables.
void extractPropagatedDistances(FullDistancesList &changes, Alignable *alignable, SingleDistancesList *oldList, SingleDistancesList *newList)
Extract entries from the updated lists that need to be further propagated.
const SingleDistancesList & getDistances(Alignable *i) const
void writeDistances(std::string filename)
~KalmanAlignmentMetricsCalculator(void)
void clear(void)
Clear stored distances.
void clearDistances(FullDistancesList &dist)
std::map< Alignable *, SingleDistancesList * > FullDistancesList
std::map< Alignable *, short int > SingleDistancesList