Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
// -*- C++ -*
/* 
The function eECALmatrix returns total energy contained in 
NxN crystal matrix for EcalRecHits or PCaloSimHits.

Inputs : 
1. CaloNavigator at the DetId around which NxN has to be formed
2. The EcalRecHitCollection  and 
3. Number of crystals to be navigated along eta and phi along 
   one direction (navigation is done alone +-deta and +-dphi).

Authors:  Seema Sharma, Sunanda Banerjee
Created: August 2009
*/

#ifndef CalibrationIsolatedParticleseECALMatrix_h
#define CalibrationIsolatedParticleseECALMatrix_h

// system include files
#include <memory>
#include <map>
#include <vector>

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Candidate/interface/Candidate.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/HcalDetId/interface/HcalDetId.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
#include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h"

#include "Calibration/IsolatedParticles/interface/MatrixECALDetIds.h"
#include "RecoCaloTools/Navigation/interface/CaloNavigator.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/CaloTopology/interface/CaloTopology.h"
#include "Geometry/CaloTopology/interface/CaloTowerConstituentsMap.h"
#include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h"

class EcalSeverityLevelAlgo;

namespace spr {

  // Energy in NxN crystal matrix
  template <typename T>
  double eECALmatrix(const DetId& detId,
                     edm::Handle<T>& hitsEB,
                     edm::Handle<T>& hitsEE,
                     const CaloGeometry* geo,
                     const CaloTopology* caloTopology,
                     int ieta,
                     int iphi,
                     double ebThr = -100,
                     double eeThr = -100,
                     double tMin = -500,
                     double tMax = 500,
                     bool debug = false);

  template <typename T>
  double eECALmatrix(const DetId& detId,
                     edm::Handle<T>& hitsEB,
                     edm::Handle<T>& hitsEE,
                     const CaloGeometry* geo,
                     const CaloTopology* caloTopology,
                     const EcalTrigTowerConstituentsMap& ttMap,
                     int ieta,
                     int iphi,
                     double ebThr = -100,
                     double eeThr = -100,
                     double tMin = -500,
                     double tMax = 500,
                     bool debug = false);

  template <typename T>
  double eECALmatrix(const DetId& detId,
                     edm::Handle<T>& hitsEB,
                     edm::Handle<T>& hitsEE,
                     const CaloGeometry* geo,
                     const CaloTopology* caloTopology,
                     int ietaE,
                     int ietaW,
                     int iphiN,
                     int iphiS,
                     double ebThr = -100,
                     double eeThr = -100,
                     double tMin = -500,
                     double tMax = 500,
                     bool debug = false);

  std::pair<double, bool> eECALmatrix(const DetId& detId,
                                      edm::Handle<EcalRecHitCollection>& hitsEB,
                                      edm::Handle<EcalRecHitCollection>& hitsEE,
                                      const EcalChannelStatus& chStatus,
                                      const CaloGeometry* geo,
                                      const CaloTopology* caloTopology,
                                      const EcalSeverityLevelAlgo* sevlv,
                                      int ieta,
                                      int iphi,
                                      double ebThr = -100,
                                      double eeThr = -100,
                                      double tMin = -500,
                                      double tMax = 500,
                                      bool debug = false);

  std::pair<double, bool> eECALmatrix(const DetId& detId,
                                      edm::Handle<EcalRecHitCollection>& hitsEB,
                                      edm::Handle<EcalRecHitCollection>& hitsEE,
                                      const EcalChannelStatus& chStatus,
                                      const CaloGeometry* geo,
                                      const CaloTopology* caloTopology,
                                      const EcalSeverityLevelAlgo* sevlv,
                                      const EcalTrigTowerConstituentsMap& ttMap,
                                      int ieta,
                                      int iphi,
                                      double ebThr = -100,
                                      double eeThr = -100,
                                      double tMin = -500,
                                      double tMax = 500,
                                      bool debug = false);

  std::pair<double, bool> eECALmatrix(const HcalDetId& detId,
                                      edm::Handle<EcalRecHitCollection>& hitsEB,
                                      edm::Handle<EcalRecHitCollection>& hitsEE,
                                      const CaloGeometry* geo,
                                      const CaloTowerConstituentsMap* ctmap,
                                      const EcalSeverityLevelAlgo* sevlv,
                                      double ebThr = -100,
                                      double eeThr = -100,
                                      double tMin = -500,
                                      double tMax = 500,
                                      bool debug = false);

