File indexing completed on 2024-04-06 12:04:44
0001 #ifndef ANOMALOUSECALVARIABLES_H_
0002 #define ANOMALOUSECALVARIABLES_H_
0003
0004
0005 #include <memory>
0006
0007 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0008 #include "DataFormats/METReco/interface/BoundaryInformation.h"
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 class AnomalousECALVariables {
0021 public:
0022 AnomalousECALVariables() {
0023
0024 v_enNeighboursGap_EB.reserve(50);
0025 v_enNeighboursGap_EE.reserve(50);
0026 v_enNeighboursGap_EB.clear();
0027 v_enNeighboursGap_EE.clear();
0028
0029
0030 v_boundaryInfoDeadCells_EB = std::vector<BoundaryInformation>();
0031 v_boundaryInfoDeadCells_EE = std::vector<BoundaryInformation>();
0032 v_boundaryInfoDeadCells_EB.reserve(50);
0033 v_boundaryInfoDeadCells_EE.reserve(50);
0034 v_boundaryInfoDeadCells_EB.clear();
0035 v_boundaryInfoDeadCells_EE.clear();
0036 };
0037
0038 AnomalousECALVariables(const std::vector<BoundaryInformation>& p_enNeighboursGap_EB,
0039 const std::vector<BoundaryInformation>& p_enNeighboursGap_EE,
0040 const std::vector<BoundaryInformation>& p_boundaryInfoDeadCells_EB,
0041 const std::vector<BoundaryInformation>& p_boundaryInfoDeadCells_EE) {
0042 v_boundaryInfoDeadCells_EB = std::vector<BoundaryInformation>();
0043 v_boundaryInfoDeadCells_EE = std::vector<BoundaryInformation>();
0044 v_boundaryInfoDeadCells_EB.reserve(50);
0045 v_boundaryInfoDeadCells_EE.reserve(50);
0046 v_boundaryInfoDeadCells_EB.clear();
0047 v_boundaryInfoDeadCells_EE.clear();
0048 v_boundaryInfoDeadCells_EB = p_boundaryInfoDeadCells_EB;
0049 v_boundaryInfoDeadCells_EE = p_boundaryInfoDeadCells_EE;
0050
0051 v_enNeighboursGap_EB = p_enNeighboursGap_EB;
0052 v_enNeighboursGap_EE = p_enNeighboursGap_EE;
0053 };
0054
0055 ~AnomalousECALVariables() {
0056
0057 v_enNeighboursGap_EB.clear();
0058 v_enNeighboursGap_EE.clear();
0059 v_boundaryInfoDeadCells_EB.clear();
0060 v_boundaryInfoDeadCells_EE.clear();
0061 };
0062
0063
0064
0065
0066
0067 bool isDeadEcalCluster(double maxBoundaryEnergy = 10,
0068 const std::vector<int>& limitDeadCellToChannelStatusEB = std::vector<int>(),
0069 const std::vector<int>& limitDeadCellToChannelStatusEE = std::vector<int>()) const {
0070 float highestEnergyDepositAroundDeadCell = 0;
0071
0072 for (int i = 0; i < (int)v_boundaryInfoDeadCells_EB.size(); ++i) {
0073 BoundaryInformation bInfo = v_boundaryInfoDeadCells_EB[i];
0074
0075
0076 bool passChannelLimitation = false;
0077 std::vector<int> status = bInfo.channelStatus;
0078
0079 for (int cs = 0; cs < (int)limitDeadCellToChannelStatusEB.size(); ++cs) {
0080 int channelAllowed = limitDeadCellToChannelStatusEB[cs];
0081
0082 for (std::vector<int>::iterator st_it = status.begin(); st_it != status.end(); ++st_it) {
0083 if (channelAllowed == *st_it || (channelAllowed < 0 && abs(channelAllowed) <= *st_it)) {
0084 passChannelLimitation = true;
0085 break;
0086 }
0087 }
0088 }
0089
0090 if (passChannelLimitation || limitDeadCellToChannelStatusEB.empty()) {
0091 if (bInfo.boundaryEnergy > highestEnergyDepositAroundDeadCell) {
0092 highestEnergyDepositAroundDeadCell = bInfo.boundaryET;
0093
0094 }
0095 }
0096 }
0097
0098 for (int i = 0; i < (int)v_boundaryInfoDeadCells_EE.size(); ++i) {
0099 BoundaryInformation bInfo = v_boundaryInfoDeadCells_EE[i];
0100
0101
0102 bool passChannelLimitation = false;
0103 std::vector<int> status = bInfo.channelStatus;
0104
0105 for (int cs = 0; cs < (int)limitDeadCellToChannelStatusEE.size(); ++cs) {
0106 int channelAllowed = limitDeadCellToChannelStatusEE[cs];
0107
0108 for (std::vector<int>::iterator st_it = status.begin(); st_it != status.end(); ++st_it) {
0109 if (channelAllowed == *st_it || (channelAllowed < 0 && abs(channelAllowed) <= *st_it)) {
0110 passChannelLimitation = true;
0111 break;
0112 }
0113 }
0114 }
0115
0116 if (passChannelLimitation || limitDeadCellToChannelStatusEE.empty()) {
0117 if (bInfo.boundaryEnergy > highestEnergyDepositAroundDeadCell) {
0118 highestEnergyDepositAroundDeadCell = bInfo.boundaryET;
0119
0120 }
0121 }
0122 }
0123
0124 if (highestEnergyDepositAroundDeadCell > maxBoundaryEnergy) {
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149 return true;
0150 } else
0151 return false;
0152 }
0153
0154 bool isGapEcalCluster(double maxGapEnergyEB = 10, double maxGapEnergyEE = 10) const {
0155 float highestEnergyDepositAlongGapEB = 0;
0156
0157 for (int i = 0; i < (int)v_enNeighboursGap_EB.size(); ++i) {
0158 BoundaryInformation gapInfo = v_enNeighboursGap_EB[i];
0159
0160 if (gapInfo.boundaryEnergy > highestEnergyDepositAlongGapEB) {
0161 highestEnergyDepositAlongGapEB = gapInfo.boundaryET;
0162
0163 }
0164 }
0165
0166 float highestEnergyDepositAlongGapEE = 0;
0167
0168 for (int i = 0; i < (int)v_enNeighboursGap_EE.size(); ++i) {
0169 BoundaryInformation gapInfo = v_enNeighboursGap_EE[i];
0170
0171 if (gapInfo.boundaryEnergy > highestEnergyDepositAlongGapEE) {
0172 highestEnergyDepositAlongGapEE = gapInfo.boundaryET;
0173
0174 }
0175 }
0176
0177 if (highestEnergyDepositAlongGapEB > maxGapEnergyEB || highestEnergyDepositAlongGapEE > maxGapEnergyEE) {
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192 return true;
0193 } else
0194 return false;
0195 }
0196
0197 std::vector<BoundaryInformation> v_enNeighboursGap_EB;
0198 std::vector<BoundaryInformation> v_enNeighboursGap_EE;
0199
0200 std::vector<BoundaryInformation> v_boundaryInfoDeadCells_EB;
0201 std::vector<BoundaryInformation> v_boundaryInfoDeadCells_EE;
0202
0203 private:
0204 };
0205
0206 #endif