CMS 3D CMS Logo

L1GctJetFinderBase.h
Go to the documentation of this file.
1 #ifndef L1GCTJETFINDERBASE_H_
2 #define L1GCTJETFINDERBASE_H_
3 
7 
11 
14 
15 #include <vector>
16 
17 class L1GctInternJetData;
20 class L1GctChannelMask;
21 class L1CaloRegion;
22 
43 /*
44  * \author Jim Brooke & Greg Heath
45  * \date June 2006
46  */
47 
49 public:
50  //Typedefs
51  typedef unsigned long int ULong;
52  typedef unsigned short int UShort;
53  typedef std::vector<L1GctRegion> RegionsVector;
54  typedef std::vector<L1GctJet> RawJetVector;
55  typedef std::vector<L1GctJetCand> JetVector;
61 
62  enum maxValues {
65  };
66 
67  // For HF-based triggers we sum the Et in the two "inner" (large eta) rings;
68  // and count towers over threshold based on the "fineGrain" bit from the RCT.
69  // Define a data type to transfer the result of all calculations.
70  // The results are defined as L1GctJetCount types since they don't have
71  // a separate overFlow bit. An overflow condition gives value=max.
72 
73  struct hfTowerSumsType {
75 
80 
81  // Define some constructors and an addition operator for our data type
82  hfTowerSumsType() : etSum0(0), etSum1(0), nOverThreshold0(0), nOverThreshold1(0) {}
83  hfTowerSumsType(unsigned e0, unsigned e1, unsigned n0, unsigned n1)
84  : etSum0(e0), etSum1(e1), nOverThreshold0(n0), nOverThreshold1(n1) {}
89  : etSum0(e0), etSum1(e1), nOverThreshold0(n0), nOverThreshold1(n1) {}
90 
91  void reset() {
92  etSum0.reset();
93  etSum1.reset();
94  nOverThreshold0.reset();
95  nOverThreshold1.reset();
96  }
97 
99  hfTowerSumsType temp((this->etSum0 + rhs.etSum0),
100  (this->etSum1 + rhs.etSum1),
101  (this->nOverThreshold0 + rhs.nOverThreshold0),
102  (this->nOverThreshold1 + rhs.nOverThreshold1));
103  return temp;
104  }
105  };
106 
108  typedef std::vector<lutPtr> lutPtrVector;
109 
110  //Statics
111  static const unsigned int MAX_JETS_OUT;
112  static const unsigned int COL_OFFSET;
113  static const unsigned int N_JF_PER_WHEEL;
114  static const unsigned int
116 
118  L1GctJetFinderBase(int id);
119 
120  ~L1GctJetFinderBase() override;
121 
123  void setNeighbourJetFinders(const std::vector<L1GctJetFinderBase*>& neighbours);
124 
126  void setJetFinderParams(const L1GctJetFinderParams* jfpars);
127 
129  void setJetEtCalibrationLuts(const lutPtrVector& jfluts);
130 
132  void setEnergySumMasks(const L1GctChannelMask* chmask);
133 
135  void setupTauAlgo(const bool useImprovedAlgo, const bool ignoreVetoBitsForIsolation) {
136  m_useImprovedTauAlgo = useImprovedAlgo;
137  m_ignoreTauVetoBitsForIsolation = ignoreVetoBitsForIsolation;
138  }
139 
141  bool setupOk() const {
143  }
144 
146  friend std::ostream& operator<<(std::ostream& os, const L1GctJetFinderBase& algo);
147 
149  void fetchInput() override = 0;
150 
152  void process() override = 0;
153 
155  void setInputRegion(const L1CaloRegion& region);
156 
158  RegionsVector getInputRegions() const { return m_inputRegions; }
159 
161  RegionsVector getSentProtoJets() const { return m_sentProtoJets; }
162 
164  RegionsVector getRcvdProtoJets() const { return m_rcvdProtoJets; }
165 
167  RegionsVector getKeptProtoJets() const { return m_keptProtoJets; }
168 
170  RawJetVector getRawJets() const { return m_outputJetsPipe.contents; }
171 
173  std::vector<L1GctInternJetData> getInternalJets() const;
174 
176  std::vector<L1GctInternEtSum> getInternalEtSums() const;
177  std::vector<L1GctInternHtMiss> getInternalHtMiss() const;
178 
180  const lutPtrVector getJetEtCalLuts() const { return m_jetEtCalLuts; }
181 
182  // The hardware output quantities
183  JetVector getJets() const { return m_sortedJets; }
184  // The hardware output quantities - refactored
185  etTotalType getEtSum() const { return m_outputEtSum; }
186  etCompInternJfType getExSum() const {
187  return m_outputExSum;
188  }
189  etCompInternJfType getEySum() const {
190  return m_outputEySum;
191  }
192  etHadType getHtSum() const { return m_outputHtSum; }
193  htCompInternJfType getHxSum() const {
194  return m_outputHxSum;
195  }
196  htCompInternJfType getHySum() const {
197  return m_outputHySum;
198  }
199 
201  return m_outputHfSums;
202  }
203 
204  // Access to threshold and cut values
205  unsigned getCenJetSeed() const { return m_CenJetSeed; }
206  unsigned getFwdJetSeed() const { return m_FwdJetSeed; }
207  unsigned getTauJetSeed() const { return m_TauJetSeed; }
208  unsigned getEtaBoundry() const { return m_EtaBoundry; }
210  unsigned getHttSumJetThreshold() const { return m_HttSumJetThreshold; }
211  unsigned getHtmSumJetThreshold() const { return m_HtmSumJetThreshold; }
212 
213 protected:
215  void resetProcessor() override;
216  void resetPipelines() override;
217 
219  void setupObjects() override;
220 
221 protected:
223  enum fetchType { TOP, BOT, TOPBOT };
224 
226  int m_id;
227 
229  std::vector<L1GctJetFinderBase*> m_neighbourJetFinders;
230 
233 
236 
239 
242 
245 
251 
253  unsigned m_minColThisJf;
260  unsigned m_CenJetSeed;
261  unsigned m_FwdJetSeed;
262  unsigned m_TauJetSeed;
263  unsigned m_EtaBoundry;
264 
266  lutPtrVector m_jetEtCalLuts;
267 
269  // If the following parameter is set to false, the tau identification
270  // is just based on the RCT tau veto bits from the nine regions
272 
273  // If useImprovedTauAlgo is true, these two parameters affect
274  // the operation of the algorithm.
275 
276  // We can require the tau veto bits to be off in all nine regions,
277  // or just in the central region.
279 
280  // In the improved tau algorithm, we require no more than one tower energy to be
281  // above the isolation threshold, in the eight regions surrounding the central one.
283 
284  // Thresholds on individual jet energies used in HTT and HTM summing
287 
288  // Masks for restricting the eta range of energy sums
289  bool m_EttMask[11];
290  bool m_EtmMask[11];
291  bool m_HttMask[11];
292  bool m_HtmMask[11];
293 
302  RegionsVector m_inputRegions;
303 
305  RegionsVector m_sentProtoJets;
307  RegionsVector m_rcvdProtoJets;
309  RegionsVector m_keptProtoJets;
310 
312  RawJetVector m_outputJets;
313  JetVector m_sortedJets;
314 
316  etTotalType m_outputEtSum;
317  etCompInternJfType m_outputExSum;
318  etCompInternJfType m_outputEySum;
319  etHadType m_outputHtSum;
320  htCompInternJfType m_outputHxSum;
321  htCompInternJfType m_outputHySum;
322 
324 
329  //PROTECTED METHODS
330  // Return the values of constants that might be changed by different jetFinders.
331  // Each jetFinder must define the constants as private and copy the
332  // function definitions below.
333  virtual unsigned maxRegionsIn() const { return MAX_REGIONS_IN; }
334  virtual unsigned centralCol0() const { return CENTRAL_COL0; }
335  virtual unsigned nCols() const { return N_COLS; }
336 
339  void fetchProtoJetsFromNeighbour(const fetchType ft);
341  void sortJets();
343  void doEnergySums();
344 
346  etTotalType calcEtStrip(const UShort strip) const;
347 
349  etTotalType calcHtStrip(const UShort strip) const;
350 
352  void doEtSums();
353 
355  void doHtSums();
356 
358  hfTowerSumsType calcHfSums() const;
359 
360 private:
362  static const unsigned int MAX_REGIONS_IN;
363  static const unsigned int N_COLS;
364  static const unsigned int CENTRAL_COL0;
365 
367  RawJetPipeline m_outputJetsPipe;
368 
376 
378  template <int kBitsInput, int kBitsOutput>
380  const unsigned& fact0,
381  const L1GctUnsignedInt<kBitsInput>& etStrip1,
382  const unsigned& fact1);
383 };
384 
385 std::ostream& operator<<(std::ostream& os, const L1GctJetFinderBase& algo);
386 
387 #endif /*L1GCTJETFINDERBASE_H_*/
bool m_idInRange
Remember whether range check on the input ID was ok.
etTotalType m_outputEtSum
output Et strip sums and Ht - refactored
static const unsigned int MAX_JETS_OUT
Max of 6 jets found per jetfinder in a 2*11 search area.
std::vector< L1GctJetCand > JetVector
void doEtSums()
Calculates scalar and vector sum of Et over input regions.
L1GctJetCount< kHfCountBits > nOverThreshold1
RegionsVector m_sentProtoJets
List of pre-clustered jets to be sent to neighbour after the first stage of clustering.
unsigned long int ULong
htCompInternJfType m_outputHySum
unsigned getHtmSumJetThreshold() const
L1GctTwosComplement< L1GctInternEtSum::kJetMissEtNBits > etCompInternJfType
Jet Et calibration LUT.
hfTowerSumsType calcHfSums() const
Calculates Et sum and number of towers over threshold in Hf.
~L1GctJetFinderBase() override
std::vector< L1GctInternHtMiss > getInternalHtMiss() const
bool m_gotChannelMask
Remember whether channel mask have been stored.
L1GctJetCount< kHfEtSumBits > etSum1
etCompInternJfType getEySum() const
Get the y component of vector Et summed over the input regions.
Pipeline< L1GctJet > RawJetPipeline
RegionsVector getRcvdProtoJets() const
get protoJets received from neighbour
bool setupOk() const
Check setup is Ok.
L1 GCT internal jet candidate.
L1GctJet::lutPtr lutPtr
void setNeighbourJetFinders(const std::vector< L1GctJetFinderBase * > &neighbours)
Set pointers to neighbours - needed to complete the setup.
RegionsVector getKeptProtoJets() const
get protoJets kept
fetchType
different ways of getting the neighbour data
htCompInternJfType m_outputHxSum
Pipeline< etTotalType > m_outputEtSumPipe
"Pipeline memories" for energy sums
L1GctJetFinderBase(int id)
id is 0-8 for -ve Eta jetfinders, 9-17 for +ve Eta, for increasing Phi.
hfTowerSumsType operator+(const hfTowerSumsType &rhs) const
std::vector< L1GctJet > RawJetVector
virtual unsigned centralCol0() const
Base class to allow implementation of jetFinder algorithms.
ABC for a GCT trigger data processing unit.
etCompInternJfType getExSum() const
Get the x component of vector Et summed over the input regions.
unsigned getTauJetSeed() const
L1GctTwosComplement< kBitsOutput > etComponentForJetFinder(const L1GctUnsignedInt< kBitsInput > &etStrip0, const unsigned &fact0, const L1GctUnsignedInt< kBitsInput > &etStrip1, const unsigned &fact1)
Private method for calculating MEt and MHt components.
void process() override=0
process the data, fill output buffers; to be filled in by derived jetFinders
friend std::ostream & operator<<(std::ostream &os, const L1GctJetFinderBase &algo)
Overload << operator.
bool m_gotNeighbourPointers
Remember whether the neighbour pointers have been stored.
Pipeline< etHadType > m_outputHtSumPipe
std::vector< L1GctInternJetData > getInternalJets() const
get output jets in raw format - to be stored in the event
void doHtSums()
Calculates scalar and vector sum of Ht over calibrated jets.
const lutPtrVector getJetEtCalLuts() const
Return pointers to calibration LUTs.
JetVector getJets() const
Get the located jets.
int n0
Definition: AMPTWrapper.h:44
etTotalType getEtSum() const
Get the scalar sum of Et summed over the input regions.
unsigned getEtaBoundry() const
void sortJets()
Sort the found jets. All jetFinders should call this in process().
std::vector< L1GctInternEtSum > getInternalEtSums() const
get et sums in raw format - to be stored in the event
etHadType getHtSum() const
Get the scalar sum of Ht summed over jets above threshold.
void setJetEtCalibrationLuts(const lutPtrVector &jfluts)
Set pointer to calibration Lut - needed to complete the setup.
lutPtrVector m_jetEtCalLuts
Jet Et Conversion LUT pointer.
std::vector< L1GctJetFinderBase * > m_neighbourJetFinders
Store neighbour pointers.
static const unsigned int N_EXTRA_REGIONS_ETA00
Number of additional regions to process on the "wrong" side of eta=0 (determines COL_OFFSET) ...
void setupObjects() override
Initialise inputs with null objects for the correct bunch crossing if required.
L1GctJetCount< kHfCountBits > nOverThreshold0
unsigned short int UShort
L1GctUnsignedInt< L1GctInternEtSum::kTotEtOrHtNBits > etHadType
static const unsigned int CENTRAL_COL0
unsigned getHttSumJetThreshold() const
RegionsVector m_keptProtoJets
List of pre-clustered jets retained locally as input to the final clustering.
etTotalType calcEtStrip(const UShort strip) const
Calculates total (raw) energy in a phi strip.
hfTowerSumsType(L1GctJetCount< kHfEtSumBits > e0, L1GctJetCount< kHfEtSumBits > e1, L1GctJetCount< kHfCountBits > n0, L1GctJetCount< kHfCountBits > n1)
static const unsigned int MAX_REGIONS_IN
The real jetFinders must define these constants.
void resetProcessor() override
Separate reset methods for the processor itself and any data stored in pipelines. ...
static const unsigned int COL_OFFSET
The index offset between columns.
RawJetVector m_outputJets
output jets
void setJetFinderParams(const L1GctJetFinderParams *jfpars)
Set pointer to parameters - needed to complete the setup.
htCompInternJfType getHySum() const
Get the y component of vector Ht summed over jets above threshold.
RegionsVector m_inputRegions
unsigned getCenJetSeed() const
RawJetPipeline m_outputJetsPipe
Output jets "pipeline memory" for checking.
htCompInternJfType getHxSum() const
Get the x component of vector Ht summed over jets above threshold.
RegionsVector getSentProtoJets() const
get protoJets sent to neighbour
L1GctJetCount< kHfEtSumBits > etSum0
void setupTauAlgo(const bool useImprovedAlgo, const bool ignoreVetoBitsForIsolation)
Setup the tau algorithm parameters.
void setInputRegion(const L1CaloRegion &region)
Set input data.
void fetchInput() override=0
get input data from sources; to be filled in by derived jetFinders
virtual unsigned nCols() const
RegionsVector getInputRegions() const
Return input data.
void resetPipelines() override
void setEnergySumMasks(const L1GctChannelMask *chmask)
Set masks for energy summing.
hfTowerSumsType getHfSums() const
Get the Hf tower Et sums and tower-over-threshold counts.
etTotalType calcHtStrip(const UShort strip) const
Calculates total calibrated energy in jets (Ht) sum.
L1GctUnsignedInt< L1GctInternEtSum::kTotEtOrHtNBits > etTotalType
std::vector< lutPtr > lutPtrVector
void fetchProtoJetsFromNeighbour(const fetchType ft)
fetch the protoJets from neighbour jetFinder
void reset()
reset value and overflow to zero
etCompInternJfType m_outputEySum
Pipeline< etCompInternJfType > m_outputExSumPipe
RawJetVector getRawJets() const
get output jets in raw format
bool m_gotJetFinderParams
Remember whether jetfinder parameters have been stored.
A calorimeter trigger region (sum of 4x4 trigger towers)
Definition: L1CaloRegion.h:21
hfTowerSumsType(unsigned e0, unsigned e1, unsigned n0, unsigned n1)
virtual unsigned maxRegionsIn() const
L1GctTwosComplement< L1GctInternHtMiss::kJetMissHtNBits > htCompInternJfType
Pipeline< htCompInternJfType > m_outputHySumPipe
unsigned getTauIsolationThreshold() const
unsigned m_minColThisJf
parameter to determine which Regions belong in our acceptance
RegionsVector m_rcvdProtoJets
List of pre-clustered jets received from neighbour before the final stage of clustering.
static const unsigned int N_COLS
std::vector< T > contents
std::vector< L1GctRegion > RegionsVector
etCompInternJfType m_outputExSum
unsigned getFwdJetSeed() const
bool m_gotJetEtCalLuts
Remember whether jet Et calibration Lut pointers have been stored.
bool m_useImprovedTauAlgo
Setup parameters for the tau jet algorithm.
Pipeline< etCompInternJfType > m_outputEySumPipe
void doEnergySums()
Fill the Et strip sums and Ht sum. All jetFinders should call this in process().
hfTowerSumsType m_outputHfSums
static const unsigned int N_JF_PER_WHEEL
No of jetFinders per Wheel.
Pipeline< htCompInternJfType > m_outputHxSumPipe
std::shared_ptr< L1GctJetEtCalibrationLut > lutPtr
Definition: L1GctJet.h:32