Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:59:09

0001 // -*- C++ -*
0002 /* 
0003 The function eECALmatrix returns total energy contained in 
0004 NxN crystal matrix for EcalRecHits or PCaloSimHits.
0005 
0006 Inputs : 
0007 1. CaloNavigator at the DetId around which NxN has to be formed
0008 2. The EcalRecHitCollection  and 
0009 3. Number of crystals to be navigated along eta and phi along 
0010    one direction (navigation is done alone +-deta and +-dphi).
0011 
0012 Authors:  Seema Sharma, Sunanda Banerjee
0013 Created: August 2009
0014 */
0015 
0016 #ifndef CalibrationIsolatedParticleseECALMatrix_h
0017 #define CalibrationIsolatedParticleseECALMatrix_h
0018 
0019 // system include files
0020 #include <memory>
0021 #include <map>
0022 #include <vector>
0023 
0024 // user include files
0025 #include "FWCore/Framework/interface/Frameworkfwd.h"
0026 #include "DataFormats/Common/interface/Handle.h"
0027 #include "DataFormats/Candidate/interface/Candidate.h"
0028 #include "DataFormats/DetId/interface/DetId.h"
0029 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0030 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0031 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
0032 #include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h"
0033 
0034 #include "Calibration/IsolatedParticles/interface/MatrixECALDetIds.h"
0035 #include "RecoCaloTools/Navigation/interface/CaloNavigator.h"
0036 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0037 #include "Geometry/CaloTopology/interface/CaloTopology.h"
0038 #include "Geometry/CaloTopology/interface/CaloTowerConstituentsMap.h"
0039 #include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h"
0040 
0041 class EcalSeverityLevelAlgo;
0042 
0043 namespace spr {
0044 
0045   // Energy in NxN crystal matrix
0046   template <typename T>
0047   double eECALmatrix(const DetId& detId,
0048                      edm::Handle<T>& hitsEB,
0049                      edm::Handle<T>& hitsEE,
0050                      const CaloGeometry* geo,
0051                      const CaloTopology* caloTopology,
0052                      int ieta,
0053                      int iphi,
0054                      double ebThr = -100,
0055                      double eeThr = -100,
0056                      double tMin = -500,
0057                      double tMax = 500,
0058                      bool debug = false);
0059 
0060   template <typename T>
0061   double eECALmatrix(const DetId& detId,
0062                      edm::Handle<T>& hitsEB,
0063                      edm::Handle<T>& hitsEE,
0064                      const CaloGeometry* geo,
0065                      const CaloTopology* caloTopology,
0066                      const EcalTrigTowerConstituentsMap& ttMap,
0067                      int ieta,
0068                      int iphi,
0069                      double ebThr = -100,
0070                      double eeThr = -100,
0071                      double tMin = -500,
0072                      double tMax = 500,
0073                      bool debug = false);
0074 
0075   template <typename T>
0076   double eECALmatrix(const DetId& detId,
0077                      edm::Handle<T>& hitsEB,
0078                      edm::Handle<T>& hitsEE,
0079                      const CaloGeometry* geo,
0080                      const CaloTopology* caloTopology,
0081                      int ietaE,
0082                      int ietaW,
0083                      int iphiN,
0084                      int iphiS,
0085                      double ebThr = -100,
0086                      double eeThr = -100,
0087                      double tMin = -500,
0088                      double tMax = 500,
0089                      bool debug = false);
0090 
0091   std::pair<double, bool> eECALmatrix(const DetId& detId,
0092                                       edm::Handle<EcalRecHitCollection>& hitsEB,
0093                                       edm::Handle<EcalRecHitCollection>& hitsEE,
0094                                       const EcalChannelStatus& chStatus,
0095                                       const CaloGeometry* geo,
0096                                       const CaloTopology* caloTopology,
0097                                       const EcalSeverityLevelAlgo* sevlv,
0098                                       int ieta,
0099                                       int iphi,
0100                                       double ebThr = -100,
0101                                       double eeThr = -100,
0102                                       double tMin = -500,
0103                                       double tMax = 500,
0104                                       bool debug = false);
0105 
0106   std::pair<double, bool> eECALmatrix(const DetId& detId,
0107                                       edm::Handle<EcalRecHitCollection>& hitsEB,
0108                                       edm::Handle<EcalRecHitCollection>& hitsEE,
0109                                       const EcalChannelStatus& chStatus,
0110                                       const CaloGeometry* geo,
0111                                       const CaloTopology* caloTopology,
0112                                       const EcalSeverityLevelAlgo* sevlv,
0113                                       const EcalTrigTowerConstituentsMap& ttMap,
0114                                       int ieta,
0115                                       int iphi,
0116                                       double ebThr = -100,
0117                                       double eeThr = -100,
0118                                       double tMin = -500,
0119                                       double tMax = 500,
0120                                       bool debug = false);
0121 
0122   std::pair<double, bool> eECALmatrix(const HcalDetId& detId,
0123                                       edm::Handle<EcalRecHitCollection>& hitsEB,
0124                                       edm::Handle<EcalRecHitCollection>& hitsEE,
0125                                       const CaloGeometry* geo,
0126                                       const CaloTowerConstituentsMap* ctmap,
0127                                       const EcalSeverityLevelAlgo* sevlv,
0128                                       double ebThr = -100,
0129                                       double eeThr = -100,
0130                                       double tMin = -500,
0131                                       double tMax = 500,
0132                                       bool debug = false);
0133 
0134   std::pair<double, bool> eECALmatrix(const DetId& detId,
0135                                       edm::Handle<EcalRecHitCollection>& hitsEB,
0136                                       edm::Handle<EcalRecHitCollection>& hitsEE,
0137                                       const EcalChannelStatus& chStatus,
0138                                       const CaloGeometry* geo,
0139                                       const CaloTopology* caloTopology,
0140                                       const EcalSeverityLevelAlgo* sevlv,
0141                                       const EcalPFRecHitThresholds* eThr,
0142                                       int ieta,
0143                                       int iphi,
0144                                       bool debug = false);
0145 
0146   // returns vector of hits in NxN matrix
0147   template <typename T>
0148   void hitECALmatrix(CaloNavigator<DetId>& navigator,
0149                      edm::Handle<T>& hits,
0150                      int ieta,
0151                      int iphi,
0152                      std::vector<typename T::const_iterator>& hitlist,
0153                      bool debug = false);
0154 
0155   // returns energy deposited from the vector of hits
0156   template <typename T>
0157   double energyECAL(std::vector<DetId>& vdets,
0158                     edm::Handle<T>& hitsEB,
0159                     edm::Handle<T>& hitsEE,
0160                     double ebThr = -100,
0161                     double eeThr = -100,
0162                     double tMin = -500,
0163                     double tMax = 500,
0164                     bool debug = false);
0165 
0166   template <typename T>
0167   double energyECAL(std::vector<DetId>& vdets,
0168                     edm::Handle<T>& hitsEB,
0169                     edm::Handle<T>& hitsEE,
0170                     const EcalTrigTowerConstituentsMap& ttMap,
0171                     double ebThr = -100,
0172                     double eeThr = -100,
0173                     double tMin = -500,
0174                     double tMax = 500,
0175                     bool debug = false);
0176 
0177   // returns energy in the EB/EE tower
0178   template <typename T>
0179   double energyECALTower(const DetId& detId,
0180                          edm::Handle<T>& hitsEB,
0181                          edm::Handle<T>& hitsEE,
0182                          const EcalTrigTowerConstituentsMap& ttMap,
0183                          bool debug = false);
0184 
0185   // Hot Crystal
0186   template <typename T>
0187   DetId hotCrystal(const DetId& detId,
0188                    edm::Handle<T>& hitsEB,
0189                    edm::Handle<T>& hitsEE,
0190                    const CaloGeometry* geo,
0191                    const CaloTopology* caloTopology,
0192                    int ieta,
0193                    int iphi,
0194                    double tMin = -500,
0195                    double tMax = 500,
0196                    bool debug = false);
0197 
0198   template <typename T>
0199   DetId hotCrystal(std::vector<DetId>& detId,
0200                    edm::Handle<T>& hitsEB,
0201                    edm::Handle<T>& hitsEE,
0202                    double tMin = -500,
0203                    double tMax = 500,
0204                    bool debug = false);
0205 
0206   // Energy in NxN crystal matrix
0207   template <typename T>
0208   double eECALmatrix(CaloNavigator<DetId>& navigator, edm::Handle<T>& hits, int ieta, int iphi, bool debug = false);
0209 
0210   template <typename T>
0211   std::vector<std::pair<DetId, double> > eECALmatrixCell(const DetId& detId,
0212                                                          edm::Handle<T>& hitsEB,
0213                                                          edm::Handle<T>& hitsEE,
0214                                                          const CaloGeometry* geo,
0215                                                          const CaloTopology* caloTopology,
0216                                                          int ieta,
0217                                                          int iphi,
0218                                                          double ebThr = -100,
0219                                                          double eeThr = -100,
0220                                                          bool debug = false);
0221 
0222   // Energy in ietaXiphi crystal matrix
0223   template <typename T>
0224   std::pair<double, int> eECALmatrixTotal(const DetId& detId,
0225                                           edm::Handle<T>& hitsEB,
0226                                           edm::Handle<T>& hitsEE,
0227                                           const CaloGeometry* geo,
0228                                           const CaloTopology* caloTopology,
0229                                           int ieta,
0230                                           int iphi,
0231                                           double ebThr = -100,
0232                                           double eeThr = -100,
0233                                           bool debug = false);
0234 
0235   // returns vector of hits in NxN matrix
0236   template <typename T>
0237   std::vector<std::pair<DetId, double> > energyECALCell(std::vector<DetId>& vdets,
0238                                                         edm::Handle<T>& hitsEB,
0239                                                         edm::Handle<T>& hitsEE,
0240                                                         double ebThr = -100,
0241                                                         double eeThr = -100,
0242                                                         bool debug = false);
0243 
0244 }  // namespace spr
0245 
0246 #include "Calibration/IsolatedParticles/interface/eECALMatrix.icc"
0247 
0248 #endif