00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "FastSimulation/L1CaloTriggerProducer/interface/FastL1GlobalAlgo.h"
00022 #include "Geometry/Records/interface/CaloGeometryRecord.h"
00023 #include <iostream>
00024 #include <fstream>
00025
00026
00027
00028
00029 FastL1GlobalAlgo::FastL1GlobalAlgo(const edm::ParameterSet& iConfig)
00030 {
00031 m_RMap = FastL1RegionMap::getL1RegionMap();
00032
00033
00034 m_L1Config.DoEMCorr = iConfig.getParameter<bool>("DoEMCorr");
00035 m_L1Config.DoJetCorr = iConfig.getParameter<bool>("DoJetCorr");
00036 m_DoBitInfo = iConfig.getParameter<bool>("DoBitInfo");
00037 m_GctIso = iConfig.getParameter<bool>("GctIso");
00038 m_IsolationEt = iConfig.getParameter<double>("IsolationEt");
00039
00040
00041 m_L1Config.HcalLUT = iConfig.getParameter<edm::FileInPath>("HcalLUT");
00042
00043 m_L1Config.EMSeedEnThreshold = iConfig.getParameter<double>("EMSeedEnThreshold");
00044 m_L1Config.EMActiveLevel = iConfig.getParameter<double>("EMActiveLevel");
00045 m_L1Config.HadActiveLevel = iConfig.getParameter<double>("HadActiveLevel");
00046 m_L1Config.noTauVetoLevel = iConfig.getParameter<double>("noTauVetoLevel");
00047 m_L1Config.hOeThreshold = iConfig.getParameter<double>("hOeThreshold");
00048 m_L1Config.FGEBThreshold = iConfig.getParameter<double>("FGEBThreshold");
00049 m_L1Config.FGEEThreshold = iConfig.getParameter<double>("FGEEThreshold");
00050
00051 m_L1Config.MuonNoiseLevel = iConfig.getParameter<double>("MuonNoiseLevel");
00052 m_L1Config.EMNoiseLevel = iConfig.getParameter<double>("EMNoiseLevel");
00053 m_L1Config.HadNoiseLevel = iConfig.getParameter<double>("HadNoiseLevel");
00054 m_L1Config.QuietRegionThreshold = iConfig.getParameter<double>("QuietRegionThreshold");
00055 m_L1Config.JetSeedEtThreshold = iConfig.getParameter<double>("JetSeedEtThreshold");
00056
00057 m_L1Config.TowerEMLSB = iConfig.getParameter<double>("TowerEMLSB");
00058 m_L1Config.TowerHadLSB = iConfig.getParameter<double>("TowerHadLSB");
00059 m_L1Config.EMLSB = iConfig.getParameter<double>("EMLSB");
00060 m_L1Config.JetLSB = iConfig.getParameter<double>("JetLSB");
00061
00062 m_L1Config.CrystalEBThreshold = iConfig.getParameter<double>("CrystalEBThreshold");
00063 m_L1Config.CrystalEEThreshold = iConfig.getParameter<double>("CrystalEEThreshold");
00064
00065 m_L1Config.TowerEBThreshold = iConfig.getParameter<double>("TowerEBThreshold");
00066 m_L1Config.TowerEEThreshold = iConfig.getParameter<double>("TowerEEThreshold");
00067 m_L1Config.TowerHBThreshold = iConfig.getParameter<double>("TowerHBThreshold");
00068 m_L1Config.TowerHEThreshold = iConfig.getParameter<double>("TowerHEThreshold");
00069
00070 m_L1Config.TowerEBScale = iConfig.getParameter<double>("TowerEBScale");
00071 m_L1Config.TowerEEScale = iConfig.getParameter<double>("TowerEEScale");
00072 m_L1Config.TowerHBScale = iConfig.getParameter<double>("TowerHBScale");
00073 m_L1Config.TowerHEScale = iConfig.getParameter<double>("TowerHEScale");
00074
00075 m_L1Config.noFGThreshold = iConfig.getParameter<double>("noFGThreshold");
00076
00077 m_L1Config.EmInputs = iConfig.getParameter <std::vector<edm::InputTag> >("EmInputs");
00078 m_L1Config.TowerInput = iConfig.getParameter<edm::InputTag>("TowerInput");
00079
00080 m_L1Config.EcalTPInput = iConfig.getParameter<edm::InputTag>("EcalTPInput");
00081 m_L1Config.HcalTPInput = iConfig.getParameter<edm::InputTag>("HcalTPInput");
00082
00083
00084
00085 std::ifstream userfile;
00086 const std::string userfileName = m_L1Config.HcalLUT.fullPath();
00087 userfile.open(userfileName.c_str());
00088 static const int etabound = 32;
00089 static const int tpgmax = 256;
00090 for (int i=0; i<tpgmax; i++) {
00091 for(int j = 1; j <=etabound; j++) {
00092 userfile >> m_hcaluncomp[j][i];
00093
00094 }
00095 }
00096 userfile.close();
00097
00098
00099 }
00100
00101 FastL1GlobalAlgo::~FastL1GlobalAlgo()
00102 {
00103
00104
00105 }
00106
00107
00108
00109
00110
00111
00112
00113 void
00114 FastL1GlobalAlgo::CaloTowersDump(edm::Event const& e) {
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134 edm::Handle<CaloTowerCollection> input;
00135
00136 edm::LogInfo("FastL1GlobalAlgo::CaloTowersDump") << "Start!";
00137 e.getByLabel(m_L1Config.TowerInput,input);
00138
00139 for (CaloTowerCollection::const_iterator j=input->begin(); j!=input->end(); j++) {
00140 edm::LogInfo("FastL1GlobalAlgo::CaloTowersDump") << *j;
00141 }
00142
00143 edm::LogInfo("FastL1GlobalAlgo::CaloTowersDump") << "End!";
00144 }
00145
00146
00147
00148 namespace myspace {
00149 bool
00150
00151 greaterEt( const reco::Candidate& a, const reco::Candidate& b ) {
00152 return (a.et()>b.et());
00153 }
00154 }
00155
00156
00157 void
00158 FastL1GlobalAlgo::findJets() {
00159
00160 m_TauJets.clear();
00161 m_CenJets.clear();
00162 m_ForJets.clear();
00163
00164 for (int i=0; i<396; i++) {
00165
00166
00167 std::pair<double, double> p = m_RMap->getRegionCenterEtaPhi(i);
00168
00169 double eta = p.first;
00170 double phi = p.second;
00171 if (m_DoBitInfo){
00172 m_Regions[i].BitInfo.setEta ( eta);
00173 m_Regions[i].BitInfo.setPhi ( phi);
00174 }
00175
00176 if (m_Regions.at(i).SumEt()>m_L1Config.JetSeedEtThreshold) {
00177 if (isMaxEtRgn_Window33(i)) {
00178
00179 if (m_GctIso == true) {
00180 if (TauIsolation(i) && (i%22)>3 && (i%22)<18 ) {
00181 addJet(i,true);
00182 } else {
00183 addJet(i,false);
00184 }
00185 } else {
00186
00187 if (isTauJet(i) && (i%22)>3 && (i%22)<18 ) {
00188 addJet(i,true);
00189 } else {
00190
00191 addJet(i,false);
00192 }
00193 }
00194
00195
00196 }
00197 else { if (m_DoBitInfo) m_Regions[i].BitInfo.setMaxEt (true);}
00198 } else {
00199 if (m_DoBitInfo) m_Regions[i].BitInfo.setSumEtBelowThres (true);
00200 }
00201
00202 }
00203
00204 }
00205
00206
00207
00208 void
00209 FastL1GlobalAlgo::addJet(int iRgn, bool taubit) {
00210 std::pair<double, double> p = m_RMap->getRegionCenterEtaPhi(iRgn);
00211
00212
00213
00214 double et = m_Regions.at(iRgn).GetJetEt();
00215
00216 double eta = p.first;
00217 double phi = p.second;
00218
00219
00220
00221
00222
00223
00224
00225 if (m_L1Config.DoJetCorr) {
00226 et = GCTEnergyTrunc(corrJetEt(et,eta), m_L1Config.JetLSB, false);
00227 } else {
00228 et = GCTEnergyTrunc(et, m_L1Config.JetLSB, false);
00229 }
00230
00231
00232
00233
00234
00235
00236 double theta = 2.*atan(exp(-eta));
00237 double ex = et*cos(phi);
00238 double ey = et*sin(phi);
00239
00240
00241 double e = ex/sin(theta)/cos(phi);
00242 double ez = e*cos(theta);
00243
00244
00245 if (m_DoBitInfo){
00246 m_Regions[iRgn].BitInfo.setEt ( et);
00247 m_Regions[iRgn].BitInfo.setEnergy ( e);
00248 }
00249
00250
00251 reco::Particle::LorentzVector rp4(ex,ey,ez,e);
00252 l1extra::L1JetParticle tjet(rp4);
00253
00254
00255
00256
00257
00258
00259 if (et>=1.) {
00260 if ((taubit || et>m_L1Config.noTauVetoLevel) && (std::abs(eta)<3.0) ) {
00261 m_TauJets.push_back(tjet);
00262
00263 std::sort(m_TauJets.begin(),m_TauJets.end(), myspace::greaterEt);
00264 } else {
00265
00266 if (m_DoBitInfo) m_Regions[iRgn].BitInfo.setHard ( true);
00267
00268 if (std::abs(eta)<3.0) {
00269 m_CenJets.push_back(tjet);
00270 std::sort(m_CenJets.begin(),m_CenJets.end(), myspace::greaterEt);
00271 } else {
00272 m_ForJets.push_back(tjet);
00273 std::sort(m_ForJets.begin(),m_ForJets.end(), myspace::greaterEt);
00274 }
00275 }
00276 }
00277 else{ if (m_DoBitInfo) m_Regions[iRgn].BitInfo.setSoft ( true);}
00278 }
00279
00280
00281
00282 void
00283 FastL1GlobalAlgo::FillEgammasTP(edm::Event const& e) {
00284 m_Egammas.clear();
00285 m_isoEgammas.clear();
00286
00287 l1extra::L1EmParticle* ph = new l1extra::L1EmParticle();
00288
00289 for (int i=0; i<396; i++) {
00290 CaloTowerCollection towers = m_Regions[i].GetCaloTowers();
00291
00292 for (CaloTowerCollection::const_iterator cnd=towers.begin(); cnd!=towers.end(); cnd++) {
00293 if (cnd->emEt()<0.01 && cnd->hadEt()<0.01) continue;
00294
00295
00296 reco::Particle::LorentzVector rp4(0.,0.,0.,0.);
00297
00298 *ph = l1extra::L1EmParticle(rp4);
00299
00300 CaloTowerDetId cid = cnd->id();
00301
00302
00303 int emTag = isEMCand(cid,ph,e);
00304
00305
00306
00307
00308 if (emTag==1) {
00309 m_Egammas.push_back(*ph);
00310 } else if (emTag==2) {
00311 m_isoEgammas.push_back(*ph);
00312 }
00313
00314 }
00315 std::sort(m_Egammas.begin(),m_Egammas.end(), myspace::greaterEt);
00316 std::sort(m_isoEgammas.begin(),m_isoEgammas.end(), myspace::greaterEt);
00317 }
00318 delete ph;
00319 }
00320
00321
00322
00323 void
00324 FastL1GlobalAlgo::FillEgammas(edm::Event const& e) {
00325 m_Egammas.clear();
00326 m_isoEgammas.clear();
00327
00328
00329
00330 edm::Handle<CaloTowerCollection> input;
00331 e.getByLabel(m_L1Config.TowerInput,input);
00332
00333
00334
00335
00336
00337 l1extra::L1EmParticle* ph = new l1extra::L1EmParticle();
00338
00339
00340 for (CaloTowerCollection::const_iterator cnd=input->begin(); cnd!=input->end(); cnd++) {
00341 reco::Particle::LorentzVector rp4(0.,0.,0.,0.);
00342
00343 *ph = l1extra::L1EmParticle(rp4);
00344
00345 CaloTowerDetId cid = cnd->id();
00346
00347 int emTag = isEMCand(cid,ph,e);
00348
00349
00350 if (emTag==1) {
00351 m_Egammas.push_back(*ph);
00352 } else if (emTag==2) {
00353 m_isoEgammas.push_back(*ph);
00354 }
00355
00356 }
00357
00358
00359 std::sort(m_Egammas.begin(),m_Egammas.end(), myspace::greaterEt);
00360 std::sort(m_isoEgammas.begin(),m_isoEgammas.end(), myspace::greaterEt);
00361
00362 delete ph;
00363 }
00364
00365
00366 void
00367 FastL1GlobalAlgo::FillMET(edm::Event const& e) {
00368
00369
00370
00371
00372 edm::Handle<CaloTowerCollection> input;
00373 e.getByLabel(m_L1Config.TowerInput,input);
00374
00375 double sum_hade = 0.0;
00376 double sum_hadet = 0.0;
00377 double sum_hadex = 0.0;
00378 double sum_hadey = 0.0;
00379 double sum_hadez = 0.0;
00380 double sum_e = 0.0;
00381 double sum_et = 0.0;
00382 double sum_ex = 0.0;
00383 double sum_ey = 0.0;
00384 double sum_ez = 0.0;
00385
00386
00387
00388
00389
00390
00391
00392 for (CaloTowerCollection::const_iterator candidate=input->begin(); candidate!=input->end(); candidate++) {
00393
00394
00395 double eme = candidate->emEt();
00396 double hade = candidate->hadEt();
00397
00398 double EThres = 0.;
00399 double HThres = 0.;
00400 double EBthres = m_L1Config.TowerEBThreshold;
00401 double HBthres = m_L1Config.TowerHBThreshold;
00402 double EEthres = m_L1Config.TowerEBThreshold;
00403 double HEthres = m_L1Config.TowerEEThreshold;
00404
00405
00406 if(std::abs(candidate->eta())<2.322) {
00407 EThres = EBthres;
00408 } else {
00409 EThres = EEthres;
00410 }
00411
00412 if(std::abs(candidate->eta())<2.322) {
00413 HThres = HBthres;
00414 } else {
00415 HThres = HEthres;
00416 }
00417
00418
00419 double emScale = 1.0;
00420 double hadScale = 1.0;
00421 if (std::abs(candidate->eta()>1.3050) && std::abs(candidate->eta())<3.0) {
00422 hadScale = m_L1Config.TowerHEScale;
00423 emScale = m_L1Config.TowerEEScale;
00424 }
00425 if (std::abs(candidate->eta()<1.3050)) {
00426 hadScale = m_L1Config.TowerHBScale;
00427 emScale = m_L1Config.TowerEBScale;
00428 }
00429 eme *= emScale;
00430 hade *= hadScale;
00431
00432 if (eme>=EThres || hade>=HThres) {
00433 double phi = candidate->phi();
00434 double eta = candidate->eta();
00435
00436
00437 double theta = 2.*atan(exp(-eta));
00438 double et = 0.;
00439 double e = 0.;
00440 double had_et = 0.;
00441 double had_e = 0.;
00442
00443 if (eme>=EThres) {
00444 et += candidate->emEt();
00445 e += candidate->emEnergy();
00446 }
00447 if (hade>=HThres) {
00448 et += candidate->hadEt();
00449 e += candidate->hadEnergy();
00450 had_et += candidate->hadEt();
00451 had_e += candidate->hadEnergy();
00452 }
00453
00454
00455 sum_et += RCTEnergyTrunc(et,1.0,1024);
00456 sum_ex += et*cos(phi);
00457 sum_ey += et*sin(phi);
00458
00459
00460
00461 sum_e += et/sin(theta);
00462 sum_ez += et*cos(theta)/sin(theta);
00463
00464 sum_hadet += had_et;
00465 sum_hadex += had_et*cos(phi);
00466 sum_hadey += had_et*sin(phi);
00467
00468
00469
00470 sum_hade += had_et/sin(theta);
00471 sum_hadez += had_et*cos(theta)/sin(theta);
00472 }
00473 }
00474
00475
00476 reco::Particle::LorentzVector rp4(-sum_ex,-sum_ey,0.,std::sqrt(sum_ex*sum_ex + sum_ey*sum_ey));
00477 m_MET = l1extra::L1EtMissParticle(rp4,sum_et,0.);
00478
00479 }
00480
00481
00482 void
00483 FastL1GlobalAlgo::FillMET() {
00484
00485
00486
00487 double sum_et = 0.0;
00488 double sum_ex = 0.0;
00489 double sum_ey = 0.0;
00490
00491
00492 for (int i=0; i<396; i++) {
00493 std::pair<double, double> etaphi = m_RMap->getRegionCenterEtaPhi(i);
00494 double phi = etaphi.second;
00495
00496
00497
00498 double et = m_Regions[i].SumEt();
00499
00500
00501
00502
00503
00504
00505
00506 sum_ex += et*cos(phi);
00507 sum_ey += et*sin(phi);
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517 }
00518
00519
00520 sum_et = std::sqrt(sum_ex*sum_ex + sum_ey*sum_ey);
00521
00522
00523 reco::Particle::LorentzVector rp4(-sum_ex,-sum_ey,0.,std::sqrt(sum_ex*sum_ex + sum_ey*sum_ey));
00524
00525 m_MET = l1extra::L1EtMissParticle(rp4,sum_et,0.);
00526
00527
00528 }
00529
00530 void
00531 FastL1GlobalAlgo::InitL1Regions()
00532 {
00533 m_Regions.clear();
00534 m_Regions = std::vector<FastL1Region>(396);
00535
00536
00537 for (int i=0; i<396; i++) {
00538 m_Regions[i].SetParameters(m_L1Config);
00539
00540
00541
00542
00543
00544
00545 std::pair<int, int> p = m_RMap->getRegionEtaPhiIndex(i);
00546 m_Regions[i].SetEtaPhiIndex(p.first,p.second,i);
00547 CaloTower c;
00548
00549 for (int twrid=0; twrid<16; twrid++) {
00550 m_Regions[i].FillTowerZero(c,twrid);
00551 }
00552 }
00553 }
00554
00555
00556 void
00557 FastL1GlobalAlgo::FillL1RegionsTP(edm::Event const& e, const edm::EventSetup& s)
00558 {
00559
00560
00561
00562
00563 InitL1Regions();
00564
00565 edm::Handle<EcalTrigPrimDigiCollection> ETPinput;
00566 e.getByLabel(m_L1Config.EcalTPInput,ETPinput);
00567
00568 edm::Handle<HcalTrigPrimDigiCollection> HTPinput;
00569 e.getByLabel(m_L1Config.HcalTPInput,HTPinput);
00570
00571
00572 int hEtV[396][16] = {0};
00573 int hFGV[396][16] = {0};
00574 int hiEtaV[396][16] = {0};
00575 int hiPhiV[396][16] = {0};
00576 for (HcalTrigPrimDigiCollection::const_iterator hTP=HTPinput->begin();
00577 hTP!=HTPinput->end(); hTP++) {
00578
00579
00580
00581
00582
00583
00584
00585
00586 int rgnid = 999;
00587 int twrid = 999;
00588
00589 int hiphi = hTP->id().iphi();
00590 int hieta = hTP->id().ieta();
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601 rgnid = m_RMap->getRegionIndex(hieta,hiphi);
00602 twrid = m_RMap->getRegionTowerIndex(hieta,hiphi);
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617 if(rgnid < 396 && twrid < 16){
00618 hEtV[rgnid][twrid] = (int)hTP->SOI_compressedEt();
00619 hFGV[rgnid][twrid] = (int)hTP->SOI_fineGrain();
00620 hiEtaV[rgnid][twrid] = hieta;
00621 hiPhiV[rgnid][twrid] = hiphi;
00622 }
00623 }
00624
00625
00626 int emEtV[396][16] = {0};
00627 int emFGV[396][16] = {0};
00628 int emiEtaV[396][16] = {0};
00629 int emiPhiV[396][16] = {0};
00630
00631 for (EcalTrigPrimDigiCollection::const_iterator eTP=ETPinput->begin();
00632 eTP!=ETPinput->end(); eTP++) {
00633
00634 int eieta = eTP->id().ieta();
00635
00636 if(abs(eieta)> 28) continue;
00637 else{
00638 int eiphi = eTP->id().iphi();
00639
00640
00641 int rgnid = 999;
00642 int twrid = 999;
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664 if(rgnid < 396 && twrid < 16){
00665 emEtV[rgnid][twrid] = (int)eTP->compressedEt();
00666 emFGV[rgnid][twrid] = (int)eTP->fineGrain();
00667 emiEtaV[rgnid][twrid] = eieta;
00668 emiPhiV[rgnid][twrid] = eiphi;
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684 }
00685 }
00686 }
00687
00688
00689 for (int i=0; i<396; i++) {
00690 for (int j=0; j<16; j++) {
00691
00692
00693
00694
00695
00696
00697 if (emEtV[i][j]>0 || hEtV[i][j]>0) {
00698
00699
00700 std::pair<double, double> etaphi
00701 = m_RMap->getRegionCenterEtaPhi(i);
00702 double eta = etaphi.first;
00703 double phi = etaphi.second;
00704
00705
00706 double emEt = ((double) emEtV[i][j]) * m_L1Config.EMLSB;
00707
00708 int iAbsTwrEta = std::abs(hiEtaV[i][j]);
00709
00710 double hadEt = ((double )hcaletValue(iAbsTwrEta, hEtV[i][j]));
00711
00712
00713 if (m_L1Config.DoEMCorr) {
00714
00715 emEt = corrEmEt(emEt,std::abs(emiEtaV[i][j]));
00716 }
00717
00718 double et = emEt + hadEt;
00719
00720
00721
00722
00723
00724 math::PtEtaPhiMLorentzVector lvec(et,eta,phi,0.);
00725
00726 CaloTowerDetId towerDetId;
00727 if (emEtV[i][j]>0)
00728 towerDetId = CaloTowerDetId(emiEtaV[i][j],emiPhiV[i][j]);
00729 else
00730 towerDetId = CaloTowerDetId(hiEtaV[i][j],hiPhiV[i][j]);
00731
00732
00733
00734
00735
00736
00737
00738 GlobalPoint emPosition,hadPosition;
00739 double theta = 2.*atan(exp(-eta));
00740 CaloTower t = CaloTower(towerDetId,emEt/sin(theta),hadEt/sin(theta),
00741 0.,0,0,lvec,emPosition,hadPosition);
00742
00743
00744 m_Regions[i].FillTower_Scaled(t,j,true);
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759 if (emEt > 3.0 && emEt < m_L1Config.noFGThreshold && (int)emFGV[i][j]!=0)
00760 m_Regions[i].SetFGBit(j,true);
00761 else
00762 m_Regions[i].SetFGBit(j,false);
00763
00764 if (emEt > 3.0){
00765 if (emEt < 60. && hadEt/emEt > m_L1Config.hOeThreshold)
00766 m_Regions[i].SetHOEBit(j,true);
00767 else
00768 m_Regions[i].SetHOEBit(j,false);
00769 }
00770 else
00771 m_Regions[i].SetHOEBit(j,false);
00772
00773 m_Regions[i].SetRegionBits(e, m_DoBitInfo);
00774 }
00775
00776
00777 }
00778 }
00779
00780
00781
00782
00783
00784
00785 }
00786
00787
00788 void
00789 FastL1GlobalAlgo::FillL1Regions(edm::Event const& e, const edm::EventSetup& c)
00790 {
00791 InitL1Regions();
00792
00793 edm::Handle<CaloTowerCollection> input;
00794 e.getByLabel(m_L1Config.TowerInput,input);
00795
00796 edm::ESHandle<CaloTowerConstituentsMap> cttopo;
00797 c.get<IdealGeometryRecord>().get(cttopo);
00798 const CaloTowerConstituentsMap* theTowerConstituentsMap = cttopo.product();
00799
00800 edm::ESHandle<CaloTopology> calotopo;
00801 c.get<CaloTopologyRecord>().get(calotopo);
00802
00803 edm::ESHandle<CaloGeometry> cGeom;
00804 c.get<CaloGeometryRecord>().get(cGeom);
00805
00806 edm::Handle<EcalRecHitCollection> ec1;
00807 e.getByLabel(m_L1Config.EmInputs.at(1),ec1);
00808
00809 edm::Handle<EcalRecHitCollection> ec0;
00810 e.getByLabel(m_L1Config.EmInputs.at(0),ec0);
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827 for (CaloTowerCollection::const_iterator cnd=input->begin(); cnd!=input->end(); cnd++) {
00828
00829 CaloTowerDetId cid = cnd->id();
00830 std::pair<int, int> pep = m_RMap->getRegionEtaPhiIndex(cid);
00831
00832
00833
00834
00835
00836
00837
00838
00839 int rgnid = 999;
00840 int twrid = 999;
00841
00842
00843
00844 if (std::abs(pep.first)<=22) {
00845 rgnid = pep.second*22 + pep.first;
00846 twrid = m_RMap->getRegionTowerIndex(cid);
00847
00848 }
00849
00850 if (rgnid<396 && twrid<16) {
00851 m_Regions[rgnid].FillTower_Scaled(*cnd,twrid);
00852 m_Regions[rgnid].SetRegionBits(e, m_DoBitInfo);
00853 } else {
00854
00855 }
00856
00857 }
00858
00859
00860
00861
00862 for (int i=0; i<396; i++) {
00863
00864
00865 m_Regions[i].FillEMCrystals(theTowerConstituentsMap,
00866 &(*calotopo),
00867 &(*cGeom),
00868 &(*ec0), &(*ec1),
00869 m_RMap);
00870
00871 }
00872
00873
00874
00875 }
00876
00877
00878
00879 void
00880 FastL1GlobalAlgo::FillBitInfos() {
00881 if (m_DoBitInfo){
00882 m_BitInfos.clear();
00883 for (int i=0; i<396; i++) {
00884 m_BitInfos.push_back(m_Regions[i].getBitInfo());
00885 }
00886 }
00887 }
00888
00889
00890 bool
00891 FastL1GlobalAlgo::isTauJet(int cRgn) {
00892
00893
00894 if ((cRgn%22)<4 || (cRgn%22)>17)
00895 return false;
00896
00897 int shower_shape = 0;
00898 int et_isolation = 0;
00899
00900 if (m_Regions[cRgn].GetTauBit())
00901 if (!m_DoBitInfo)
00902 return false;
00903
00904 int nwid = m_Regions[cRgn].GetNWId();
00905 int nid = m_Regions[cRgn].GetNorthId();
00906 int neid = m_Regions[cRgn].GetNEId();
00907 int wid = m_Regions[cRgn].GetWestId();
00908 int eid = m_Regions[cRgn].GetEastId();
00909 int swid = m_Regions[cRgn].GetSWId();
00910 int sid = m_Regions[cRgn].GetSouthId();
00911 int seid = m_Regions[cRgn].GetSEId();
00912
00913 if (!m_DoBitInfo)
00914 if (m_Regions[cRgn].GetTauBit()) shower_shape = 1;
00915
00916
00917
00918 if((cRgn%22)==4 || (cRgn%22)==17 ) {
00919
00920 if ((cRgn%22)==4) {
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930 if (
00931 m_Regions[nid].GetTauBit() ||
00932 m_Regions[neid].GetTauBit() ||
00933 m_Regions[eid].GetTauBit() ||
00934 m_Regions[seid].GetTauBit() ||
00935 m_Regions[sid].GetTauBit() ||
00936 m_Regions[cRgn].GetTauBit()
00937 )
00938 {
00939 if (!m_DoBitInfo) return false;
00940 }
00941 else {
00942 if (!m_DoBitInfo) return true;
00943 }
00944
00945 if (m_DoBitInfo) m_Regions[cRgn].BitInfo.setIsolationVeto ( true);
00946 et_isolation = 1;
00947 } else { et_isolation = 2;}
00948
00949
00950 if ((cRgn%22)==17) {
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960 if (
00961 m_Regions[nid].GetTauBit() ||
00962 m_Regions[nwid].GetTauBit() ||
00963 m_Regions[wid].GetTauBit() ||
00964 m_Regions[swid].GetTauBit() ||
00965 m_Regions[sid].GetTauBit() ||
00966 m_Regions[cRgn].GetTauBit()
00967 )
00968 {
00969 if (!m_DoBitInfo) return false;
00970 }
00971 else {
00972 if (!m_DoBitInfo) return true;
00973 }
00974
00975 } else { et_isolation = 2; }
00976
00977
00978
00979 if (et_isolation == 1 || shower_shape == 1 ) return false;
00980 if (et_isolation == 2 && shower_shape == 0) return true;
00981 }
00982
00983 if ( (cRgn%22)>4 && (cRgn%22)<17){
00984 if (nwid==999 || neid==999 || nid==999 || swid==999 || seid==999 || sid==999 || wid==999 ||
00985 eid==999 ) {
00986 return false;
00987 }
00988
00989 if (
00990 m_Regions[nwid].GetTauBit() ||
00991 m_Regions[nid].GetTauBit() ||
00992 m_Regions[neid].GetTauBit() ||
00993 m_Regions[wid].GetTauBit() ||
00994 m_Regions[eid].GetTauBit() ||
00995 m_Regions[swid].GetTauBit() ||
00996 m_Regions[seid].GetTauBit() ||
00997 m_Regions[sid].GetTauBit() ||
00998 m_Regions[cRgn].GetTauBit()
00999 )
01000 {
01001 if (m_DoBitInfo) m_Regions[cRgn].BitInfo.setIsolationVeto(true);
01002 et_isolation = 1;
01003 if (!m_DoBitInfo) return false;
01004 } else {
01005 et_isolation = 2;
01006 if (!m_DoBitInfo) return true;
01007 }
01008
01009 if (et_isolation == 1 || shower_shape == 1) return false;
01010 if (et_isolation == 2 && shower_shape == 0) return true;
01011 }
01012
01013 return true;
01014 }
01015
01016
01017
01018 int
01019 FastL1GlobalAlgo::isEMCand(CaloTowerDetId cid, l1extra::L1EmParticle* ph,const edm::Event& iEvent) {
01020
01021
01022 int crgn = m_RMap->getRegionIndex(cid);
01023 int ctwr = m_RMap->getRegionTowerIndex(cid);
01024
01025
01026 if ((crgn%22)<4 || (crgn%22)>17) return 0;
01027 if (crgn>395 || crgn < 0 || ctwr > 15 || ctwr < 0) return 0;
01028
01029 CaloTowerCollection c = m_Regions.at(crgn).GetCaloTowers();
01030 double cenEt = c[ctwr].et();
01031
01032
01033
01034
01035 std::pair<double, double> crpos = m_RMap->getRegionCenterEtaPhi(crgn);
01036
01037
01038 double cenEta = crpos.first;
01039 double cenPhi = crpos.second;
01040
01041 double cenFGbit = m_Regions.at(crgn).GetFGBit(ctwr);
01042 double cenHOEbit = m_Regions.at(crgn).GetHOEBit(ctwr);
01043
01044 if (cenEt<m_L1Config.TowerEBThreshold) return 0;
01045
01046
01047 if (cenFGbit) return 0;
01048
01049
01050 if (cenHOEbit) return 0;
01051
01052
01053 std::pair<int, int> no = m_RMap->GetTowerNorthEtaPhi(cid.ieta(),cid.iphi());
01054 std::pair<int, int> so = m_RMap->GetTowerSouthEtaPhi(cid.ieta(),cid.iphi());
01055 std::pair<int, int> we = m_RMap->GetTowerWestEtaPhi(cid.ieta(),cid.iphi());
01056 std::pair<int, int> ea = m_RMap->GetTowerEastEtaPhi(cid.ieta(),cid.iphi());
01057 std::pair<int, int> nw = m_RMap->GetTowerNWEtaPhi(cid.ieta(),cid.iphi());
01058 std::pair<int, int> ne = m_RMap->GetTowerNEEtaPhi(cid.ieta(),cid.iphi());
01059 std::pair<int, int> sw = m_RMap->GetTowerSWEtaPhi(cid.ieta(),cid.iphi());
01060 std::pair<int, int> se = m_RMap->GetTowerSEEtaPhi(cid.ieta(),cid.iphi());
01061 if (no.first>29 || no.first<-29 || no.second>72 || no.second<0) return 0;
01062 if (so.first>29 || so.first<-29 || so.second>72 || so.second<0) return 0;
01063 if (we.first>29 || we.first<-29 || we.second>72 || we.second<0) return 0;
01064 if (ea.first>29 || ea.first<-29 || ea.second>72 || ea.second<0) return 0;
01065 if (nw.first>29 || nw.first<-29 || nw.second>72 || nw.second<0) return 0;
01066 if (ne.first>29 || ne.first<-29 || ne.second>72 || ne.second<0) return 0;
01067 if (sw.first>29 || sw.first<-29 || sw.second>72 || sw.second<0) return 0;
01068 if (se.first>29 || se.first<-29 || se.second>72 || se.second<0) return 0;
01069
01070 int notwr = m_RMap->getRegionTowerIndex(no);
01071 int norgn = m_RMap->getRegionIndex(no.first,no.second);
01072 int sotwr = m_RMap->getRegionTowerIndex(so);
01073 int sorgn = m_RMap->getRegionIndex(so.first,so.second);
01074 int wetwr = m_RMap->getRegionTowerIndex(we);
01075 int wergn = m_RMap->getRegionIndex(we.first,we.second);
01076 int eatwr = m_RMap->getRegionTowerIndex(ea);
01077 int eargn = m_RMap->getRegionIndex(ea.first,ea.second);
01078 int setwr = m_RMap->getRegionTowerIndex(se);
01079 int sergn = m_RMap->getRegionIndex(se.first,sw.second);
01080 int swtwr = m_RMap->getRegionTowerIndex(sw);
01081 int swrgn = m_RMap->getRegionIndex(sw.first,sw.second);
01082 int netwr = m_RMap->getRegionTowerIndex(ne);
01083 int nergn = m_RMap->getRegionIndex(ne.first,ne.second);
01084 int nwtwr = m_RMap->getRegionTowerIndex(nw);
01085 int nwrgn = m_RMap->getRegionIndex(nw.first,nw.second);
01086
01087
01088 if (norgn>395 || norgn < 0 || notwr > 15 || notwr < 0) return 0;
01089 c = m_Regions[norgn].GetCaloTowers();
01090 double noEt = c[notwr].et();
01091
01092
01093
01094 bool noFGbit = m_Regions[norgn].GetFGBit(notwr);
01095
01096 bool noHOEbit = m_Regions[norgn].GetHOEBit(notwr);
01097
01098
01099 if (sorgn>395 || sorgn < 0 || sotwr > 15 || sotwr < 0) return 0;
01100 c = m_Regions[sorgn].GetCaloTowers();
01101 double soEt = c[sotwr].et();
01102
01103
01104
01105 bool soFGbit = m_Regions[sorgn].GetFGBit(sotwr);
01106
01107 bool soHOEbit = m_Regions[sorgn].GetHOEBit(sotwr);
01108
01109
01110 if (wergn>395 || wergn < 0 || wetwr > 15 || wetwr < 0) return 0;
01111 c = m_Regions[wergn].GetCaloTowers();
01112 double weEt = c[wetwr].et();
01113
01114
01115
01116 bool weFGbit = m_Regions[wergn].GetFGBit(wetwr);
01117
01118 bool weHOEbit = m_Regions[wergn].GetHOEBit(wetwr);
01119
01120
01121 if (eargn>395 || eargn < 0 || eatwr > 15 || eatwr < 0) return 0;
01122 c = m_Regions[eargn].GetCaloTowers();
01123 double eaEt = c[eatwr].et();
01124
01125
01126
01127 bool eaFGbit = m_Regions[eargn].GetFGBit(eatwr);
01128
01129 bool eaHOEbit = m_Regions[eargn].GetHOEBit(eatwr);
01130
01131
01132 if (nwrgn>395 || nwrgn < 0 || nwtwr > 15 || nwtwr < 0) return 0;
01133 c = m_Regions[nwrgn].GetCaloTowers();
01134 double nwEt = c[nwtwr].et();
01135
01136
01137
01138 bool nwFGbit = m_Regions[nwrgn].GetFGBit(nwtwr);
01139
01140 bool nwHOEbit = m_Regions[nwrgn].GetHOEBit(nwtwr);
01141
01142
01143 if (nergn>395 || nergn < 0 || netwr > 15 || netwr < 0) return 0;
01144 c = m_Regions[nergn].GetCaloTowers();
01145 double neEt = c[netwr].et();
01146
01147
01148
01149 bool neFGbit = m_Regions[nergn].GetFGBit(netwr);
01150
01151 bool neHOEbit = m_Regions[nergn].GetHOEBit(netwr);
01152
01153
01154 if (swrgn>395 || swrgn < 0 || swtwr > 15 || swtwr < 0) return 0;
01155 c = m_Regions[swrgn].GetCaloTowers();
01156 double swEt = c[swtwr].et();
01157
01158
01159
01160 bool swFGbit = m_Regions[swrgn].GetFGBit(swtwr);
01161
01162 bool swHOEbit = m_Regions[swrgn].GetHOEBit(swtwr);
01163
01164
01165 if (sergn>395 || sergn < 0 || setwr > 15 || setwr < 0) return 0;
01166 c = m_Regions[sergn].GetCaloTowers();
01167 double seEt = c[setwr].et();
01168
01169
01170
01171 bool seFGbit = m_Regions[sergn].GetFGBit(setwr);
01172
01173 bool seHOEbit = m_Regions[sergn].GetHOEBit(setwr);
01174
01175
01176
01177 bool isHit = false;
01178 if ( cenEt > noEt && cenEt >= soEt && cenEt > weEt &&
01179 cenEt >= eaEt && cenEt > nwEt && cenEt > neEt &&
01180 cenEt >= swEt && cenEt >= seEt ) isHit = true;
01181 else
01182 return 0;
01183
01184
01185 double hitEt = cenEt;
01186
01187 double maxEt = std::max(noEt,std::max(soEt,std::max(weEt,eaEt)));
01188
01189
01190
01191 float emEtThres = m_L1Config.EMSeedEnThreshold;
01192
01193
01194
01195
01196 double emet = (hitEt+maxEt);
01197
01198
01199
01200
01201
01202
01203
01204
01205
01206 emet = GCTEnergyTrunc(emet,m_L1Config.EMLSB, true);
01207
01208 if ((emet)<emEtThres) return 0;
01209
01210 double emtheta = 2.*atan(exp(-cenEta));
01211
01212 double emex = emet*cos(cenPhi);
01213 double emey = emet*sin(cenPhi);
01214
01215
01216 double eme = emex/sin(emtheta)/cos(cenPhi);
01217 double emez = eme*cos(emtheta);
01218
01219
01220 reco::Particle::LorentzVector rp4(emex,emey,emez,eme);
01221
01222
01223
01224 *ph = l1extra::L1EmParticle(rp4);
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01236
01237 if (noFGbit || soFGbit || weFGbit || eaFGbit ||
01238 nwFGbit || neFGbit || swFGbit || seFGbit ||
01239 noHOEbit || soHOEbit || weHOEbit || eaHOEbit ||
01240 nwHOEbit || neHOEbit || swHOEbit || seHOEbit)
01241 return 1;
01242
01243
01244
01245
01246 double quietThres = m_L1Config.QuietRegionThreshold;
01247 bool isoVeto1 = false,isoVeto2 = false,isoVeto3 = false,isoVeto4 = false;
01248 if (swEt>quietThres || weEt>quietThres || nwEt>quietThres || noEt>quietThres || neEt>quietThres ) {
01249
01250 isoVeto1 = true;
01251 }
01252 if (neEt>quietThres || eaEt>quietThres || seEt>quietThres || soEt>quietThres || swEt>quietThres ) {
01253
01254 isoVeto2 = true;
01255 }
01256 if (nwEt>quietThres || noEt>quietThres || neEt>quietThres || eaEt>quietThres || seEt>quietThres ) {
01257
01258 isoVeto3 = true;
01259 }
01260 if (seEt>quietThres || soEt>quietThres || swEt>quietThres || weEt>quietThres || nwEt>quietThres ) {
01261
01262 isoVeto4 = true;
01263 }
01264 if (isoVeto1 && isoVeto2 && isoVeto3 && isoVeto4)
01265 return 1;
01266
01267 return 2;
01268 }
01269
01270
01271
01272 bool
01273 FastL1GlobalAlgo::isMaxEtRgn_Window33(int crgn) {
01274
01275 int nwid = m_Regions.at(crgn).GetNWId();
01276 int nid = m_Regions.at(crgn).GetNorthId();
01277 int neid = m_Regions.at(crgn).GetNEId();
01278 int wid = m_Regions.at(crgn).GetWestId();
01279 int eid = m_Regions.at(crgn).GetEastId();
01280 int swid = m_Regions.at(crgn).GetSWId();
01281 int sid = m_Regions.at(crgn).GetSouthId();
01282 int seid = m_Regions.at(crgn).GetSEId();
01283
01284
01285
01286
01287 if ((crgn%22)==21) {
01288
01289 if (nwid==999 || nid==999 || swid==999 || sid==999 || wid==999 ) {
01290 return false;
01291 }
01292
01293 double cenet = m_Regions.at(crgn).SumEt();
01294 double nwet = m_Regions[nwid].SumEt();
01295 double noet = m_Regions[nid].SumEt();
01296 double weet = m_Regions[wid].SumEt();
01297 double swet = m_Regions[swid].SumEt();
01298 double soet = m_Regions[sid].SumEt();
01299
01300 if ( cenet > nwet && cenet > noet &&
01301 cenet >= weet && cenet >= soet &&
01302 cenet >= swet )
01303 {
01304
01305 double cene = m_Regions.at(crgn).SumE();
01306 double nwe = m_Regions[nwid].SumE();
01307 double noe = m_Regions[nid].SumE();
01308 double wee = m_Regions[wid].SumE();
01309 double swe = m_Regions[swid].SumE();
01310 double soe = m_Regions[sid].SumE();
01311
01312
01313
01314 double jE = cene + nwe + noe + wee + swe + soe;
01315 double jEt = cenet + nwet + noet + weet + swet + soet;
01316
01317
01318 m_Regions.at(crgn).SetJetE(jE);
01319 m_Regions.at(crgn).SetJetEt(jEt);
01320
01321 m_Regions.at(crgn).SetJetE3x3(cene);
01322 m_Regions.at(crgn).SetJetEt3x3(cenet);
01323
01324 return true;
01325 } else { return false; }
01326
01327 }
01328
01329
01330
01331 if ((crgn%22)==0) {
01332
01333 if (neid==999 || nid==999 || seid==999 || sid==999 || eid==999 ) {
01334 return false;
01335 }
01336
01337 double cenet = m_Regions.at(crgn).SumEt();
01338 double neet = m_Regions[neid].SumEt();
01339 double noet = m_Regions[nid].SumEt();
01340 double eaet = m_Regions[eid].SumEt();
01341 double seet = m_Regions[seid].SumEt();
01342 double soet = m_Regions[sid].SumEt();
01343
01344 if ( cenet > neet && cenet > noet &&
01345 cenet >= eaet && cenet >= soet &&
01346 cenet >= seet )
01347 {
01348
01349 double cene = m_Regions.at(crgn).SumE();
01350 double nee = m_Regions[neid].SumE();
01351 double noe = m_Regions[nid].SumE();
01352 double eae = m_Regions[eid].SumE();
01353 double see = m_Regions[seid].SumE();
01354 double soe = m_Regions[sid].SumE();
01355
01356
01357
01358 double jE = cene + nee + noe + eae + see + soe;
01359 double jEt = cenet + neet + noet + eaet + seet + soet;
01360
01361 m_Regions.at(crgn).SetJetE(jE);
01362 m_Regions.at(crgn).SetJetEt(jEt);
01363
01364 m_Regions.at(crgn).SetJetE3x3(cene);
01365 m_Regions.at(crgn).SetJetEt3x3(cenet);
01366
01367 return true;
01368 } else { return false; }
01369
01370 }
01371
01372
01373 if (nwid==999 || neid==999 || nid==999 || swid==999 || seid==999 || sid==999 || wid==999 ||
01374 eid==999 ) {
01375
01376
01377
01378
01379 return false;
01380 }
01381
01382 double cenet = m_Regions.at(crgn).SumEt();
01383 double nwet = m_Regions[nwid].SumEt();
01384 double noet = m_Regions[nid].SumEt();
01385 double neet = m_Regions[neid].SumEt();
01386 double weet = m_Regions[wid].SumEt();
01387 double eaet = m_Regions[eid].SumEt();
01388 double swet = m_Regions[swid].SumEt();
01389 double soet = m_Regions[sid].SumEt();
01390 double seet = m_Regions[seid].SumEt();
01391
01392 if ( cenet > nwet && cenet > noet &&
01393 cenet > neet && cenet >= eaet &&
01394 cenet > weet && cenet >= soet &&
01395 cenet >= swet && cenet >= seet )
01396 {
01397
01398 double cene = m_Regions.at(crgn).SumE();
01399 double nwe = m_Regions[nwid].SumE();
01400 double noe = m_Regions[nid].SumE();
01401 double nee = m_Regions[neid].SumE();
01402 double wee = m_Regions[wid].SumE();
01403 double eae = m_Regions[eid].SumE();
01404 double swe = m_Regions[swid].SumE();
01405 double soe = m_Regions[sid].SumE();
01406 double see = m_Regions[seid].SumE();
01407
01408
01409
01410 double jE = cene + nwe + noe + nee + wee + eae + swe + soe + see;
01411 double jEt = cenet + nwet + noet + neet + weet + eaet + swet + soet + seet;
01412
01413
01414 m_Regions.at(crgn).SetJetE(jE);
01415 m_Regions.at(crgn).SetJetEt(jEt);
01416
01417 m_Regions.at(crgn).SetJetE3x3(cene);
01418 m_Regions.at(crgn).SetJetEt3x3(cenet);
01419
01420 return true;
01421 } else { return false; }
01422
01423 }
01424
01425
01426 void
01427 FastL1GlobalAlgo::checkMapping() {
01428
01429
01430 for (int j=1;j<=72;j++) {
01431 for (int i=-28; i<=28; i++) {
01432 if (i==0) continue;
01433 int iRgn = m_RMap->getRegionIndex(i,j);
01434 std::pair<double, double> RgnEtaPhi = m_RMap->getRegionCenterEtaPhi(iRgn);
01435
01436 std::pair<int, int> iRgnEtaPhi = m_RMap->getRegionEtaPhiIndex(iRgn);
01437 std::pair<int, int> iRgnEtaPhi2 = m_RMap->getRegionEtaPhiIndex(std::pair<int, int>(i,j));
01438
01439 std::cout<<"---------------------------------------------------------------------------"<<std::endl;
01440 std::cout<<"Region: "<<iRgn<<" | "<<RgnEtaPhi.first<<", "<<RgnEtaPhi.second*180./3.141<<std::endl;
01441 std::cout<<" - "<<iRgnEtaPhi.first<<", "<<iRgnEtaPhi.second<<std::endl;
01442 std::cout<<" - "<<iRgnEtaPhi2.first<<", "<<iRgnEtaPhi2.second<<std::endl;
01443 std::cout<<" Tower: "<<i<<", "<<m_RMap->convertFromECal_to_HCal_iphi(j)<<std::endl;
01444 std::cout<<" TowerId: "<<m_RMap->getRegionTowerIndex(i,j)<<std::endl;
01445
01446 }
01447 }
01448
01449 }
01450
01451 double
01452 FastL1GlobalAlgo::hcaletValue(const int ieta,const int compET) {
01453 double etvalue = m_hcaluncomp[ieta][compET];
01454 return etvalue;
01455 }
01456
01457
01458 bool
01459 FastL1GlobalAlgo::TauIsolation(int cRgn) {
01460
01461 if ((cRgn%22)<4 || (cRgn%22)>17) return false;
01462
01463 double iso_threshold = m_IsolationEt;
01464 int shower_shape = 0;
01465 int et_isolation = 0;
01466 unsigned int iso_count = 0;
01467
01468 int nwid = m_Regions[cRgn].GetNWId();
01469 int nid = m_Regions[cRgn].GetNorthId();
01470 int neid = m_Regions[cRgn].GetNEId();
01471 int wid = m_Regions[cRgn].GetWestId();
01472 int eid = m_Regions[cRgn].GetEastId();
01473 int swid = m_Regions[cRgn].GetSWId();
01474 int sid = m_Regions[cRgn].GetSouthId();
01475 int seid = m_Regions[cRgn].GetSEId();
01476
01477 if (m_Regions[cRgn].GetTauBit()) shower_shape = 1;
01478 if((cRgn%22)==4 || (cRgn%22)==17 ) {
01479
01480 if ((cRgn%22)==4) {
01481 if( m_Regions[neid].SumEt() > iso_threshold){
01482 iso_count ++;
01483 if (m_Regions[neid].GetTauBit()) iso_count++;
01484 }
01485 if( m_Regions[nid].SumEt() > iso_threshold){
01486 iso_count ++;
01487 if (m_Regions[nid].GetTauBit()) iso_count++;
01488 }
01489 if( m_Regions[eid].SumEt() > iso_threshold){
01490 iso_count ++;
01491 if (m_Regions[eid].GetTauBit()) iso_count++;
01492 }
01493 if( m_Regions[seid].SumEt() > iso_threshold){
01494 iso_count ++;
01495 if (m_Regions[seid].GetTauBit()) iso_count++;
01496 }
01497 if( m_Regions[sid].SumEt() > iso_threshold){
01498 iso_count ++;
01499 if (m_Regions[sid].GetTauBit()) iso_count++;
01500 }
01501
01502 if (iso_count >= 2 ){
01503 if (m_DoBitInfo){
01504 m_Regions[cRgn].BitInfo.setIsolationVeto ( true);
01505
01506 }
01507 et_isolation = 1;
01508 }
01509 else{ et_isolation = 2;}
01510 }
01511
01512
01513 if ((cRgn%22)==17) {
01514 if( m_Regions[nwid].SumEt() > iso_threshold){
01515 iso_count ++;
01516 if (m_Regions[nwid].GetTauBit()) iso_count++;
01517 }
01518 if( m_Regions[nid].SumEt() > iso_threshold){
01519 iso_count ++;
01520 if (m_Regions[nid].GetTauBit()) iso_count++;
01521 }
01522 if( m_Regions[wid].SumEt() > iso_threshold){
01523 iso_count ++;
01524 if (m_Regions[wid].GetTauBit()) iso_count++;
01525 }
01526 if( m_Regions[swid].SumEt() > iso_threshold){
01527 iso_count ++;
01528 if (m_Regions[swid].GetTauBit()) iso_count++;
01529 }
01530 if( m_Regions[sid].SumEt() > iso_threshold){
01531 iso_count ++;
01532 if (m_Regions[sid].GetTauBit()) iso_count++;
01533 }
01534
01535 if (iso_count >= 2 ){
01536 if (m_DoBitInfo){
01537 m_Regions[cRgn].BitInfo.setIsolationVeto ( true);
01538
01539 }
01540 et_isolation = 1;
01541 }
01542 else{ et_isolation = 2;}
01543 }
01544
01545
01546 if (et_isolation == 1 || shower_shape == 1 ) return false;
01547 if (et_isolation == 2 && shower_shape == 0) return true;
01548 }
01549
01550 if ( (cRgn%22)>4 && (cRgn%22)<17){
01551 if (nwid==999 || neid==999 || nid==999 || swid==999 || seid==999 || sid==999 || wid==999 ||
01552 eid==999 ) {
01553 return false;
01554 }
01555
01556 if( m_Regions[neid].SumEt() > iso_threshold){
01557 iso_count ++;
01558 if (m_Regions[neid].GetTauBit()) iso_count++;
01559 }
01560 if( m_Regions[nid].SumEt() > iso_threshold){
01561 iso_count ++;
01562 if (m_Regions[nid].GetTauBit()) iso_count++;
01563 }
01564 if( m_Regions[eid].SumEt() > iso_threshold){
01565 iso_count ++;
01566 if (m_Regions[eid].GetTauBit()) iso_count++;
01567 }
01568 if( m_Regions[seid].SumEt() > iso_threshold){
01569 iso_count ++;
01570 if (m_Regions[seid].GetTauBit()) iso_count++;
01571 }
01572 if( m_Regions[sid].SumEt() > iso_threshold){
01573 iso_count ++;
01574 if (m_Regions[sid].GetTauBit()) iso_count++;
01575 }
01576 if( m_Regions[nwid].SumEt() > iso_threshold){
01577 iso_count ++;
01578 if (m_Regions[nwid].GetTauBit()) iso_count++;
01579 }
01580 if( m_Regions[wid].SumEt() > iso_threshold){
01581 iso_count ++;
01582 if (m_Regions[wid].GetTauBit()) iso_count++;
01583 }
01584 if( m_Regions[swid].SumEt() > iso_threshold){
01585 iso_count ++;
01586 if (m_Regions[swid].GetTauBit()) iso_count++;
01587 }
01588
01589 if (iso_count >= 2 ){
01590 if (m_DoBitInfo){
01591 m_Regions[cRgn].BitInfo.setIsolationVeto ( true);
01592
01593 }
01594 et_isolation = 1;
01595 }
01596 else {et_isolation = 2;}
01597
01598 if (et_isolation == 1 || shower_shape == 1) return false;
01599 if (et_isolation == 2 && shower_shape == 0) return true;
01600 }
01601
01602 return true;
01603 }
01604