CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

FastL1Region Class Reference

#include <FastL1Region.h>

List of all members.

Public Member Functions

double CalcSumE ()
double CalcSumEmE ()
double CalcSumEmEt ()
double CalcSumEt ()
double CalcSumHadE ()
double CalcSumHadEt ()
void Dump ()
 FastL1Region ()
void FillEMCrystals (const CaloTowerConstituentsMap *theTowerConstituentsMap, const CaloTopology *calotopo, const CaloGeometry *cGeom, const EcalRecHitCollection *ec0, const EcalRecHitCollection *ec1, FastL1RegionMap *m_RMap)
void FillTower (const CaloTower &t, int &tid, edm::ESHandle< CaloGeometry > &cGeom)
void FillTower_Scaled (const CaloTower &t, int &tid, bool doRCTTrunc, edm::ESHandle< CaloGeometry > &cGeom)
void FillTowerZero (const CaloTower &t, int &tid)
FastL1BitInfo getBitInfo ()
CaloTowerCollection GetCaloTowers ()
int GetEastId ()
double GetEMCrystalEnergy (int itwr, int icell)
bool GetFGBit (int i)
bool GetHCFGBit (int i)
bool GetHOEBit (int i)
int GetId ()
int GetiEta ()
int GetiPhi ()
double GetJetE ()
double GetJetE3x3 ()
double GetJetEt ()
double GetJetEt3x3 ()
bool GetMIPBit ()
int GetNEId ()
int GetNorthId ()
int GetNWId ()
bool GetQuietBit ()
std::pair< double, double > getRegionCenterEtaPhi (const edm::EventSetup &c)
int GetSEId ()
int GetSouthId ()
int GetSWId ()
bool GetTauBit ()
std::pair< int, int > GetTowerNorthEtaPhi (int ieta, int iphi)
int GetWestId ()
int HighestEmEtTowerID ()
int HighestEtTowerID ()
int HighestHadEtTowerID ()
void SetDoBitInfo (bool doIt)
void SetEMCrystalEnergy (int itwr, int icell, double en)
void SetEtaPhiIndex (int eta, int phi, int ind)
void SetFGBit (int twrid, bool FGBIT)
void SetHCFGBit (int twrid, bool FGBIT)
void SetHOEBit (int twrid, bool FGBIT)
void SetJetE (double jE)
void SetJetE3x3 (double jE)
void SetJetEt (double jEt)
void SetJetEt3x3 (double jEt)
void SetParameters (L1Config)
void SetRegionBits (edm::Event const &e)
void SetRegionEnergy ()
void SetTowerBits ()
double SumE ()
double SumEmE ()
double SumEmEt ()
double SumEt ()
double SumHadE ()
double SumHadEt ()
 ~FastL1Region ()

Public Attributes

FastL1BitInfo BitInfo
bool doBitInfo

Private Member Functions

void SetFGBit ()
void SetHCFGBit ()
void SetHOEBit ()
void SetMIPBit ()
void SetQuietBit ()
void SetTauBit (edm::Event const &e)

Private Attributes

L1Config Config
double EMCrystalEnergy [16][25]
bool fgBit [16]
bool hcfgBit [16]
bool hOeBit [16]
int id
int ieta
int iphi
double jetE
double jetE3x3
double jetEt
double jetEt3x3
bool mipBit
bool quietBit
double sumE
double sumEt
bool tauBit
CaloTowerCollection Towers

Detailed Description

Description: Container class for L1 regions.

Implementation: <Notes on="" implementation>="">

Definition at line 110 of file FastL1Region.h.


Constructor & Destructor Documentation

FastL1Region::FastL1Region ( )

Definition at line 22 of file FastL1Region.cc.

References Config, L1Config::CrystalEBThreshold, L1Config::CrystalEEThreshold, L1Config::EMActiveLevel, EMCrystalEnergy, L1Config::EMLSB, L1Config::EMNoiseLevel, L1Config::EMSeedEnThreshold, fgBit, L1Config::FGEBThreshold, L1Config::FGEEThreshold, L1Config::HadActiveLevel, L1Config::HadNoiseLevel, hcfgBit, hOeBit, L1Config::hOeThreshold, i, ieta, iphi, j, jetE, jetEt, L1Config::JetLSB, L1Config::JetSeedEtThreshold, mipBit, L1Config::MuonNoiseLevel, L1Config::noFGThreshold, L1Config::noTauVetoLevel, quietBit, L1Config::QuietRegionThreshold, tauBit, L1Config::TowerEBScale, L1Config::TowerEBThreshold, L1Config::TowerEEScale, L1Config::TowerEEThreshold, L1Config::TowerEMLSB, L1Config::TowerHadLSB, L1Config::TowerHBScale, L1Config::TowerHBThreshold, L1Config::TowerHEScale, L1Config::TowerHEThreshold, and Towers.

