710 std::vector < G4double > rhoa;
713 for (
G4int i = 0 ; i <
n ; i++ )
719 for (
G4int j = 0 ; j <
n ; j++ )
722 rhoa[i] +=
rha[i][j];
732 std::map < G4int , std::vector < G4int > > cluster_map;
733 std::vector < G4bool > is_already_belong_some_cluster;
736 std::multimap < G4int , G4int > comb_map;
737 std::multimap < G4int , G4int > assign_map;
740 std::vector < G4int > mascl;
741 std::vector < G4int > num;
744 is_already_belong_some_cluster.resize ( n );
746 std::vector < G4int > is_assigned_to ( n , -1 );
747 std::multimap < G4int , G4int > clusters;
749 for (
G4int i = 0 ; i <
n ; i++ )
754 is_already_belong_some_cluster[i] =
false;
763 G4int cluster_id = -1;
764 for (
G4int i = 0 ; i < n-1 ; i++ )
767 G4bool hasThisCompany =
false;
778 for (
G4int j = j1 ; j <
n ; j++ )
781 std::vector < G4int > cluster_participants;
789 * ( rhoa[ i ] + rhoa[ j ] )
790 * ( rhoa[ i ] + rhoa[ j ] );
793 if ( rdist2 < rcc2 && pdist2 < pcc2 )
803 if ( is_assigned_to [ j ] == -1 )
805 if ( is_assigned_to [ i ] == -1 )
807 if ( clusters.size() != 0 )
809 id = clusters.rbegin()->first + 1;
816 clusters.insert ( std::multimap<G4int,G4int>::value_type (
id , i ) );
817 is_assigned_to [ i ] = id;
818 clusters.insert ( std::multimap<G4int,G4int>::value_type (
id , j ) );
819 is_assigned_to [ j ] = id;
823 clusters.insert ( std::multimap<G4int,G4int>::value_type ( is_assigned_to [ i ] , j ) );
824 is_assigned_to [ j ] = is_assigned_to [ i ];
830 if ( is_assigned_to [ i ] == -1 )
832 clusters.insert ( std::multimap<G4int,G4int>::value_type ( is_assigned_to [ j ] , i ) );
833 is_assigned_to [ i ] = is_assigned_to [ j ];
838 if ( is_assigned_to [ i ] != is_assigned_to [ j ] )
843 std::multimap< G4int , G4int > clusters_tmp;
844 G4int target_cluster_id;
845 if ( is_assigned_to [ i ] > is_assigned_to [ j ] )
846 target_cluster_id = is_assigned_to [ i ];
848 target_cluster_id = is_assigned_to [ j ];
850 for ( std::multimap< G4int , G4int >::iterator it
851 = clusters.begin() ; it != clusters.end() ; it++ )
855 if ( it->first == target_cluster_id )
858 is_assigned_to [ it->second ] = is_assigned_to [ j ];
859 clusters_tmp.insert ( std::multimap<G4int,G4int>::value_type ( is_assigned_to [ j ] , it->second ) );
863 clusters_tmp.insert ( std::multimap<G4int,G4int>::value_type ( it->first , it->second ) );
867 clusters = clusters_tmp;
876 comb_map.insert( std::multimap<G4int,G4int>::value_type ( i , j ) );
877 cluster_participants.push_back ( j );
881 if ( assign_map.find( cluster_id ) == assign_map.end() )
883 is_already_belong_some_cluster[i] =
true;
884 assign_map.insert ( std::multimap<G4int,G4int>::value_type ( cluster_id , i ) );
885 hasThisCompany =
true;
887 assign_map.insert ( std::multimap<G4int,G4int>::value_type ( cluster_id , j ) );
888 is_already_belong_some_cluster[j] =
true;
899 if ( cluster_participants.size() > 0 )
902 cluster_map.insert ( std::pair <
G4int , std::vector < G4int > > ( i , cluster_participants ) );
907 if ( hasThisCompany ==
true ) cluster_id++;
915 std::multimap< G4int , G4int > sorted_cluster_map;
916 for (
G4int i = 0 ; i <= id ; i++ )
920 sorted_cluster_map.insert ( std::multimap<G4int,G4int>::value_type ( (
G4int) clusters.count( i ) , i ) );
926 std::vector < G4QMDNucleus* > result;
927 for ( std::multimap < G4int , G4int >::reverse_iterator it
928 = sorted_cluster_map.rbegin() ; it != sorted_cluster_map.rend() ; it ++)
933 if ( it->first != 0 )
936 for ( std::multimap < G4int , G4int >::iterator itt
937 = clusters.begin() ; itt != clusters.end() ; itt ++)
940 if ( it->second == itt->first )
947 result.push_back( nucleus );
954 for ( std::vector < G4QMDNucleus* > ::iterator it
955 = result.begin() ; it != result.end() ; it++ )
static G4Pow * GetInstance()
void SetParticipant(G4QMDParticipant *particle)
void SubtractSystem(G4QMDSystem *)
G4double A23(G4double A) const
void Cal2BodyQuantities()
G4int GetTotalNumberOfParticipant()
G4QMDParticipant * GetParticipant(G4int i)
std::vector< std::vector< G4double > > rr2
G4double A13(G4double A) const
std::vector< std::vector< G4double > > rha
std::vector< std::vector< G4double > > pp2