CMS 3D CMS Logo

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

#include <L1Trigger/L1TCaloSummary/plugins/L1TCaloSummary.cc>

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

Public Member Functions

 L1TCaloSummary (const edm::ParameterSet &)
 
 ~L1TCaloSummary () override
 
- 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 beginRun (edm::Run const &, edm::EventSetup const &) override
 
void print ()
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

double boostedJetPtFactor
 
double caloScaleFactor
 
double eGammaIsolationFactor
 
uint32_t eGammaSeed
 
int fwVersion
 
uint32_t jetSeed
 
UCTLayer1 * layer1
 
uint32_t nPumBins
 
std::vector< std::vector< std::vector< uint32_t > > > pumLUT
 
edm::EDGetTokenT< L1CaloRegionCollectionregionToken
 
UCTSummaryCard * summaryCard
 
float tauIsolationFactor
 
uint32_t tauSeed
 
bool verbose
 

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: The package L1Trigger/L1TCaloSummary is prepared for monitoring the CMS Layer-1 Calorimeter Trigger.

Implementation: It prepares region objects and puts them in the event

Definition at line 68 of file L1TCaloSummary.cc.

Constructor & Destructor Documentation

◆ L1TCaloSummary()

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

Definition at line 119 of file L1TCaloSummary.cc.

References caloScaleFactor, eGammaIsolationFactor, eGammaSeed, edm::ParameterSet::getParameter(), l1tTowerCalibrationProducer_cfi::iEta, jetSeed, SiStripPI::max, nPumBins, pumLUT, summaryCard, tauIsolationFactor, and tauSeed.

120  : nPumBins(iConfig.getParameter<unsigned int>("nPumBins")),
121  pumLUT(nPumBins, std::vector<std::vector<uint32_t>>(2, std::vector<uint32_t>(13))),
122  caloScaleFactor(iConfig.getParameter<double>("caloScaleFactor")),
123  jetSeed(iConfig.getParameter<unsigned int>("jetSeed")),
124  tauSeed(iConfig.getParameter<unsigned int>("tauSeed")),
125  tauIsolationFactor(iConfig.getParameter<double>("tauIsolationFactor")),
126  eGammaSeed(iConfig.getParameter<unsigned int>("eGammaSeed")),
127  eGammaIsolationFactor(iConfig.getParameter<double>("eGammaIsolationFactor")),
128  boostedJetPtFactor(iConfig.getParameter<double>("boostedJetPtFactor")),
129  verbose(iConfig.getParameter<bool>("verbose")),
130  fwVersion(iConfig.getParameter<int>("firmwareVersion")),
131  regionToken(consumes<L1CaloRegionCollection>(edm::InputTag("simCaloStage2Layer1Digis"))) {
132  std::vector<double> pumLUTData;
133  char pumLUTString[10];
134  for (uint32_t pumBin = 0; pumBin < nPumBins; pumBin++) {
135  for (uint32_t side = 0; side < 2; side++) {
136  if (side == 0)
137  sprintf(pumLUTString, "pumLUT%2.2dp", pumBin);
138  else
139  sprintf(pumLUTString, "pumLUT%2.2dn", pumBin);
140  pumLUTData = iConfig.getParameter<std::vector<double>>(pumLUTString);
141  for (uint32_t iEta = 0; iEta < std::max((uint32_t)pumLUTData.size(), MaxUCTRegionsEta); iEta++) {
142  pumLUT[pumBin][side][iEta] = (uint32_t)round(pumLUTData[iEta] / caloScaleFactor);
143  }
144  if (pumLUTData.size() != (MaxUCTRegionsEta))
145  edm::LogError("L1TCaloSummary") << "PUM LUT Data size integrity check failed; Expected size = "
146  << MaxUCTRegionsEta << "; Provided size = " << pumLUTData.size()
147  << "; Will use what is provided :(" << std::endl;
148  }
149  }
150  produces<L1JetParticleCollection>("Boosted");
152 }
double caloScaleFactor
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
uint32_t eGammaSeed
Log< level::Error, false > LogError
UCTSummaryCard * summaryCard
double eGammaIsolationFactor
float tauIsolationFactor
std::vector< std::vector< std::vector< uint32_t > > > pumLUT
double boostedJetPtFactor
edm::EDGetTokenT< L1CaloRegionCollection > regionToken

◆ ~L1TCaloSummary()

L1TCaloSummary::~L1TCaloSummary ( )
override

Definition at line 154 of file L1TCaloSummary.cc.

References summaryCard.

154  {
155  if (summaryCard != nullptr)
156  delete summaryCard;
157 }
UCTSummaryCard * summaryCard

Member Function Documentation

◆ beginRun()

void L1TCaloSummary::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprivate

Definition at line 272 of file L1TCaloSummary.cc.

272 {}

◆ fillDescriptions()

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

Definition at line 299 of file L1TCaloSummary.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