{
  Towers = CaloTowerCollection(16);

  jetE = 0.;
  jetEt = 0.;

  id = 999;
  ieta = 999;
  iphi = 999;

  tauBit = false;
  quietBit = false;
  mipBit = false;
  for(int i=0;i<16;i++) {
    hcfgBit[i] = false;
    fgBit[i] = false;
    hOeBit[i] = false;
    for (int j=0;j<25;j++) {
      EMCrystalEnergy[i][j] = 0. ; // 16x25 Crystals
    }
  }

  // default values
  Config.EMSeedEnThreshold = 2.;
  Config.EMActiveLevel = 3.;
  Config.HadActiveLevel = 3.;
  Config.noTauVetoLevel = 10000.;       
  Config.hOeThreshold = 0.05;
  Config.FGEBThreshold = 0.8;
  Config.noFGThreshold = 50.;
  Config.FGEEThreshold = 0.8;
  Config.MuonNoiseLevel = 2.;
  Config.EMNoiseLevel = 2.;
  Config.HadNoiseLevel = 2.;
  Config.QuietRegionThreshold = 2.;  
  Config.JetSeedEtThreshold = 2.;  
  Config.CrystalEBThreshold = 0.09;
  Config.CrystalEEThreshold = 0.45;

  Config.TowerEMLSB = 1.;
  Config.TowerHadLSB = 1.;
  Config.EMLSB = 1.;
  Config.JetLSB = 1.;

  Config.TowerEBThreshold = 0.2;
  Config.TowerEEThreshold = 0.45;
  Config.TowerHBThreshold = 0.9;
  Config.TowerHEThreshold = 1.4;

  Config.TowerEBScale = 1.0;
  Config.TowerEEScale = 1.0;
  Config.TowerHBScale = 1.0;
  Config.TowerHEScale = 1.0;


  //Config.EmInputs;
  //Config.xTowerInput;

}
FastL1Region::~FastL1Region ( )

Definition at line 84 of file FastL1Region.cc.

{
}

Member Function Documentation

double FastL1Region::CalcSumE ( )

Definition at line 690 of file FastL1Region.cc.

References i, and Towers.

Referenced by SetRegionEnergy(), and SumE().

{
  double sume=0;
  for (int i=0; i<16; i++) {
    sume += Towers[i].emEnergy();
    sume += Towers[i].hadEnergy();

  }
  return sume;
}
double FastL1Region::CalcSumEmE ( )

Definition at line 702 of file FastL1Region.cc.

References i, and Towers.

Referenced by SumEmE().

{
  double sume=0;
  for (int i=0; i<16; i++) {
    sume += Towers[i].emEnergy();
  }
  return sume;
}
double FastL1Region::CalcSumEmEt ( )

Definition at line 668 of file FastL1Region.cc.

References i, and Towers.

Referenced by SumEmEt().

{
  double sumet=0;
  for (int i=0; i<16; i++) {
    sumet += Towers[i].emEt();
  }

  return sumet;
}
double FastL1Region::CalcSumEt ( )

Definition at line 656 of file FastL1Region.cc.

References i, and Towers.

Referenced by SetRegionEnergy(), and SumEt().

{
  double sumet=0;
  for (int i=0; i<16; i++) {
    sumet += Towers[i].emEt();
    sumet += Towers[i].hadEt();
  }

  return sumet;
}
double FastL1Region::CalcSumHadE ( )

Definition at line 712 of file FastL1Region.cc.

References i, and Towers.

Referenced by SumHadE().

{
  double sume=0;
  for (int i=0; i<16; i++) {
    sume += Towers[i].hadEnergy();
  }
  return sume;
}
double FastL1Region::CalcSumHadEt ( )

Definition at line 679 of file FastL1Region.cc.

References i, and Towers.

Referenced by SumHadEt().

{
  double sumet=0;
  for (int i=0; i<16; i++) {
    sumet += Towers[i].hadEt();
  }

  return sumet;
}
void FastL1Region::Dump ( void  )

Definition at line 742 of file FastL1Region.cc.

References gather_cfg::cout, GetEastId(), GetId(), GetNEId(), GetNorthId(), GetNWId(), GetSEId(), GetSouthId(), GetSWId(), and GetWestId().

{

  // test tower filling:
  /*
  CaloTowerCollection::const_iterator t;
  int count = 0;
  for (t=Towers.begin(); t!=Towers.end(); t++) {
    std::cout << count << ") " << t->energy() << " | " << t->eta()  << " | " << t->phi() << std::endl;
    count++;
  }
  std::cout << std::endl;
  */

  // test region neighbours:
  std::cout << this->GetNWId() << " "  << this->GetNorthId() << " "  << this->GetNEId() << std::endl;
  std::cout << this->GetWestId() << " "  << this->GetId() << " "  << this->GetEastId() << std::endl;
  std::cout << this->GetSWId() << " "  << this->GetSouthId() << " "  << this->GetSEId() << std::endl;
  std::cout << std::endl;

}
void FastL1Region::FillEMCrystals ( const CaloTowerConstituentsMap theTowerConstituentsMap,
const CaloTopology calotopo,
const CaloGeometry cGeom,
const EcalRecHitCollection ec0,
const EcalRecHitCollection ec1,
FastL1RegionMap m_RMap 
)

Definition at line 120 of file FastL1Region.cc.

References edm::SortedCollection< T, SORT >::begin(), Config, L1Config::CrystalEBThreshold, L1Config::CrystalEEThreshold, CaloTopology::east(), EMCrystalEnergy, L1Config::EMNoiseLevel, edm::SortedCollection< T, SORT >::end(), relval_parameters_module::energy, fgBit, L1Config::FGEEThreshold, GetiEta(), i, EBDetId::ieta(), ieta, CaloTowerDetId::ieta(), iphi, EBDetId::iphi(), CaloTowerDetId::iphi(), L1Config::noFGThreshold, CaloTopology::north(), SetTowerBits(), CaloTopology::south(), EBDetId::tower_ieta(), EBDetId::tower_iphi(), L1Config::TowerEEThreshold, CaloTowerConstituentsMap::towerOf(), Towers, and CaloTopology::west().

