00001
00002
00003
00004
00005 #include "StEventTypes.h"
00006
00007
00008 #include "StMuDSTMaker/COMMON/StMuTypes.hh"
00009
00010
00011 #include "StTriggerUtilities/Bbc/StBbcTriggerSimu.h"
00012
00013 ClassImp(StBbcTriggerSimu)
00014
00015
00016
00017 StBbcTriggerSimu::StBbcTriggerSimu(){
00018 BBCadcNum=48;
00019 }
00020
00021
00022
00023 StBbcTriggerSimu::~StBbcTriggerSimu(){
00024 }
00025
00026
00027 void
00028 StBbcTriggerSimu::Init(){
00029
00030 LOG_INFO <<Form("Bbc::Init() MC_flag=%d, adcThres=%d",mMCflag,AdcTrigThresh)<<endm;
00031 if(mMCflag) LOG_WARN <<"Bbc:: TDC thresholds not implemented"<<endm;
00032 }
00033
00034
00035
00036 void StBbcTriggerSimu::Clear(){
00037
00038 bbcTrig=kNo;
00039 Wbbc=0;
00040 Ebbc=0;
00041 for (int i=0;i<BBCadcNum;i++) {
00042 BBCadc[i]=0;
00043 }
00044
00045 }
00046
00047
00048
00049 void StBbcTriggerSimu::Make()
00050 {
00051
00052 if (mSource == "MuDst") {
00053 StMuDst* mudst = (StMuDst*)StMaker::GetChain()->GetDataSet("MuDst");
00054 if (mudst) Make(mudst);
00055 }
00056 else if (mSource == "StEvent") {
00057 StEvent* event = (StEvent*)StMaker::GetChain()->GetDataSet("StEvent");
00058 if (event) Make(event);
00059 }
00060 else {
00061 LOG_ERROR << "StBbcTriggerSimu - Unknown source \"" << mSource << "\"" << endm;
00062 }
00063
00064 if ((Ebbc==1)&&(Wbbc==1)) bbcTrig=kYes;
00065
00066 LOG_DEBUG<<" Wbbc ="<<Wbbc<<" Ebbc="<<Ebbc<<" bbcTrig="<<bbcTrig<<endm;
00067 for (int i=0;i<BBCadcNum;i++) {
00068 LOG_DEBUG<<i<<" adc="<<BBCadc[i]<<endm;
00069 }
00070
00071 }
00072
00073 void StBbcTriggerSimu::Make(StMuDst*)
00074 {
00075 StBbcTriggerDetector& bbc = StMuDst::event()->bbcTriggerDetector();
00076 Make(bbc);
00077 }
00078
00079 void StBbcTriggerSimu::Make(StEvent* event)
00080 {
00081 StTriggerDetectorCollection* trig = event->triggerDetectorCollection();
00082 if (trig) {
00083 StBbcTriggerDetector& bbc = trig->bbc();
00084 Make(bbc);
00085 }
00086 }
00087
00088 void StBbcTriggerSimu::Make(StBbcTriggerDetector& bbc)
00089 {
00090 bbc.setYear(StMaker::GetChain()->GetDBTime().GetYear());
00091
00092 for (UInt_t pmt=0; pmt<bbc.numberOfPMTs(); pmt++) {
00093
00094 BBCadc[pmt]=bbc.adc(pmt);
00095
00096 int bbcadc=bbc.adc(pmt);
00097
00098 if (bbcadc>AdcTrigThresh) {
00099 if (pmt<16) Ebbc=1;
00100 if (23<pmt && pmt<40) Wbbc=1;
00101 }
00102 }
00103 }
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139