CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
MixerAlg.cxx File Reference
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/INTuple.h"
#include "GaudiKernel/INTupleSvc.h"
#include "BesEventMixer/MixerAlg.h"
#include "RawDataCnv/EventManagement/RAWEVENT.h"
#include "IRawFile/RawFileExceptions.h"
#include "EventModel/EventModel.h"
#include "EventModel/Event.h"
#include "EventModel/EventHeader.h"
#include "TrigEvent/TrigGTD.h"
#include "HltEvent/DstHltInf.h"
#include "BesKernel/IBesRndmGenSvc.h"
#include "CLHEP/Random/Random.h"
#include "CLHEP/Random/RandFlat.h"
#include "CLHEP/Random/RandExponential.h"
#include "RawDataCnv/Util/MdcConverter.h"
#include "RawDataCnv/Util/MucConverter.h"
#include "RawDataCnv/Util/TofConverter.h"
#include "RawDataCnv/Util/EmcConverter.h"
#include "RootCnvSvc/RootInterface.h"
#include <vector>
#include <map>
#include <algorithm>
#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 879 of file MixerAlg.cxx.

880{
881 vector<T2*> newDigiCol;
882 typename T1::iterator mc;
883 typename T1::const_iterator bg;
884 bool new_digi;
885 for(bg = bgDigits.begin(); bg != bgDigits.end(); bg++ )
886 {
887 new_digi = true;
888 for(mc = mcDigits->begin(); mc != mcDigits->end(); mc++ )
889 {
890 if((*mc)->identify()==(*bg)->identify())
891 {
892 if( verbosity < 2 )
893 {
894 cout << "****************************************"<<endl;
895 cout << "MC id " << (*mc)->identify().get_value()
896 << " BG Id " << (*bg)->identify().get_value() << endl;
897 cout<<"==> MC Digi : ";
898 (*mc)->fillStream(cout);
899 cout<<"==> BG Digi : ";
900 (*bg)->fillStream(cout);
901 }
902
903 (*mc)->setTrackIndex((*mc)->getTrackIndex() - 999);
904 *(*mc) += *(*bg);
905
906 new_digi = false;
907 if( verbosity < 2 )
908 {
909 cout<<"==> New MC Digi: ";
910 (*mc)->fillStream(cout);
911 cout << "****************************************"<<endl;
912 }
913 }
914 }
915
916 // no signal digi in this channel. Create new digi with BG only
917 if (new_digi) {
918 (*bg)->setTrackIndex(-1000);
919 newDigiCol.push_back(*bg);
920 }
921 }
922
923 for(bg=newDigiCol.begin(); bg!=newDigiCol.end(); bg++ )
924 mcDigits->push_back(*bg);
925}
void bg(int i, double p)
Definition: betagamma.cxx:1

◆ combineMdcDigits()

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

Definition at line 927 of file MixerAlg.cxx.

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 // no signal digi in this channel. Create new digi with BG only
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}

Referenced by MixerAlg::mixDigi().

◆ combineTofDigits()

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

Definition at line 976 of file MixerAlg.cxx.

977{
978 vector<TofDigi*> newDigiCol;
979 //typename TofDigiCol::const_iterator bg;
980 TofDigiCol::const_iterator bgTof = bgDigits.begin();
981 for(; bgTof!=bgDigits.end(); bgTof++ )
982 {
983 (*bgTof)->setTrackIndex(-1000);
984 newDigiCol.push_back(*bgTof);
985 }
986 for(bgTof=newDigiCol.begin(); bgTof!=newDigiCol.end(); bgTof++ ) {
987 mcDigits->push_back(*bgTof);
988 }
989}

Referenced by MixerAlg::mixDigi().