{
  //std::vector< std::pair <std::string,std::string> > la;
  //la.resize(2);
  //la[0].first = "ecalRecHit";
  //la[0].second = "EcalRecHitsEB";
  //la[1].first = "ecalRecHit";
  //la[1].second = "EcalRecHitsEE";


  double ethres = Config.CrystalEBThreshold;

  // EB
  //e.getByLabel(la[0].first,la[0].second,ec);
  //e.getByLabel(Config.EmInputs.at(0),ec);

  ethres = Config.CrystalEBThreshold;
  for(EcalRecHitCollection::const_iterator ecItr = ec0->begin();
      ecItr != ec0->end(); ++ecItr) {
    //CaloRecHit recHit = (CaloRecHit)(*ecItr);
    if (ecItr->energy()<ethres) continue;

    EBDetId detId = ecItr->detid();

    //int hiphi = detId.tower_iphi();
    int hieta = detId.tower_ieta();
    int eieta = detId.ieta();
    int eiphi = detId.iphi();
    int crIeta = 999;
    if (hieta>0)
      crIeta = (eieta-1)%5;
    else
      crIeta = 4 + (eieta+1)%5;
    int crIphi = (eiphi - 1)%5;
    
    //const GlobalPoint gP = cGeom->getPosition(detId);

    //CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
    // loop over towers
    for(int i=0;i<16;i++) {
      //int hiphi = m_RMap->convertFromECal_to_HCal_iphi(detId.tower_iphi());
      //int hiphi = m_RMap->convertFromHCal_to_ECal_iphi(detId.tower_iphi());
      int hiphi = detId.tower_iphi();
      if ( !Towers[i].id().iphi()==hiphi ||  !Towers[i].id().ieta()==hieta ) continue;
      EMCrystalEnergy[i][crIeta + 5*crIphi] = ecItr->energy();
    }  
  }
  
  // After having filled crsystal info set all veto bits
  SetTowerBits();
 
  // EE FG bits are filled here!!!
  //e.getByLabel(la[1].first,la[1].second,ec);

  if (GetiEta()==4 || GetiEta()==5 ||  GetiEta()==6 ||  
      GetiEta()==15 || GetiEta()==16 || GetiEta()==17 ) {
    
    //e.getByLabel(Config.EmInputs.at(1),ec);
    ethres = Config.CrystalEEThreshold;
    double towerEnergy[16];
    // loop over towers
    for(int i=0;i<16;i++) {
      fgBit[i] = false; // re-iniate
            
      //if (Towers[i].hadEt()>Config.HadNoiseLevel && Towers[i].emEt()>Config.EMNoiseLevel ) {
      if (Towers[i].emEt()>=Config.EMNoiseLevel ) {
      //if (Towers[i].emEnergy()>Config.EMNoiseLevel ) {
        //towerEnergy[i]  = Towers[i].hadEt() + Towers[i].emEt(); 
        towerEnergy[i]  = Towers[i].hadEnergy() + Towers[i].emEnergy(); 
      } else {
        fgBit[i] = false;
        continue;
      }

      // EB/EE transition area: unset fg bits
      // if (std::abs(Towers[i].id().ieta())==16 || std::abs(Towers[i].id().ieta())==17) {
      // fgBit[i] = false;
      // continue;
      // }
      if (Towers[i].emEt()>Config.noFGThreshold) {
        fgBit[i] = false;
        continue;
      }
      
      //CaloRecHit maxRecHit;
      //CaloRecHit maxRecHit2;
      double maxRecHit=-1.;
      double maxRecHit2=-1.;
      DetId maxDetId;

      double max2En = 0.;
      
      for(EcalRecHitCollection::const_iterator ecItr = ec1->begin();
          ecItr != ec1->end(); ++ecItr) {
        //CaloRecHit recHit = (CaloRecHit)(*ecItr);
        if (ecItr->energy()<ethres) continue;
        
        EEDetId detId = ecItr->detid();
        
        CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
        //int hiphi = m_RMap->convertFromECal_to_HCal_iphi(towerDetId.iphi());
        int hiphi = towerDetId.iphi();
        if (Towers[i].id().iphi()==hiphi && 
            Towers[i].id().ieta()==towerDetId.ieta() ) {        
          if (maxRecHit<ecItr->energy()) {
            maxRecHit = ecItr->energy();
            maxDetId = detId;
          }     
        }
      } 

      std::vector<DetId> westV = calotopo->west(maxDetId);
      std::vector<DetId> eastV = calotopo->east(maxDetId);
      std::vector<DetId> southV = calotopo->south(maxDetId);
      std::vector<DetId> northV = calotopo->north(maxDetId);
      for(EcalRecHitCollection::const_iterator ecItr = ec1->begin();
          ecItr != ec1->end(); ++ecItr) {
        //CaloRecHit recHit = (CaloRecHit)(*ecItr);
        if (ecItr->energy()<ethres) continue;
        
        EEDetId detId = ecItr->detid();
        
        CaloTowerDetId towerDetId = theTowerConstituentsMap->towerOf(detId);
        //int hiphi = m_RMap->convertFromECal_to_HCal_iphi(towerDetId.iphi());
        int hiphi = towerDetId.iphi();
        if (Towers[i].id().iphi()==hiphi && 
            Towers[i].id().ieta()==towerDetId.ieta() ) {
          if ( 
              (!westV.empty() && detId==westV[0]) || 
              (!eastV.empty() && detId==eastV[0]) || 
              (!northV.empty() && detId==northV[0]) || 
              (!southV.empty() && detId==southV[0]) 
              ) {
            if (maxRecHit2<ecItr->energy()) {
              maxRecHit2 = ecItr->energy();
            }   
            max2En += ecItr->energy();
          }
        }
      }  
      
      double eeThres = Config.FGEEThreshold;
      //double totE = maxRecHit.energy() + max2En;
      double totE = maxRecHit + maxRecHit2;
      if (towerEnergy[i]>(Config.TowerEEThreshold)) {
        //double totE = maxRecHit.energy() + maxRecHit2.energy();
        //if (totE/towerEnergy[i]<Config.FGEBThreshold) fgBit[i] = true;    
        if (totE/towerEnergy[i]<eeThres) fgBit[i] = true;    
      }
            
    }
  }
   
 
}
void FastL1Region::FillTower ( const CaloTower t,
int &  tid,
edm::ESHandle< CaloGeometry > &  cGeom 
)

