928{
929 vector<MdcDigi*> newDigiCol;
930 MdcDigiCol::const_iterator mc;
931 MdcDigiCol::const_iterator
bg;
932 bool new_digi;
933 for(
bg = bgDigits.begin();
bg != bgDigits.end();
bg++ )
934 {
935 if((*bg)->getChargeChannel() < 0x7FFFFFFF) (*bg)->setChargeChannel(0);
936 new_digi = true;
937 for(mc = mcDigits->begin(); mc != mcDigits->end(); mc++ )
938 {
939 if((*mc)->identify()==(*bg)->identify())
940 {
941 if( verbosity < 2 )
942 {
943 cout << "****************************************"<<endl;
944 cout << "MC id " << (*mc)->identify().get_value()
945 << " BG Id " << (*bg)->identify().get_value() << endl;
946 cout<<"==> MC Digi : ";
947 (*mc)->fillStream(cout);
948 cout<<"==> BG Digi : ";
949 (*bg)->fillStream(cout);
950 }
951
952 (*mc)->setTrackIndex((*mc)->getTrackIndex() - 999);
953 *(*mc) += *(*bg);
954
955 new_digi = false;
956 if( verbosity < 2 )
957 {
958 cout<<"==> New MC Digi: ";
959 (*mc)->fillStream(cout);
960 cout << "****************************************"<<endl;
961 }
962 }
963 }
964
965
966 if (new_digi) {
967 (*bg)->setTrackIndex(-1000);
968 newDigiCol.push_back(*
bg);
969 }
970 }
971
972 for(
bg=newDigiCol.begin();
bg!=newDigiCol.end();
bg++ )
973 mcDigits->push_back(*
bg);
974}