CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GctJetLeafCard.cc
Go to the documentation of this file.
2 
4 
9 
11 
12 //DEFINE STATICS
14 
17  m_id(id),
18  m_whichJetFinder(jfType),
19  phiPosition(iphi),
20  m_exSum(0), m_eySum(0),
21  m_hxSum(0), m_hySum(0),
22  m_etSum(0), m_htSum(0),
23  m_hfSums(),
24  m_exSumPipe(), m_eySumPipe(),
25  m_hxSumPipe(), m_hySumPipe(),
26  m_etSumPipe(), m_htSumPipe(),
27  m_hfSumsPipe(),
28  m_ctorInputOk(true)
29 {
30  //Check jetLeafCard setup
31  if(m_id < 0 || m_id > 5)
32  {
33  m_ctorInputOk = false;
34  if (m_verbose) {
35  edm::LogWarning("L1GctSetupError")
36  << "L1GctJetLeafCard::L1GctJetLeafCard() : Jet Leaf Card ID " << m_id << " has been incorrectly constructed!\n"
37  << "ID number should be between the range of 0 to 5\n";
38  }
39  }
40 
41  //iphi is redundant
42  if(phiPosition != m_id%3)
43  {
44  m_ctorInputOk = false;
45  if (m_verbose) {
46  edm::LogWarning("L1GctSetupError")
47  << "L1GctJetLeafCard::L1GctJetLeafCard() : Jet Leaf Card ID " << m_id << " has been incorrectly constructed!\n"
48  << "Argument iphi is " << phiPosition << ", should be " << (m_id%3) << " for this ID value \n";
49  }
50  }
51 
52  switch (m_whichJetFinder) {
53  case tdrJetFinder :
54  m_jetFinderA = new L1GctTdrJetFinder( 3*id );
55  m_jetFinderB = new L1GctTdrJetFinder(3*id+1);
56  m_jetFinderC = new L1GctTdrJetFinder(3*id+2);
57  break;
58 
59  case hardwareJetFinder :
63  break;
64 
65  case nullJetFinder :
66  m_jetFinderA = new L1GctNullJetFinder( 3*id );
67  m_jetFinderB = new L1GctNullJetFinder(3*id+1);
68  m_jetFinderC = new L1GctNullJetFinder(3*id+2);
69  break;
70 
71  default :
72 
73  m_ctorInputOk = false;
74  if (m_verbose) {
75  edm::LogWarning("L1GctSetupError")
76  << "L1GctJetLeafCard::L1GctJetLeafCard() : Jet Leaf Card ID " << m_id << " has been incorrectly constructed!\n"
77  << "Unrecognised jetFinder type " << m_whichJetFinder << ", cannot setup jetFinders\n";
78  }
79 
80  }
81 
82  if (!m_ctorInputOk && m_verbose) {
83  edm::LogError("L1GctSetupError") << "Jet Leaf Card ID " << m_id << " has been incorrectly constructed";
84  }
85 }
86 
88 {
89  delete m_jetFinderA;
90  delete m_jetFinderB;
91  delete m_jetFinderC;
92 }
93 
95 void L1GctJetLeafCard::setNeighbourLeafCards(const std::vector<L1GctJetLeafCard*>& neighbours)
96 {
97  std::vector<L1GctJetFinderBase*> jfNeighbours(2);
98 
99  if (neighbours.size()==2) {
100 
101  jfNeighbours.at(0) = neighbours.at(0)->getJetFinderC();
102  jfNeighbours.at(1) = m_jetFinderB;
103  m_jetFinderA->setNeighbourJetFinders(jfNeighbours);
104 
105  jfNeighbours.at(0) = m_jetFinderA;
106  jfNeighbours.at(1) = m_jetFinderC;
107  m_jetFinderB->setNeighbourJetFinders(jfNeighbours);
108 
109  jfNeighbours.at(0) = m_jetFinderB;
110  jfNeighbours.at(1) = neighbours.at(1)->getJetFinderA();
111  m_jetFinderC->setNeighbourJetFinders(jfNeighbours);
112 
113  } else {
114  m_ctorInputOk = false;
115  if (m_verbose) {
116  edm::LogWarning("L1GctSetupError")
117  << "L1GctJetLeafCard::setNeighbourLeafCards() : In Jet Leaf Card ID " << m_id
118  << " size of input vector should be 2, but is in fact " << neighbours.size() << "\n";
119  }
120  }
121 }
122 
123 std::ostream& operator << (std::ostream& s, const L1GctJetLeafCard& card)
124 {
125  using std::endl;
126 
127  s << "===L1GctJetLeafCard===" << endl;
128  s << "ID = " << card.m_id << endl;
129  s << "i_phi = " << card.phiPosition << endl;;
130  s << "Ex " << card.m_exSum << endl;
131  s << "Ey " << card.m_eySum << endl;
132  s << "Hx " << card.m_hxSum << endl;
133  s << "Hy " << card.m_hySum << endl;
134  s << "Et " << card.m_etSum << endl;
135  s << "Ht " << card.m_htSum << endl;
136  s << "JetFinder A : " << endl << (*card.m_jetFinderA);
137  s << "JetFinder B : " << endl << (*card.m_jetFinderB);
138  s << "JetFinder C : " << endl << (*card.m_jetFinderC);
139  s << endl;
140 
141  return s;
142 }
143 
147  m_jetFinderA->reset();
148  m_jetFinderB->reset();
149  m_jetFinderC->reset();
150 }
151 
153 void L1GctJetLeafCard::setBxRange(const int firstBx, const int numberOfBx) {
154  L1GctProcessor::setBxRange(firstBx, numberOfBx);
155  m_jetFinderA->setBxRange(firstBx, numberOfBx);
156  m_jetFinderB->setBxRange(firstBx, numberOfBx);
157  m_jetFinderC->setBxRange(firstBx, numberOfBx);
158 }
159 
160 void L1GctJetLeafCard::setNextBx(const int bx) {
162  m_jetFinderA->setNextBx(bx);
163  m_jetFinderB->setNextBx(bx);
164  m_jetFinderC->setNextBx(bx);
165 }
166 
168 {
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 {
180  m_exSumPipe.reset(numOfBx());
181  m_eySumPipe.reset(numOfBx());
182  m_hxSumPipe.reset(numOfBx());
183  m_hySumPipe.reset(numOfBx());
184  m_etSumPipe.reset(numOfBx());
185  m_htSumPipe.reset(numOfBx());
186  m_hfSumsPipe.reset(numOfBx());
187 }
188 
193 }
194 
196 
197  // Check the setup
198  if (setupOk()) {
199 
200  // Perform the jet finding
204 
205  // Finish Et and Ht sums for the Leaf Card
206  // First Et and missing Et
207  m_etSum =
212  m_exSum =
216  m_eySum =
220 
221  // Exactly the same procedure for Ht and missing Ht
222  m_htSum =
227  m_hxSum =
231  m_hySum =
235 
236  // And the same again for Hf Sums
237  m_hfSums =
241 
242  // Store the outputs in pipelines
243  m_exSumPipe.store (m_exSum, bxRel());
244  m_eySumPipe.store (m_eySum, bxRel());
245  m_hxSumPipe.store (m_hxSum, bxRel());
246  m_hySumPipe.store (m_hySum, bxRel());
247  m_etSumPipe.store (m_etSum, bxRel());
248  m_htSumPipe.store (m_htSum, bxRel());
249  m_hfSumsPipe.store (m_hfSums, bxRel());
250  }
251 }
252 
254  return (m_ctorInputOk &&
255  m_jetFinderA->setupOk() &&
256  m_jetFinderB->setupOk() &&
257  m_jetFinderC->setupOk()); }
258 
259 // get the jet output
266 
268 std::vector< L1GctInternEtSum > L1GctJetLeafCard::getInternalEtSums() const
269 {
270 
271  std::vector< L1GctInternEtSum > result;
272  for (int bx=0; bx<numOfBx(); bx++) {
273  result.push_back( L1GctInternEtSum::fromEmulatorJetTotEt ( m_etSumPipe.contents.at(bx).value(),
274  m_etSumPipe.contents.at(bx).overFlow(),
275  static_cast<int16_t> (bx-bxMin()) ) );
276  result.push_back( L1GctInternEtSum::fromEmulatorJetMissEt( m_exSumPipe.contents.at(bx).value(),
277  m_exSumPipe.contents.at(bx).overFlow(),
278  static_cast<int16_t> (bx-bxMin()) ) );
279  result.push_back( L1GctInternEtSum::fromEmulatorJetMissEt( m_eySumPipe.contents.at(bx).value(),
280  m_eySumPipe.contents.at(bx).overFlow(),
281  static_cast<int16_t> (bx-bxMin()) ) );
282  result.push_back( L1GctInternEtSum::fromEmulatorJetTotHt ( m_htSumPipe.contents.at(bx).value(),
283  m_htSumPipe.contents.at(bx).overFlow(),
284  static_cast<int16_t> (bx-bxMin()) ) );
285  }
286  return result;
287 }
288 
289 std::vector< L1GctInternHtMiss > L1GctJetLeafCard::getInternalHtMiss() const
290 {
291 
292  std::vector< L1GctInternHtMiss > result;
293  for (int bx=0; bx<numOfBx(); bx++) {
294  result.push_back( L1GctInternHtMiss::emulatorMissHtxHty( m_hxSumPipe.contents.at(bx).value(),
295  m_hySumPipe.contents.at(bx).value(),
296  m_hxSumPipe.contents.at(bx).overFlow(),
297  static_cast<int16_t> (bx-bxMin()) ) );
298  }
299  return result;
300 
301 }
htComponentType m_hySum
void reset()
complete reset of processor
std::vector< L1GctInternHtMiss > getInternalHtMiss() const
Pipeline< htComponentType > m_hxSumPipe
3*3 sliding window algorithm jet finder.
L1GctJetFinderBase * m_jetFinderB
middle jetFinder in phi
std::vector< L1GctJetCand > JetVector
void reset()
clear internal buffers
static L1GctInternEtSum fromEmulatorJetTotEt(unsigned totEt, bool overFlow, int16_t bx)
Emulator constructors.
virtual void resetProcessor()
Separate reset methods for the processor itself and any data stored in pipelines. ...
L1GctJetFinderBase * m_jetFinderC
highest jetFinder in phi
bool m_verbose
Flag to control output messages.
Pipeline< etHadType > m_htSumPipe
Pipeline< etTotalType > m_etSumPipe
etCompInternJfType getEySum() const
Get the y component of vector Et summed over the input regions.
int bxRel() const
bool setupOk() const
Check setup is Ok.
no-op jet finder for test purposes.
int bxMin() const
Support for multiple beam crossing operation.
void setNeighbourJetFinders(const std::vector< L1GctJetFinderBase * > &neighbours)
Set pointers to neighbours - needed to complete the setup.
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
int numOfBx() const
std::vector< L1GctInternEtSum > getInternalEtSums() const
get the Et sums in internal component format
ABC for a GCT trigger data processing unit.
std::vector< L1GctJetCand > getOutputJetsA() const
Output jetfinder A jets (lowest jetFinder in phi)
static L1GctInternEtSum fromEmulatorJetTotHt(unsigned totHt, bool overFlow, int16_t bx)
etCompInternJfType getExSum() const
Get the x component of vector Et summed over the input regions.
virtual void process()
process the data and set outputs
Pipeline< etComponentType > m_eySumPipe
JetVector getJets() const
Get the located jets.
Pipeline< htComponentType > m_hySumPipe
etTotalType getEtSum() const
Get the scalar sum of Et summed over the input regions.
tuple result
Definition: query.py:137
etHadType getHtSum() const
Get the scalar sum of Ht summed over jets above threshold.
std::vector< L1GctJetCand > getOutputJetsB() const
Output jetfinder B jets (middle jetFinder in phi)
virtual void fetchInput()
set the input buffers
void setBxRange(const int firstBx, const int numberOfBx)
define the bunch crossing range to process
virtual void process()=0
process the data, fill output buffers; to be filled in by derived jetFinders
void setBxRange(const int firstBx, const int numberOfBx)
define the bunch crossing range to process
jetFinderType m_whichJetFinder
htCompInternJfType getHySum() const
Get the y component of vector Ht summed over jets above threshold.
m_id("(unknown)")
htCompInternJfType getHxSum() const
Get the x component of vector Ht summed over jets above threshold.
void setNextBx(const int bx)
partially clear buffers
void setNeighbourLeafCards(const std::vector< L1GctJetLeafCard * > &neighbours)
set pointers to neighbours - needed to complete the setup
static const int MAX_JET_FINDERS
Number of jetfinders per jet leaf card.
static L1GctInternHtMiss emulatorMissHtxHty(const int htx, const int hty, const bool overFlow, const int16_t bx)
Named ctor for making missing Ht x &amp; y components object from emulator (wheel input).
std::vector< L1GctJetCand > getOutputJetsC() const
Ouptut jetfinder C jets (highest jetFinder in phi)
L1GctJetLeafCard(int id, int iphi, jetFinderType jfType=tdrJetFinder)
hfTowerSumsType m_hfSums
hfTowerSumsType getHfSums() const
Get the Hf tower Et sums and tower-over-threshold counts.
void reset()
reset value and overflow to zero
L1GctTwosComplement< L1GctInternHtMiss::kMissHxOrHyNBits > htComponentType
L1GctJetFinderBase * m_jetFinderA
lowest jetFinder in phi
void setValue(unsigned value)
Set value from unsigned.
Pipeline< hfTowerSumsType > m_hfSumsPipe
etComponentType m_eySum
virtual void fetchInput()=0
get input data from sources; to be filled in by derived jetFinders
bool setupOk() const
Check setup is Ok.
void reset()
reset value and overflow to zero
Emulation of the hardware jet finder.
Pipeline< etComponentType > m_exSumPipe
static L1GctInternEtSum fromEmulatorJetMissEt(int missEtxOrEty, bool overFlow, int16_t bx)
virtual void resetPipelines()
L1GctTwosComplement< L1GctInternEtSum::kMissExOrEyNBits > etComponentType
bool overFlow() const
access overflow
void setNextBx(const int bxnum)
clear input data buffers and process a new bunch crossing
htComponentType m_hxSum
etComponentType m_exSum