7 #include "DSMLayer_LD301_2009.hh"
10 TCU_2009::TCU_2009() : mDSMInput(0), mTCUInput(0)
12 defineTrigger(
"bemc-jp1-mb", 137222, 0x4020);
13 defineTrigger(
"eemc-jp1-mb", 137273, 0x4080);
14 defineTrigger(
"bemc-jp0-mb", 137501, 0x4010);
15 defineTrigger(
"bemc-jp0-mb", 137501, 0x4020);
16 defineTrigger(
"eemc-jp0-mb", 137551, 0x4040);
17 defineTrigger(
"eemc-jp0-mb", 137551, 0x4080);
18 defineTrigger(
"bemc-jp2", 137585, 0x0030);
19 defineTrigger(
"eemc-jp2", 137635, 0x00c0);
20 defineTrigger(
"jpsi-mb", 137705, 0x4008);
21 defineTrigger(
"ajp-mb", 999996, 0x4400);
22 defineTrigger(
"emc2-jp0-mb", 999997, 0x4100);
23 defineTrigger(
"emc2-jp0-mb", 999997, 0x4200);
24 defineTrigger(
"emc2-jp1-mb", 999998, 0x4200);
25 defineTrigger(
"emc2-jp2", 999999, 0x0300);
31 mDSMInput = evtDesc->DSMInput;
36 mTCUInput = layer[0].output & 0xffff;
39 void TCU_2009::update()
41 mTCUInput = mDSMInput;
44 void TCU_2009::defineTrigger(
const char* name,
int id,
int mask)
46 mTriggers.insert(make_pair(
id, make_pair(name, mask)));
49 int TCU_2009::numberOfTriggers()
const {
return mTriggers.size(); }
51 bool TCU_2009::isTrigger(
int triggerId)
const
53 pair<MapIterator, MapIterator> p = mTriggers.equal_range(triggerId);
54 for (MapIterator i = p.first; i != p.second; ++i)
55 if (isTrigger(i))
return true;
59 string TCU_2009::triggerName(
int triggerId)
const
61 MapIterator i = mTriggers.find(triggerId);
62 return (i == mTriggers.end()) ?
"" : triggerName(i);
65 void TCU_2009::getTriggerMasks(
int triggerId, vector<int>& masks)
const
67 pair<MapIterator, MapIterator> p = mTriggers.equal_range(triggerId);
68 for (MapIterator i = p.first; i != p.second; ++i)
69 masks.push_back(triggerMask(i));
72 int TCU_2009::barrelJetPatchBits(
int triggerId)
const
75 getTriggerMasks(triggerId, masks);
76 return masks.empty() ? 0 : *min_element(masks.begin(), masks.end()) >> 4 & 0x3;
79 int TCU_2009::endcapJetPatchBits(
int triggerId)
const
82 getTriggerMasks(triggerId, masks);
83 return masks.empty() ? 0 : *min_element(masks.begin(), masks.end()) >> 6 & 0x3;
86 int TCU_2009::emcJetPatchBits(
int triggerId)
const
89 getTriggerMasks(triggerId, masks);
90 return masks.empty() ? 0 : *min_element(masks.begin(), masks.end()) >> 8 & 0x3;
93 void TCU_2009::dump()
const
96 for (MapIterator i = mTriggers.begin(); i != mTriggers.end(); ++i)
97 printf(
"%s\t%d\t0x%04x\t%d\n", triggerName(i).c_str(), triggerId(i), triggerMask(i), isTrigger(i));