BOSS 7.0.1
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 882 of file MixerAlg.cxx.

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

◆ combineMdcDigits()

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

Definition at line 930 of file MixerAlg.cxx.

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

Referenced by MixerAlg::mixDigi().

◆ combineTofDigits()

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

Definition at line 979 of file MixerAlg.cxx.

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

Referenced by MixerAlg::mixDigi().