Definition at line 292 of file FastL1Region.cc.

References abs, Config, CaloTower::emEt(), reco::LeafCandidate::energy(), reco::LeafCandidate::eta(), CaloTower::hadEt(), CaloTower::id(), CaloTower::outerEt(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), RCTEnergyTrunc(), L1Config::TowerEBThreshold, L1Config::TowerEEThreshold, L1Config::TowerEMLSB, L1Config::TowerHadLSB, L1Config::TowerHBThreshold, L1Config::TowerHEThreshold, and Towers.

{
  double EThres = 0.;
  double HThres = 0.;
  double EBthres = Config.TowerEBThreshold;
  double HBthres = Config.TowerHBThreshold;
  double EEthres = Config.TowerEEThreshold;
  double HEthres = Config.TowerHEThreshold;
  
  if(std::abs(t.eta())<2.322) {
    EThres = EBthres;
  } else {
    EThres = EEthres;
  }
  if(std::abs(t.eta())<2.322) {
    HThres = HBthres;
  } else {
    HThres = HEthres;
  }

  double upperThres = 1024.;
  double emet = RCTEnergyTrunc(t.emEt(),Config.TowerEMLSB,upperThres);
  double hadet = RCTEnergyTrunc(t.hadEt(),Config.TowerHadLSB,upperThres);
  //double eme = RCTEnergyTrunc(t.emEnergy(),Config.TowerEMLSB,upperThres);
  //double hade = RCTEnergyTrunc(t.hadEnergy(),Config.TowerHadLSB,upperThres);

  if ( emet<EThres) emet = 0.;
  if ( hadet<HThres) hadet = 0.;
  //if ( eme<EThres) emet = 0.;
  //if ( hade<HThres) hadet = 0.;
 
  GlobalPoint gP = cGeom->getPosition(t.id());
  math::XYZTLorentzVector lvec(t.px(),t.py(),t.px(),t.energy());
  //Towers[tid] = CaloTower(t);
  //Towers[tid] = CaloTower(t.id(),t.momentum(),emet,hadet,t.outerEt(),0,0);
  Towers[tid] = CaloTower(t.id(),emet,hadet,t.outerEt(),0,0,lvec,gP,gP);
}
void FastL1Region::FillTower_Scaled ( const CaloTower t,
int &  tid,
bool  doRCTTrunc,
edm::ESHandle< CaloGeometry > &  cGeom 
)

Definition at line 333 of file FastL1Region.cc.

References abs, Config, CaloTower::emEnergy(), CaloTower::emEt(), reco::LeafCandidate::energy(), reco::LeafCandidate::eta(), CaloTower::hadEnergy(), CaloTower::hadEt(), CaloTower::id(), CaloTower::outerEt(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), RCTEnergyTrunc(), L1Config::TowerEBScale, L1Config::TowerEBThreshold, L1Config::TowerEEScale, L1Config::TowerEEThreshold, L1Config::TowerEMLSB, L1Config::TowerHadLSB, L1Config::TowerHBScale, L1Config::TowerHBThreshold, L1Config::TowerHEScale, L1Config::TowerHEThreshold, and Towers.

{

  double EThres = 0.;
  double HThres = 0.;
  double EBthres = Config.TowerEBThreshold;
  double HBthres = Config.TowerHBThreshold;
  double EEthres = Config.TowerEEThreshold;
  double HEthres = Config.TowerHEThreshold;
  
  if(std::abs(t.eta())<2.322) {
    EThres = EBthres;
  } else {
    EThres = EEthres;
  }
  if(std::abs(t.eta())<2.322) {
    HThres = HBthres;
  } else {
    HThres = HEthres;
  }

  double emScale = 1.0;
  double hadScale = 1.0;
  //double outerScale = 1.0;

  if (std::abs(t.eta()>1.3050) && std::abs(t.eta())<3.0) {
    hadScale = Config.TowerHEScale;
    emScale = Config.TowerEEScale;
  }
  if (std::abs(t.eta()<1.3050)) {
    hadScale = Config.TowerHBScale;
    emScale = Config.TowerEBScale;
  }

  double emet = emScale * t.emEt();
  double hadet = hadScale * t.hadEt();
  double eme = emScale * t.emEnergy();
  double hade = hadScale * t.hadEnergy();

  if (doRCTTrunc) {
    double upperThres = 1024.;
    emet = RCTEnergyTrunc(emet,Config.TowerEMLSB,upperThres);
    hadet = RCTEnergyTrunc(hadet,Config.TowerHadLSB,upperThres);
    eme = RCTEnergyTrunc(eme,Config.TowerEMLSB,upperThres);
    hade = RCTEnergyTrunc(hade,Config.TowerHadLSB,upperThres);
  }
  if ( emet<EThres) emet = 0.;
  if ( hadet<HThres) hadet = 0.;
  //if ( eme<EThres) emet = 0.;
  //if ( hade<HThres) hadet = 0.;

  /* 
  if (t.emEt()>0. || t.hadEt()>0.) {
    std::cout<<"+++ "
             <<t.emEt()<<" "<<t.hadEt()<<" "
             <<t.eta()<<" "<<t.phi()<<" "
             <<std::endl;
  }
  */

  //Towers[tid] = CaloTower(t);
  //Towers[tid] = CaloTower(t.id(),t.momentum(),emet,hadet,0.,0,0);
  //edm::ESHandle<CaloGeometry> cGeom; 
  //c.get<CaloGeometryRecord>().get(cGeom);    
  GlobalPoint gP = cGeom->getPosition(t.id());
  math::XYZTLorentzVector lvec(t.px(),t.py(),t.px(),t.energy());
  //Towers[tid] = CaloTower(t);
  //Towers[tid] = CaloTower(t.id(),t.momentum(),emet,hadet,t.outerEt(),0,0);
  Towers[tid] = CaloTower(t.id(),emet,hadet,t.outerEt(),0,0,lvec,gP,gP);
  
  //std::cout<<tid<<"  "<<Towers[tid].emEt()<< " " <<Towers[tid].hadEt()<< std::endl;

}
void FastL1Region::FillTowerZero ( const CaloTower t,
int &  tid 
)

