CMS 3D CMS Logo

L1GctJetLeafCard.cc
Go to the documentation of this file.
2 
4 
9 
11 
12 //DEFINE STATICS
14 
16  : L1GctProcessor(),
17  m_id(id),
18  m_whichJetFinder(jfType),
19  phiPosition(iphi),
20  m_exSum(0),
21  m_eySum(0),
22  m_hxSum(0),
23  m_hySum(0),
24  m_etSum(0),
25  m_htSum(0),
26  m_hfSums(),
27  m_exSumPipe(),
28  m_eySumPipe(),
29  m_hxSumPipe(),
30  m_hySumPipe(),
31  m_etSumPipe(),
32  m_htSumPipe(),
33  m_hfSumsPipe(),
34  m_ctorInputOk(true) {
35  //Check jetLeafCard setup
36  if (m_id < 0 || m_id > 5) {
37  m_ctorInputOk = false;
38  if (m_verbose) {
39  edm::LogWarning("L1GctSetupError") << "L1GctJetLeafCard::L1GctJetLeafCard() : Jet Leaf Card ID " << m_id
40  << " has been incorrectly constructed!\n"
41  << "ID number should be between the range of 0 to 5\n";
42  }
43  }
44 
45  //iphi is redundant
46  if (phiPosition != m_id % 3) {
47  m_ctorInputOk = false;
48  if (m_verbose) {
49  edm::LogWarning("L1GctSetupError") << "L1GctJetLeafCard::L1GctJetLeafCard() : Jet Leaf Card ID " << m_id
50  << " has been incorrectly constructed!\n"
51  << "Argument iphi is " << phiPosition << ", should be " << (m_id % 3)
52  << " for this ID value \n";
53  }
54  }
55 
56  switch (m_whichJetFinder) {
57  case tdrJetFinder:
58  m_jetFinderA = new L1GctTdrJetFinder(3 * id);
59  m_jetFinderB = new L1GctTdrJetFinder(3 * id + 1);
60  m_jetFinderC = new L1GctTdrJetFinder(3 * id + 2);
61  break;
62 
63  case hardwareJetFinder:
65  m_jetFinderB = new L1GctHardwareJetFinder(3 * id + 1);
66  m_jetFinderC = new L1GctHardwareJetFinder(3 * id + 2);
67  break;
68 
69  case nullJetFinder:
70  m_jetFinderA = new L1GctNullJetFinder(3 * id);
71  m_jetFinderB = new L1GctNullJetFinder(3 * id + 1);
72  m_jetFinderC = new L1GctNullJetFinder(3 * id + 2);
73  break;
74 
75  default:
76 
77  m_ctorInputOk = false;
78  if (m_verbose) {
79  edm::LogWarning("L1GctSetupError")
80  << "L1GctJetLeafCard::L1GctJetLeafCard() : Jet Leaf Card ID " << m_id
81  << " has been incorrectly constructed!\n"
82  << "Unrecognised jetFinder type " << m_whichJetFinder << ", cannot setup jetFinders\n";
83  }
84  }
85 
86  if (!m_ctorInputOk && m_verbose) {
87  edm::LogError("L1GctSetupError") << "Jet Leaf Card ID " << m_id << " has been incorrectly constructed";
88  }
89 }
90 
92  delete m_jetFinderA;
93  delete m_jetFinderB;
94  delete m_jetFinderC;
95 }
96 
98 void L1GctJetLeafCard::setNeighbourLeafCards(const std::vector<L1GctJetLeafCard*>& neighbours) {
99  std::vector<L1GctJetFinderBase*> jfNeighbours(2);
100 
101  if (neighbours.size() == 2) {
102  jfNeighbours.at(0) = neighbours.at(0)->getJetFinderC();
103  jfNeighbours.at(1) = m_jetFinderB;
104  m_jetFinderA->setNeighbourJetFinders(jfNeighbours);
105 
106  jfNeighbours.at(0) = m_jetFinderA;
107  jfNeighbours.at(1) = m_jetFinderC;
108  m_jetFinderB->setNeighbourJetFinders(jfNeighbours);
109 
110  jfNeighbours.at(0) = m_jetFinderB;
111  jfNeighbours.at(1) = neighbours.at(1)->getJetFinderA();
112  m_jetFinderC->setNeighbourJetFinders(jfNeighbours);
113 
114  } else {
115  m_ctorInputOk = false;
116  if (m_verbose) {
117  edm::LogWarning("L1GctSetupError") << "L1GctJetLeafCard::setNeighbourLeafCards() : In Jet Leaf Card ID " << m_id
118  << " size of input vector should be 2, but is in fact " << neighbours.size()
119  << "\n";
120  }
121  }
122 }
123 
124 std::ostream& operator<<(std::ostream& s, const L1GctJetLeafCard& card) {
125  using std::endl;
126 
127  s << "===L1GctJetLeafCard===" << endl;
128  s << "ID = " << card.m_id << endl;
129  s << "i_phi = " << card.phiPosition << endl;
130  ;
131  s << "Ex " << card.m_exSum << endl;
132  s << "Ey " << card.m_eySum << endl;
133  s << "Hx " << card.m_hxSum << endl;
134  s << "Hy " << card.m_hySum << endl;
135  s << "Et " << card.m_etSum << endl;
136  s << "Ht " << card.m_htSum << endl;
137  s << "JetFinder A : " << endl << (*card.m_jetFinderA);
138  s << "JetFinder B : " << endl << (*card.m_jetFinderB);
139  s << "JetFinder C : " << endl << (*card.m_jetFinderC);
140  s << endl;
141 
142  return s;
143 }
144 
148  m_jetFinderA->reset();
149  m_jetFinderB->reset();
150  m_jetFinderC->reset();
151 }
152 
154 void L1GctJetLeafCard::setBxRange(const int firstBx, const int numberOfBx) {
155  L1GctProcessor::setBxRange(firstBx, numberOfBx);
156  m_jetFinderA->setBxRange(firstBx, numberOfBx);
157  m_jetFinderB->setBxRange(firstBx, numberOfBx);
158  m_jetFinderC->setBxRange(firstBx, numberOfBx);
159 }
160 
166 }
167 
169  m_exSum.reset();
170  m_eySum.reset();
171  m_hxSum.reset();
172  m_hySum.reset();
173  m_etSum.reset();
174  m_htSum.reset();
175  m_hfSums.reset();
176 }
177 
179  m_exSumPipe.reset(numOfBx());
180  m_eySumPipe.reset(numOfBx());
181  m_hxSumPipe.reset(numOfBx());
182  m_hySumPipe.reset(numOfBx());
183  m_etSumPipe.reset(numOfBx());
184  m_htSumPipe.reset(numOfBx());
185  m_hfSumsPipe.reset(numOfBx());
186 }
187 
192 }
193 
195  // Check the setup
196  if (setupOk()) {
197  // Perform the jet finding
201 
202  // Finish Et and Ht sums for the Leaf Card
203  // First Et and missing Et
205  if (m_etSum.overFlow())
211 
212  // Exactly the same procedure for Ht and missing Ht
214  if (m_htSum.overFlow())
220 
221  // And the same again for Hf Sums
223 
224  // Store the outputs in pipelines
225  m_exSumPipe.store(m_exSum, bxRel());
226  m_eySumPipe.store(m_eySum, bxRel());
227  m_hxSumPipe.store(m_hxSum, bxRel());
228  m_hySumPipe.store(m_hySum, bxRel());
229  m_etSumPipe.store(m_etSum, bxRel());
230  m_htSumPipe.store(m_htSum, bxRel());
231  m_hfSumsPipe.store(m_hfSums, bxRel());
232  }
233 }
234 
237 }
238 
239 // get the jet output
241  return m_jetFinderA->getJets();
242 }
244  return m_jetFinderB->getJets();
245 }
247  return m_jetFinderC->getJets();
248 }
249 
251 std::vector<L1GctInternEtSum> L1GctJetLeafCard::getInternalEtSums() const {
252  std::vector<L1GctInternEtSum> result;
253  for (int bx = 0; bx < numOfBx(); bx++) {
254  result.push_back(L1GctInternEtSum::fromEmulatorJetTotEt(m_etSumPipe.contents.at(bx).value(),
255  m_etSumPipe.contents.at(bx).overFlow(),
256  static_cast<int16_t>(bx - bxMin())));
257  result.push_back(L1GctInternEtSum::fromEmulatorJetMissEt(m_exSumPipe.contents.at(bx).value(),
258  m_exSumPipe.contents.at(bx).overFlow(),
259  static_cast<int16_t>(bx - bxMin())));
260  result.push_back(L1GctInternEtSum::fromEmulatorJetMissEt(m_eySumPipe.contents.at(bx).value(),
261  m_eySumPipe.contents.at(bx).overFlow(),
262  static_cast<int16_t>(bx - bxMin())));
263  result.push_back(L1GctInternEtSum::fromEmulatorJetTotHt(m_htSumPipe.contents.at(bx).value(),
264  m_htSumPipe.contents.at(bx).overFlow(),
265  static_cast<int16_t>(bx - bxMin())));
266  }
267  return result;
268 }
269 
270 std::vector<L1GctInternHtMiss> L1GctJetLeafCard::getInternalHtMiss() const {
271  std::vector<L1GctInternHtMiss> result;
272  result.reserve(numOfBx());
273  for (int bx = 0; bx < numOfBx(); bx++) {
274  result.push_back(L1GctInternHtMiss::emulatorMissHtxHty(m_hxSumPipe.contents.at(bx).value(),
275  m_hySumPipe.contents.at(bx).value(),
276  m_hxSumPipe.contents.at(bx).overFlow(),
277  static_cast<int16_t>(bx - bxMin())));
278  }
279  return result;
280 }
L1GctJetLeafCard::jetFinderType
jetFinderType
Definition: L1GctJetLeafCard.h:31
L1GctJetLeafCard::phiPosition
int phiPosition
Definition: L1GctJetLeafCard.h:148
L1GctJetLeafCard::m_exSum
etComponentType m_exSum
Definition: L1GctJetLeafCard.h:150
L1GctJetLeafCard::m_ctorInputOk
bool m_ctorInputOk
Definition: L1GctJetLeafCard.h:168
L1GctUnsignedInt::setValue
void setValue(unsigned value)
Set value from unsigned.
Definition: L1GctUnsignedInt.h:111
L1GctJetLeafCard::m_hxSum
htComponentType m_hxSum
Definition: L1GctJetLeafCard.h:152
L1GctHardwareJetFinder.h
L1GctJetLeafCard::resetProcessor
void resetProcessor() override
Separate reset methods for the processor itself and any data stored in pipelines.
Definition: L1GctJetLeafCard.cc:168
L1GctJetLeafCard::~L1GctJetLeafCard
~L1GctJetLeafCard() override
Definition: L1GctJetLeafCard.cc:91
MessageLogger.h
L1GctJetLeafCard::m_hfSumsPipe
Pipeline< hfTowerSumsType > m_hfSumsPipe
Definition: L1GctJetLeafCard.h:166
L1GctJetLeafCard::m_hySum
htComponentType m_hySum
Definition: L1GctJetLeafCard.h:153
L1GctJetLeafCard::m_exSumPipe
Pipeline< etComponentType > m_exSumPipe
Definition: L1GctJetLeafCard.h:160
L1GctJetLeafCard::m_whichJetFinder
jetFinderType m_whichJetFinder
Definition: L1GctJetLeafCard.h:139
L1GctProcessor::setNextBx
void setNextBx(const int bxnum)
clear input data buffers and process a new bunch crossing
Definition: L1GctProcessor.h:51
L1GctJetFinderBase::getHySum
htCompInternJfType getHySum() const
Get the y component of vector Ht summed over jets above threshold.
Definition: L1GctJetFinderBase.h:196
L1GctJetLeafCard::m_hxSumPipe
Pipeline< htComponentType > m_hxSumPipe
Definition: L1GctJetLeafCard.h:162
L1GctJetFinderBase::getJets
JetVector getJets() const
Get the located jets.
Definition: L1GctJetFinderBase.h:183
L1GctJetLeafCard::m_id
int m_id
Definition: L1GctJetLeafCard.h:136
L1GctJetFinderBase::getHxSum
htCompInternJfType getHxSum() const
Get the x component of vector Ht summed over jets above threshold.
Definition: L1GctJetFinderBase.h:193
L1GctProcessor::numOfBx
int numOfBx() const
Definition: L1GctProcessor.h:79
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
L1GctProcessor::bxRel
int bxRel() const
Definition: L1GctProcessor.h:81
L1GctJetLeafCard::m_htSumPipe
Pipeline< etHadType > m_htSumPipe
Definition: L1GctJetLeafCard.h:165
L1GctProcessor::setBxRange
void setBxRange(const int firstBx, const int numberOfBx)
define the bunch crossing range to process
Definition: L1GctProcessor.h:44
L1GctJetLeafCard::setNeighbourLeafCards
void setNeighbourLeafCards(const std::vector< L1GctJetLeafCard * > &neighbours)
set pointers to neighbours - needed to complete the setup
Definition: L1GctJetLeafCard.cc:98
L1GctNullJetFinder.h
L1GctHardwareJetFinder
Emulation of the hardware jet finder.
Definition: L1GctHardwareJetFinder.h:18
L1GctJetLeafCard::getInternalEtSums
std::vector< L1GctInternEtSum > getInternalEtSums() const
get the Et sums in internal component format
Definition: L1GctJetLeafCard.cc:251
L1GctJetLeafCard::m_hySumPipe
Pipeline< htComponentType > m_hySumPipe
Definition: L1GctJetLeafCard.h:163
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
L1GctJetLeafCard::tdrJetFinder
Definition: L1GctJetLeafCard.h:31
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
L1GctJetLeafCard::m_htSum
etHadType m_htSum
Definition: L1GctJetLeafCard.h:155
L1GctNullJetFinder
no-op jet finder for test purposes.
Definition: L1GctNullJetFinder.h:19
L1GctJetLeafCard::m_jetFinderC
L1GctJetFinderBase * m_jetFinderC
highest jetFinder in phi
Definition: L1GctJetLeafCard.h:144
L1GctJetFinderBase::setNeighbourJetFinders
void setNeighbourJetFinders(const std::vector< L1GctJetFinderBase * > &neighbours)
Set pointers to neighbours - needed to complete the setup.
Definition: L1GctJetFinderBase.cc:80
L1GctTdrJetFinder
3*3 sliding window algorithm jet finder.
Definition: L1GctTdrJetFinder.h:51
alignCSCRings.s
s
Definition: alignCSCRings.py:92
operator<<
std::ostream & operator<<(std::ostream &s, const L1GctJetLeafCard &card)
Definition: L1GctJetLeafCard.cc:124
L1GctJetLeafCard::process
void process() override
process the data and set outputs
Definition: L1GctJetLeafCard.cc:194
L1GctJetLeafCard::setBxRange
void setBxRange(const int firstBx, const int numberOfBx)
define the bunch crossing range to process
Definition: L1GctJetLeafCard.cc:154
L1GctJetLeafCard::m_etSum
etTotalType m_etSum
Definition: L1GctJetLeafCard.h:154
L1GctJetCand.h
L1GctJetLeafCard::resetPipelines
void resetPipelines() override
Definition: L1GctJetLeafCard.cc:178
L1GctJetFinderBase.h
L1GctJetLeafCard::hardwareJetFinder
Definition: L1GctJetLeafCard.h:31
L1GctJetLeafCard::setupOk
bool setupOk() const
Check setup is Ok.
Definition: L1GctJetLeafCard.cc:235
L1GctTwosComplement< L1GctInternEtSum::kMissExOrEyNBits >
L1GctProcessor::reset
void reset()
complete reset of processor
Definition: L1GctProcessor.h:28
L1GctJetLeafCard::reset
void reset()
clear internal buffers
Definition: L1GctJetLeafCard.cc:146
L1GctJetFinderBase::process
void process() override=0
process the data, fill output buffers; to be filled in by derived jetFinders
L1GctJetLeafCard::etTotalMaxValue
Definition: L1GctJetLeafCard.h:46
funct::true
true
Definition: Factorize.h:173
L1GctJetLeafCard::setNextBx
void setNextBx(const int bx)
partially clear buffers
Definition: L1GctJetLeafCard.cc:161
L1GctTdrJetFinder.h
L1GctJetLeafCard::nullJetFinder
Definition: L1GctJetLeafCard.h:31
L1GctJetFinderBase::JetVector
std::vector< L1GctJetCand > JetVector
Definition: L1GctJetFinderBase.h:55
L1GctJetFinderBase::getHfSums
hfTowerSumsType getHfSums() const
Get the Hf tower Et sums and tower-over-threshold counts.
Definition: L1GctJetFinderBase.h:200
L1GctProcessor::m_verbose
bool m_verbose
Flag to control output messages.
Definition: L1GctProcessor.h:109
L1GctJetLeafCard::getInternalHtMiss
std::vector< L1GctInternHtMiss > getInternalHtMiss() const
Definition: L1GctJetLeafCard.cc:270
L1GctProcessor::bxMin
int bxMin() const
Support for multiple beam crossing operation.
Definition: L1GctProcessor.h:77
L1GctJetLeafCard::MAX_JET_FINDERS
static const int MAX_JET_FINDERS
Number of jetfinders per jet leaf card.
Definition: L1GctJetLeafCard.h:34
L1GctJetLeafCard::etComponentType
L1GctTwosComplement< L1GctInternEtSum::kMissExOrEyNBits > etComponentType
Definition: L1GctJetLeafCard.h:40
L1GctJetLeafCard::getOutputJetsB
std::vector< L1GctJetCand > getOutputJetsB() const
Output jetfinder B jets (middle jetFinder in phi)
Definition: L1GctJetLeafCard.cc:243
L1GctJetLeafCard::htComponentType
L1GctTwosComplement< L1GctInternHtMiss::kMissHxOrHyNBits > htComponentType
Definition: L1GctJetLeafCard.h:41
L1GctJetLeafCard::m_etSumPipe
Pipeline< etTotalType > m_etSumPipe
Definition: L1GctJetLeafCard.h:164
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
L1GctJetFinderBase::setupOk
bool setupOk() const
Check setup is Ok.
Definition: L1GctJetFinderBase.h:141
L1GctJetFinderBase::hfTowerSumsType::reset
void reset()
Definition: L1GctJetFinderBase.h:91
L1GctInternEtSum::fromEmulatorJetMissEt
static L1GctInternEtSum fromEmulatorJetMissEt(int missEtxOrEty, bool overFlow, int16_t bx)
Definition: L1GctInternEtSum.cc:109
L1GctJetLeafCard::fetchInput
void fetchInput() override
set the input buffers
Definition: L1GctJetLeafCard.cc:188
L1GctJetFinderBase::getHtSum
etHadType getHtSum() const
Get the scalar sum of Ht summed over jets above threshold.
Definition: L1GctJetFinderBase.h:192
L1GctJetLeafCard::m_hfSums
hfTowerSumsType m_hfSums
Definition: L1GctJetLeafCard.h:157
L1GctJetLeafCard::getOutputJetsA
std::vector< L1GctJetCand > getOutputJetsA() const
Output jetfinder A jets (lowest jetFinder in phi)
Definition: L1GctJetLeafCard.cc:240
L1GctJetLeafCard::htTotalMaxValue
Definition: L1GctJetLeafCard.h:47
L1GctJetFinderBase::getEtSum
etTotalType getEtSum() const
Get the scalar sum of Et summed over the input regions.
Definition: L1GctJetFinderBase.h:185
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
L1GctUnsignedInt::reset
void reset()
reset value and overflow to zero
Definition: L1GctUnsignedInt.h:41
L1GctUnsignedInt::overFlow
bool overFlow() const
access overflow
Definition: L1GctUnsignedInt.h:56
L1GctJetFinderBase::fetchInput
void fetchInput() override=0
get input data from sources; to be filled in by derived jetFinders
L1GctJetLeafCard::getOutputJetsC
std::vector< L1GctJetCand > getOutputJetsC() const
Ouptut jetfinder C jets (highest jetFinder in phi)
Definition: L1GctJetLeafCard.cc:246
L1GctInternHtMiss::emulatorMissHtxHty
static L1GctInternHtMiss emulatorMissHtxHty(const int htx, const int hty, const bool overFlow, const int16_t bx)
Named ctor for making missing Ht x & y components object from emulator (wheel input).
Definition: L1GctInternHtMiss.cc:50
L1GctJetFinderBase::getExSum
etCompInternJfType getExSum() const
Get the x component of vector Et summed over the input regions.
Definition: L1GctJetFinderBase.h:186
L1GctJetLeafCard.h
L1GctJetLeafCard::m_eySumPipe
Pipeline< etComponentType > m_eySumPipe
Definition: L1GctJetLeafCard.h:161
mps_fire.result
result
Definition: mps_fire.py:311
L1GctJetLeafCard::m_eySum
etComponentType m_eySum
Definition: L1GctJetLeafCard.h:151
L1GctInternEtSum::fromEmulatorJetTotHt
static L1GctInternEtSum fromEmulatorJetTotHt(unsigned totHt, bool overFlow, int16_t bx)
Definition: L1GctInternEtSum.cc:99
L1GctProcessor
ABC for a GCT trigger data processing unit.
Definition: L1GctProcessor.h:22
L1GctJetLeafCard::L1GctJetLeafCard
L1GctJetLeafCard(int id, int iphi, jetFinderType jfType=tdrJetFinder)
Definition: L1GctJetLeafCard.cc:15
L1GctJetLeafCard
Definition: L1GctJetLeafCard.h:28
L1GctJetFinderBase::getEySum
etCompInternJfType getEySum() const
Get the y component of vector Et summed over the input regions.
Definition: L1GctJetFinderBase.h:189
L1GctJetLeafCard::m_jetFinderB
L1GctJetFinderBase * m_jetFinderB
middle jetFinder in phi
Definition: L1GctJetLeafCard.h:143
L1GctJetLeafCard::m_jetFinderA
L1GctJetFinderBase * m_jetFinderA
lowest jetFinder in phi
Definition: L1GctJetLeafCard.h:142
L1GctTwosComplement::reset
void reset()
reset value and overflow to zero
Definition: L1GctTwosComplement.h:132
L1GctInternEtSum::fromEmulatorJetTotEt
static L1GctInternEtSum fromEmulatorJetTotEt(unsigned totEt, bool overFlow, int16_t bx)
Emulator constructors.
Definition: L1GctInternEtSum.cc:89