  std::pair<double, bool> eECALmatrix(const DetId& detId,
                                      edm::Handle<EcalRecHitCollection>& hitsEB,
                                      edm::Handle<EcalRecHitCollection>& hitsEE,
                                      const EcalChannelStatus& chStatus,
                                      const CaloGeometry* geo,
                                      const CaloTopology* caloTopology,
                                      const EcalSeverityLevelAlgo* sevlv,
                                      const EcalPFRecHitThresholds* eThr,
                                      int ieta,
                                      int iphi,
                                      bool debug = false);

  // returns vector of hits in NxN matrix
  template <typename T>
  void hitECALmatrix(CaloNavigator<DetId>& navigator,
                     edm::Handle<T>& hits,
                     int ieta,
                     int iphi,
                     std::vector<typename T::const_iterator>& hitlist,
                     bool debug = false);

  // returns energy deposited from the vector of hits
  template <typename T>
  double energyECAL(std::vector<DetId>& vdets,
                    edm::Handle<T>& hitsEB,
                    edm::Handle<T>& hitsEE,
                    double ebThr = -100,
                    double eeThr = -100,
                    double tMin = -500,
                    double tMax = 500,
                    bool debug = false);

  template <typename T>
  double energyECAL(std::vector<DetId>& vdets,
                    edm::Handle<T>& hitsEB,
                    edm::Handle<T>& hitsEE,
                    const EcalTrigTowerConstituentsMap& ttMap,
                    double ebThr = -100,
                    double eeThr = -100,
                    double tMin = -500,
                    double tMax = 500,
                    bool debug = false);

  // returns energy in the EB/EE tower
  template <typename T>
  double energyECALTower(const DetId& detId,
                         edm::Handle<T>& hitsEB,
                         edm::Handle<T>& hitsEE,
                         const EcalTrigTowerConstituentsMap& ttMap,
                         bool debug = false);

  // Hot Crystal
  template <typename T>
  DetId hotCrystal(const DetId& detId,
                   edm::Handle<T>& hitsEB,
                   edm::Handle<T>& hitsEE,
                   const CaloGeometry* geo,
                   const CaloTopology* caloTopology,
                   int ieta,
                   int iphi,
                   double tMin = -500,
                   double tMax = 500,
                   bool debug = false);

  template <typename T>
  DetId hotCrystal(std::vector<DetId>& detId,
                   edm::Handle<T>& hitsEB,
                   edm::Handle<T>& hitsEE,
                   double tMin = -500,
                   double tMax = 500,
                   bool debug = false);

  // Energy in NxN crystal matrix
  template <typename T>
  double eECALmatrix(CaloNavigator<DetId>& navigator, edm::Handle<T>& hits, int ieta, int iphi, bool debug = false);

  template <typename T>
  std::vector<std::pair<DetId, double> > eECALmatrixCell(const DetId& detId,
                                                         edm::Handle<T>& hitsEB,
                                                         edm::Handle<T>& hitsEE,
                                                         const CaloGeometry* geo,
                                                         const CaloTopology* caloTopology,
                                                         int ieta,
                                                         int iphi,
                                                         double ebThr = -100,
                                                         double eeThr = -100,
                                                         bool debug = false);

  // Energy in ietaXiphi crystal matrix
  template <typename T>
  std::pair<double, int> eECALmatrixTotal(const DetId& detId,
                                          edm::Handle<T>& hitsEB,
                                          edm::Handle<T>& hitsEE,
                                          const CaloGeometry* geo,
                                          const CaloTopology* caloTopology,
                                          int ieta,
                                          int iphi,
                                          double ebThr = -100,
                                          double eeThr = -100,
                                          bool debug = false);

  // returns vector of hits in NxN matrix
  template <typename T>
  std::vector<std::pair<DetId, double> > energyECALCell(std::vector<DetId>& vdets,
                                                        edm::Handle<T>& hitsEB,
                                                        edm::Handle<T>& hitsEE,
                                                        double ebThr = -100,
                                                        double eeThr = -100,
                                                        bool debug = false);

}  // namespace spr

#include "Calibration/IsolatedParticles/interface/eECALMatrix.icc"

#endif