CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
Phase2L1CaloPFClusterEmulator Class Reference

#include <L1Trigger/L1CaloTrigger/plugins/Phase2L1CaloPFClusterEmulator.cc>

Inheritance diagram for Phase2L1CaloPFClusterEmulator:
edm::stream::EDProducer<>

Public Member Functions

 Phase2L1CaloPFClusterEmulator (const edm::ParameterSet &)
 
 ~Phase2L1CaloPFClusterEmulator () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

const edm::EDGetTokenT< l1tp2::CaloTowerCollectioncaloTowerToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: Creates 3x3 PF clusters from GCTintTowers to be sent to correlator. Follows firmware logic, creates 8 clusters per (2+17+2)x(2+4+2).

Implementation: To be run together with Phase2L1CaloEGammaEmulator.

Definition at line 48 of file Phase2L1CaloPFClusterEmulator.cc.

Constructor & Destructor Documentation

◆ Phase2L1CaloPFClusterEmulator()

Phase2L1CaloPFClusterEmulator::Phase2L1CaloPFClusterEmulator ( const edm::ParameterSet iConfig)
explicit

Definition at line 65 of file Phase2L1CaloPFClusterEmulator.cc.

66  : caloTowerToken_(consumes<l1tp2::CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("gctFullTowers"))) {
67  produces<l1tp2::CaloPFClusterCollection>("GCTPFCluster");
68 }
const edm::EDGetTokenT< l1tp2::CaloTowerCollection > caloTowerToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307

◆ ~Phase2L1CaloPFClusterEmulator()

Phase2L1CaloPFClusterEmulator::~Phase2L1CaloPFClusterEmulator ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

void Phase2L1CaloPFClusterEmulator::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 170 of file Phase2L1CaloPFClusterEmulator.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