Definition at line 285 of file FastL1Region.cc.

References Towers.

{
  Towers[tid] = CaloTower(t);
  //std::cout<<"--- "<<Towers[tid].emEt()<<" "<<Towers[tid].hadEt()<<std::endl;
}
FastL1BitInfo FastL1Region::getBitInfo ( ) [inline]

Definition at line 192 of file FastL1Region.h.

References BitInfo.

{ return BitInfo; }
CaloTowerCollection FastL1Region::GetCaloTowers ( ) [inline]

Definition at line 156 of file FastL1Region.h.

References Towers.

{ return Towers; };
int FastL1Region::GetEastId ( )

Definition at line 778 of file FastL1Region.cc.

References ieta, and iphi.

Referenced by Dump().

{ if (ieta != 21) return (iphi*22 + ieta+1); else return 999; }
double FastL1Region::GetEMCrystalEnergy ( int  itwr,
int  icell 
) [inline]

Definition at line 158 of file FastL1Region.h.

References EMCrystalEnergy.

{ return EMCrystalEnergy[itwr][icell]; };
bool FastL1Region::GetFGBit ( int  i) [inline]

Definition at line 152 of file FastL1Region.h.

References fgBit, and i.

{ if(i>=0 && i<16) {return fgBit[i];} else { return false; } };
bool FastL1Region::GetHCFGBit ( int  i) [inline]

Definition at line 154 of file FastL1Region.h.

References hcfgBit, and i.

{  if(i>=0 && i<16) return hcfgBit[i]; else return false; };
bool FastL1Region::GetHOEBit ( int  i) [inline]

Definition at line 153 of file FastL1Region.h.

References hOeBit, and i.

{ if(i>=0 && i<16) { return hOeBit[i]; } else { return false; } };
int FastL1Region::GetId ( ) [inline]

Definition at line 134 of file FastL1Region.h.

References id.

Referenced by Dump().

{ return id; };
int FastL1Region::GetiEta ( ) [inline]

Definition at line 132 of file FastL1Region.h.

References ieta.

Referenced by FillEMCrystals(), and SetFGBit().

{ return ieta; };
int FastL1Region::GetiPhi ( ) [inline]

Definition at line 133 of file FastL1Region.h.

References iphi.

{ return iphi; };
double FastL1Region::GetJetE ( ) [inline]

Definition at line 172 of file FastL1Region.h.

References jetE.

{ return jetE; };
double FastL1Region::GetJetE3x3 ( ) [inline]

Definition at line 183 of file FastL1Region.h.

References jetE3x3.

{ return jetE3x3; };
double FastL1Region::GetJetEt ( ) [inline]

Definition at line 173 of file FastL1Region.h.

References jetEt.

{ return jetEt; };
double FastL1Region::GetJetEt3x3 ( ) [inline]

Definition at line 184 of file FastL1Region.h.

References jetEt3x3.

{ return jetEt3x3; };
bool FastL1Region::GetMIPBit ( ) [inline]

Definition at line 151 of file FastL1Region.h.

References mipBit.

{ return mipBit; };
int FastL1Region::GetNEId ( )

Definition at line 807 of file FastL1Region.cc.

References ieta, and iphi.

Referenced by Dump().

{ 
  if (ieta != 21) {
    if (iphi != 17) 
      return ((iphi+1)*22 + ieta+1); 
    else
      return (ieta+1);  
  } else {
    return 999; 
  }
}
int FastL1Region::GetNorthId ( )

Definition at line 765 of file FastL1Region.cc.

References ieta, and iphi.

Referenced by Dump().

{ if (iphi != 17) return ((iphi+1)*22 + ieta); else return ieta; }
int FastL1Region::GetNWId ( )

Definition at line 782 of file FastL1Region.cc.

References ieta, and iphi.

Referenced by Dump().

{ 
  if (ieta != 0) {
    if (iphi != 17) 
      return ((iphi+1)*22 + ieta-1); 
    else
      return (ieta-1);  
  } else {
    return 999; 
  }
}
bool FastL1Region::GetQuietBit ( ) [inline]

Definition at line 150 of file FastL1Region.h.

References quietBit.

{ return quietBit; };
std::pair< double, double > FastL1Region::getRegionCenterEtaPhi ( const edm::EventSetup c)

Definition at line 723 of file FastL1Region.cc.

References eta(), PV3DBase< T, PVType, FrameType >::eta(), edm::EventSetup::get(), PV3DBase< T, PVType, FrameType >::phi(), phi, and Towers.

{
  edm::ESHandle<CaloGeometry> cGeom; 
  //c.get<IdealGeometryRecord>().get(cGeom);    
  c.get<CaloGeometryRecord>().get(cGeom);    

  const GlobalPoint gP1 = cGeom->getPosition(Towers[5].id());
  //const GlobalPoint gP2 = cGeom->getPosition(Towers[6].id());
  //const GlobalPoint gP3 = cGeom->getPosition(Towers[10].id());

  double eta = gP1.eta();  
  double phi = gP1.phi();
  
  return std::pair<double, double>(eta, phi);
}
int FastL1Region::GetSEId ( )