299  {
300  //The following says we do not know what parameters are allowed so do no validation
301  // Please change this to state exactly what you do use, even if it is no parameters
303  desc.setUnknown();
304  descriptions.addDefault(desc);
305 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ print()

void L1TCaloSummary::print ( void  )
private

Definition at line 262 of file L1TCaloSummary.cc.

262 {}

◆ produce()

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

Definition at line 164 of file L1TCaloSummary.cc.

References funct::abs(), boostedJetPtFactor, caloScaleFactor, PVValHelper::eta, beamvalidation::exit(), fwVersion, g, mps_fire::i, l1tTowerCalibrationProducer_cfi::iEta, iEvent, EgHLTOffHistBins_cfi::mass, eostools::move(), resolutioncreator_cfi::object, phi, DiDispStaMuonMonitor_cfi::pt, alignCSCRings::r, HLT_2022v15_cff::region, regionToken, summaryCard, and submitPVValidationJobs::t.

164  {
165  using namespace edm;
166 
167  std::unique_ptr<L1JetParticleCollection> bJetCands(new L1JetParticleCollection);
168 
169  UCTGeometry g;
170 
171  // Here we read region data from the region collection created by L1TCaloLayer1 instead of
172  // independently creating regions from TPGs for processing by the summary card. This results
173  // in a single region vector of size 252 whereas from independent creation we had 3*6 vectors
174  // of size 7*2. Indices are mapped in UCTSummaryCard accordingly.
175  summaryCard->clearRegions();
176  std::vector<UCTRegion*> inputRegions;
177  inputRegions.clear();
178  edm::Handle<std::vector<L1CaloRegion>> regionCollection;
179  if (!iEvent.getByToken(regionToken, regionCollection))
180  edm::LogError("L1TCaloSummary") << "UCT: Failed to get regions from region collection!";
181  iEvent.getByToken(regionToken, regionCollection);
182  for (const L1CaloRegion& i : *regionCollection) {
183  UCTRegionIndex r = g.getUCTRegionIndexFromL1CaloRegion(i.gctEta(), i.gctPhi());
184  UCTTowerIndex t = g.getUCTTowerIndexFromL1CaloRegion(r, i.raw());
185  uint32_t absCaloEta = std::abs(t.first);
186  uint32_t absCaloPhi = std::abs(t.second);
187  bool negativeEta = false;
188  if (t.first < 0)
189  negativeEta = true;
190  uint32_t crate = g.getCrate(t.first, t.second);
191  uint32_t card = g.getCard(t.first, t.second);
192  uint32_t region = g.getRegion(absCaloEta, absCaloPhi);
193  UCTRegion* test = new UCTRegion(crate, card, negativeEta, region, fwVersion);
194  test->setRegionSummary(i.raw());
195  inputRegions.push_back(test);
196  }
197  summaryCard->setRegionData(inputRegions);
198 
199  if (!summaryCard->process()) {
200  edm::LogError("L1TCaloSummary") << "UCT: Failed to process summary card" << std::endl;
201  exit(1);
202  }
203 
204  double pt = 0;
205  double eta = -999.;
206  double phi = -999.;
207  double mass = 0;
208 
209  std::list<UCTObject*> boostedJetObjs = summaryCard->getBoostedJetObjs();
210  for (std::list<UCTObject*>::const_iterator i = boostedJetObjs.begin(); i != boostedJetObjs.end(); i++) {
211  const UCTObject* object = *i;
212  pt = ((double)object->et()) * caloScaleFactor * boostedJetPtFactor;
213  eta = g.getUCTTowerEta(object->iEta());
214  phi = g.getUCTTowerPhi(object->iPhi());
215  bitset<3> activeRegionEtaPattern = 0;
216  for (uint32_t iEta = 0; iEta < 3; iEta++) {
217  bool activeStrip = false;
218  for (uint32_t iPhi = 0; iPhi < 3; iPhi++) {
219  if (object->boostedJetRegionET()[3 * iEta + iPhi] > 30 &&
220  object->boostedJetRegionET()[3 * iEta + iPhi] > object->et() * 0.0625)
221  activeStrip = true;
222  }
223  if (activeStrip)
224  activeRegionEtaPattern |= (0x1 << iEta);
225  }
226  bitset<3> activeRegionPhiPattern = 0;
227  for (uint32_t iPhi = 0; iPhi < 3; iPhi++) {
228  bool activeStrip = false;
229  for (uint32_t iEta = 0; iEta < 3; iEta++) {
230  if (object->boostedJetRegionET()[3 * iEta + iPhi] > 30 &&
231  object->boostedJetRegionET()[3 * iEta + iPhi] > object->et() * 0.0625)
232  activeStrip = true;
233  }
234  if (activeStrip)
235  activeRegionPhiPattern |= (0x1 << iPhi);
236  }
237  string regionEta = activeRegionEtaPattern.to_string<char, std::string::traits_type, std::string::allocator_type>();
238  string regionPhi = activeRegionPhiPattern.to_string<char, std::string::traits_type, std::string::allocator_type>();
239 
240  bool centralHighest = object->boostedJetRegionET()[4] >= object->boostedJetRegionET()[0] &&
241  object->boostedJetRegionET()[4] >= object->boostedJetRegionET()[1] &&
242  object->boostedJetRegionET()[4] >= object->boostedJetRegionET()[2] &&
243  object->boostedJetRegionET()[4] >= object->boostedJetRegionET()[3] &&
244  object->boostedJetRegionET()[4] >= object->boostedJetRegionET()[5] &&
245  object->boostedJetRegionET()[4] >= object->boostedJetRegionET()[6] &&
246  object->boostedJetRegionET()[4] >= object->boostedJetRegionET()[7] &&
247  object->boostedJetRegionET()[4] >= object->boostedJetRegionET()[8];
248 
249  if (abs(eta) < 2.5 && ((regionEta == "101" && (regionPhi == "110" || regionPhi == "101" || regionPhi == "010")) ||
250  ((regionEta == "110" || regionEta == "101" || regionEta == "010") && regionPhi == "101") ||
251  (regionEta == "111" && (regionPhi == "110" || regionPhi == "010")) ||
252  ((regionEta == "110" || regionEta == "010") && regionPhi == "111") ||
253  ((regionEta == "010" || regionPhi == "010" || regionEta == "110" || regionPhi == "110" ||
254  regionEta == "011" || regionPhi == "011") &&
255  centralHighest)))
256  bJetCands->push_back(L1JetParticle(math::PtEtaPhiMLorentzVector(pt, eta, phi, mass), L1JetParticle::kCentral));
257  }
258 
259  iEvent.put(std::move(bJetCands), "Boosted");
260 }
double caloScaleFactor
Log< level::Error, false > LogError
UCTSummaryCard * summaryCard
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
int iEvent
Definition: GenABIO.cc:224
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double boostedJetPtFactor
HLT enums.
A calorimeter trigger region (sum of 4x4 trigger towers)
Definition: L1CaloRegion.h:21
def move(src, dest)
Definition: eostools.py:511
def exit(msg="")
edm::EDGetTokenT< L1CaloRegionCollection > regionToken

Member Data Documentation

◆ boostedJetPtFactor

double L1TCaloSummary::boostedJetPtFactor
private

Definition at line 97 of file L1TCaloSummary.cc.

Referenced by produce().

◆ caloScaleFactor

double L1TCaloSummary::caloScaleFactor
private

Definition at line 90 of file L1TCaloSummary.cc.

Referenced by L1TCaloSummary(), and produce().

◆ eGammaIsolationFactor

double L1TCaloSummary::eGammaIsolationFactor
private

Definition at line 96 of file L1TCaloSummary.cc.

Referenced by L1TCaloSummary().

◆ eGammaSeed

uint32_t L1TCaloSummary::eGammaSeed
private

Definition at line 95 of file L1TCaloSummary.cc.

Referenced by L1TCaloSummary().

◆ fwVersion

int L1TCaloSummary::fwVersion
private

Definition at line 100 of file L1TCaloSummary.cc.

Referenced by produce().

◆ jetSeed

uint32_t L1TCaloSummary::jetSeed
private

Definition at line 92 of file L1TCaloSummary.cc.

Referenced by L1TCaloSummary().

◆ layer1

UCTLayer1* L1TCaloSummary::layer1
private

Definition at line 104 of file L1TCaloSummary.cc.

◆ nPumBins

uint32_t L1TCaloSummary::nPumBins
private

Definition at line 86 of file L1TCaloSummary.cc.

Referenced by L1TCaloSummary().

◆ pumLUT

std::vector<std::vector<std::vector<uint32_t> > > L1TCaloSummary::pumLUT
private

Definition at line 88 of file L1TCaloSummary.cc.

Referenced by L1TCaloSummary().

◆ regionToken

edm::EDGetTokenT<L1CaloRegionCollection> L1TCaloSummary::regionToken
private

Definition at line 102 of file L1TCaloSummary.cc.

Referenced by produce().

◆ summaryCard

UCTSummaryCard* L1TCaloSummary::summaryCard
private

Definition at line 105 of file L1TCaloSummary.cc.

Referenced by L1TCaloSummary(), produce(), and ~L1TCaloSummary().

◆ tauIsolationFactor

float L1TCaloSummary::tauIsolationFactor
private

Definition at line 94 of file L1TCaloSummary.cc.

Referenced by L1TCaloSummary().

◆ tauSeed

uint32_t L1TCaloSummary::tauSeed
private

Definition at line 93 of file L1TCaloSummary.cc.

Referenced by L1TCaloSummary().

◆ verbose

bool L1TCaloSummary::verbose
private