File indexing completed on 2024-04-06 12:20:26
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "L1Trigger/L1TCalorimeter/interface/PUSubtractionMethods.h"
0010 #include "TMath.h"
0011
0012
0013 #include <vector>
0014
0015 namespace l1t {
0016
0017
0018 void HICaloRingSubtraction(const std::vector<l1t::CaloRegion> ®ions,
0019 std::vector<l1t::CaloRegion> *subRegions,
0020 CaloParamsHelper const *params) {
0021 int puLevelHI[L1CaloRegionDetId::N_ETA];
0022
0023 for (unsigned i = 0; i < L1CaloRegionDetId::N_ETA; ++i) {
0024 puLevelHI[i] = 0;
0025 }
0026
0027 for (std::vector<CaloRegion>::const_iterator region = regions.begin(); region != regions.end(); region++) {
0028 puLevelHI[region->hwEta()] += region->hwPt();
0029 }
0030
0031 for (unsigned i = 0; i < L1CaloRegionDetId::N_ETA; ++i) {
0032
0033 puLevelHI[i] = (puLevelHI[i] + 9) * 455 / (1 << 13);
0034 }
0035
0036 for (std::vector<CaloRegion>::const_iterator region = regions.begin(); region != regions.end(); region++) {
0037 int subPt = std::max(0, region->hwPt() - puLevelHI[region->hwEta()]);
0038 int subEta = region->hwEta();
0039 int subPhi = region->hwPhi();
0040
0041 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0, 0, 0, 0);
0042
0043 CaloRegion newSubRegion(
0044 *&ldummy, 0, 0, subPt, subEta, subPhi, region->hwQual(), region->hwEtEm(), region->hwEtHad());
0045 subRegions->push_back(newSubRegion);
0046 }
0047 }
0048
0049 void simpleHWSubtraction(const std::vector<l1t::CaloRegion> ®ions, std::vector<l1t::CaloRegion> *subRegions) {
0050 for (std::vector<CaloRegion>::const_iterator region = regions.begin(); region != regions.end(); region++) {
0051 int subEta = region->hwEta();
0052 int subPhi = region->hwPhi();
0053 int subPt = region->hwPt();
0054
0055 if (subPt != (2 << 10) - 1)
0056 subPt = subPt - (10 + subEta);
0057 if (subPt < 0)
0058 subPt = 0;
0059 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > ldummy(0, 0, 0, 0);
0060
0061 CaloRegion newSubRegion(
0062 *&ldummy, 0, 0, subPt, subEta, subPhi, region->hwQual(), region->hwEtEm(), region->hwEtHad());
0063 subRegions->push_back(newSubRegion);
0064 }
0065 }
0066
0067
0068
0069 void RegionCorrection(const std::vector<l1t::CaloRegion> ®ions,
0070 std::vector<l1t::CaloRegion> *subRegions,
0071 CaloParamsHelper const *params) {
0072 std::string regionPUSType = params->regionPUSType();
0073
0074 if (regionPUSType == "None") {
0075 for (std::vector<CaloRegion>::const_iterator notCorrectedRegion = regions.begin();
0076 notCorrectedRegion != regions.end();
0077 notCorrectedRegion++) {
0078 const CaloRegion &newSubRegion = *notCorrectedRegion;
0079 subRegions->push_back(newSubRegion);
0080 }
0081 }
0082
0083 if (regionPUSType == "HICaloRingSub") {
0084 HICaloRingSubtraction(regions, subRegions, params);
0085 }
0086
0087 if (regionPUSType == "PUM0") {
0088 int puMult = 0;
0089
0090
0091 for (std::vector<CaloRegion>::const_iterator notCorrectedRegion = regions.begin();
0092 notCorrectedRegion != regions.end();
0093 notCorrectedRegion++) {
0094 int regionET = notCorrectedRegion->hwPt();
0095 if (regionET > 0) {
0096 puMult++;
0097 }
0098 }
0099 int pumbin = (int)puMult / 22;
0100 if (pumbin == 18)
0101 pumbin = 17;
0102
0103 for (std::vector<CaloRegion>::const_iterator notCorrectedRegion = regions.begin();
0104 notCorrectedRegion != regions.end();
0105 notCorrectedRegion++) {
0106 int regionET = notCorrectedRegion->hwPt();
0107 int regionEta = notCorrectedRegion->hwEta();
0108 int regionPhi = notCorrectedRegion->hwPhi();
0109
0110
0111 int puSub = params->regionPUSValue(pumbin, regionEta);
0112
0113
0114
0115
0116
0117 int regionEtCorr = std::max(0, regionET - puSub);
0118 if (regionET == 1023)
0119 regionEtCorr = 1023;
0120 if ((regionET == 255) && (regionEta < 4 || regionEta > 17))
0121 regionEtCorr = 255;
0122
0123 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > lorentz(0, 0, 0, 0);
0124 CaloRegion newSubRegion(*&lorentz,
0125 0,
0126 0,
0127 regionEtCorr,
0128 regionEta,
0129 regionPhi,
0130 notCorrectedRegion->hwQual(),
0131 notCorrectedRegion->hwEtEm(),
0132 notCorrectedRegion->hwEtHad());
0133 subRegions->push_back(newSubRegion);
0134 }
0135 }
0136 }
0137 }