BOSS 6.6.4.p03
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 875 of file MixerAlg.cxx.

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

◆ combineMdcDigits()

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

Definition at line 923 of file MixerAlg.cxx.

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

Referenced by MixerAlg::mixDigi().

◆ combineTofDigits()

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

Definition at line 972 of file MixerAlg.cxx.

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

Referenced by MixerAlg::mixDigi().