24 Stage1Layer2TauAlgorithmImpPP::Stage1Layer2TauAlgorithmImpPP(
CaloParamsHelper const* params) : params_(params)
31 const std::vector<l1t::CaloRegion> &
regions,
32 std::vector<l1t::Tau> * isoTaus,
33 std::vector<l1t::Tau> *
taus) {
47 std::vector<l1t::CaloRegion> subRegions;
57 std::vector<l1t::Jet> unCorrJets;
61 std::vector<l1t::Tau> preGtTaus;
62 std::vector<l1t::Tau> preSortTaus;
63 std::vector<l1t::Tau> sortedTaus;
64 std::vector<l1t::Tau> preGtIsoTaus;
65 std::vector<l1t::Tau> preSortIsoTaus;
66 std::vector<l1t::Tau> sortedIsoTaus;
69 region != subRegions.end(); region++) {
71 int regionEt = region->hwPt();
72 if(regionEt < tauSeedThreshold)
continue;
74 int regionEta = region->hwEta();
75 if(regionEta < 4 || regionEta > 17)
77 int regionPhi = region->hwPhi();
87 int highestNeighborEt=0;
88 int highestNeighborEta=999;
89 int highestNeighborPhi=999;
90 int highestNeighborTauVeto=999;
94 neighbor != subRegions.end(); neighbor++) {
96 int neighborPhi = neighbor->hwPhi();
97 int neighborEta = neighbor->hwEta();
98 if(neighborEta < 4 || neighborEta > 17)
101 int deltaPhi = regionPhi - neighborPhi;
103 deltaPhi = -deltaPhi/
std::abs(deltaPhi);
108 if (deltaPhi + deltaEta > 0 && deltaPhi + deltaEta < 2) {
109 if (neighbor->hwPt() > highestNeighborEt) {
110 highestNeighborEt = neighbor->hwPt();
111 highestNeighborEta = neighbor->hwEta();
112 highestNeighborPhi = neighbor->hwPhi();
113 int neighborTauVeto = neighbor->hwQual() & 0x1;
114 highestNeighborTauVeto = neighborTauVeto;
120 string NESW =
findNESW(regionEta, regionPhi, highestNeighborEta, highestNeighborPhi);
122 if((tauEt > highestNeighborEt && (NESW==
"isEast" || NESW==
"isNorth"))
123 || (tauEt >= highestNeighborEt && (NESW==
"isSouth" || NESW==
"isWest"))
124 || highestNeighborEt == 0 ) {
126 if (highestNeighborEt >= tauNeighbourThreshold) tauEt += highestNeighborEt;
128 int regionTauVeto = region->hwQual() & 0x1;
131 if (region->hwEta() >= isoTauEtaMin && region->hwEta() <= isoTauEtaMax ){
132 if ((highestNeighborTauVeto == 0 && regionTauVeto == 0) || tauEt > tauMaxPtTauVeto) {
133 bool useIsolLut=
true;
135 int jetEt=
AssociatedJetPt(region->hwEta(), region->hwPhi(),&unCorrJets);
138 unsigned int lutAddress =
isoLutIndex(tauEt,jetEt);
140 if (lutAddress > MAX_LUT_ADDRESS) lutAddress = MAX_LUT_ADDRESS;
147 double jetIsolation =
JetIsolation(tauEt, region->hwEta(), region->hwPhi(), unCorrJets);
148 if (jetIsolation < tauMaxJetIsolationA || (tauEt >= tauMinPtJetIsolationB && jetIsolation < tauMaxJetIsolationB)
149 || (
std::abs(jetIsolation - 999.) < 0.1) ) isoFlag=1;
155 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > tauLorentz(0,0,0,0);
157 l1t::Tau theTau(*&tauLorentz, tauEt, region->hwEta(), region->hwPhi(),
quality, isoFlag);
159 preGtTaus.push_back(theTau);
161 preGtIsoTaus.push_back(theTau);
167 SortTaus(&preSortTaus, &sortedTaus);
168 SortTaus(&preSortIsoTaus, &sortedIsoTaus);
180 const std::vector<l1t::Jet> &
jets)
const {
183 jet != jets.end();
jet++) {
185 if (ieta==
jet->hwEta() && iphi==
jet->hwPhi()){
202 deltaPhi = -deltaPhi/
std::abs(deltaPhi);
210 else if (deltaEta==0) {
228 const std::vector<l1t::Jet> *
jets)
const {
234 itJet != jets->end(); ++itJet){
236 int jetEta = itJet->hwEta();
237 int jetPhi = itJet->hwPhi();
238 if ((jetEta == ieta) && (jetPhi == iphi)){
253 const unsigned int nbitsTau=8;
254 const unsigned int nbitsJet=8;
256 const unsigned int maxJet =
pow(2,nbitsJet)-1;
257 const unsigned int maxTau =
pow(2,nbitsTau)-1;
265 else if (nbitsTau == 7)
269 else if (nbitsTau == 8)
281 else if (nbitsJet == 7)
285 else if (nbitsJet == 8)
291 if (jetPt>maxJet) jetPt=maxJet;
292 if (tauPt>maxTau) tauPt=maxTau;
294 unsigned int address= (jetPt << nbitsTau) + tauPt;
double tauMaxJetIsolationB() const
unsigned int maxSize() const
double tauMaxPtTauVeto() const
void processEvent(const std::vector< l1t::CaloEmCand > &EMCands, const std::vector< l1t::CaloRegion > ®ions, std::vector< l1t::Tau > *isoTaus, std::vector< l1t::Tau > *taus) override
int AssociatedJetPt(int ieta, int iphi, const std::vector< l1t::Jet > *jets) const
double tauMinPtJetIsolationB() const
double tauNeighbourThreshold() const
void TwelveByTwelveFinder(const int, const std::vector< l1t::CaloRegion > *regions, std::vector< l1t::Jet > *uncalibjets)
void SortTaus(std::vector< l1t::Tau > *input, std::vector< l1t::Tau > *output)
static const double deltaEta
void RegionCorrection(const std::vector< l1t::CaloRegion > ®ions, std::vector< l1t::CaloRegion > *subRegions, CaloParamsHelper const *params)
------— New region correction (PUsub, no response correction at the moment) --------— ...
string findNESW(int ieta, int iphi, int neta, int nphi) const
Abs< T >::type abs(const T &t)
unsigned isoLutIndex(unsigned int tauPt, unsigned int jetPt) const
void TauToGtEtaScales(CaloParamsHelper const *params, const std::vector< l1t::Tau > *input, std::vector< l1t::Tau > *output)
et
define resolution functions of each parameter
void TauToGtPtScales(CaloParamsHelper const *params, const std::vector< l1t::Tau > *input, std::vector< l1t::Tau > *output)
double tauSeedThreshold() const
double towerLsbSum() const
double JetIsolation(int et, int ieta, int iphi, const std::vector< l1t::Jet > &jets) const
int data(unsigned int address) const
static const unsigned N_PHI
double jetSeedThreshold() const
l1t::LUT * tauIsolationLUT()
CaloParamsHelper const *const params_
Power< A, B >::type pow(const A &a, const B &b)
std::vector< T >::const_iterator const_iterator
double tauMaxJetIsolationA() const