170  {
172  desc.add<edm::InputTag>("gctFullTowers", edm::InputTag("l1tPhase2L1CaloEGammaEmulator", "GCTFullTowers"));
173  descriptions.addWithDefaultLabel(desc);
174 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

void Phase2L1CaloPFClusterEmulator::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 75 of file Phase2L1CaloPFClusterEmulator.cc.

References caloTowerToken_, gctpf::GCTpfcluster_t::et, gctpf::GCTpfcluster_t::eta, gctpf::PFcluster_t::GCTpfclusters, mps_fire::i, hcalRecHitTable_cff::ieta, iEvent, hcalRecHitTable_cff::iphi, edm::HandleBase::isValid(), dqmdumpme::k, eostools::move(), nPFClusterSLR, nSLR, nTowerEta, nTowerEtaSLR, nTowerPhi, nTowerPhiSLR, gctpf::pfcluster(), gctpf::GCTpfcluster_t::phi, l1tp2::CaloPFCluster::setClusterEt(), l1tp2::CaloPFCluster::setClusterEta(), l1tp2::CaloPFCluster::setClusterIEta(), l1tp2::CaloPFCluster::setClusterIPhi(), and l1tp2::CaloPFCluster::setClusterPhi().

75  {
76  using namespace edm;
77  std::unique_ptr<l1tp2::CaloPFClusterCollection> pfclusterCands(make_unique<l1tp2::CaloPFClusterCollection>());
78 
79  edm::Handle<std::vector<l1tp2::CaloTower>> caloTowerCollection;
80  iEvent.getByToken(caloTowerToken_, caloTowerCollection);
81  if (!caloTowerCollection.isValid())
82  cms::Exception("Phase2L1CaloPFClusterEmulator") << "Failed to get towers from caloTowerCollection!";
83 
84  float GCTintTowers[nTowerEta][nTowerPhi];
85  float realEta[nTowerEta][nTowerPhi];
86  float realPhi[nTowerEta][nTowerPhi];
87  for (const l1tp2::CaloTower& i : *caloTowerCollection) {
88  int ieta = i.towerIEta();
89  int iphi = i.towerIPhi();
90  GCTintTowers[ieta][iphi] = i.ecalTowerEt();
91  realEta[ieta][iphi] = i.towerEta();
92  realPhi[ieta][iphi] = i.towerPhi();
93  }
94 
96 
97  for (int ieta = 0; ieta < nTowerEtaSLR; ieta++) {
98  for (int iphi = 0; iphi < nTowerPhiSLR; iphi++) {
99  for (int k = 0; k < nSLR; k++) {
100  regions[k][ieta][iphi] = 0.;
101  }
102  }
103  }
104 
105  //Assign ETs to 36 21x8 regions
106 
107  for (int ieta = 0; ieta < nTowerEtaSLR; ieta++) {
108  for (int iphi = 0; iphi < nTowerPhiSLR; iphi++) {
109  if (ieta > 1) {
110  if (iphi > 1)
111  regions[0][ieta][iphi] = GCTintTowers[ieta - 2][iphi - 2];
112  for (int k = 1; k < 17; k++) {
113  regions[k * 2][ieta][iphi] = GCTintTowers[ieta - 2][iphi + k * 4 - 2];
114  }
115  if (iphi < 6)
116  regions[34][ieta][iphi] = GCTintTowers[ieta - 2][iphi + 66];
117  }
118  if (ieta < 19) {
119  if (iphi > 1)
120  regions[1][ieta][iphi] = GCTintTowers[ieta + 15][iphi - 2];
121  for (int k = 1; k < 17; k++) {
122  regions[k * 2 + 1][ieta][iphi] = GCTintTowers[ieta + 15][iphi + k * 4 - 2];
123  }
124  if (iphi < 6)
125  regions[35][ieta][iphi] = GCTintTowers[ieta + 15][iphi + 66];
126  }
127  }
128  }
129 
130  float temporary[nTowerEtaSLR][nTowerPhiSLR];
131  int etaoffset = 0;
132  int phioffset = 0;
133 
134  //Use same code from firmware for finding clusters
135  for (int k = 0; k < nSLR; k++) {
136  for (int ieta = 0; ieta < nTowerEtaSLR; ieta++) {
137  for (int iphi = 0; iphi < nTowerPhiSLR; iphi++) {
138  temporary[ieta][iphi] = regions[k][ieta][iphi];
139  }
140  }
141  if (k % 2 == 0)
142  etaoffset = 0;
143  else
144  etaoffset = 17;
145  if (k > 1 && k % 2 == 0)
146  phioffset = phioffset + 4;
147 
148  gctpf::PFcluster_t tempPfclusters;
149  tempPfclusters = gctpf::pfcluster(temporary, etaoffset, phioffset);
150 
151  for (int i = 0; i < nPFClusterSLR; i++) {
152  int gcteta = tempPfclusters.GCTpfclusters[i].eta;
153  int gctphi = tempPfclusters.GCTpfclusters[i].phi;
154  float towereta = realEta[gcteta][gctphi];
155  float towerphi = realPhi[gcteta][gctphi];
156  l1tp2::CaloPFCluster l1CaloPFCluster;
157  l1CaloPFCluster.setClusterEt(tempPfclusters.GCTpfclusters[i].et);
158  l1CaloPFCluster.setClusterIEta(gcteta);
159  l1CaloPFCluster.setClusterIPhi(gctphi);
160  l1CaloPFCluster.setClusterEta(towereta);
161  l1CaloPFCluster.setClusterPhi(towerphi);
162  pfclusterCands->push_back(l1CaloPFCluster);
163  }
164  }
165 
166  iEvent.put(std::move(pfclusterCands), "GCTPFCluster");
167 }
void setClusterEta(float clusterEtaIn)
Definition: CaloPFCluster.h:43
const edm::EDGetTokenT< l1tp2::CaloTowerCollection > caloTowerToken_
static constexpr int nPFClusterSLR
void setClusterIPhi(int clusterIPhiIn)
Definition: CaloPFCluster.h:42
static constexpr int nSLR
int iEvent
Definition: GenABIO.cc:224
GCTpfcluster_t GCTpfclusters[nPFClusterSLR]
static constexpr int nTowerEtaSLR
static constexpr int nTowerEta
PFcluster_t pfcluster(float temporary[nTowerEtaSLR][nTowerPhiSLR], int etaoffset, int phioffset)
static constexpr int nTowerPhiSLR
static constexpr int nTowerPhi
bool isValid() const
Definition: HandleBase.h:70
HLT enums.
void setClusterPhi(float clusterPhiIn)
Definition: CaloPFCluster.h:44
void setClusterIEta(int clusterIEtaIn)
Definition: CaloPFCluster.h:41
def move(src, dest)
Definition: eostools.py:511
void setClusterEt(float clusterEtIn)
Definition: CaloPFCluster.h:40

Member Data Documentation

◆ caloTowerToken_

const edm::EDGetTokenT<l1tp2::CaloTowerCollection> Phase2L1CaloPFClusterEmulator::caloTowerToken_
private

Definition at line 59 of file Phase2L1CaloPFClusterEmulator.cc.

Referenced by produce().