BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MixerAlg.cxx File Reference
#include "CLHEP/Random/RandExponential.h"
#include "CLHEP/Random/RandFlat.h"
#include "CLHEP/Random/Random.h"
#include "GaudiKernel/INTuple.h"
#include "GaudiKernel/INTupleSvc.h"
#include "GaudiKernel/MsgStream.h"
#include "IRawFile/RawFileExceptions.h"
#include "MixerAlg.h"
#include "EventModel/Event.h"
#include "EventModel/EventHeader.h"
#include "EventModel/EventModel.h"
#include "HltEvent/DstHltInf.h"
#include "TrigEvent/TrigGTD.h"
#include "BesRndmGenSvc/IBesRndmGenSvc.h"
#include "RawDataCnv/EventManagement/RAWEVENT.h"
#include "RawDataCnv/SniperJSON.h"
#include "RawDataCnv/Util/EmcConverter.h"
#include "RawDataCnv/Util/MdcConverter.h"
#include "RawDataCnv/Util/MucConverter.h"
#include "RawDataCnv/Util/TofConverter.h"
#include "RootCnvSvc/RootInterface.h"
#include <algorithm>
#include <map>
#include <vector>
#include <libgen.h>

Go to the source code of this file.

Functions

template<class T1, class T2>
void combineDigits (SmartDataPtr< T1 > &mcDigits, T1 &bgDigits, int verbosity)
void combineMdcDigits (SmartDataPtr< MdcDigiCol > &mcDigits, MdcDigiCol &bgDigits, int verbosity)
void combineTofDigits (SmartDataPtr< TofDigiCol > &mcDigits, TofDigiCol &bgDigits, int verbosity)

Function Documentation

◆ combineDigits()

template<class T1, class T2>
void combineDigits ( SmartDataPtr< T1 > & mcDigits,
T1 & bgDigits,
int verbosity )

Definition at line 972 of file MixerAlg.cxx.

972 {
973 vector<T2*> newDigiCol;
974 typename T1::iterator mc;
975 typename T1::const_iterator bg;
976 bool new_digi;
977 for ( bg = bgDigits.begin(); bg != bgDigits.end(); bg++ )
978 {
979 new_digi = true;
980 for ( mc = mcDigits->begin(); mc != mcDigits->end(); mc++ )
981 {
982 if ( ( *mc )->identify() == ( *bg )->identify() )
983 {
984 if ( verbosity < 2 )
985 {
986 cout << "****************************************" << endl;
987 cout << "MC id " << ( *mc )->identify().get_value() << " BG Id "
988 << ( *bg )->identify().get_value() << endl;
989 cout << "==> MC Digi : ";
990 ( *mc )->fillStream( cout );
991 cout << "==> BG Digi : ";
992 ( *bg )->fillStream( cout );
993 }
994
995 ( *mc )->setTrackIndex( ( *mc )->getTrackIndex() - 999 );
996 *( *mc ) += *( *bg );
997
998 new_digi = false;
999 if ( verbosity < 2 )
1000 {
1001 cout << "==> New MC Digi: ";
1002 ( *mc )->fillStream( cout );
1003 cout << "****************************************" << endl;
1004 }
1005 }
1006 }
1007
1008 // no signal digi in this channel. Create new digi with BG only
1009 if ( new_digi )
1010 {
1011 ( *bg )->setTrackIndex( -1000 );
1012 newDigiCol.push_back( *bg );
1013 }
1014 }
1015
1016 for ( bg = newDigiCol.begin(); bg != newDigiCol.end(); bg++ ) mcDigits->push_back( *bg );
1017}

Referenced by MixerAlg::mixDigi().

◆ combineMdcDigits()

void combineMdcDigits ( SmartDataPtr< MdcDigiCol > & mcDigits,
MdcDigiCol & bgDigits,
int verbosity )

Definition at line 1019 of file MixerAlg.cxx.

1020 {
1021 vector<MdcDigi*> newDigiCol;
1022 MdcDigiCol::const_iterator mc;
1023 MdcDigiCol::const_iterator bg;
1024 bool new_digi;
1025 for ( bg = bgDigits.begin(); bg != bgDigits.end(); bg++ )
1026 {
1027 if ( ( *bg )->getChargeChannel() < 0x7FFFFFFF ) ( *bg )->setChargeChannel( 0 );
1028 new_digi = true;
1029 for ( mc = mcDigits->begin(); mc != mcDigits->end(); mc++ )
1030 {
1031 if ( ( *mc )->identify() == ( *bg )->identify() )
1032 {
1033 if ( verbosity < 2 )
1034 {
1035 cout << "****************************************" << endl;
1036 cout << "MC id " << ( *mc )->identify().get_value() << " BG Id "
1037 << ( *bg )->identify().get_value() << endl;
1038 cout << "==> MC Digi : ";
1039 ( *mc )->fillStream( cout );
1040 cout << "==> BG Digi : ";
1041 ( *bg )->fillStream( cout );
1042 }
1043
1044 ( *mc )->setTrackIndex( ( *mc )->getTrackIndex() - 999 );
1045 *( *mc ) += *( *bg );
1046
1047 new_digi = false;
1048 if ( verbosity < 2 )
1049 {
1050 cout << "==> New MC Digi: ";
1051 ( *mc )->fillStream( cout );
1052 cout << "****************************************" << endl;
1053 }
1054 }
1055 }
1056
1057 // no signal digi in this channel. Create new digi with BG only
1058 if ( new_digi )
1059 {
1060 ( *bg )->setTrackIndex( -1000 );
1061 newDigiCol.push_back( *bg );
1062 }
1063 }
1064
1065 for ( bg = newDigiCol.begin(); bg != newDigiCol.end(); bg++ ) mcDigits->push_back( *bg );
1066}

Referenced by MixerAlg::mixDigi().

◆ combineTofDigits()

void combineTofDigits ( SmartDataPtr< TofDigiCol > & mcDigits,
TofDigiCol & bgDigits,
int verbosity )

Definition at line 1068 of file MixerAlg.cxx.

1069 {
1070 vector<TofDigi*> newDigiCol;
1071 // typename TofDigiCol::const_iterator bg;
1072 TofDigiCol::const_iterator bgTof = bgDigits.begin();
1073 for ( ; bgTof != bgDigits.end(); bgTof++ )
1074 {
1075 ( *bgTof )->setTrackIndex( -1000 );
1076 newDigiCol.push_back( *bgTof );
1077 }
1078 for ( bgTof = newDigiCol.begin(); bgTof != newDigiCol.end(); bgTof++ )
1079 { mcDigits->push_back( *bgTof ); }
1080}

Referenced by MixerAlg::mixDigi().