36 for(
int i=0;
i<16;
i++) {
40 for (
int j=0;
j<25;
j++) {
145 ecItr != ec0->
end(); ++ecItr) {
147 if (ecItr->energy()<ethres)
continue;
149 EBDetId detId = ecItr->detid();
153 int eieta = detId.
ieta();
154 int eiphi = detId.
iphi();
157 crIeta = (eieta-1)%5;
159 crIeta = 4 + (eieta+1)%5;
160 int crIphi = (eiphi - 1)%5;
166 for(
int i=0;
i<16;
i++) {
186 double towerEnergy[16];
188 for(
int i=0;
i<16;
i++) {
213 double maxRecHit=-1.;
214 double maxRecHit2=-1.;
220 ecItr != ec1->
end(); ++ecItr) {
222 if (ecItr->energy()<ethres)
continue;
224 EEDetId detId = ecItr->detid();
228 int hiphi = towerDetId.
iphi();
231 if (maxRecHit<ecItr->
energy()) {
232 maxRecHit = ecItr->energy();
238 std::vector<DetId> westV = calotopo->
west(maxDetId);
239 std::vector<DetId> eastV = calotopo->
east(maxDetId);
240 std::vector<DetId> southV = calotopo->
south(maxDetId);
241 std::vector<DetId> northV = calotopo->
north(maxDetId);
243 ecItr != ec1->
end(); ++ecItr) {
245 if (ecItr->energy()<ethres)
continue;
247 EEDetId detId = ecItr->detid();
251 int hiphi = towerDetId.
iphi();
255 (!westV.empty() && detId==westV[0]) ||
256 (!eastV.empty() && detId==eastV[0]) ||
257 (!northV.empty() && detId==northV[0]) ||
258 (!southV.empty() && detId==southV[0])
260 if (maxRecHit2<ecItr->
energy()) {
261 maxRecHit2 = ecItr->energy();
263 max2En += ecItr->energy();
270 double totE = maxRecHit + maxRecHit2;
274 if (totE/towerEnergy[
i]<eeThres)
fgBit[
i] =
true;
312 double upperThres = 1024.;
318 if ( emet<EThres) emet = 0.;
319 if ( hadet<HThres) hadet = 0.;
354 double emScale = 1.0;
355 double hadScale = 1.0;
367 double emet = emScale * t.
emEt();
368 double hadet = hadScale * t.
hadEt();
369 double eme = emScale * t.
emEnergy();
373 double upperThres = 1024.;
379 if ( emet<EThres) emet = 0.;
380 if ( hadet<HThres) hadet = 0.;
412 for (
int i=0;
i<16;
i++) {
442 for (
int i=0;
i<16;
i++) {
453 fgBit[twrid] = FGBIT;
471 double stripEnergy[16][5];
472 double duostripEnergy[16][4];
473 double towerEnergy[16];
477 for (
int i=0;
i<16;
i++) {
498 for (
int j=0;
j<5;
j++) {
502 for (
int j=0;
j<4;
j++) {
503 duostripEnergy[
i][
j] = stripEnergy[
i][
j] + stripEnergy[
i][
j+1];
506 if ( (duostripEnergy[
i][
j] / towerEnergy[
i]) > ratioCut) {
540 unsigned emEtaPat = 0;
541 unsigned emPhiPat = 0;
542 unsigned hadEtaPat = 0;
543 unsigned hadPhiPat = 0;
548 for (
int i=0;
i<16;
i++) {
549 if(
Towers[
i].emEt() > emThres) {
550 emEtaPat |= (one << (unsigned)(
i%4));
551 emPhiPat |= (one << (unsigned)(
i/4));
554 if(
Towers[
i].hadEt() > hadThres) {
555 hadEtaPat |= (one << (unsigned)(
i%4));
556 hadPhiPat |= (one << (unsigned)(
i/4));
565 static std::vector<unsigned> vetoPatterns;
566 if(vetoPatterns.size() == 0) {
567 vetoPatterns.push_back(5);
568 vetoPatterns.push_back(7);
569 vetoPatterns.push_back(9);
570 vetoPatterns.push_back(10);
571 vetoPatterns.push_back(11);
572 vetoPatterns.push_back(13);
573 vetoPatterns.push_back(14);
574 vetoPatterns.push_back(15);
578 for(std::vector<unsigned>::iterator
i = vetoPatterns.begin();
579 i != vetoPatterns.end();
i++) {
580 unsigned etaPattern = emEtaPat | hadEtaPat;
581 unsigned phiPattern = emPhiPat | hadPhiPat;
584 if(emEtaPat == *
i || emPhiPat == *
i) {
588 if(hadEtaPat == *
i || hadPhiPat == *
i) {
592 if(etaPattern == *
i || phiPattern == *
i)
611 for (
int i=0;
i<16;
i++) {
628 for (
int i=0;
i<16;
i++) {
629 if ( (
Towers[
i].emEt()) > tmpet) {
644 for (
int i=0;
i<16;
i++) {
645 if ( (
Towers[
i].hadEt()) > tmpet) {
659 for (
int i=0;
i<16;
i++) {
671 for (
int i=0;
i<16;
i++) {
682 for (
int i=0;
i<16;
i++) {
693 for (
int i=0;
i<16;
i++) {
705 for (
int i=0;
i<16;
i++) {
715 for (
int i=0;
i<16;
i++) {
722 std::pair<double, double>
736 return std::pair<double, double>(
eta,
phi);
775 {
if (
ieta != 0)
return (
iphi*22 +
ieta-1);
else return 999; }
779 {
if (
ieta != 21)
return (
iphi*22 +
ieta+1);
else return 999; }
801 return (17*22 +
ieta-1);
826 return (17*22 +
ieta+1);
844 const int NUMBER_ETA_VALUES = 11;
845 std::vector< std::vector<float> > m_calibFunc;
847 m_calibFunc.resize(NUMBER_ETA_VALUES);
850 m_calibFunc.at(0).push_back(1);
851 m_calibFunc.at(0).push_back(1);
852 m_calibFunc.at(0).push_back(2);
854 m_calibFunc.at(1).push_back(1);
855 m_calibFunc.at(1).push_back(2);
856 m_calibFunc.at(1).push_back(2);
858 m_calibFunc.at(2).push_back(2);
859 m_calibFunc.at(2).push_back(2);
860 m_calibFunc.at(2).push_back(2);
861 m_calibFunc.at(2).push_back(2);
862 m_calibFunc.at(2).push_back(3);
863 m_calibFunc.at(2).push_back(3);
865 m_calibFunc.at(3).push_back(1);
866 m_calibFunc.at(3).push_back(1);
867 m_calibFunc.at(3).push_back(3);
869 m_calibFunc.at(4).push_back(1);
870 m_calibFunc.at(4).push_back(3);
871 m_calibFunc.at(4).push_back(3);
872 m_calibFunc.at(4).push_back(6);
873 m_calibFunc.at(4).push_back(6);
874 m_calibFunc.at(4).push_back(6);
875 m_calibFunc.at(4).push_back(6);
876 m_calibFunc.at(4).push_back(6);
878 m_calibFunc.at(5).push_back(3);
879 m_calibFunc.at(5).push_back(3);
880 m_calibFunc.at(5).push_back(3);
882 m_calibFunc.at(6).push_back(1);
883 m_calibFunc.at(6).push_back(1);
884 m_calibFunc.at(6).push_back(4);
886 m_calibFunc.at(7).push_back(1);
887 m_calibFunc.at(7).push_back(4);
888 m_calibFunc.at(7).push_back(4);
890 m_calibFunc.at(8).push_back(4);
891 m_calibFunc.at(8).push_back(4);
892 m_calibFunc.at(8).push_back(4);
893 m_calibFunc.at(8).push_back(1);
894 m_calibFunc.at(8).push_back(1);
895 m_calibFunc.at(8).push_back(1);
897 m_calibFunc.at(9).push_back(1);
898 m_calibFunc.at(9).push_back(1);
899 m_calibFunc.at(9).push_back(5);
901 m_calibFunc.at(10).push_back(1);
902 m_calibFunc.at(10).push_back(5);
903 m_calibFunc.at(10).push_back(5);
906 double etabin[12] = { 0.0, 0.348, 0.696, 1.044, 1.392, 1.74, 2.172, 3.0,
907 3.33, 3.839, 4.439, 5.115};
909 for(
int i = 0;
i < 11;
i++){
910 if(
std::abs(eta) >= etabin[
i] && eta < etabin[
i+1])
915 for (
unsigned i=0;
i<m_calibFunc.at(BinID).size();
i++){
916 corrEt += m_calibFunc.at(BinID).at(
i)*
pow(et,(
int)
i);
919 uint16_t jetEtOut = (uint16_t)corrEt;
921 if(jetEtOut < 1024) {
922 return (
double)jetEtOut;
932 double etabin[23] = {-5.115, -4.439, -3.839, -3.33,
933 -3.0, -2.172, -1.74, -1.392, -1.044, -0.696, -0.348,
934 0.0, 0.348, 0.696, 1.044, 1.392, 1.74, 2.172, 3.0,
935 3.33, 3.839, 4.439, 5.115};
939 double domainbin_L[22] = {6.52223337753073373e+00,6.64347505748981959e+00,6.78054870174118296e+00,6.75191887554567405e+00,
940 6.60891660595437802e+00,6.57813476381055473e+00,6.96764764481347232e+00,6.77192746888150943e+00,
941 7.16209661824076260e+00,7.09640803784948027e+00,7.29886808171882517e+00,7.29883431473330546e+00,
942 7.24561741344293875e+00,7.05381822724987995e+00,6.52340799679028827e+00,6.96091042775473401e+00,
943 6.69803071767842262e+00,7.79138848427964259e+00,6.78565437835616603e+00,6.71201461174192904e+00,
944 6.60832257380386334e+00,6.54875448717649267e+00};
946 double domainbin_U[22] = {8.90225568813317558e+00,1.24483653543590922e+01,1.32037091554958987e+01,1.70036104608977681e+01,
947 3.54325008263432011e+01,4.28758696753095450e+01,4.73079850563588025e+01,4.74182802251108981e+01,
948 4.62509826468679748e+01,5.02198002212212913e+01,4.69817029938948352e+01,4.77263481299233732e+01,
949 4.86083837976362076e+01,4.80105593452927337e+01,5.11550616006504200e+01,4.90703092811585861e+01,
950 4.11879629179572788e+01,3.21820720507165845e+01,1.71844078553560529e+01,1.33158534849654764e+01,
951 1.43586396719878149e+01,1.08629843894704248e+01};
953 double A[22] = {2.03682,-4.36824,-4.45258,-6.76524,-22.5984,-24.5289,-24.0313,-22.1896,-21.7818,-22.9882,-20.3321,
954 -21.0595,-22.1007,-22.658,-23.6898,-24.8888,-23.3246,-21.5343,-6.41221,-4.58952,-3.17222,0.637666};
956 double B[22] = {0.226303,0.683099,0.704578,0.704623,0.825928,0.80086,0.766475,0.726059,0.760964,0.792227,0.789188,0.795219,
957 0.781097,0.768022,0.740101,0.774782,0.788106,0.814502,0.686877,0.709556,0.628581,0.317453};
959 double C[22] = {0.00409083,0.000235995,8.22958e-05,2.47567e-05,0.000127995,0.000132914,0.000133342,0.000133035,0.000125993,
960 8.25968e-05,9.94442e-05,9.11652e-05,0.000109351,0.000115883,0.00011112,0.000122559,0.00015868,0.000152601,
961 0.000112927,6.29999e-05,0.000741798,0.00274605};
963 double D[22] = {8.24022,7.55916,7.16448,6.31577,5.96339,5.31203,5.35456,4.95243,5.34809,4.93339,5.05723,5.08575,5.18643,5.15202,
964 4.48249,5.2734,5.51785,8.00182,6.21742,6.96692,7.22975,8.12257};
966 double E[22] = {-0.343598,-0.294067,-0.22529,-0.0718625,0.004164,0.081987,0.124964,0.15006,0.145201,0.182151,0.187525,0.184763,
967 0.170689,0.155268,0.174603,0.133432,0.0719798,-0.0921457,-0.0525274,-0.208415,-0.253542,-0.318476};
969 double F[22] = {0.0171799,0.0202499,0.0186897,0.0115477,0.00603883,0.00446235,0.00363449,0.00318894,0.00361997,0.00341508,
970 0.00366392,0.0036545,0.00352303,0.00349116,0.00294891,0.00353187,0.00460384,0.00711028,0.0109351,0.0182924,
973 for(
int i = 0;
i < 22;
i++){
974 if(eta > etabin[
i] && eta <= etabin[
i+1])
978 if(et >= domainbin_U[BinID]){
979 return 2*(et-A[BinID])/(B[BinID]+
sqrt(B[BinID]*B[BinID]-4*A[BinID]*C[BinID]+4*et*C[BinID]));
981 else if(et > domainbin_L[BinID]){
982 return 2*(et-D[BinID])/(E[BinID]+
sqrt(E[BinID]*E[BinID]-4*D[BinID]*F[BinID]+4*et*F[BinID]));
994 const int nscales = 32;
1002 double scfactor[nscales] = {
1003 1.00,1.01,1.02,1.02,1.02,1.06,1.04,1.04,1.05,1.09,1.10,1.10,1.15,
1004 1.20,1.27,1.29,1.32,1.52,1.52,1.48,1.40,1.32,1.26,1.21,1.17,1.15,
1005 1.15,1.15,1.15,1.15,1.15,1.15};
1017 if (eta>=0 && eta <=28)
1018 return (scfactor[eta]*et);
1029 if (et>=thres)
return thres;
1033 int iEt = (int)(et / LSB);
1034 double ret = (double)iEt * LSB;
1050 double L1CaloEmThresholds[64] = {
1051 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.,
1052 10., 11., 12., 13., 14., 15., 16., 17., 18., 19.,
1053 20., 21., 22., 23., 24., 25., 26., 27., 28., 29.,
1054 30., 31., 32., 33., 34., 35., 36., 37., 38., 39.,
1055 40., 41., 42., 43., 44., 45., 46., 47., 48., 49.,
1056 50., 51., 52., 53., 54., 55., 56., 57., 58., 59.,
1060 double L1CaloJetThresholds[64] = {
1061 0., 10., 12., 14., 15., 18., 20., 22., 24., 25.,
1062 28., 30., 32., 35., 37., 40., 45., 50., 55., 60.,
1063 65., 70., 75., 80., 85., 90., 100., 110., 120., 125.,
1064 130., 140., 150., 160., 170., 175., 180., 190., 200., 215.,
1065 225., 235., 250., 275., 300., 325., 350., 375., 400., 425.,
1066 450., 475., 500., 525., 550., 575., 600., 625., 650., 675.,
1067 700., 725., 750., 775.
1072 double L1CaloThresholds[64];
1074 for (
int i=0;
i<64;
i++)
1075 L1CaloThresholds[
i] = L1CaloEmThresholds[
i];
1077 for (
int i=0;
i<64;
i++)
1078 L1CaloThresholds[
i] = L1CaloJetThresholds[
i];
1083 for (
int i=63;
i>0;
i--) {
1084 if (et>=(L1CaloThresholds[
i])) {
1086 ret = L1CaloThresholds[63];
1103 ret = L1CaloThresholds[
i];
virtual double energy() const GCC11_FINAL
energy
double corrJetEt(double et, double eta)
void SetRegionBits(edm::Event const &e)
std::pair< double, double > getRegionCenterEtaPhi(const edm::EventSetup &c)
void setTauVeto(bool tauVeto)
double corrJetEt2(double et, double eta)
double QuietRegionThreshold
int tower_ieta() const
get the HCAL/trigger ieta of this crystal
int tower_iphi() const
get the HCAL/trigger iphi of this crystal
Geom::Phi< T > phi() const
std::vector< EcalRecHit >::const_iterator const_iterator
void setHighestEtTowerID(int id)
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
void FillEMCrystals(const CaloTowerConstituentsMap *theTowerConstituentsMap, const CaloTopology *calotopo, const CaloGeometry *cGeom, const EcalRecHitCollection *ec0, const EcalRecHitCollection *ec1, FastL1RegionMap *m_RMap)
int iphi() const
get the crystal iphi
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void setHadTauVeto(bool hadTauVeto)
CaloTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
double CrystalEBThreshold
double JetSeedEtThreshold
int iphi() const
get the tower iphi
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
std::vector< DetId > east(const DetId &id) const
Get the neighbors of the given cell in east direction.
double GCTEnergyTrunc(double et, double LSB=1., bool doEM=false)
int ieta() const
get the crystal ieta
void FillTowerZero(const CaloTower &t, int &tid)
std::vector< DetId > north(const DetId &id) const
Get the neighbors of the given cell in north direction.
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
const_iterator end() const
double corrEmEt(double et, int eta)
CaloTowerDetId id() const
void SetParameters(L1Config)
void setIsolationVeto(bool isolationVeto)
CaloTowerCollection Towers
std::vector< DetId > west(const DetId &id) const
Get the neighbors of the given cell in west direction.
void setEmTauVeto(bool emTauVeto)
double EMCrystalEnergy[16][25]
void setHighestHadEtTowerID(int id)
double corrJetEt1(double et, double eta)
edm::SortedCollection< CaloTower > CaloTowerCollection
double CrystalEEThreshold
void SetTauBit(edm::Event const &e)
double RCTEnergyTrunc(double et, double Resol=1., double thres=1024.)
void FillTower(const CaloTower &t, int &tid, edm::ESHandle< CaloGeometry > &cGeom)
int ieta() const
get the tower ieta
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
void FillTower_Scaled(const CaloTower &t, int &tid, bool doRCTTrunc, edm::ESHandle< CaloGeometry > &cGeom)
int HighestHadEtTowerID()
DecomposeProduct< arg, typename Div::arg > D
Power< A, B >::type pow(const A &a, const B &b)
std::vector< DetId > south(const DetId &id) const
Get the neighbors of the given cell in south direction.
void setHighestEmEtTowerID(int id)
const_iterator begin() const