Definition at line 820 of file FastL1Region.cc.

References ieta, and iphi.

Referenced by Dump().

{ 
  if (ieta != 21) {
    if (iphi != 0) 
      return ((iphi-1)*22 + ieta+1); 
    else
      return (17*22 + ieta+1);  
  } else {
    return 999; 
  }
}
int FastL1Region::GetSouthId ( )

Definition at line 770 of file FastL1Region.cc.

References ieta, and iphi.

Referenced by Dump().

{ if (iphi != 0) return ((iphi-1)*22 + ieta); else return (17*22 + ieta); }
int FastL1Region::GetSWId ( )

Definition at line 795 of file FastL1Region.cc.

References ieta, and iphi.

Referenced by Dump().

{ 
  if (ieta != 0) {
    if (iphi != 0) 
      return ((iphi-1)*22 + ieta-1); 
    else
      return (17*22 + ieta-1);  
  } else {
    return 999; 
  }
}
bool FastL1Region::GetTauBit ( ) [inline]

Definition at line 149 of file FastL1Region.h.

References tauBit.

{ return tauBit; };
std::pair<int, int> FastL1Region::GetTowerNorthEtaPhi ( int  ieta,
int  iphi 
)
int FastL1Region::GetWestId ( )

Definition at line 774 of file FastL1Region.cc.

References ieta, and iphi.

Referenced by Dump().

{ if (ieta != 0) return (iphi*22 + ieta-1); else return 999; }
int FastL1Region::HighestEmEtTowerID ( )

Definition at line 624 of file FastL1Region.cc.

References BitInfo, doBitInfo, i, FastL1BitInfo::setHighestEmEtTowerID(), and Towers.

{
  int hid = -1;
  double tmpet=0.;
  for (int i=0; i<16; i++) {
    if ( (Towers[i].emEt()) > tmpet) {
      tmpet = (Towers[i].emEt());
      hid = i;
    }
  }

  if (doBitInfo) BitInfo.setHighestEmEtTowerID (hid);    
  return hid;
}
int FastL1Region::HighestEtTowerID ( )

Definition at line 607 of file FastL1Region.cc.

References BitInfo, doBitInfo, i, FastL1BitInfo::setHighestEtTowerID(), and Towers.

{
  int hid = -1;
  double tmpet=0.;
  for (int i=0; i<16; i++) {
    if ( (Towers[i].emEt()+Towers[i].hadEt()) > tmpet) {
      tmpet = (Towers[i].emEt()+Towers[i].hadEt());
      hid = i;
    }
  }

  if (doBitInfo) BitInfo.setHighestEtTowerID (hid);      

  return hid;
}
int FastL1Region::HighestHadEtTowerID ( )

Definition at line 640 of file FastL1Region.cc.

References BitInfo, doBitInfo, i, FastL1BitInfo::setHighestHadEtTowerID(), and Towers.

{
  int hid = -1;
  double tmpet=0.;
  for (int i=0; i<16; i++) {
    if ( (Towers[i].hadEt()) > tmpet) {
      tmpet = (Towers[i].hadEt());
      hid = i;
    }
  }

  if (doBitInfo) BitInfo.setHighestHadEtTowerID (hid);   
  return hid;
}
void FastL1Region::SetDoBitInfo ( bool  doIt) [inline]

Definition at line 177 of file FastL1Region.h.

References doBitInfo.

{doBitInfo = doIt;}
void FastL1Region::SetEMCrystalEnergy ( int  itwr,
int  icell,
double  en 
) [inline]

Definition at line 157 of file FastL1Region.h.

References EMCrystalEnergy.

{ EMCrystalEnergy[itwr][icell] = en; };
void FastL1Region::SetEtaPhiIndex ( int  eta,
int  phi,
int  ind 
) [inline]

Definition at line 129 of file FastL1Region.h.

References eta(), ieta, iphi, and phi.

  { ieta=eta; iphi=phi; id=ind; };
void FastL1Region::SetFGBit ( int  twrid,
bool  FGBIT 
)

Definition at line 451 of file FastL1Region.cc.

References fgBit.

{
  fgBit[twrid] = FGBIT;
}
void FastL1Region::SetFGBit ( ) [private]

Definition at line 467 of file FastL1Region.cc.

References Config, EMCrystalEnergy, L1Config::EMNoiseLevel, fgBit, L1Config::FGEBThreshold, GetiEta(), i, j, L1Config::noFGThreshold, L1Config::TowerEBThreshold, and Towers.

Referenced by SetTowerBits().

