CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AnomalousECALVariables.h
Go to the documentation of this file.
1 #ifndef ANOMALOUSECALVARIABLES_H_
2 #define ANOMALOUSECALVARIABLES_H_
3 //DataFormats/AnomalousEcalDataFormats/interface/AnomalousECALVariables.h
4 // system include files
5 #include <memory>
6 
9 
10 //using namespace edm;
11 //using namespace std;
12 /*
13  * This class summarizes the information about the boundary energy calculated in EcalAnomalousEventFilter:
14  * 1. next to ECAL border/gap
15  * 2. next to masked ECAL channels: for each dead area with boundary energy above a threshold defined in the filter
16  * the vector 'v_enDeadNeighbours_EB' or 'v_enDeadNeighbours_EE' is filled with the calculated boundary energy.
17  * The determined size of the corresponding cluster is filled in v_enDeadNeighboursNoCells_EB/EE accordingly.
18  *
19  */
21 public:
23  //energy next to ECAL Gap
24  v_enNeighboursGap_EB.reserve(50);
25  v_enNeighboursGap_EE.reserve(50);
26  v_enNeighboursGap_EB.clear();
27  v_enNeighboursGap_EE.clear();
28 
29  //energy around dead cells
30  v_boundaryInfoDeadCells_EB = std::vector<BoundaryInformation>();
31  v_boundaryInfoDeadCells_EE = std::vector<BoundaryInformation>();
32  v_boundaryInfoDeadCells_EB.reserve(50);
33  v_boundaryInfoDeadCells_EE.reserve(50);
35  v_boundaryInfoDeadCells_EE.clear();
36  };
37 
38  AnomalousECALVariables(const std::vector<BoundaryInformation>& p_enNeighboursGap_EB,
39  const std::vector<BoundaryInformation>& p_enNeighboursGap_EE,
40  const std::vector<BoundaryInformation>& p_boundaryInfoDeadCells_EB,
41  const std::vector<BoundaryInformation>& p_boundaryInfoDeadCells_EE) {
42  v_boundaryInfoDeadCells_EB = std::vector<BoundaryInformation>();
43  v_boundaryInfoDeadCells_EE = std::vector<BoundaryInformation>();
44  v_boundaryInfoDeadCells_EB.reserve(50);
45  v_boundaryInfoDeadCells_EE.reserve(50);
47  v_boundaryInfoDeadCells_EE.clear();
48  v_boundaryInfoDeadCells_EB = p_boundaryInfoDeadCells_EB;
49  v_boundaryInfoDeadCells_EE = p_boundaryInfoDeadCells_EE;
50 
51  v_enNeighboursGap_EB = p_enNeighboursGap_EB;
52  v_enNeighboursGap_EE = p_enNeighboursGap_EE;
53  };
54 
56  //cout<<"destructor AnomalousECAL"<<endl;
57  v_enNeighboursGap_EB.clear();
58  v_enNeighboursGap_EE.clear();
61  };
62 
63  //returns true if at least 1 dead cell area was found in EcalAnomalousEventFilter with
64  //boundary energy above threshold
65  //Note: no sense to change this cut BELOW the threshold given in EcalAnomalousEventFilter
66 
67  bool isDeadEcalCluster(double maxBoundaryEnergy = 10,
68  const std::vector<int>& limitDeadCellToChannelStatusEB = std::vector<int>(),
69  const std::vector<int>& limitDeadCellToChannelStatusEE = std::vector<int>()) const {
70  float highestEnergyDepositAroundDeadCell = 0;
71 
72  for (int i = 0; i < (int)v_boundaryInfoDeadCells_EB.size(); ++i) {
74 
75  //check if channel limitation rejectsbInfo
76  bool passChannelLimitation = false;
77  std::vector<int> status = bInfo.channelStatus;
78 
79  for (int cs = 0; cs < (int)limitDeadCellToChannelStatusEB.size(); ++cs) {
80  int channelAllowed = limitDeadCellToChannelStatusEB[cs];
81 
82  for (std::vector<int>::iterator st_it = status.begin(); st_it != status.end(); ++st_it) {
83  if (channelAllowed == *st_it || (channelAllowed < 0 && abs(channelAllowed) <= *st_it)) {
84  passChannelLimitation = true;
85  break;
86  }
87  }
88  }
89 
90  if (passChannelLimitation || limitDeadCellToChannelStatusEB.empty()) {
91  if (bInfo.boundaryEnergy > highestEnergyDepositAroundDeadCell) {
92  highestEnergyDepositAroundDeadCell = bInfo.boundaryET;
93  //highestEnergyDepositAroundDeadCell = bInfo.boundaryEnergy;
94  }
95  }
96  }
97 
98  for (int i = 0; i < (int)v_boundaryInfoDeadCells_EE.size(); ++i) {
100 
101  //check if channel limitation rejectsbInfo
102  bool passChannelLimitation = false;
103  std::vector<int> status = bInfo.channelStatus;
104 
105  for (int cs = 0; cs < (int)limitDeadCellToChannelStatusEE.size(); ++cs) {
106  int channelAllowed = limitDeadCellToChannelStatusEE[cs];
107 
108  for (std::vector<int>::iterator st_it = status.begin(); st_it != status.end(); ++st_it) {
109  if (channelAllowed == *st_it || (channelAllowed < 0 && abs(channelAllowed) <= *st_it)) {
110  passChannelLimitation = true;
111  break;
112  }
113  }
114  }
115 
116  if (passChannelLimitation || limitDeadCellToChannelStatusEE.empty()) {
117  if (bInfo.boundaryEnergy > highestEnergyDepositAroundDeadCell) {
118  highestEnergyDepositAroundDeadCell = bInfo.boundaryET;
119  //highestEnergyDepositAroundDeadCell = bInfo.boundaryEnergy;
120  }
121  }
122  }
123 
124  if (highestEnergyDepositAroundDeadCell > maxBoundaryEnergy) {
125  // cout << "<<<<<<<<<< List of EB Boundary objects <<<<<<<<<<" << endl;
126  // for (int i = 0; i < (int) v_boundaryInfoDeadCells_EB.size(); ++i) {
127  // BoundaryInformation bInfo = v_boundaryInfoDeadCells_EB[i];
128  // cout << "no of neighbouring RecHits:" << bInfo.recHits.size() << endl;
129  // cout << "no of neighbouring DetIds:" << bInfo.detIds.size() << endl;
130  // cout << "boundary energy:" << bInfo.boundaryEnergy << endl;
131  // cout << "Channel stati: ";
132  // for (std::vector<int>::iterator it = bInfo.channelStatus.begin(); it != bInfo.channelStatus.end(); ++it) {
133  // cout << *it << " ";
134  // }
135  // cout << endl;
136  // }
137  // cout << "<<<<<<<<<< List of EE Boundary objects <<<<<<<<<<" << endl;
138  // for (int i = 0; i < (int) v_boundaryInfoDeadCells_EE.size(); ++i) {
139  // BoundaryInformation bInfo = v_boundaryInfoDeadCells_EE[i];
140  // cout << "no of neighbouring RecHits:" << bInfo.recHits.size() << endl;
141  // cout << "no of neighbouring DetIds:" << bInfo.detIds.size() << endl;
142  // cout << "boundary energy:" << bInfo.boundaryEnergy << endl;
143  // cout << "Channel stati: ";
144  // for (std::vector<int>::iterator it = bInfo.channelStatus.begin(); it != bInfo.channelStatus.end(); ++it) {
145  // cout << *it << " ";
146  // }
147  // cout << endl;
148  // }
149  return true;
150  } else
151  return false;
152  }
153 
154  bool isGapEcalCluster(double maxGapEnergyEB = 10, double maxGapEnergyEE = 10) const {
155  float highestEnergyDepositAlongGapEB = 0;
156 
157  for (int i = 0; i < (int)v_enNeighboursGap_EB.size(); ++i) {
159 
160  if (gapInfo.boundaryEnergy > highestEnergyDepositAlongGapEB) {
161  highestEnergyDepositAlongGapEB = gapInfo.boundaryET;
162  //highestEnergyDepositAlongGapEB = gapInfo.boundaryEnergy;
163  }
164  }
165 
166  float highestEnergyDepositAlongGapEE = 0;
167 
168  for (int i = 0; i < (int)v_enNeighboursGap_EE.size(); ++i) {
170 
171  if (gapInfo.boundaryEnergy > highestEnergyDepositAlongGapEE) {
172  highestEnergyDepositAlongGapEE = gapInfo.boundaryET;
173  //highestEnergyDepositAlongGapEE = gapInfo.boundaryEnergy;
174  }
175  }
176 
177  if (highestEnergyDepositAlongGapEB > maxGapEnergyEB || highestEnergyDepositAlongGapEE > maxGapEnergyEE) {
178  // cout << "<<<<<<<<<< List of EB Gap objects <<<<<<<<<<" << endl;
179  // for (int i = 0; i < (int) v_enNeighboursGap_EB.size(); ++i) {
180  // BoundaryInformation gapInfo = v_enNeighboursGap_EB[i];
181  // cout << "no of neighbouring RecHits:" << gapInfo.recHits.size() << endl;
182  // cout << "no of neighbouring DetIds:" << gapInfo.detIds.size() << endl;
183  // cout << "gap energy:" << gapInfo.boundaryEnergy << endl;
184  // }
185  // cout << "<<<<<<<<<< List of EE Gap objects <<<<<<<<<<" << endl;
186  // for (int i = 0; i < (int) v_enNeighboursGap_EE.size(); ++i) {
187  // BoundaryInformation gapInfo = v_enNeighboursGap_EE[i];
188  // cout << "no of neighbouring RecHits:" << gapInfo.recHits.size() << endl;
189  // cout << "no of neighbouring DetIds:" << gapInfo.detIds.size() << endl;
190  // cout << "gap energy:" << gapInfo.boundaryEnergy << endl;
191  // }
192  return true;
193  } else
194  return false;
195  }
196 
197  std::vector<BoundaryInformation> v_enNeighboursGap_EB;
198  std::vector<BoundaryInformation> v_enNeighboursGap_EE;
199 
200  std::vector<BoundaryInformation> v_boundaryInfoDeadCells_EB;
201  std::vector<BoundaryInformation> v_boundaryInfoDeadCells_EE;
202 
203 private:
204 };
205 
206 #endif /*ANOMALOUSECALVARIABLES_H_*/
std::vector< BoundaryInformation > v_enNeighboursGap_EE
unique_ptr< ClusterSequence > cs
list status
Definition: mps_update.py:107
bool isDeadEcalCluster(double maxBoundaryEnergy=10, const std::vector< int > &limitDeadCellToChannelStatusEB=std::vector< int >(), const std::vector< int > &limitDeadCellToChannelStatusEE=std::vector< int >()) const
std::vector< BoundaryInformation > v_boundaryInfoDeadCells_EE
bool isGapEcalCluster(double maxGapEnergyEB=10, double maxGapEnergyEE=10) const
std::vector< BoundaryInformation > v_enNeighboursGap_EB
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< int > channelStatus
AnomalousECALVariables(const std::vector< BoundaryInformation > &p_enNeighboursGap_EB, const std::vector< BoundaryInformation > &p_enNeighboursGap_EE, const std::vector< BoundaryInformation > &p_boundaryInfoDeadCells_EB, const std::vector< BoundaryInformation > &p_boundaryInfoDeadCells_EE)
std::vector< BoundaryInformation > v_boundaryInfoDeadCells_EB