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