File indexing completed on 2024-04-06 12:19:51
0001 #ifndef L1GCTJETFINDERBASE_H_
0002 #define L1GCTJETFINDERBASE_H_
0003
0004 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCand.h"
0005 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctInternEtSum.h"
0006 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctInternHtMiss.h"
0007
0008 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctProcessor.h"
0009 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctRegion.h"
0010 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJet.h"
0011
0012 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctUnsignedInt.h"
0013 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetCount.h"
0014
0015 #include <vector>
0016
0017 class L1GctInternJetData;
0018 class L1GctJetFinderParams;
0019 class L1GctJetEtCalibrationLut;
0020 class L1GctChannelMask;
0021 class L1CaloRegion;
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 class L1GctJetFinderBase : public L1GctProcessor {
0049 public:
0050
0051 typedef unsigned long int ULong;
0052 typedef unsigned short int UShort;
0053 typedef std::vector<L1GctRegion> RegionsVector;
0054 typedef std::vector<L1GctJet> RawJetVector;
0055 typedef std::vector<L1GctJetCand> JetVector;
0056 typedef Pipeline<L1GctJet> RawJetPipeline;
0057 typedef L1GctUnsignedInt<L1GctInternEtSum::kTotEtOrHtNBits> etTotalType;
0058 typedef L1GctUnsignedInt<L1GctInternEtSum::kTotEtOrHtNBits> etHadType;
0059 typedef L1GctTwosComplement<L1GctInternEtSum::kJetMissEtNBits> etCompInternJfType;
0060 typedef L1GctTwosComplement<L1GctInternHtMiss::kJetMissHtNBits> htCompInternJfType;
0061
0062 enum maxValues {
0063 etTotalMaxValue = L1GctInternEtSum::kTotEtOrHtMaxValue,
0064 htTotalMaxValue = L1GctInternEtSum::kTotEtOrHtMaxValue
0065 };
0066
0067
0068
0069
0070
0071
0072
0073 struct hfTowerSumsType {
0074 enum numberOfBits { kHfEtSumBits = 8, kHfCountBits = 5 };
0075
0076 L1GctJetCount<kHfEtSumBits> etSum0;
0077 L1GctJetCount<kHfEtSumBits> etSum1;
0078 L1GctJetCount<kHfCountBits> nOverThreshold0;
0079 L1GctJetCount<kHfCountBits> nOverThreshold1;
0080
0081
0082 hfTowerSumsType() : etSum0(0), etSum1(0), nOverThreshold0(0), nOverThreshold1(0) {}
0083 hfTowerSumsType(unsigned e0, unsigned e1, unsigned n0, unsigned n1)
0084 : etSum0(e0), etSum1(e1), nOverThreshold0(n0), nOverThreshold1(n1) {}
0085 hfTowerSumsType(L1GctJetCount<kHfEtSumBits> e0,
0086 L1GctJetCount<kHfEtSumBits> e1,
0087 L1GctJetCount<kHfCountBits> n0,
0088 L1GctJetCount<kHfCountBits> n1)
0089 : etSum0(e0), etSum1(e1), nOverThreshold0(n0), nOverThreshold1(n1) {}
0090
0091 void reset() {
0092 etSum0.reset();
0093 etSum1.reset();
0094 nOverThreshold0.reset();
0095 nOverThreshold1.reset();
0096 }
0097
0098 hfTowerSumsType operator+(const hfTowerSumsType& rhs) const {
0099 hfTowerSumsType temp((this->etSum0 + rhs.etSum0),
0100 (this->etSum1 + rhs.etSum1),
0101 (this->nOverThreshold0 + rhs.nOverThreshold0),
0102 (this->nOverThreshold1 + rhs.nOverThreshold1));
0103 return temp;
0104 }
0105 };
0106
0107 typedef L1GctJet::lutPtr lutPtr;
0108 typedef std::vector<lutPtr> lutPtrVector;
0109
0110
0111 static const unsigned int MAX_JETS_OUT;
0112 static const unsigned int COL_OFFSET;
0113 static const unsigned int N_JF_PER_WHEEL;
0114 static const unsigned int
0115 N_EXTRA_REGIONS_ETA00;
0116
0117
0118 L1GctJetFinderBase(int id);
0119
0120 ~L1GctJetFinderBase() override;
0121
0122
0123 void setNeighbourJetFinders(const std::vector<L1GctJetFinderBase*>& neighbours);
0124
0125
0126 void setJetFinderParams(const L1GctJetFinderParams* jfpars);
0127
0128
0129 void setJetEtCalibrationLuts(const lutPtrVector& jfluts);
0130
0131
0132 void setEnergySumMasks(const L1GctChannelMask* chmask);
0133
0134
0135 void setupTauAlgo(const bool useImprovedAlgo, const bool ignoreVetoBitsForIsolation) {
0136 m_useImprovedTauAlgo = useImprovedAlgo;
0137 m_ignoreTauVetoBitsForIsolation = ignoreVetoBitsForIsolation;
0138 }
0139
0140
0141 bool setupOk() const {
0142 return m_idInRange && m_gotNeighbourPointers && m_gotJetFinderParams && m_gotJetEtCalLuts && m_gotChannelMask;
0143 }
0144
0145
0146 friend std::ostream& operator<<(std::ostream& os, const L1GctJetFinderBase& algo);
0147
0148
0149 void fetchInput() override = 0;
0150
0151
0152 void process() override = 0;
0153
0154
0155 void setInputRegion(const L1CaloRegion& region);
0156
0157
0158 RegionsVector getInputRegions() const { return m_inputRegions; }
0159
0160
0161 RegionsVector getSentProtoJets() const { return m_sentProtoJets; }
0162
0163
0164 RegionsVector getRcvdProtoJets() const { return m_rcvdProtoJets; }
0165
0166
0167 RegionsVector getKeptProtoJets() const { return m_keptProtoJets; }
0168
0169
0170 RawJetVector getRawJets() const { return m_outputJetsPipe.contents; }
0171
0172
0173 std::vector<L1GctInternJetData> getInternalJets() const;
0174
0175
0176 std::vector<L1GctInternEtSum> getInternalEtSums() const;
0177 std::vector<L1GctInternHtMiss> getInternalHtMiss() const;
0178
0179
0180 const lutPtrVector getJetEtCalLuts() const { return m_jetEtCalLuts; }
0181
0182
0183 JetVector getJets() const { return m_sortedJets; }
0184
0185 etTotalType getEtSum() const { return m_outputEtSum; }
0186 etCompInternJfType getExSum() const {
0187 return m_outputExSum;
0188 }
0189 etCompInternJfType getEySum() const {
0190 return m_outputEySum;
0191 }
0192 etHadType getHtSum() const { return m_outputHtSum; }
0193 htCompInternJfType getHxSum() const {
0194 return m_outputHxSum;
0195 }
0196 htCompInternJfType getHySum() const {
0197 return m_outputHySum;
0198 }
0199
0200 hfTowerSumsType getHfSums() const {
0201 return m_outputHfSums;
0202 }
0203
0204
0205 unsigned getCenJetSeed() const { return m_CenJetSeed; }
0206 unsigned getFwdJetSeed() const { return m_FwdJetSeed; }
0207 unsigned getTauJetSeed() const { return m_TauJetSeed; }
0208 unsigned getEtaBoundry() const { return m_EtaBoundry; }
0209 unsigned getTauIsolationThreshold() const { return m_tauIsolationThreshold; }
0210 unsigned getHttSumJetThreshold() const { return m_HttSumJetThreshold; }
0211 unsigned getHtmSumJetThreshold() const { return m_HtmSumJetThreshold; }
0212
0213 protected:
0214
0215 void resetProcessor() override;
0216 void resetPipelines() override;
0217
0218
0219 void setupObjects() override;
0220
0221 protected:
0222
0223 enum fetchType { TOP, BOT, TOPBOT };
0224
0225
0226 int m_id;
0227
0228
0229 std::vector<L1GctJetFinderBase*> m_neighbourJetFinders;
0230
0231
0232 bool m_idInRange;
0233
0234
0235 bool m_gotNeighbourPointers;
0236
0237
0238 bool m_gotJetFinderParams;
0239
0240
0241 bool m_gotJetEtCalLuts;
0242
0243
0244 bool m_gotChannelMask;
0245
0246
0247
0248
0249
0250 bool m_positiveEtaWheel;
0251
0252
0253 unsigned m_minColThisJf;
0254
0255
0256
0257
0258
0259
0260 unsigned m_CenJetSeed;
0261 unsigned m_FwdJetSeed;
0262 unsigned m_TauJetSeed;
0263 unsigned m_EtaBoundry;
0264
0265
0266 lutPtrVector m_jetEtCalLuts;
0267
0268
0269
0270
0271 bool m_useImprovedTauAlgo;
0272
0273
0274
0275
0276
0277
0278 bool m_ignoreTauVetoBitsForIsolation;
0279
0280
0281
0282 unsigned m_tauIsolationThreshold;
0283
0284
0285 unsigned m_HttSumJetThreshold;
0286 unsigned m_HtmSumJetThreshold;
0287
0288
0289 bool m_EttMask[11];
0290 bool m_EtmMask[11];
0291 bool m_HttMask[11];
0292 bool m_HtmMask[11];
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302 RegionsVector m_inputRegions;
0303
0304
0305 RegionsVector m_sentProtoJets;
0306
0307 RegionsVector m_rcvdProtoJets;
0308
0309 RegionsVector m_keptProtoJets;
0310
0311
0312 RawJetVector m_outputJets;
0313 JetVector m_sortedJets;
0314
0315
0316 etTotalType m_outputEtSum;
0317 etCompInternJfType m_outputExSum;
0318 etCompInternJfType m_outputEySum;
0319 etHadType m_outputHtSum;
0320 htCompInternJfType m_outputHxSum;
0321 htCompInternJfType m_outputHySum;
0322
0323 hfTowerSumsType m_outputHfSums;
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333 virtual unsigned maxRegionsIn() const { return MAX_REGIONS_IN; }
0334 virtual unsigned centralCol0() const { return CENTRAL_COL0; }
0335 virtual unsigned nCols() const { return N_COLS; }
0336
0337
0338
0339 void fetchProtoJetsFromNeighbour(const fetchType ft);
0340
0341 void sortJets();
0342
0343 void doEnergySums();
0344
0345
0346 etTotalType calcEtStrip(const UShort strip) const;
0347
0348
0349 etTotalType calcHtStrip(const UShort strip) const;
0350
0351
0352 void doEtSums();
0353
0354
0355 void doHtSums();
0356
0357
0358 hfTowerSumsType calcHfSums() const;
0359
0360 private:
0361
0362 static const unsigned int MAX_REGIONS_IN;
0363 static const unsigned int N_COLS;
0364 static const unsigned int CENTRAL_COL0;
0365
0366
0367 RawJetPipeline m_outputJetsPipe;
0368
0369
0370 Pipeline<etTotalType> m_outputEtSumPipe;
0371 Pipeline<etCompInternJfType> m_outputExSumPipe;
0372 Pipeline<etCompInternJfType> m_outputEySumPipe;
0373 Pipeline<etHadType> m_outputHtSumPipe;
0374 Pipeline<htCompInternJfType> m_outputHxSumPipe;
0375 Pipeline<htCompInternJfType> m_outputHySumPipe;
0376
0377
0378 template <int kBitsInput, int kBitsOutput>
0379 L1GctTwosComplement<kBitsOutput> etComponentForJetFinder(const L1GctUnsignedInt<kBitsInput>& etStrip0,
0380 const unsigned& fact0,
0381 const L1GctUnsignedInt<kBitsInput>& etStrip1,
0382 const unsigned& fact1);
0383 };
0384
0385 std::ostream& operator<<(std::ostream& os, const L1GctJetFinderBase& algo);
0386
0387 #endif