119 : HcalTpEtMin(iConfig.getParameter<double>(
"HcalTpEtMin")),
120 EcalTpEtMin(iConfig.getParameter<double>(
"EcalTpEtMin")),
121 HGCalHadTpEtMin(iConfig.getParameter<double>(
"HGCalHadTpEtMin")),
122 HGCalEmTpEtMin(iConfig.getParameter<double>(
"HGCalEmTpEtMin")),
123 HFTpEtMin(iConfig.getParameter<double>(
"HFTpEtMin")),
124 puThreshold(iConfig.getParameter<double>(
"puThreshold")),
125 puThresholdL1eg(iConfig.getParameter<double>(
"puThresholdL1eg")),
126 puThresholdHcalMin(iConfig.getParameter<double>(
"puThresholdHcalMin")),
127 puThresholdHcalMax(iConfig.getParameter<double>(
"puThresholdHcalMax")),
128 puThresholdEcalMin(iConfig.getParameter<double>(
"puThresholdEcalMin")),
129 puThresholdEcalMax(iConfig.getParameter<double>(
"puThresholdEcalMax")),
130 puThresholdHGCalEMMin(iConfig.getParameter<double>(
"puThresholdHGCalEMMin")),
131 puThresholdHGCalEMMax(iConfig.getParameter<double>(
"puThresholdHGCalEMMax")),
132 puThresholdHGCalHadMin(iConfig.getParameter<double>(
"puThresholdHGCalHadMin")),
133 puThresholdHGCalHadMax(iConfig.getParameter<double>(
"puThresholdHGCalHadMax")),
134 puThresholdHFMin(iConfig.getParameter<double>(
"puThresholdHFMin")),
135 puThresholdHFMax(iConfig.getParameter<double>(
"puThresholdHFMax")),
136 barrelSF(iConfig.getParameter<double>(
"barrelSF")),
137 hgcalSF(iConfig.getParameter<double>(
"hgcalSF")),
138 hfSF(iConfig.getParameter<double>(
"hfSF")),
139 debug(iConfig.getParameter<bool>(
"debug")),
140 skipCalibrations(iConfig.getParameter<bool>(
"skipCalibrations")),
146 nHits_to_nvtx_params(iConfig.getParameter<std::
vector<edm::
ParameterSet> >(
"nHits_to_nvtx_params")),
147 nvtx_to_PU_sub_params(iConfig.getParameter<std::
vector<edm::
ParameterSet> >(
"nvtx_to_PU_sub_params")) {
153 nHits_to_nvtx_funcs[calo.c_str()].SetParameter(0, pset->
getParameter<std::vector<double> >(
"params").at(0));
154 nHits_to_nvtx_funcs[calo.c_str()].SetParameter(1, pset->
getParameter<std::vector<double> >(
"params").at(1));
158 "nHits_to_nvtx_params[%i]\n \
164 nHits_to_nvtx_funcs[calo.c_str()].GetParameter(0),
165 nHits_to_nvtx_funcs[calo.c_str()].GetParameter(1));
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.;
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_iterator end(int bx) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
double puThresholdHcalMin
edm::EDGetTokenT< l1tp2::CaloTowerCollection > l1TowerToken_
std::map< std::string, TF1 > nHits_to_nvtx_funcs
std::map< std::string, TF1 > hf_nvtx_to_PU_sub_funcs
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setEcalTowerEt(float et)
#define DEFINE_FWK_MODULE(type)
float hcalTowerEt() const
void setTowerIPhi(int iPhi)
std::vector< CaloTower > CaloTowerCollection
double puThresholdEcalMin
void setL1egStandaloneIso(int staIso)
EventAuxiliary const & eventAuxiliary() const override
void setL1egTrkIso(int trkIso)
LuminosityBlockNumber_t luminosityBlock() const
std::map< std::string, TF1 > hgcalEM_nvtx_to_PU_sub_funcs
BXVector< HGCalTower > HGCalTowerBxCollection
bool getData(T &iHolder) const
std::vector< edm::ParameterSet > nHits_to_nvtx_params
void setHcalTowerEt(float et)
void setTowerIEta(int iEta)
L1TowerCalibrator(const edm::ParameterSet &)
double puThresholdHGCalEMMin
void setTowerPhi(float phi)
float ecalTowerEt() const
std::map< std::string, std::map< std::string, TF1 > > all_nvtx_to_PU_sub_funcs
edm::EDGetTokenT< l1t::HGCalTowerBxCollection > hgcalTowersToken_
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
Abs< T >::type abs(const T &t)
std::map< std::string, TF1 > hcal_nvtx_to_PU_sub_funcs
void setL1egTrkSS(int trkSS)
void setIsBarrel(bool isBarrel)
double puThresholdHGCalHadMin
void setTowerEta(float eta)
std::vector< edm::ParameterSet > nvtx_to_PU_sub_params
T const * product() const
void produce(edm::Event &, const edm::EventSetup &) override
edm::Handle< l1tp2::CaloTowerCollection > l1CaloTowerHandle
void setL1egTowerEt(float et)
double puThresholdEcalMax
T getParameter(std::string const &) const
edm::Handle< l1t::HGCalTowerBxCollection > hgcalTowersHandle
std::map< std::string, TF1 > hgcalHad_nvtx_to_PU_sub_funcs
double puThresholdHGCalEMMax
double puThresholdHGCalHadMax
double puThresholdHcalMax
edm::Handle< HcalTrigPrimDigiCollection > hcalTowerHandle
std::map< std::string, TF1 > ecal_nvtx_to_PU_sub_funcs
const_iterator begin(int bx) const
edm::ESGetToken< CaloTPGTranscoder, CaloTPGRecord > decoderTag_
l1t::HGCalTowerBxCollection hgcalTowers
void setL1egStandaloneSS(int staSS)
EventNumber_t event() const
edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalToken_