CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
22  public:
24  //energy next to ECAL Gap
25  v_enNeighboursGap_EB.reserve(50);
26  v_enNeighboursGap_EE.reserve(50);
27  v_enNeighboursGap_EB.clear();
28  v_enNeighboursGap_EE.clear();
29 
30  //energy around dead cells
31  v_boundaryInfoDeadCells_EB = std::vector<BoundaryInformation> ();
32  v_boundaryInfoDeadCells_EE = std::vector<BoundaryInformation> ();
33  v_boundaryInfoDeadCells_EB.reserve(50);
34  v_boundaryInfoDeadCells_EE.reserve(50);
36  v_boundaryInfoDeadCells_EE.clear();
37 
38  }
39  ;
40 
41  AnomalousECALVariables(std::vector<BoundaryInformation> p_enNeighboursGap_EB,
42  std::vector<BoundaryInformation> p_enNeighboursGap_EE, std::vector<BoundaryInformation> p_boundaryInfoDeadCells_EB,
43  std::vector<BoundaryInformation> p_boundaryInfoDeadCells_EE) {
44 
45  v_boundaryInfoDeadCells_EB = std::vector<BoundaryInformation> ();
46  v_boundaryInfoDeadCells_EE = std::vector<BoundaryInformation> ();
47  v_boundaryInfoDeadCells_EB.reserve(50);
48  v_boundaryInfoDeadCells_EE.reserve(50);
50  v_boundaryInfoDeadCells_EE.clear();
51  v_boundaryInfoDeadCells_EB = p_boundaryInfoDeadCells_EB;
52  v_boundaryInfoDeadCells_EE = p_boundaryInfoDeadCells_EE;
53 
54  v_enNeighboursGap_EB = p_enNeighboursGap_EB;
55  v_enNeighboursGap_EE = p_enNeighboursGap_EE;
56  }
57  ;
58 
60  //cout<<"destructor AnomalousECAL"<<endl;
61  v_enNeighboursGap_EB.clear();
62  v_enNeighboursGap_EE.clear();
65  }
66  ;
67 
68  //returns true if at least 1 dead cell area was found in EcalAnomalousEventFilter with
69  //boundary energy above threshold
70  //Note: no sense to change this cut BELOW the threshold given in EcalAnomalousEventFilter
71 
72  bool isDeadEcalCluster(double maxBoundaryEnergy = 10,
73  std::vector<int> limitDeadCellToChannelStatusEB = std::vector<int> (), std::vector<int> limitDeadCellToChannelStatusEE =
74  std::vector<int> ()) const {
75 
76  float highestEnergyDepositAroundDeadCell = 0;
77 
78  for (int i = 0; i < (int) v_boundaryInfoDeadCells_EB.size(); ++i) {
80 
81  //check if channel limitation rejectsbInfo
82  bool passChannelLimitation = false;
83  std::vector<int> status = bInfo.channelStatus;
84 
85  for (int cs = 0; cs < (int) limitDeadCellToChannelStatusEB.size(); ++cs) {
86  int channelAllowed = limitDeadCellToChannelStatusEB[cs];
87 
88  for (std::vector<int>::iterator st_it = status.begin(); st_it != status.end(); ++st_it) {
89 
90  if (channelAllowed == *st_it || (channelAllowed < 0 && abs(channelAllowed) <= *st_it)) {
91  passChannelLimitation = true;
92  break;
93  }
94  }
95  }
96 
97  if (passChannelLimitation || limitDeadCellToChannelStatusEB.size() == 0) {
98 
99  if (bInfo.boundaryEnergy > highestEnergyDepositAroundDeadCell) {
100  highestEnergyDepositAroundDeadCell = bInfo.boundaryET;
101  //highestEnergyDepositAroundDeadCell = bInfo.boundaryEnergy;
102  }
103  }
104  }
105 
106  for (int i = 0; i < (int) v_boundaryInfoDeadCells_EE.size(); ++i) {
108 
109  //check if channel limitation rejectsbInfo
110  bool passChannelLimitation = false;
111  std::vector<int> status = bInfo.channelStatus;
112 
113  for (int cs = 0; cs < (int) limitDeadCellToChannelStatusEE.size(); ++cs) {
114  int channelAllowed = limitDeadCellToChannelStatusEE[cs];
115 
116  for (std::vector<int>::iterator st_it = status.begin(); st_it != status.end(); ++st_it) {
117 
118  if (channelAllowed == *st_it || (channelAllowed < 0 && abs(channelAllowed) <= *st_it)) {
119  passChannelLimitation = true;
120  break;
121  }
122  }
123  }
124 
125  if (passChannelLimitation || limitDeadCellToChannelStatusEE.size() == 0) {
126 
127  if (bInfo.boundaryEnergy > highestEnergyDepositAroundDeadCell){
128  highestEnergyDepositAroundDeadCell = bInfo.boundaryET;
129  //highestEnergyDepositAroundDeadCell = bInfo.boundaryEnergy;
130  }
131  }
132  }
133 
134  if (highestEnergyDepositAroundDeadCell > maxBoundaryEnergy) {
135  // cout << "<<<<<<<<<< List of EB Boundary objects <<<<<<<<<<" << endl;
136  // for (int i = 0; i < (int) v_boundaryInfoDeadCells_EB.size(); ++i) {
137  // BoundaryInformation bInfo = v_boundaryInfoDeadCells_EB[i];
138  // cout << "no of neighbouring RecHits:" << bInfo.recHits.size() << endl;
139  // cout << "no of neighbouring DetIds:" << bInfo.detIds.size() << endl;
140  // cout << "boundary energy:" << bInfo.boundaryEnergy << endl;
141  // cout << "Channel stati: ";
142  // for (std::vector<int>::iterator it = bInfo.channelStatus.begin(); it != bInfo.channelStatus.end(); ++it) {
143  // cout << *it << " ";
144  // }
145  // cout << endl;
146  // }
147  // cout << "<<<<<<<<<< List of EE Boundary objects <<<<<<<<<<" << endl;
148  // for (int i = 0; i < (int) v_boundaryInfoDeadCells_EE.size(); ++i) {
149  // BoundaryInformation bInfo = v_boundaryInfoDeadCells_EE[i];
150  // cout << "no of neighbouring RecHits:" << bInfo.recHits.size() << endl;
151  // cout << "no of neighbouring DetIds:" << bInfo.detIds.size() << endl;
152  // cout << "boundary energy:" << bInfo.boundaryEnergy << endl;
153  // cout << "Channel stati: ";
154  // for (std::vector<int>::iterator it = bInfo.channelStatus.begin(); it != bInfo.channelStatus.end(); ++it) {
155  // cout << *it << " ";
156  // }
157  // cout << endl;
158  // }
159  return true;
160  } else
161  return false;
162  }
163 
164  bool isGapEcalCluster(double maxGapEnergyEB = 10, double maxGapEnergyEE = 10) const {
165 
166  float highestEnergyDepositAlongGapEB = 0;
167 
168  for (int i = 0; i < (int) v_enNeighboursGap_EB.size(); ++i) {
170 
171  if (gapInfo.boundaryEnergy > highestEnergyDepositAlongGapEB){
172  highestEnergyDepositAlongGapEB = gapInfo.boundaryET;
173  //highestEnergyDepositAlongGapEB = gapInfo.boundaryEnergy;
174  }
175  }
176 
177  float highestEnergyDepositAlongGapEE = 0;
178 
179  for (int i = 0; i < (int) v_enNeighboursGap_EE.size(); ++i) {
181 
182  if (gapInfo.boundaryEnergy > highestEnergyDepositAlongGapEE){
183  highestEnergyDepositAlongGapEE = gapInfo.boundaryET;
184  //highestEnergyDepositAlongGapEE = gapInfo.boundaryEnergy;
185  }
186  }
187 
188  if (highestEnergyDepositAlongGapEB > maxGapEnergyEB || highestEnergyDepositAlongGapEE > maxGapEnergyEE) {
189  // cout << "<<<<<<<<<< List of EB Gap objects <<<<<<<<<<" << endl;
190  // for (int i = 0; i < (int) v_enNeighboursGap_EB.size(); ++i) {
191  // BoundaryInformation gapInfo = v_enNeighboursGap_EB[i];
192  // cout << "no of neighbouring RecHits:" << gapInfo.recHits.size() << endl;
193  // cout << "no of neighbouring DetIds:" << gapInfo.detIds.size() << endl;
194  // cout << "gap energy:" << gapInfo.boundaryEnergy << endl;
195  // }
196  // cout << "<<<<<<<<<< List of EE Gap objects <<<<<<<<<<" << endl;
197  // for (int i = 0; i < (int) v_enNeighboursGap_EE.size(); ++i) {
198  // BoundaryInformation gapInfo = v_enNeighboursGap_EE[i];
199  // cout << "no of neighbouring RecHits:" << gapInfo.recHits.size() << endl;
200  // cout << "no of neighbouring DetIds:" << gapInfo.detIds.size() << endl;
201  // cout << "gap energy:" << gapInfo.boundaryEnergy << endl;
202  // }
203  return true;
204  } else
205  return false;
206  }
207 
208  std::vector<BoundaryInformation> v_enNeighboursGap_EB;
209  std::vector<BoundaryInformation> v_enNeighboursGap_EE;
210 
211  std::vector<BoundaryInformation> v_boundaryInfoDeadCells_EB;
212  std::vector<BoundaryInformation> v_boundaryInfoDeadCells_EE;
213 
214  private:
215 
216 };
217 
218 #endif /*ANOMALOUSECALVARIABLES_H_*/
int i
Definition: DBlmapReader.cc:9
std::vector< BoundaryInformation > v_enNeighboursGap_EE
auto_ptr< ClusterSequence > cs
#define abs(x)
Definition: mlp_lapack.h:159
std::vector< BoundaryInformation > v_boundaryInfoDeadCells_EE
bool isGapEcalCluster(double maxGapEnergyEB=10, double maxGapEnergyEE=10) const
std::vector< BoundaryInformation > v_enNeighboursGap_EB
std::vector< int > channelStatus
std::vector< BoundaryInformation > v_boundaryInfoDeadCells_EB
AnomalousECALVariables(std::vector< BoundaryInformation > p_enNeighboursGap_EB, std::vector< BoundaryInformation > p_enNeighboursGap_EE, std::vector< BoundaryInformation > p_boundaryInfoDeadCells_EB, std::vector< BoundaryInformation > p_boundaryInfoDeadCells_EE)
bool isDeadEcalCluster(double maxBoundaryEnergy=10, std::vector< int > limitDeadCellToChannelStatusEB=std::vector< int >(), std::vector< int > limitDeadCellToChannelStatusEE=std::vector< int >()) const
tuple status
Definition: ntuplemaker.py:245