File indexing completed on 2024-04-06 12:19:51
0001 #ifndef L1GLOBALCALOTRIGGER_H_
0002 #define L1GLOBALCALOTRIGGER_H_
0003
0004 #include "DataFormats/L1CaloTrigger/interface/L1CaloRegion.h"
0005 #include "DataFormats/L1CaloTrigger/interface/L1CaloEmCand.h"
0006
0007 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctCollections.h"
0008
0009 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctUnsignedInt.h"
0010
0011 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetFinderBase.h"
0012 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetLeafCard.h"
0013
0014 #include <vector>
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 class L1GctJetLeafCard;
0029 class L1GctJetFinderBase;
0030 class L1GctEmLeafCard;
0031 class L1GctElectronSorter;
0032
0033 class L1GctWheelJetFpga;
0034 class L1GctWheelEnergyFpga;
0035 class L1GctJetFinalStage;
0036 class L1GctGlobalEnergyAlgos;
0037 class L1GctGlobalHfSumAlgos;
0038 class L1GctElectronFinalSort;
0039 class L1GctJetFinderParams;
0040 class L1GctJetEtCalibrationLut;
0041 class L1GctChannelMask;
0042 class L1CaloEtScale;
0043
0044 class L1GlobalCaloTrigger {
0045 public:
0046
0047 static const int N_JET_LEAF_CARDS;
0048
0049 static const int N_EM_LEAF_CARDS;
0050
0051 static const int N_WHEEL_CARDS;
0052
0053
0054 typedef L1GctUnsignedInt<L1GctEtTotal::kEtTotalNBits> etTotalType;
0055 typedef L1GctUnsignedInt<L1GctEtHad::kEtHadNBits> etHadType;
0056 typedef L1GctUnsignedInt<L1GctEtMiss::kEtMissNBits> etMissType;
0057 typedef L1GctUnsignedInt<L1GctEtMiss::kEtMissPhiNBits> etMissPhiType;
0058
0059 typedef L1GctJetFinderBase::lutPtr lutPtr;
0060 typedef L1GctJetFinderBase::lutPtrVector lutPtrVector;
0061
0062
0063 L1GlobalCaloTrigger(const L1GctJetLeafCard::jetFinderType jfType = L1GctJetLeafCard::hardwareJetFinder,
0064 unsigned jetLeafMask = 0);
0065
0066
0067 ~L1GlobalCaloTrigger();
0068
0069
0070 void reset();
0071
0072
0073 void process();
0074
0075
0076
0077
0078
0079 void setJetFinderParams(const L1GctJetFinderParams* const jfpars);
0080
0081
0082 void setJetEtCalibrationLuts(const lutPtrVector& jfluts);
0083
0084
0085 void setupTauAlgo(const bool useImprovedAlgo, const bool ignoreVetoBitsForIsolation);
0086
0087
0088 void setHtMissScale(const L1CaloEtScale* const scale);
0089
0090
0091 void setupHfSumLuts(const L1CaloEtScale* const scale);
0092
0093
0094 void setChannelMask(const L1GctChannelMask* const mask);
0095
0096
0097
0098
0099
0100
0101 void setBxRange(const int firstBx, const int lastBx);
0102
0103 void setBxRangeSymmetric(const int numOfBx);
0104
0105 void setBxRangeAutomatic();
0106
0107
0108 int getFirstBx() const { return m_bxStart; }
0109 int getLastBx() const { return (m_bxStart + m_numOfBx - 1); }
0110 int getTotalBx() const { return m_numOfBx; }
0111
0112
0113
0114
0115
0116
0117 void fillRegions(const std::vector<L1CaloRegion>& rgn);
0118
0119
0120 void fillEmCands(const std::vector<L1CaloEmCand>& rgn);
0121
0122
0123
0124 void setRegion(const L1CaloRegion& region);
0125
0126
0127 void setRegion(const unsigned et,
0128 const unsigned ieta,
0129 const unsigned iphi,
0130 const bool overFlow = false,
0131 const bool fineGrain = true);
0132
0133
0134 void setIsoEm(const L1CaloEmCand& em);
0135
0136
0137 void setNonIsoEm(const L1CaloEmCand& em);
0138
0139
0140
0141
0142
0143 L1GctEmCandCollection getIsoElectrons() const;
0144
0145
0146 L1GctEmCandCollection getNonIsoElectrons() const;
0147
0148
0149 L1GctJetCandCollection getCentralJets() const;
0150
0151
0152 L1GctJetCandCollection getForwardJets() const;
0153
0154
0155 L1GctJetCandCollection getTauJets() const;
0156
0157
0158 L1GctInternJetDataCollection getInternalJets() const;
0159
0160
0161 L1GctEtTotalCollection getEtSumCollection() const;
0162
0163
0164 L1GctEtHadCollection getEtHadCollection() const;
0165
0166
0167 L1GctEtMissCollection getEtMissCollection() const;
0168
0169
0170 L1GctHtMissCollection getHtMissCollection() const;
0171
0172
0173 L1GctInternEtSumCollection getInternalEtSums() const;
0174 L1GctInternHtMissCollection getInternalHtMiss() const;
0175
0176
0177 L1GctHFBitCountsCollection getHFBitCountsCollection() const;
0178 L1GctHFRingEtSumsCollection getHFRingEtSumsCollection() const;
0179
0180
0181
0182
0183
0184 std::vector<L1GctJetLeafCard*> getJetLeafCards() const { return theJetLeafCards; }
0185
0186
0187 std::vector<L1GctEmLeafCard*> getEmLeafCards() const { return theEmLeafCards; }
0188
0189
0190 std::vector<L1GctWheelJetFpga*> getWheelJetFpgas() const { return theWheelJetFpgas; }
0191
0192
0193 std::vector<L1GctWheelEnergyFpga*> getWheelEnergyFpgas() const { return theWheelEnergyFpgas; }
0194
0195
0196 L1GctJetFinalStage* getJetFinalStage() const { return theJetFinalStage; }
0197
0198
0199 L1GctGlobalEnergyAlgos* getEnergyFinalStage() const { return theEnergyFinalStage; }
0200
0201
0202 L1GctGlobalHfSumAlgos* getHfSumProcessor() const;
0203
0204
0205 L1GctElectronFinalSort* getIsoEmFinalStage() const { return theIsoEmFinalStage; }
0206 L1GctElectronFinalSort* getNonIsoEmFinalStage() const { return theNonIsoEmFinalStage; }
0207
0208
0209 const L1GctJetFinderParams* getJetFinderParams() const { return m_jetFinderParams; }
0210
0211
0212 const lutPtrVector getJetEtCalibLuts() const { return m_jetEtCalLuts; }
0213
0214
0215
0216
0217
0218 void print();
0219
0220
0221 void setVerbose();
0222 void setTerse();
0223
0224 private:
0225
0226
0227 void sortInputData();
0228
0229 void bxSetup();
0230
0231 void bxReset(const int bx);
0232
0233 void fillEmCands(std::vector<L1CaloEmCand>::iterator& emc, const int bx);
0234 void fillRegions(std::vector<L1CaloRegion>::iterator& rgn, const int bx);
0235
0236 void bxProcess(const int bx);
0237
0238
0239 void build(L1GctJetLeafCard::jetFinderType jfType, unsigned jetLeafMask);
0240
0241
0242 bool setupOk() const;
0243
0244
0245
0246 unsigned sorterNo(const L1CaloEmCand& em) const;
0247
0248
0249
0250
0251 template <class T>
0252 struct CompareBx {
0253 bool operator()(const T& i, const T& j) const { return i.bx() < j.bx(); }
0254 };
0255 CompareBx<L1CaloEmCand> emcBxComparator;
0256 CompareBx<L1CaloRegion> rgnBxComparator;
0257
0258 private:
0259
0260 std::vector<L1GctJetLeafCard*> theJetLeafCards;
0261
0262
0263 std::vector<L1GctJetFinderBase*> theJetFinders;
0264
0265
0266 std::vector<L1GctEmLeafCard*> theEmLeafCards;
0267
0268
0269 std::vector<L1GctElectronSorter*> theIsoElectronSorters;
0270 std::vector<L1GctElectronSorter*> theNonIsoElectronSorters;
0271
0272
0273 std::vector<L1GctWheelJetFpga*> theWheelJetFpgas;
0274
0275
0276 std::vector<L1GctWheelEnergyFpga*> theWheelEnergyFpgas;
0277
0278
0279 L1GctJetFinalStage* theJetFinalStage;
0280
0281
0282 L1GctGlobalEnergyAlgos* theEnergyFinalStage;
0283
0284
0285 L1GctElectronFinalSort* theIsoEmFinalStage;
0286
0287
0288 L1GctElectronFinalSort* theNonIsoEmFinalStage;
0289
0290
0291 const L1GctJetFinderParams* m_jetFinderParams;
0292
0293
0294 lutPtrVector m_jetEtCalLuts;
0295
0296
0297 const L1GctChannelMask* m_inputChannelMask;
0298
0299
0300 bool m_bxRangeAuto;
0301 int m_bxStart;
0302 int m_numOfBx;
0303
0304
0305
0306 std::vector<L1CaloEmCand> m_allInputEmCands;
0307 std::vector<L1CaloRegion> m_allInputRegions;
0308 };
0309
0310 #endif