11 #include "StTriggerUtilities/Bemc/StBemcTriggerSimu.h"
12 #include "StTriggerUtilities/Eemc/StEemcTriggerSimu.h"
13 #include "StTriggerUtilities/StDSMUtilities/StDSM2009Utilities.hh"
14 #include "StEmcTriggerSimu.h"
18 StEmcTriggerSimu::StEmcTriggerSimu()
25 StEmcTriggerSimu::~StEmcTriggerSimu()
27 delete mEM201; mEM201 = 0;
28 delete mLD301; mLD301 = 0;
29 delete mTcu; mTcu = 0;
42 void StEmcTriggerSimu::InitRun(
int runNumber)
45 StMaker* chain = StMaker::GetChain();
47 mDBTime = chain->GetDBTime();
48 mYear = mDBTime.GetYear();
52 if(mYear == 2009 || mYear == 2010 || mYear == 2011 || mYear == 2012){
54 }
else if(mYear == 2013){
55 if(runNumber < 14081067){
57 }
else if(runNumber < 14084042){
63 }
else if(mYear == 2015){
65 }
else if(mYear == 2016){
67 }
else if(mYear == 2017){
73 void StEmcTriggerSimu::Make()
76 if (mBemc) mBemc->get2009_DSMLayer1_Result()->write(*mEM201);
77 if (mEemc) mEemc->get2009_DSMLayer1_Result()->write(*mEM201);
79 TString EM201String =
"EM201: ";
80 for (
int ch = 0; ch < 8; ++ch) EM201String += Form(
"%04x ",(*mEM201)[0].channels[ch]);
81 LOG_DEBUG << EM201String << endm;
86 LOG_INFO << Form(
"EM201: BHT0=%d BHT1=%d BHT2=%d BHT3=%d EHT0=%d EHT1=%d JP1=%d JP2=%d BJP1=%d EEMCdijet=%d EJP1=%d JP1dijet=%d JP0dijet=%d BAJP=%d DAQ10k=%d JP0=%d",
87 BHT0(),BHT1(),BHT2(),BHT3(),EHT0(),EHT1(),JP1(),JP2(),BJP1(),EEMCdijet(),EJP1(),JP1dijet(),JP0dijet(),BAJP(),DAQ10k(),JP0()) << endm;
88 }
else if(mYear == 2015){
89 LOG_INFO << Form(
"EM201: BHT0=%d BHT1=%d BHT2=%d HTTP=%d EHT0=%d EHT1=%d JP1=%d JP2=%d BJP1=%d BJP2=%d EJP1=%d EJP2=%d AJP=%d BAJP=%d EB2B=%d JP0=%d",
90 BHT0(),BHT1(),BHT2(),HTTP(),EHT0(), EHT1(), JP1(), JP2(), BJP1(),BJP2(), EJP1(),EJP2(),AJP(), BAJP(), EB2B(), JP0()) << endm;
91 }
else if(mYear == 2016){
92 LOG_INFO << Form(
"EM201: BHT0=%d BHT1=%d BHT2=%d BHT3=%d BHT4=%d BHTUPC=%d BTP=%d BHTTP=%d BTPtopo=%d BHTTPtopo=%d BHT4topo=%d EHT0=%d EHT1=%d DAQ10k=%d",
93 BHT0(),BHT1(),BHT2(),BHT3(),BHT4(), BHTUPC(), BTP(), BHTTP(),BTPtopo(),BHTTPtopo(),BHT4topo(),EHT0_2014(),EHT1_2014(),DAQ10k_2014()) << endm;
94 }
else if(mYear == 2017){
95 LOG_INFO << Form(
"EM201: BHT1=%d BHT2=%d BHT3=%d HTTP=%d EHT0=%d EHT1=%d BJP1=%d BJP2=%d JP0=%d JP1=%d JP2=%d EJP1=%d EJP2=%d",
96 BHT1_2017(),BHT2_2017(),BHT3_2017(),HTTP(), EHT0(), EHT1(), BJP1_2017(),BJP2_2017(), JP0_2017(), JP1_2017(),JP2_2017(),EJP1_2017(), EJP2_2017()) << endm;
98 LOG_INFO << Form(
"EM201: BHT0=%d BHT1=%d BHT2=%d BHT3=%d EHT0=%d EHT1=%d JP1=%d JP2=%d BJP1=%d BJP2=%d EJP1=%d EJP2=%d AJP=%d BAJP=%d EAJP=%d JP0=%d",
99 BHT0(),BHT1(),BHT2(),BHT3(),EHT0(),EHT1(),JP1(),JP2(),BJP1(),BJP2(),EJP1(),EJP2(),AJP(),BAJP(),EAJP(),JP0()) << endm;
105 mEM201->write(*mLD301);
107 TString LD301String =
"LD301: ";
109 for (
int ch = 0; ch < 8; ++ch) LD301String += Form(
"%04x ",(*mLD301)[0].channels[ch]);
110 LOG_DEBUG << LD301String << endm;
114 mTcu->setInput((*mLD301)[0].output);
115 }
else if(mYear > 2010)
117 mTcu->setInput((*mEM201)[0].output);
119 LOG_DEBUG << Form(
"TCU: 0x%04x",mTcu->input() & 0xffff) << endm;
123 bool StEmcTriggerSimu::isTrigger(
int trigId)
125 return mTcu->isTrigger(trigId);
128 set<int> StEmcTriggerSimu::triggerIds()
const
130 return mTcu->triggerIds();
135 return isTrigger(trigId) ? kYes : kNo;}
143 trigdef.onbits = trigdef.onbits1;
144 trigdef.onbits = trigdef.onbits >> 16;
146 mTcu->defineTrigger(trigdef);
149 void StEmcTriggerSimu::defineTrigger(
int triggerIndex,
const char* name,
int triggerId,
unsigned int onbits,
unsigned int offbits,
unsigned int onbits1,
unsigned int onbits2,
unsigned int onbits3,
unsigned int offbits1,
unsigned int offbits2,
unsigned int offbits3)
152 triggerDefinition.triggerIndex = triggerIndex;
153 strcpy(triggerDefinition.name,name);
154 triggerDefinition.triggerId = triggerId;
155 triggerDefinition.onbits = onbits;
156 triggerDefinition.offbits = offbits;
157 triggerDefinition.onbits1 = onbits1;
158 triggerDefinition.onbits2 = onbits2;
159 triggerDefinition.onbits3 = onbits3;
160 triggerDefinition.offbits1 = offbits1;
161 triggerDefinition.offbits2 = offbits2;
162 triggerDefinition.offbits3 = offbits3;
163 LOG_INFO <<
"New Defined Trigger: "
164 << Form(
"triggerIndex=%d name=%s triggerId=%d onbits=0x%04x offbits=0x%04x onbit1=0x%04x onbits2=0x%04x onbits3=0x%04x offbits1=0x%04x offbits2=0x%04x offbits3=0x%04x\n", triggerDefinition.triggerIndex,triggerDefinition.name,triggerDefinition.triggerId,triggerDefinition.onbits, triggerDefinition.offbits, triggerDefinition.onbits1, triggerDefinition.onbits2, triggerDefinition.onbits3, triggerDefinition.offbits1, triggerDefinition.offbits2, triggerDefinition.offbits3) << endm;
166 defineTrigger(triggerDefinition);
169 int StEmcTriggerSimu::EM201output()
const {
return (*mEM201)[0].output; }
171 int StEmcTriggerSimu::overlapJetPatchTh(
int i)
const {
return mEM201->getRegister(i); }
173 void StEmcTriggerSimu::getOverlapJetPatchAdc(
int i,
int& jp,
int& adc)
const
175 int jp_partial = (*mEM201)[0].channels[6+i] >> 12 & 0x3;
176 jp = (1-i)*3+jp_partial-1;
177 adc = (*mEM201)[0].info[i];
179 int StEmcTriggerSimu::overlapJetPatchAdc(
int jp)
const
183 adc = mBemc->barrelPartialJetPatchAdc(jp) + mEemc->endcapPartialJetPatchAdc(jp);
StTriggerSimuDecision triggerDecision(int trigId)
like isTrigger(), but returns kDoNotCare if detector isn't a part of the given trigId ...