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