119 :
HcalTpEtMin(iConfig.getParameter<double>(
"HcalTpEtMin")),
120 EcalTpEtMin(iConfig.getParameter<double>(
"EcalTpEtMin")),
123 HFTpEtMin(iConfig.getParameter<double>(
"HFTpEtMin")),
124 puThreshold(iConfig.getParameter<double>(
"puThreshold")),
136 barrelSF(iConfig.getParameter<double>(
"barrelSF")),
137 hgcalSF(iConfig.getParameter<double>(
"hgcalSF")),
138 hfSF(iConfig.getParameter<double>(
"hfSF")),
139 debug(iConfig.getParameter<
bool>(
"debug")),
158 "nHits_to_nvtx_params[%i]\n \ 180 double p1 =
pset->getParameter<std::vector<double> >(
"params").at(0);
181 double p2 =
pset->getParameter<std::vector<double> >(
"params").at(1);
189 "nvtx_to_PU_sub_params[%i]\n \ 190 sub detector: %s \n \ 203 produces<l1tp2::CaloTowerCollection>(
"L1CaloTowerCalibratedCollection");
204 produces<double>(
"EstimatedNvtx");
209 std::unique_ptr<double> EstimatedNvtx(
new double);
252 (*L1CaloTowerCalibratedCollection).push_back(l1Hit);
254 printf(
"Barrel tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et_sum %f\n",
288 (*L1CaloTowerCalibratedCollection).push_back(l1Hit);
290 printf(
"HGCal tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et_sum %f\n",
304 double et = decoder.hcaletValue(
hit.
id(),
hit.t0());
321 (*L1CaloTowerCalibratedCollection).push_back(l1Hit);
324 printf(
"HCAL HF tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et_sum %f\n",
335 int i_ecal_hits_leq_threshold = 0;
336 int i_hgcalEM_hits_leq_threshold = 0;
337 int i_hcal_hits_leq_threshold = 0;
338 int i_hgcalHad_hits_leq_threshold = 0;
339 int i_hf_hits_leq_threshold = 0;
345 for (
auto& l1CaloTower : (*L1CaloTowerCalibratedCollection)) {
347 if (l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() != -98) {
349 i_ecal_hits_leq_threshold++;
354 if (l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) {
356 i_hgcalEM_hits_leq_threshold++;
361 if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 &&
362 abs(l1CaloTower.towerEta()) < 2.0)
365 i_hcal_hits_leq_threshold++;
370 if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) {
372 i_hgcalHad_hits_leq_threshold++;
377 if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 &&
378 abs(l1CaloTower.towerEta()) > 2.0)
381 i_hf_hits_leq_threshold++;
390 double hgcalHad_nvtx =
nHits_to_nvtx_funcs[
"hgcalHad"].Eval(i_hgcalHad_hits_leq_threshold);
397 if (hgcalEM_nvtx < 0)
399 if (hgcalHad_nvtx < 0)
408 *EstimatedNvtx = (hgcalEM_nvtx + hgcalHad_nvtx + hf_nvtx) / 3.;
411 double lumi =
iEvent.eventAuxiliary().luminosityBlock();
412 double event =
iEvent.eventAuxiliary().event();
415 "L1TowerCalibrater: lumi %.0f evt %.0f nTowers for subdetecters \ 416 \nECAL: %i --> nvtx = %.1f \ 417 \nHGCal EM: %i --> nvtx = %.1f \ 418 \nHCAL: %i --> nvtx = %.1f \ 419 \nHGCal Had: %i --> nvtx = %.1f \ 420 \nHCAL HF: %i --> nvtx = %.1f \ 421 \nEstimated Nvtx = %.1f\n",
424 i_ecal_hits_leq_threshold,
426 i_hgcalEM_hits_leq_threshold,
428 i_hcal_hits_leq_threshold,
430 i_hgcalHad_hits_leq_threshold,
432 i_hf_hits_leq_threshold,
442 for (
auto& l1CaloTower : (*L1CaloTowerCalibratedCollection)) {
444 if (l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() != -98) {
445 if (
abs(l1CaloTower.towerIEta()) <= 3) {
446 l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() -
449 if (
abs(l1CaloTower.towerIEta()) <= 6 &&
abs(l1CaloTower.towerIEta()) >= 4) {
450 l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() -
453 if (
abs(l1CaloTower.towerIEta()) <= 9 &&
abs(l1CaloTower.towerIEta()) >= 7) {
454 l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() -
457 if (
abs(l1CaloTower.towerIEta()) <= 12 &&
abs(l1CaloTower.towerIEta()) >= 10) {
458 l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() -
461 if (
abs(l1CaloTower.towerIEta()) <= 15 &&
abs(l1CaloTower.towerIEta()) >= 13) {
462 l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() -
465 if (
abs(l1CaloTower.towerIEta()) <= 18 &&
abs(l1CaloTower.towerIEta()) >= 16) {
466 l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() -
472 if (l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) {
473 if (
abs(l1CaloTower.towerEta()) <= 1.8) {
474 l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() -
477 if (
abs(l1CaloTower.towerEta()) <= 2.1 &&
abs(l1CaloTower.towerEta()) > 1.8) {
478 l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() -
481 if (
abs(l1CaloTower.towerEta()) <= 2.4 &&
abs(l1CaloTower.towerEta()) > 2.1) {
482 l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() -
485 if (
abs(l1CaloTower.towerEta()) <= 2.7 &&
abs(l1CaloTower.towerEta()) > 2.4) {
486 l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() -
489 if (
abs(l1CaloTower.towerEta()) <= 3.1 &&
abs(l1CaloTower.towerEta()) > 2.7) {
490 l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() -
496 if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 &&
497 abs(l1CaloTower.towerEta()) < 2.0)
499 if (
abs(l1CaloTower.towerIEta()) <= 3) {
500 l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() -
503 if (
abs(l1CaloTower.towerIEta()) <= 6 &&
abs(l1CaloTower.towerIEta()) >= 4) {
504 l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() -
507 if (
abs(l1CaloTower.towerIEta()) <= 9 &&
abs(l1CaloTower.towerIEta()) >= 7) {
508 l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() -
511 if (
abs(l1CaloTower.towerIEta()) <= 12 &&
abs(l1CaloTower.towerIEta()) >= 10) {
512 l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() -
515 if (
abs(l1CaloTower.towerIEta()) <= 15 &&
abs(l1CaloTower.towerIEta()) >= 13) {
516 l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() -
519 if (
abs(l1CaloTower.towerIEta()) <= 18 &&
abs(l1CaloTower.towerIEta()) >= 16) {
520 l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() -
526 if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) {
527 if (
abs(l1CaloTower.towerEta()) <= 1.8) {
528 l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() -
531 if (
abs(l1CaloTower.towerEta()) <= 2.1 &&
abs(l1CaloTower.towerEta()) > 1.8) {
532 l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() -
535 if (
abs(l1CaloTower.towerEta()) <= 2.4 &&
abs(l1CaloTower.towerEta()) > 2.1) {
536 l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() -
539 if (
abs(l1CaloTower.towerEta()) <= 2.7 &&
abs(l1CaloTower.towerEta()) > 2.4) {
540 l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() -
543 if (
abs(l1CaloTower.towerEta()) <= 3.1 &&
abs(l1CaloTower.towerEta()) > 2.7) {
544 l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() -
550 if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 &&
551 abs(l1CaloTower.towerEta()) > 2.0)
553 if (
abs(l1CaloTower.towerIEta()) <= 33 &&
abs(l1CaloTower.towerIEta()) >= 29) {
554 l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() -
557 if (
abs(l1CaloTower.towerIEta()) <= 37 &&
abs(l1CaloTower.towerIEta()) >= 34) {
558 l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() -
561 if (
abs(l1CaloTower.towerIEta()) <= 41 &&
abs(l1CaloTower.towerIEta()) >= 38) {
562 l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() -
568 if (l1CaloTower.ecalTowerEt() < 0.)
569 l1CaloTower.setEcalTowerEt(0.);
570 if (l1CaloTower.hcalTowerEt() < 0.)
571 l1CaloTower.setHcalTowerEt(0.);
576 iEvent.put(
std::move(L1CaloTowerCalibratedCollection),
"L1CaloTowerCalibratedCollection");
const double puThresholdHGCalEMMin
const double HGCalEmTpEtMin
float ecalTowerEt() const
const double puThresholdHcalMax
const double puThresholdEcalMax
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const double HGCalHadTpEtMin
std::map< std::string, TF1 > nHits_to_nvtx_funcs
std::map< std::string, TF1 > hf_nvtx_to_PU_sub_funcs
const double puThresholdL1eg
const bool skipCalibrations
void setEcalTowerEt(float et)
void setTowerIPhi(int iPhi)
T const * product() const
std::vector< CaloTower > CaloTowerCollection
void setL1egStandaloneIso(int staIso)
const edm::ESGetToken< CaloTPGTranscoder, CaloTPGRecord > decoderTag_
const double puThresholdEcalMin
void setL1egTrkIso(int trkIso)
const edm::EDGetTokenT< l1t::HGCalTowerBxCollection > hgcalTowersToken_
const double puThresholdHFMin
const_iterator begin(int bx) const
std::map< std::string, TF1 > hgcalEM_nvtx_to_PU_sub_funcs
BXVector< HGCalTower > HGCalTowerBxCollection
std::vector< edm::ParameterSet > nHits_to_nvtx_params
void setHcalTowerEt(float et)
void setTowerIEta(int iEta)
L1TowerCalibrator(const edm::ParameterSet &)
void setTowerPhi(float phi)
std::map< std::string, std::map< std::string, TF1 > > all_nvtx_to_PU_sub_funcs
const double puThresholdHGCalEMMax
Abs< T >::type abs(const T &t)
std::map< std::string, TF1 > hcal_nvtx_to_PU_sub_funcs
#define DEFINE_FWK_MODULE(type)
void setL1egTrkSS(int trkSS)
void setIsBarrel(bool isBarrel)
void setTowerEta(float eta)
const edm::EDGetTokenT< l1tp2::CaloTowerCollection > l1TowerToken_
const double puThresholdHcalMin
std::vector< edm::ParameterSet > nvtx_to_PU_sub_params
void produce(edm::Event &, const edm::EventSetup &) override
edm::Handle< l1tp2::CaloTowerCollection > l1CaloTowerHandle
float hcalTowerEt() const
void setL1egTowerEt(float et)
edm::Handle< l1t::HGCalTowerBxCollection > hgcalTowersHandle
std::map< std::string, TF1 > hgcalHad_nvtx_to_PU_sub_funcs
const_iterator end(int bx) const
const double puThresholdHFMax
const double puThresholdHGCalHadMax
const edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalToken_
const double puThresholdHGCalHadMin
edm::Handle< HcalTrigPrimDigiCollection > hcalTowerHandle
std::map< std::string, TF1 > ecal_nvtx_to_PU_sub_funcs
l1t::HGCalTowerBxCollection hgcalTowers
void setL1egStandaloneSS(int staSS)