28 declareInterface<IjFEXPileupAndNoise>(
this);
37 ATH_CHECK(m_jTowerContainerKey.initialize());
41 return StatusCode::SUCCESS;
48 if(! m_jTowerContainer.isValid()) {
49 ATH_MSG_ERROR(
"Could not retrieve jTowerContainer " << m_jTowerContainerKey.key());
50 return StatusCode::FAILURE;
53 return StatusCode::SUCCESS;
59 m_apply_pileup2jets=0;
66 return StatusCode::SUCCESS;
89 ATH_MSG_DEBUG(
"---------------- jFEXPileupAndNoise::setup ----------------");
99 ATH_MSG_DEBUG(
"---------------- jFEXPileupAndNoise::setup ----------------");
116 for(
int ieta=0;ieta<m_etaMAX;ieta++){
121 TTID = m_FPGA_forward[iphi][ieta];
124 TTID = m_FPGA_central[iphi][ieta];
131 const LVL1::jTower *tmpTower = m_jTowerContainer->findTower(TTID);
133 int tmp_eta = getTTowerEta(tmpTower);
136 int em_granularity = 25;
137 int had_granularity = tmp_eta < 15 ? 500 : 25;
139 int tmp_energy_EM = getET_EM(tmpTower)/em_granularity;
140 int tmp_energy_HAD = getET_HAD(tmpTower)/had_granularity;
141 int tmp_EM_AreaINV = getTTAreaINV_EM(tmpTower);
142 int tmp_HD_AreaINV = getTTAreaINV_HAD(tmpTower);
143 m_FPGA_ET_EM[TTID] = getET_EM(tmpTower);
144 m_FPGA_ET_HAD[TTID] = getET_HAD(tmpTower);
154 if(tmp_energy_EM > myDBTool->get_PUThrLowEm() and tmp_energy_EM < myDBTool->get_PUThrHighEm()) {
155 m_rho_EM += tmp_energy_EM;
162 if(tmp_energy_HAD > myDBTool->get_PUThrLowHadTrex() and tmp_energy_HAD < myDBTool->get_PUThrHighHadTrex()){
163 m_rho_HAD1 += tmp_energy_HAD;
168 else if(tmp_eta < 16 ){
169 if(tmp_energy_HAD > myDBTool->get_PUThrLowHadHecOverlap() and tmp_energy_HAD < myDBTool->get_PUThrHighHadHecOverlap()){
170 m_rho_HAD2 += tmp_energy_HAD;
175 else if(tmp_eta < 32 ){
176 if(tmp_energy_HAD > myDBTool->get_PUThrLowHadLar() and tmp_energy_HAD < myDBTool->get_PUThrHighHadLar()){
177 m_rho_HAD3 += tmp_energy_HAD;
182 else if(tmp_eta >= 32){
186 if(tmp_energy_HAD > myDBTool->get_PUThrLowFcal() and tmp_energy_HAD < myDBTool->get_PUThrHighFcal()){
187 m_rho_FCAL += tmp_energy_HAD;
193 if(tmp_energy_EM > myDBTool->get_PUThrLowFcal() and tmp_energy_EM < myDBTool->get_PUThrHighFcal()){
194 m_rho_FCAL += tmp_energy_EM;
212 std::vector<int> rho_values {m_rho_EM*25,m_rho_HAD1*500,m_rho_HAD2*25,m_rho_HAD3*25,m_rho_FCAL*25};
229 for(
int ieta=0; ieta<m_etaMAX; ieta++) {
234 TTID = m_FPGA_forward[iphi][ieta];
237 TTID = m_FPGA_central[iphi][ieta];
240 if(TTID == 0)
continue;
242 const LVL1::jTower *tmpTower = m_jTowerContainer->findTower(TTID);
243 int tmp_eta = getTTowerEta(tmpTower);
244 int tmp_EM_Area = getTTArea_EM(tmpTower);
245 int tmp_HD_Area = getTTArea_HAD(tmpTower);
254 else if(tmp_eta < 16 ) {
257 else if(tmp_eta < 32 ) {
260 else if(tmp_eta >= 32) {
280 return StatusCode::FAILURE;
283 m_apply_pileup2jets = myDBTool->get_doPileUpJet();
284 m_apply_pileup2met = myDBTool->get_doPileUpMet();
286 return StatusCode::SUCCESS;
290 m_apply_noise2jets =
b;
294 m_apply_noise2met =
b;
302 m_map_Etvalues_EM.clear();
306 for(
int ieta=0; ieta<m_etaMAX; ieta++) {
311 TTID = m_FPGA_forward[iphi][ieta];
314 TTID = m_FPGA_central[iphi][ieta];
317 if(TTID == 0)
continue;
318 const LVL1::jTower *tmpTower = m_jTowerContainer->findTower(TTID);
321 std::vector<int> v_energies;
323 v_energies.resize(2,0);
326 int tmp_TotalEt_jet=getET_EM(tmpTower);
327 int tmp_TotalEt_met=getET_EM(tmpTower);
330 if(m_apply_pileup2jets){
331 tmp_TotalEt_jet = m_FPGA_ET_EM[TTID];
335 if(m_apply_pileup2met){
336 tmp_TotalEt_met = m_FPGA_ET_EM[TTID];
339 v_energies[0]=tmp_TotalEt_jet;
340 v_energies[1]=tmp_TotalEt_met;
342 m_map_Etvalues_EM.insert(std::make_pair(TTID, v_energies));
346 if(m_apply_noise2jets || m_apply_noise2met) ApplyNoiseCuts(m_map_Etvalues_EM,0);
348 return m_map_Etvalues_EM;
354 m_map_Etvalues_HAD.clear();
358 for(
int ieta=0; ieta<m_etaMAX; ieta++) {
363 TTID = m_FPGA_forward[iphi][ieta];
366 TTID = m_FPGA_central[iphi][ieta];
369 if(TTID == 0)
continue;
370 const LVL1::jTower *tmpTower = m_jTowerContainer->findTower(TTID);
373 std::vector<int> v_energies;
375 v_energies.resize(2,0);
378 int tmp_TotalEt_jet=getET_HAD(tmpTower);
379 int tmp_TotalEt_met=getET_HAD(tmpTower);
382 if(m_apply_pileup2jets){
383 tmp_TotalEt_jet = m_FPGA_ET_HAD[TTID];
387 if(m_apply_pileup2met){
388 tmp_TotalEt_met = m_FPGA_ET_HAD[TTID];
391 v_energies[0]=tmp_TotalEt_jet;
392 v_energies[1]=tmp_TotalEt_met;
394 m_map_Etvalues_HAD.insert(std::make_pair(TTID, v_energies));
398 if(m_apply_noise2jets || m_apply_noise2met) ApplyNoiseCuts(m_map_Etvalues_HAD,1);
400 return m_map_Etvalues_HAD;
407 for(
auto [
key,
vec] : map_Etvalues){
409 tmpTower = m_jTowerContainer->findTower(
key);
413 if(m_apply_noise2jets && map_Etvalues[
key][0]<=Jet_NoiseCut){
414 map_Etvalues[
key][0]=0.;
416 if(m_apply_noise2met && map_Etvalues[
key][1]<=Met_NoiseCut){
417 map_Etvalues[
key][1]=0.;
427 std::unordered_map<int,std::vector<int> > map_Etvalues;
428 map_Etvalues.clear();
436 std::vector<int> Et_energy;
438 for(
auto [
key,
vec] : m_map_Etvalues_EM){
441 Et_energy.resize(2,0);
443 Et_energy[0]=m_map_Etvalues_EM[
key][0]+m_map_Etvalues_HAD[
key][0];
444 Et_energy[1]=m_map_Etvalues_EM[
key][1]+m_map_Etvalues_HAD[
key][1];
445 map_Etvalues[
key] = Et_energy;
453 return tmpTower->
iEta() < 0 ? std::abs(tmpTower->
iEta()+1) : tmpTower->
iEta() ;