74 std::vector<std::tuple<int, int>>
findSeeds(
float seedThreshold)
const;
80 bool killZeroPt)
const;
97 template <
class Container>
98 void fillCaloGrid(TH2F& caloGrid,
const Container& triggerPrimitives,
const unsigned int regionIndex);
106 const unsigned int regionIndex)
const;
110 template <
class Handle>
131 bool trimTower(
const int etaIndex,
const int phiIndex)
const;
170 etaBinning_(iConfig.getParameter<std::vector<double>>(
"etaBinning")),
171 nBinsEta_(etaBinning_.size() - 1),
172 nBinsPhi_(iConfig.getParameter<
unsigned int>(
"nBinsPhi")),
173 phiLow_(iConfig.getParameter<
double>(
"phiLow")),
174 phiUp_(iConfig.getParameter<
double>(
"phiUp")),
175 jetIEtaSize_(iConfig.getParameter<
unsigned int>(
"jetIEtaSize")),
176 jetIPhiSize_(iConfig.getParameter<
unsigned int>(
"jetIPhiSize")),
177 trimmedGrid_(iConfig.getParameter<
bool>(
"trimmedGrid")),
178 seedPtThreshold_(iConfig.getParameter<
double>(
"seedPtThreshold")),
179 ptlsb_(iConfig.getParameter<
double>(
"ptlsb")),
180 philsb_(iConfig.getParameter<
double>(
"philsb")),
181 etalsb_(iConfig.getParameter<
double>(
"etalsb")),
182 puSubtraction_(iConfig.getParameter<
bool>(
"puSubtraction")),
183 vetoZeroPt_(iConfig.getParameter<
bool>(
"vetoZeroPt")),
184 etaRegionEdges_(iConfig.getParameter<std::vector<double>>(
"etaRegions")),
185 phiRegionEdges_(iConfig.getParameter<std::vector<double>>(
"phiRegions")),
186 maxInputsPerRegion_(iConfig.getParameter<
unsigned int>(
"maxInputsPerRegion")),
187 sinPhi_(iConfig.getParameter<std::vector<double>>(
"sinPhi")),
188 cosPhi_(iConfig.getParameter<std::vector<double>>(
"cosPhi")),
189 metAbsEtaCut_(iConfig.getParameter<
double>(
"metAbsEtaCut")),
190 metHFAbsEtaCut_(iConfig.getParameter<
double>(
"metHFAbsEtaCut")),
191 outputCollectionName_(iConfig.getParameter<
std::string>(
"outputCollectionName")) {
193 std::make_unique<TH2F>(
"caloGrid",
"Calorimeter grid", nBinsEta_, etaBinning_.data(), nBinsPhi_, phiLow_, phiUp_);
194 caloGrid_->GetXaxis()->SetTitle(
"#eta");
195 caloGrid_->GetYaxis()->SetTitle(
"#phi");
196 produces<std::vector<reco::CaloJet>>(outputCollectionName_).setBranchAlias(outputCollectionName_);
197 produces<std::vector<l1t::EtSum>>(outputCollectionName_ +
"MET").setBranchAlias(outputCollectionName_ +
"MET");
227 std::vector<std::vector<reco::CandidatePtr>> inputsInRegions = prepareInputsIntoRegions<>(inputCollectionHandle);
231 for (
unsigned int iInputRegion = 0; iInputRegion < inputsInRegions.size(); ++iInputRegion) {
232 fillCaloGrid<>(*(
caloGrid_), inputsInRegions[iInputRegion], iInputRegion);
243 return jet1.
pt() > jet2.pt();
246 auto l1jetVectorPtr = std::make_unique<std::vector<reco::CaloJet>>(l1jetVector);
252 std::unique_ptr<std::vector<l1t::EtSum>> lSumVectorPtr(
new std::vector<l1t::EtSum>(0));
253 lSumVectorPtr->push_back(lMET);
254 lSumVectorPtr->push_back(lMETHF);
263 float leftBandPt = 0;
264 float rightBandPt = 0;
265 float bottomBandPt = 0;
269 int xCenter, yCenter, zCenter;
291 pileUpEnergy = topBandPt + leftBandPt + rightBandPt + bottomBandPt -
297 float ptAfterPUSubtraction =
jet.pt() - pileUpEnergy;
298 ptVector.SetPt((ptAfterPUSubtraction > 0) ? ptAfterPUSubtraction : 0);
299 ptVector.SetEta(
jet.eta());
300 ptVector.SetPhi(
jet.phi());
303 jet.setPileup(pileUpEnergy);
311 std::vector<std::tuple<int, int>>
seeds;
321 for (
int iPhi = 1; iPhi <= nBinsY; iPhi++) {
324 if (centralPt < seedThreshold)
326 bool isLocalMaximum =
true;
329 for (
int etaIndex = -etaHalfSize; etaIndex <= etaHalfSize; etaIndex++) {
330 for (
int phiIndex = -phiHalfSize; phiIndex <= phiHalfSize; phiIndex++) {
336 if ((etaIndex == 0) && (phiIndex == 0))
339 if (phiIndex > -etaIndex) {
340 isLocalMaximum = ((isLocalMaximum) && (centralPt >
getTowerEnergy(
iEta + etaIndex, iPhi + phiIndex)));
342 isLocalMaximum = ((isLocalMaximum) && (centralPt >=
getTowerEnergy(
iEta + etaIndex, iPhi + phiIndex)));
345 if (phiIndex >= -etaIndex) {
346 isLocalMaximum = ((isLocalMaximum) && (centralPt >
getTowerEnergy(
iEta + etaIndex, iPhi + phiIndex)));
348 isLocalMaximum = ((isLocalMaximum) && (centralPt >=
getTowerEnergy(
iEta + etaIndex, iPhi + phiIndex)));
353 if (isLocalMaximum) {
364 int iPhi = std::get<1>(
seed);
371 for (
int etaIndex = -etaHalfSize; etaIndex <= etaHalfSize; etaIndex++) {
372 for (
int phiIndex = -phiHalfSize; phiIndex <= phiHalfSize; phiIndex++) {
383 ptVector.SetPt(ptSum);
385 ptVector.SetPhi(
caloGrid_->GetYaxis()->GetBinCenter(iPhi));
395 std::vector<reco::CaloJet>
jets;
411 std::vector<reco::CaloJet>
jets;
419 template <
class Container>
422 const unsigned int regionIndex) {
424 for (
const auto& primitiveIterator : triggerPrimitives) {
426 std::pair<float, float> digi_EtaPhi =
429 caloGrid.Fill(static_cast<float>(digi_EtaPhi.first),
430 static_cast<float>(digi_EtaPhi.second),
431 static_cast<float>(primitiveIterator->pt()));
437 const unsigned int regionIndex)
const {
440 int digitisedEta = floor((
eta - regionLowEdges.second) /
etalsb_);
441 int digitisedPhi = floor((
phi - regionLowEdges.first) /
philsb_);
449 int digiEtaEdgeLastBinUp = floor((regionUpEdges.second - regionLowEdges.second) /
etalsb_);
453 if (digitisedEta >= digiEtaEdgeLastBinUp) {
454 digitisedEta = digiEtaEdgeLastBinUp - 1;
456 for (
int i = 0;
i < etaAxis->GetNbins(); ++
i) {
457 if (etaAxis->GetBinUpEdge(
i) < regionLowEdges.second)
459 int digiEdgeBinUp = floor((etaAxis->GetBinUpEdge(
i) - regionLowEdges.second) /
etalsb_);
460 if (digiEdgeBinUp == digitisedEta) {
468 int digiPhiEdgeLastBinUp = floor((regionUpEdges.first - regionLowEdges.first) /
philsb_);
469 if (digitisedPhi >= digiPhiEdgeLastBinUp) {
470 digitisedPhi = digiPhiEdgeLastBinUp - 1;
472 for (
int i = 0;
i < phiAxis->GetNbins(); ++
i) {
473 if (phiAxis->GetBinUpEdge(
i) < regionLowEdges.first)
475 int digiEdgeBinUp = floor((phiAxis->GetBinUpEdge(
i) - regionLowEdges.first) /
philsb_);
476 if (digiEdgeBinUp == digitisedPhi) {
483 float floatDigitisedEta = (digitisedEta + 0.5) *
etalsb_ + regionLowEdges.second;
484 float floatDigitisedPhi = (digitisedPhi + 0.5) *
philsb_ + regionLowEdges.first;
486 return std::pair<float, float>{floatDigitisedEta, floatDigitisedPhi};
492 desc.add<std::vector<double>>(
"etaBinning");
493 desc.add<
unsigned int>(
"nBinsPhi", 72);
496 desc.add<
unsigned int>(
"jetIEtaSize", 7);
497 desc.add<
unsigned int>(
"jetIPhiSize", 7);
498 desc.add<
bool>(
"trimmedGrid",
false);
499 desc.add<
double>(
"seedPtThreshold", 5);
500 desc.add<
double>(
"ptlsb", 0.25),
desc.add<
double>(
"philsb", 0.0043633231),
desc.add<
double>(
"etalsb", 0.0043633231),
501 desc.add<
bool>(
"puSubtraction",
false);
502 desc.add<
string>(
"outputCollectionName",
"UncalibratedPhase1L1TJetFromPfCandidates");
503 desc.add<
bool>(
"vetoZeroPt",
true);
504 desc.add<std::vector<double>>(
"etaRegions");
505 desc.add<std::vector<double>>(
"phiRegions");
506 desc.add<
unsigned int>(
"maxInputsPerRegion", 18);
507 desc.add<std::vector<double>>(
"sinPhi");
508 desc.add<std::vector<double>>(
"cosPhi");
509 desc.add<
double>(
"metAbsEtaCut", 3);
510 desc.add<
double>(
"metHFAbsEtaCut", 5);
511 descriptions.
add(
"Phase1L1TJetProducer",
desc);
514 template <
class Handle>
516 const Handle triggerPrimitives) {
519 for (
unsigned int i = 0;
i < triggerPrimitives->size(); ++
i) {
542 for (
auto&
inputs : inputsInRegions) {
548 return inputsInRegions;
576 const auto phiProjection =
caloGrid_->ProjectionY(
"temp", lowEtaBin, highEtaBin);
582 for (
int i = 1;
i < phiProjection->GetNbinsX() + 1; ++
i) {
583 double pt = phiProjection->GetBinContent(
i);
588 double lMET = floor(
sqrt(totalDigiPx * totalDigiPx + totalDigiPy * totalDigiPy)) *
ptlsb_;
591 l1t::EtSum lMETSum(lMETVector, sumType, 0, 0, 0, 0);
599 if (etaIndex == -etaHalfSize || etaIndex == etaHalfSize) {
600 if (phiIndex <= -phiHalfSize + 1 || phiIndex >= phiHalfSize - 1) {
603 }
else if (etaIndex == -etaHalfSize + 1 || etaIndex == etaHalfSize - 1) {
604 if (phiIndex == -phiHalfSize || phiIndex == phiHalfSize) {