27 m_neighbourJetFinders(2),
29 m_gotNeighbourPointers(
false),
30 m_gotJetFinderParams(
false),
31 m_gotJetEtCalLuts(
false),
32 m_gotChannelMask(
false),
34 m_CenJetSeed(0), m_FwdJetSeed(0), m_TauJetSeed(0), m_EtaBoundry(0),
36 m_useImprovedTauAlgo(
false), m_ignoreTauVetoBitsForIsolation(
false), m_tauIsolationThreshold(0),
37 m_HttSumJetThreshold(0), m_HtmSumJetThreshold(0),
38 m_EttMask(), m_EtmMask(), m_HttMask(), m_HtmMask(),
39 m_inputRegions(MAX_REGIONS_IN),
40 m_sentProtoJets(MAX_JETS_OUT), m_rcvdProtoJets(MAX_JETS_OUT), m_keptProtoJets(MAX_JETS_OUT),
41 m_outputJets(MAX_JETS_OUT), m_sortedJets(MAX_JETS_OUT),
43 m_outputJetsPipe(MAX_JETS_OUT),
44 m_outputEtSumPipe(), m_outputExSumPipe(), m_outputEySumPipe(),
45 m_outputHtSumPipe(), m_outputHxSumPipe(), m_outputHySumPipe()
54 <<
"L1GctJetFinderBase::L1GctJetFinderBase() : Jet Finder ID " <<
m_id <<
" has been incorrectly constructed!\n"
69 if (neighbours.size()==2) {
75 <<
"L1GctJetFinderBase::setNeighbourJetFinders() : In Jet Finder ID " <<
m_id
76 <<
" size of input vector should be 2, but is in fact " << neighbours.size() <<
"\n";
83 <<
"L1GctJetFinderBase::setNeighbourJetFinders() : In Jet Finder ID " <<
m_id
84 <<
" first neighbour pointer is set to zero\n";
91 <<
"L1GctJetFinderBase::setNeighbourJetFinders() : In Jet Finder ID " <<
m_id
92 <<
" second neighbour pointer is set to zero\n";
96 edm::LogError(
"L1GctSetupError") <<
"Jet Finder ID " <<
m_id <<
" has incorrect assignment of neighbour pointers";
123 bool matchCheckEttAndEtm =
true;
126 for (
unsigned ieta=0; ieta<N_ETA; ++ieta) {
135 if (!matchCheckEttAndEtm)
137 <<
"L1GctJetFinderBase::setEnergySumMasks() : In Jet Finder ID " <<
m_id
138 <<
" setting eta-dependent masks for Et sums: you cannot have different masks for total and missing Et\n";
147 os <<
"ID = " << algo.
m_id << endl;
148 os <<
"Calibration lut pointers stored for " << algo.
m_jetEtCalLuts.size() <<
" eta bins" << endl;
150 os <<
"Eta bin " << ieta <<
", JetEtCalibrationLut* = " << algo.
m_jetEtCalLuts.at(ieta) << endl;
152 os <<
"No of input regions " << algo.
m_inputRegions.size() << endl;
157 os <<
"No of output jets " << algo.
m_outputJets.size() << endl;
162 os <<
"Output total scalar Et " << algo.
m_outputEtSum << endl;
163 os <<
"Output vector Et x component " << algo.
m_outputExSum << endl;
164 os <<
"Output vector Et y component " << algo.
m_outputEySum << endl;
165 os <<
"Output total scalar Ht " << algo.
m_outputHtSum << endl;
166 os <<
"Output vector Ht x component " << algo.
m_outputHxSum << endl;
167 os <<
"Output vector Ht y component " << algo.
m_outputHySum << endl;
243 unsigned colAbsolute = (crate+1)*2 + region.
rctPhi();
244 unsigned colRelative = ((colAbsolute+NPHI) -
m_minColThisJf) % NPHI;
245 if (colRelative < this->
nCols()) {
253 if (region.
rctEta() < N_00) {
264 std::vector< L1GctInternJetData >
result;
283 std::vector< L1GctInternEtSum >
result;
284 for (
int bx=0; bx<
numOfBx(); bx++) {
287 static_cast<int16_t
> (bx-
bxMin()) ) );
290 static_cast<int16_t
> (bx-
bxMin()) ) );
293 static_cast<int16_t
> (bx-
bxMin()) ) );
296 static_cast<int16_t
> (bx-
bxMin()) ) );
303 std::vector< L1GctInternHtMiss >
result;
304 for (
int bx=0; bx<
numOfBx(); bx++) {
308 static_cast<int16_t
> (bx-
bxMin()) ) );
326 static const unsigned int MAX_TOPBOT_JETS =
MAX_JETS_OUT/2;
330 for ( ; j<MAX_TOPBOT_JETS; ++
j) {
395 unsigned xfact0 = (4*
m_id + 6) % 36;
396 unsigned xfact1 = (4*
m_id + 8) % 36;
397 unsigned yfact0 = (4*
m_id + 15) % 36;
398 unsigned yfact1 = (4*
m_id + 17) % 36;
401 m_outputExSum = etComponentForJetFinder<L1GctInternEtSum::kTotEtOrHtNBits,L1GctInternEtSum::kJetMissEtNBits>
402 (etStrip0, xfact0, etStrip1, xfact1);
403 m_outputEySum = etComponentForJetFinder<L1GctInternEtSum::kTotEtOrHtNBits,L1GctInternEtSum::kJetMissEtNBits>
404 (etStrip0, yfact0, etStrip1, yfact1);
448 unsigned xfact0 = (4*
m_id + 10) % 36;
449 unsigned xfact1 = (4*
m_id + 4) % 36;
450 unsigned yfact0 = (4*
m_id + 19) % 36;
451 unsigned yfact1 = (4*
m_id + 13) % 36;
453 m_outputHxSum = etComponentForJetFinder<L1GctInternEtSum::kTotEtOrHtNBits,L1GctInternHtMiss::kJetMissHtNBits>
454 (htStrip0, xfact0, htStrip1, xfact1);
455 m_outputHySum = etComponentForJetFinder<L1GctInternEtSum::kTotEtOrHtNBits,L1GctInternHtMiss::kJetMissHtNBits>
456 (htStrip0, yfact0, htStrip1, yfact1);
461 m_outputHySum.setOverFlow(htmOverFlow);
472 static const UShort NUMBER_OF_FRWRD_RINGS = 4;
473 static const UShort NUMBER_OF_INNER_RINGS = 2;
474 std::vector<unsigned> et(NUMBER_OF_INNER_RINGS, 0);
475 std::vector<bool> of(NUMBER_OF_INNER_RINGS,
false);
476 std::vector<unsigned>
nt(NUMBER_OF_INNER_RINGS, 0);
479 for (
UShort i=0;
i < NUMBER_OF_FRWRD_RINGS; ++
i) {
483 if (
i<NUMBER_OF_INNER_RINGS) {
495 temp.etSum0.setOverFlow(
temp.etSum0.overFlow() || of.at(0));
496 temp.etSum1.setOverFlow(
temp.etSum1.overFlow() || of.at(1));
505 template <
int kBitsInput,
int kBitsOutput>
526 static const int internalComponentSize = 15;
527 static const int maxEt = 1<<internalComponentSize;
529 static const int kBitsFactor = internalComponentSize+kBitsInput+1;
530 static const int maxFactor = 1<<kBitsFactor;
532 static const int bitsToShift = internalComponentSize-2;
533 static const int halfInputLsb = 1<<(bitsToShift-1);
538 const int factors[19] = {maxFactor-16383, maxFactor-16134, maxFactor-15395, maxFactor-14188, maxFactor-12550,
539 maxFactor-10531, maxFactor-8192, maxFactor-5603, maxFactor-2845, 0,
540 2845, 5603, 8192, 10531, 12550, 14188, 15395, 16134, 16383};
542 int rotatedValue0, rotatedValue1, myFact;
543 int etComponentSum = 0;
545 if (fact0 >= 36 || fact1 >= 36) {
548 <<
"L1GctJetLeafCard::rotateEtValue() has been called with factor numbers "
549 << fact0 <<
" and " << fact1 <<
"; should be less than 36 \n";
554 if (fact0>18) { myFact = factors[(36-fact0)]; }
555 else { myFact = factors[fact0]; }
558 rotatedValue0 =
static_cast<int>(etStrip0.
value()) * myFact;
561 if (fact1>18) { myFact = factors[(36-fact1)]; }
562 else { myFact = factors[fact1]; }
565 rotatedValue1 =
static_cast<int>(etStrip1.
value()) * myFact;
573 etComponentSum = ((rotatedValue0 + rotatedValue1) + halfInputLsb)>>bitsToShift;
575 etComponentSum = etComponentSum & (maxEt-1);
576 if (etComponentSum >= (maxEt/2)) {
577 etComponentSum = etComponentSum - maxEt;
582 OutputType
temp(etComponentSum);
583 temp.setOverFlow(temp.overFlow() || etStrip0.
overFlow() || etStrip1.
overFlow());
591 L1GctJetFinderBase::etComponentForJetFinder<L1GctInternEtSum::kTotEtOrHtNBits,L1GctInternEtSum::kJetMissEtNBits>
598 L1GctJetFinderBase::etComponentForJetFinder<L1GctInternEtSum::kTotEtOrHtNBits,L1GctInternHtMiss::kJetMissHtNBits>
bool m_idInRange
Remember whether range check on the input ID was ok.
bool overFlow() const
access overflow
void setOverFlow(bool oflow)
set the overflow bit
void reset()
complete reset of processor
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.
void setOverFlow(bool oflow)
set the overflow bit
RegionsVector m_sentProtoJets
List of pre-clustered jets to be sent to neighbour after the first stage of clustering.
htCompInternJfType m_outputHySum
static L1GctInternEtSum fromEmulatorJetTotEt(unsigned totEt, bool overFlow, int16_t bx)
Emulator constructors.
hfTowerSumsType calcHfSums() const
Calculates Et sum and number of towers over threshold in Hf.
unsigned rctEta() const
get local eta index (within RCT crate)
unsigned rctCrate() const
get RCT crate ID
void store(const T &thisBx, const int bxNum)
bool m_verbose
Flag to control output messages.
unsigned getCenJetEtSeedGct() const
unsigned getTauJetEtSeedGct() const
std::vector< L1GctInternHtMiss > getInternalHtMiss() const
bool m_gotChannelMask
Remember whether channel mask have been stored.
Gct version of a calorimeter region, used within GCT emulation.
void setBx(int16_t bx)
set bx
Pipeline< etCompInternJfType > m_outputExSumPipe
virtual void resetPipelines()
bool totalHtMask(unsigned ieta) const
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.
bool missingHtMask(unsigned ieta) const
fetchType
different ways of getting the neighbour data
htCompInternJfType m_outputHxSum
std::ostream & operator<<(std::ostream &out, const ALILine &li)
virtual void setupObjects()
Initialise inputs with null objects for the correct bunch crossing if required.
unsigned getTauIsoEtThresholdGct() const
Pipeline< htCompInternJfType > m_outputHySumPipe
Pipeline< htCompInternJfType > m_outputHxSumPipe
L1GctJetFinderBase(int id)
id is 0-8 for -ve Eta jetfinders, 9-17 for +ve Eta, for increasing Phi.
A Level-1 jet candidate, used within GCT emulation.
void setBx(const int16_t bx)
virtual unsigned centralCol0() const
JetVector getSortedJets() const
Base class to allow implementation of jetFinder algorithms.
static L1GctRegion makeJfInputRegion(const L1CaloRegion &)
ABC for a GCT trigger data processing unit.
static L1GctInternEtSum fromEmulatorJetTotHt(unsigned totHt, bool overFlow, int16_t bx)
unsigned value() const
access value as unsigned
unsigned getMHtJetEtThresholdGct() 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.
bool m_gotNeighbourPointers
Remember whether the neighbour pointers have been stored.
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.
Definition of signed integer types with overflow.
static L1GctInternHtMiss emulatorJetMissHt(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 (jetFinder output)...
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
unsigned m_tauIsolationThreshold
unsigned rctPhi() const
get local phi index (within RCT crate)
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.
Pipeline< etHadType > m_outputHtSumPipe
static const unsigned int N_EXTRA_REGIONS_ETA00
Number of additional regions to process on the "wrong" side of eta=0 (determines COL_OFFSET) ...
unsigned short int UShort
static const unsigned int CENTRAL_COL0
RegionsVector m_keptProtoJets
List of pre-clustered jets retained locally as input to the final clustering.
unsigned int offset(bool)
static const unsigned int MAX_REGIONS_IN
The real jetFinders must define these constants.
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.
RegionsVector m_inputRegions
static const unsigned NUMBER_ETA_VALUES
Number of eta bins used in correction.
Pipeline< etCompInternJfType > m_outputEySumPipe
RawJetPipeline m_outputJetsPipe
Output jets "pipeline memory" for checking.
virtual void resetProcessor()
Separate reset methods for the processor itself and any data stored in pipelines. ...
static L1GctInternJetData fromEmulator(L1CaloRegionDetId rgn, int16_t bx, uint16_t et, bool overFlow, bool tauVeto, uint8_t eta, uint8_t phi, uint16_t rank)
unsigned m_HtmSumJetThreshold
void reset(const unsigned nBx)
unsigned getCenForJetEtaBoundary() const
void setInputRegion(const L1CaloRegion ®ion)
Set input data.
virtual unsigned nCols() const
void setEnergySumMasks(const L1GctChannelMask *chmask)
Set masks for energy summing.
std::vector< lutPtr > lutPtrVector
void fetchProtoJetsFromNeighbour(const fetchType ft)
fetch the protoJets from neighbour jetFinder
unsigned getHtJetEtThresholdGct() const
bool totalEtMask(unsigned ieta) const
etCompInternJfType m_outputEySum
void setValue(unsigned value)
Set value from unsigned.
Pipeline< etTotalType > m_outputEtSumPipe
"Pipeline memories" for energy sums
unsigned getForJetEtSeedGct() const
bool m_gotJetFinderParams
Remember whether jetfinder parameters have been stored.
A calorimeter trigger region (sum of 4x4 trigger towers)
virtual unsigned maxRegionsIn() const
static L1GctInternEtSum fromEmulatorJetMissEt(int missEtxOrEty, bool overFlow, int16_t bx)
static const unsigned N_PHI
unsigned m_minColThisJf
parameter to determine which Regions belong in our acceptance
volatile std::atomic< bool > shutdown_flag false
bool overFlow() const
access overflow
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
bool missingEtMask(unsigned ieta) const
bool m_gotJetEtCalLuts
Remember whether jet Et calibration Lut pointers have been stored.
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.
unsigned m_HttSumJetThreshold