CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DataFormats/METReco/interface/AnomalousECALVariables.h

Go to the documentation of this file.
00001 #ifndef ANOMALOUSECALVARIABLES_H_
00002 #define ANOMALOUSECALVARIABLES_H_
00003 //DataFormats/AnomalousEcalDataFormats/interface/AnomalousECALVariables.h
00004 // system include files
00005 #include <memory>
00006 
00007 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00008 #include "DataFormats/METReco/interface/BoundaryInformation.h"
00009 
00010 //using namespace edm;
00011 //using namespace std;
00012 /*
00013  * This class summarizes the information about the boundary energy calculated in EcalAnomalousEventFilter:
00014  * 1. next to ECAL border/gap
00015  * 2. next to masked ECAL channels: for each dead area with boundary energy above a threshold defined in the filter
00016  * the vector 'v_enDeadNeighbours_EB' or 'v_enDeadNeighbours_EE' is filled with the calculated boundary energy.
00017  * The determined size of the corresponding cluster is filled in v_enDeadNeighboursNoCells_EB/EE accordingly.
00018  *
00019  */
00020 class AnomalousECALVariables {
00021 
00022    public:
00023       AnomalousECALVariables() {
00024          //energy next to ECAL Gap
00025          v_enNeighboursGap_EB.reserve(50);
00026          v_enNeighboursGap_EE.reserve(50);
00027          v_enNeighboursGap_EB.clear();
00028          v_enNeighboursGap_EE.clear();
00029 
00030          //energy around dead cells
00031          v_boundaryInfoDeadCells_EB = std::vector<BoundaryInformation> ();
00032          v_boundaryInfoDeadCells_EE = std::vector<BoundaryInformation> ();
00033          v_boundaryInfoDeadCells_EB.reserve(50);
00034          v_boundaryInfoDeadCells_EE.reserve(50);
00035          v_boundaryInfoDeadCells_EB.clear();
00036          v_boundaryInfoDeadCells_EE.clear();
00037 
00038       }
00039       ;
00040 
00041       AnomalousECALVariables(std::vector<BoundaryInformation> p_enNeighboursGap_EB,
00042             std::vector<BoundaryInformation> p_enNeighboursGap_EE, std::vector<BoundaryInformation> p_boundaryInfoDeadCells_EB,
00043             std::vector<BoundaryInformation> p_boundaryInfoDeadCells_EE) {
00044 
00045          v_boundaryInfoDeadCells_EB = std::vector<BoundaryInformation> ();
00046          v_boundaryInfoDeadCells_EE = std::vector<BoundaryInformation> ();
00047          v_boundaryInfoDeadCells_EB.reserve(50);
00048          v_boundaryInfoDeadCells_EE.reserve(50);
00049          v_boundaryInfoDeadCells_EB.clear();
00050          v_boundaryInfoDeadCells_EE.clear();
00051          v_boundaryInfoDeadCells_EB = p_boundaryInfoDeadCells_EB;
00052          v_boundaryInfoDeadCells_EE = p_boundaryInfoDeadCells_EE;
00053 
00054          v_enNeighboursGap_EB = p_enNeighboursGap_EB;
00055          v_enNeighboursGap_EE = p_enNeighboursGap_EE;
00056       }
00057       ;
00058 
00059       ~AnomalousECALVariables() {
00060          //cout<<"destructor AnomalousECAL"<<endl;
00061          v_enNeighboursGap_EB.clear();
00062          v_enNeighboursGap_EE.clear();
00063          v_boundaryInfoDeadCells_EB.clear();
00064          v_boundaryInfoDeadCells_EE.clear();
00065       }
00066       ;
00067 
00068       //returns true if at least 1 dead cell area was found in EcalAnomalousEventFilter with
00069       //boundary energy above threshold
00070       //Note: no sense to change this cut BELOW the threshold given in EcalAnomalousEventFilter
00071 
00072       bool isDeadEcalCluster(double maxBoundaryEnergy = 10,
00073             std::vector<int> limitDeadCellToChannelStatusEB = std::vector<int> (), std::vector<int> limitDeadCellToChannelStatusEE =
00074                   std::vector<int> ()) const {
00075 
00076          float highestEnergyDepositAroundDeadCell = 0;
00077 
00078          for (int i = 0; i < (int) v_boundaryInfoDeadCells_EB.size(); ++i) {
00079             BoundaryInformation bInfo = v_boundaryInfoDeadCells_EB[i];
00080 
00081             //check if channel limitation rejectsbInfo
00082             bool passChannelLimitation = false;
00083             std::vector<int> status = bInfo.channelStatus;
00084 
00085             for (int cs = 0; cs < (int) limitDeadCellToChannelStatusEB.size(); ++cs) {
00086                int channelAllowed = limitDeadCellToChannelStatusEB[cs];
00087 
00088                for (std::vector<int>::iterator st_it = status.begin(); st_it != status.end(); ++st_it) {
00089 
00090                   if (channelAllowed == *st_it || (channelAllowed < 0 && abs(channelAllowed) <= *st_it)) {
00091                      passChannelLimitation = true;
00092                      break;
00093                   }
00094                }
00095             }
00096 
00097             if (passChannelLimitation || limitDeadCellToChannelStatusEB.size() == 0) {
00098 
00099                if (bInfo.boundaryEnergy > highestEnergyDepositAroundDeadCell) {
00100                   highestEnergyDepositAroundDeadCell = bInfo.boundaryET;
00101                   //highestEnergyDepositAroundDeadCell = bInfo.boundaryEnergy;
00102                }
00103             }
00104          }
00105 
00106          for (int i = 0; i < (int) v_boundaryInfoDeadCells_EE.size(); ++i) {
00107             BoundaryInformation bInfo = v_boundaryInfoDeadCells_EE[i];
00108 
00109             //check if channel limitation rejectsbInfo
00110             bool passChannelLimitation = false;
00111             std::vector<int> status = bInfo.channelStatus;
00112 
00113             for (int cs = 0; cs < (int) limitDeadCellToChannelStatusEE.size(); ++cs) {
00114                int channelAllowed = limitDeadCellToChannelStatusEE[cs];
00115 
00116                for (std::vector<int>::iterator st_it = status.begin(); st_it != status.end(); ++st_it) {
00117 
00118                   if (channelAllowed == *st_it || (channelAllowed < 0 && abs(channelAllowed) <= *st_it)) {
00119                      passChannelLimitation = true;
00120                      break;
00121                   }
00122                }
00123             }
00124 
00125             if (passChannelLimitation || limitDeadCellToChannelStatusEE.size() == 0) {
00126 
00127                if (bInfo.boundaryEnergy > highestEnergyDepositAroundDeadCell){
00128                   highestEnergyDepositAroundDeadCell = bInfo.boundaryET;
00129                   //highestEnergyDepositAroundDeadCell = bInfo.boundaryEnergy;
00130                }
00131             }
00132          }
00133 
00134          if (highestEnergyDepositAroundDeadCell > maxBoundaryEnergy) {
00135             //            cout << "<<<<<<<<<< List of EB  Boundary objects <<<<<<<<<<" << endl;
00136             //            for (int i = 0; i < (int) v_boundaryInfoDeadCells_EB.size(); ++i) {
00137             //               BoundaryInformation bInfo = v_boundaryInfoDeadCells_EB[i];
00138             //               cout << "no of neighbouring RecHits:" << bInfo.recHits.size() << endl;
00139             //               cout << "no of neighbouring DetIds:" << bInfo.detIds.size() << endl;
00140             //               cout << "boundary energy:" << bInfo.boundaryEnergy << endl;
00141             //               cout << "Channel stati: ";
00142             //               for (std::vector<int>::iterator it = bInfo.channelStatus.begin(); it != bInfo.channelStatus.end(); ++it) {
00143             //                  cout << *it << " ";
00144             //               }
00145             //               cout << endl;
00146             //            }
00147             //            cout << "<<<<<<<<<< List of EE  Boundary objects <<<<<<<<<<" << endl;
00148             //            for (int i = 0; i < (int) v_boundaryInfoDeadCells_EE.size(); ++i) {
00149             //               BoundaryInformation bInfo = v_boundaryInfoDeadCells_EE[i];
00150             //               cout << "no of neighbouring RecHits:" << bInfo.recHits.size() << endl;
00151             //               cout << "no of neighbouring DetIds:" << bInfo.detIds.size() << endl;
00152             //               cout << "boundary energy:" << bInfo.boundaryEnergy << endl;
00153             //               cout << "Channel stati: ";
00154             //               for (std::vector<int>::iterator it = bInfo.channelStatus.begin(); it != bInfo.channelStatus.end(); ++it) {
00155             //                  cout << *it << " ";
00156             //               }
00157             //               cout << endl;
00158             //            }
00159             return true;
00160          } else
00161             return false;
00162       }
00163 
00164       bool isGapEcalCluster(double maxGapEnergyEB = 10, double maxGapEnergyEE = 10) const {
00165 
00166          float highestEnergyDepositAlongGapEB = 0;
00167 
00168          for (int i = 0; i < (int) v_enNeighboursGap_EB.size(); ++i) {
00169             BoundaryInformation gapInfo = v_enNeighboursGap_EB[i];
00170 
00171             if (gapInfo.boundaryEnergy > highestEnergyDepositAlongGapEB){
00172                highestEnergyDepositAlongGapEB = gapInfo.boundaryET;
00173                //highestEnergyDepositAlongGapEB = gapInfo.boundaryEnergy;
00174             }
00175          }
00176 
00177          float highestEnergyDepositAlongGapEE = 0;
00178 
00179          for (int i = 0; i < (int) v_enNeighboursGap_EE.size(); ++i) {
00180             BoundaryInformation gapInfo = v_enNeighboursGap_EE[i];
00181 
00182             if (gapInfo.boundaryEnergy > highestEnergyDepositAlongGapEE){
00183                highestEnergyDepositAlongGapEE = gapInfo.boundaryET;
00184                //highestEnergyDepositAlongGapEE = gapInfo.boundaryEnergy;
00185             }
00186          }
00187 
00188          if (highestEnergyDepositAlongGapEB > maxGapEnergyEB || highestEnergyDepositAlongGapEE > maxGapEnergyEE) {
00189             //            cout << "<<<<<<<<<< List of EB Gap objects <<<<<<<<<<" << endl;
00190             //            for (int i = 0; i < (int) v_enNeighboursGap_EB.size(); ++i) {
00191             //               BoundaryInformation gapInfo = v_enNeighboursGap_EB[i];
00192             //               cout << "no of neighbouring RecHits:" << gapInfo.recHits.size() << endl;
00193             //               cout << "no of neighbouring DetIds:" << gapInfo.detIds.size() << endl;
00194             //               cout << "gap energy:" << gapInfo.boundaryEnergy << endl;
00195             //            }
00196             //            cout << "<<<<<<<<<< List of EE Gap objects <<<<<<<<<<" << endl;
00197             //            for (int i = 0; i < (int) v_enNeighboursGap_EE.size(); ++i) {
00198             //               BoundaryInformation gapInfo = v_enNeighboursGap_EE[i];
00199             //               cout << "no of neighbouring RecHits:" << gapInfo.recHits.size() << endl;
00200             //               cout << "no of neighbouring DetIds:" << gapInfo.detIds.size() << endl;
00201             //               cout << "gap energy:" << gapInfo.boundaryEnergy << endl;
00202             //            }
00203             return true;
00204          } else
00205             return false;
00206       }
00207 
00208       std::vector<BoundaryInformation> v_enNeighboursGap_EB;
00209       std::vector<BoundaryInformation> v_enNeighboursGap_EE;
00210 
00211       std::vector<BoundaryInformation> v_boundaryInfoDeadCells_EB;
00212       std::vector<BoundaryInformation> v_boundaryInfoDeadCells_EE;
00213 
00214    private:
00215 
00216 };
00217 
00218 #endif /*ANOMALOUSECALVARIABLES_H_*/