{
  double ratioCut = Config.FGEBThreshold;

  double stripEnergy[16][5];
  double duostripEnergy[16][4];
  double towerEnergy[16];

  if (GetiEta()>=7 && GetiEta()<=14) {
    //Barrel
    for (int i=0; i<16; i++) {
      //if (Towers[i].hadEt()>Config.HadNoiseLevel && Towers[i].emEt()>Config.EMNoiseLevel ) {
      if (Towers[i].emEt()>Config.EMNoiseLevel ) {
        //towerEnergy[i]  = Towers[i].hadEt() + Towers[i].emEt(); 
        towerEnergy[i]  = Towers[i].hadEnergy() + Towers[i].emEnergy(); 
      } else {
        fgBit[i] = false;
        continue;
      }

      // EB/EE transition area: unset fg bits
      //if (std::abs(Towers[i].id().ieta())==16 || std::abs(Towers[i].id().ieta())==17) {
      //fgBit[i] = false;
      //continue;
      //}
      if (Towers[i].emEt()>Config.noFGThreshold) {
        fgBit[i] = false;
        continue;
      }

      bool fgflag = false;
        for (int j=0; j<5; j++) {
        stripEnergy[i][j] = EMCrystalEnergy[i][j] + EMCrystalEnergy[i][j+5] + EMCrystalEnergy[i][j+10] + 
          EMCrystalEnergy[i][j+15] + EMCrystalEnergy[i][j+20];
      }
      for (int j=0; j<4; j++) {
        duostripEnergy[i][j] = stripEnergy[i][j] + stripEnergy[i][j+1];
        if (towerEnergy[i]>(Config.TowerEBThreshold)) {
          //std::cout<<duostripEnergy[i][j]<<" |"<<towerEnergy[i]<<" |"<<duostripEnergy[i][j]/towerEnergy[i]<<std::endl;
          if ( (duostripEnergy[i][j] / towerEnergy[i]) > ratioCut) {
            fgflag = true;
          } 
          //std::cout<<duostripEnergy[i][j]<<" | "<<towerEnergy[i]<<": "<<duostripEnergy[i][j]/towerEnergy[i]<<std::endl;       
        }
      }

      if (fgflag) { 
        fgBit[i] = false;
      } else {
        fgBit[i] = true;
      }
      //std::cout<<GetiEta()<<" | "<<i<<": "<<fgBit[i]<<std::endl;
      //std::cout<<"********************************************"<<std::endl;
    }
  } else {
    // Endcap FG bit is already filled in fillEMCrystals()!!! 
  }
  
}
void FastL1Region::SetHCFGBit ( ) [private]

Definition at line 430 of file FastL1Region.cc.

Referenced by SetTowerBits().

{
  // temporary: check definition 
  // if (Tower->hadEt>100GeV) hcfgBit = true; ????
  //for (int i=0; i<16; i++) {
  //}
}
void FastL1Region::SetHCFGBit ( int  twrid,
bool  FGBIT 
)

Definition at line 456 of file FastL1Region.cc.

{
  ;
}
void FastL1Region::SetHOEBit ( ) [private]

Definition at line 408 of file FastL1Region.cc.

References Config, L1Config::EMNoiseLevel, L1Config::HadNoiseLevel, hOeBit, L1Config::hOeThreshold, i, and Towers.

Referenced by SetTowerBits().

{
  double fracThres = Config.hOeThreshold;

  for (int i=0; i<16; i++) {
    //if (Towers[i].hadEt()>Config.HadNoiseLevel && Towers[i].emEt()>Config.EMNoiseLevel ) {
    if (Towers[i].hadEnergy()>Config.HadNoiseLevel && Towers[i].emEnergy()>Config.EMNoiseLevel ) {
      if((Towers[i].hadEt()/Towers[i].emEt()) > fracThres) {
        hOeBit[i] = true;
      }
    }
  }
}
void FastL1Region::SetHOEBit ( int  twrid,
bool  FGBIT 
)

Definition at line 461 of file FastL1Region.cc.

References hOeBit.

{
  hOeBit[twrid] = FGBIT;
}
void FastL1Region::SetJetE ( double  jE) [inline]

Definition at line 174 of file FastL1Region.h.

References jetE.

{ jetE = jE; };
void FastL1Region::SetJetE3x3 ( double  jE) [inline]

Definition at line 185 of file FastL1Region.h.

References jetE3x3.

{ jetE3x3 = jE; };
void FastL1Region::SetJetEt ( double  jEt) [inline]

Definition at line 175 of file FastL1Region.h.

References jetEt.

{ jetEt = jEt; };
void FastL1Region::SetJetEt3x3 ( double  jEt) [inline]

Definition at line 186 of file FastL1Region.h.

References jetEt3x3.

{ jetEt3x3 = jEt; };
void FastL1Region::SetMIPBit ( ) [private]

Definition at line 439 of file FastL1Region.cc.

References hcfgBit, i, mipBit, and quietBit.

Referenced by SetRegionBits().

{
  if (quietBit)
  for (int i=0; i<16; i++) {
    if (hcfgBit) {
      mipBit = true;
      return;
    }
  }
}
void FastL1Region::SetParameters ( L1Config  iconfig)

Definition at line 90 of file FastL1Region.cc.

References Config.

{ 
  Config = iconfig;
}
void FastL1Region::SetQuietBit ( ) [private]

Definition at line 423 of file FastL1Region.cc.

References Config, quietBit, L1Config::QuietRegionThreshold, and SumEt().

Referenced by SetRegionBits().

void FastL1Region::SetRegionBits ( edm::Event const &  e)

Definition at line 103 of file FastL1Region.cc.

References SetMIPBit(), SetQuietBit(), and SetTauBit().

void FastL1Region::SetRegionEnergy ( )

Definition at line 96 of file FastL1Region.cc.

References CalcSumE(), CalcSumEt(), sumE, and sumEt.

{
  sumE = CalcSumE();
  sumEt = CalcSumEt();
}
void FastL1Region::SetTauBit ( edm::Event const &  e) [private]

Definition at line 529 of file FastL1Region.cc.

References BitInfo, Config, doBitInfo, L1Config::EMActiveLevel, L1Config::HadActiveLevel, i, FastL1BitInfo::setEmTauVeto(), FastL1BitInfo::setHadTauVeto(), FastL1BitInfo::setIsolationVeto(), FastL1BitInfo::setTauVeto(), tauBit, and Towers.

Referenced by SetRegionBits().

{
  float emThres = Config.EMActiveLevel;
  float hadThres = Config.HadActiveLevel;

  if (doBitInfo) BitInfo.setIsolationVeto(false);       
  if (doBitInfo) BitInfo.setTauVeto(false);     
  if (doBitInfo) BitInfo.setEmTauVeto(false);   
  if (doBitInfo) BitInfo.setHadTauVeto(false);  

  // init pattern containers
  unsigned emEtaPat = 0;
  unsigned emPhiPat = 0;
  unsigned hadEtaPat = 0;
  unsigned hadPhiPat = 0;
  unsigned one = 1;


  // fill hits as bit pattern
  for (int i=0; i<16; i++) {
    if(Towers[i].emEt() > emThres) {
      emEtaPat |= (one << (unsigned)(i%4));
      emPhiPat |= (one << (unsigned)(i/4));
    }

    if( Towers[i].hadEt() > hadThres) {
      hadEtaPat |= (one << (unsigned)(i%4));
      hadPhiPat |= (one << (unsigned)(i/4));
    }

  }

  // Patterns with two or less contiguous bits set are passed
  // rest are vetoed; 5=0101;7=0111;9=1001;10=1010;11=1011;13=1101;14=1110;15=1111
  //  --- Alternate patterns
  //  --- 9=1001;15=1111
  static std::vector<unsigned> vetoPatterns;
  if(vetoPatterns.size() == 0) {
    vetoPatterns.push_back(5);
    vetoPatterns.push_back(7);
    vetoPatterns.push_back(9);
    vetoPatterns.push_back(10);
    vetoPatterns.push_back(11);
    vetoPatterns.push_back(13);
    vetoPatterns.push_back(14);
    vetoPatterns.push_back(15);
  }


  for(std::vector<unsigned>::iterator i = vetoPatterns.begin();
      i != vetoPatterns.end();  i++) {
    unsigned etaPattern = emEtaPat | hadEtaPat;
    unsigned phiPattern = emPhiPat | hadPhiPat;

    //  em pattern
    if(emEtaPat == *i || emPhiPat == *i) {
      if (doBitInfo) BitInfo.setEmTauVeto(true);
    }
    //  had pattern
    if(hadEtaPat == *i || hadPhiPat == *i) {
      if (doBitInfo) BitInfo.setHadTauVeto(true);
    }

    if(etaPattern == *i || phiPattern == *i) // combined pattern
      //if(emEtaPat == *i || emPhiPat == *i || hadEtaPat == *i || hadPhiPat == *i)
      {
        tauBit = true;
        if (doBitInfo) BitInfo.setTauVeto(true);        
        return;
      }  
  }
  
  tauBit = false;
  
}
void FastL1Region::SetTowerBits ( )

Definition at line 111 of file FastL1Region.cc.

References SetFGBit(), SetHCFGBit(), and SetHOEBit().

Referenced by FillEMCrystals().

double FastL1Region::SumE ( ) [inline]

Definition at line 160 of file FastL1Region.h.

References CalcSumE().

{ return CalcSumE(); };
double FastL1Region::SumEmE ( ) [inline]

Definition at line 162 of file FastL1Region.h.

References CalcSumEmE().

{ return CalcSumEmE(); };
double FastL1Region::SumEmEt ( ) [inline]

Definition at line 163 of file FastL1Region.h.

References CalcSumEmEt().

{ return CalcSumEmEt(); };
double FastL1Region::SumEt ( ) [inline]

Definition at line 161 of file FastL1Region.h.

References CalcSumEt().

Referenced by SetQuietBit().

{ return CalcSumEt(); };
double FastL1Region::SumHadE ( ) [inline]

Definition at line 164 of file FastL1Region.h.

References CalcSumHadE().

{ return CalcSumHadE(); };
double FastL1Region::SumHadEt ( ) [inline]

Definition at line 165 of file FastL1Region.h.

References CalcSumHadEt().

{ return CalcSumHadEt(); };

Member Data Documentation

double FastL1Region::EMCrystalEnergy[16][25] [private]
bool FastL1Region::fgBit[16] [private]

Definition at line 235 of file FastL1Region.h.

Referenced by FastL1Region(), FillEMCrystals(), GetFGBit(), and SetFGBit().

bool FastL1Region::hcfgBit[16] [private]

Definition at line 237 of file FastL1Region.h.

Referenced by FastL1Region(), GetHCFGBit(), and SetMIPBit().

bool FastL1Region::hOeBit[16] [private]

Definition at line 236 of file FastL1Region.h.

Referenced by FastL1Region(), GetHOEBit(), and SetHOEBit().

int FastL1Region::id [private]

Definition at line 227 of file FastL1Region.h.

Referenced by GetId().

int FastL1Region::ieta [private]
int FastL1Region::iphi [private]
double FastL1Region::jetE [private]

Definition at line 222 of file FastL1Region.h.

Referenced by FastL1Region(), GetJetE(), and SetJetE().

double FastL1Region::jetE3x3 [private]

Definition at line 224 of file FastL1Region.h.

Referenced by GetJetE3x3(), and SetJetE3x3().

double FastL1Region::jetEt [private]

Definition at line 223 of file FastL1Region.h.

Referenced by FastL1Region(), GetJetEt(), and SetJetEt().

double FastL1Region::jetEt3x3 [private]

Definition at line 225 of file FastL1Region.h.

Referenced by GetJetEt3x3(), and SetJetEt3x3().

bool FastL1Region::mipBit [private]

Definition at line 233 of file FastL1Region.h.

Referenced by FastL1Region(), GetMIPBit(), and SetMIPBit().

bool FastL1Region::quietBit [private]

Definition at line 232 of file FastL1Region.h.

Referenced by FastL1Region(), GetQuietBit(), SetMIPBit(), and SetQuietBit().

double FastL1Region::sumE [private]

Definition at line 240 of file FastL1Region.h.

Referenced by SetRegionEnergy().

double FastL1Region::sumEt [private]

Definition at line 239 of file FastL1Region.h.

Referenced by SetRegionEnergy().

bool FastL1Region::tauBit [private]

Definition at line 231 of file FastL1Region.h.

Referenced by FastL1Region(), GetTauBit(), and SetTauBit().