Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:14:45

0001 #ifndef Geometry_HcalTowerAlgo_HcalDDDSimConstants_h
0002 #define Geometry_HcalTowerAlgo_HcalDDDSimConstants_h
0003 
0004 /** \class HcalDDDSimConstants
0005  *
0006  * this class reads the constant section of
0007  * the hcal-sim-numbering xml-file
0008  *  
0009  * \author Sunanda Banerjee, SINP <sunanda.banerjee@cern.ch>
0010  *
0011  */
0012 
0013 #include <string>
0014 #include <vector>
0015 #include <iostream>
0016 #include <iomanip>
0017 
0018 #include "CondFormats/GeometryObjects/interface/HcalParameters.h"
0019 #include "Geometry/HcalCommonData/interface/HcalCellType.h"
0020 #include "Geometry/HcalCommonData/interface/HcalLayerDepthMap.h"
0021 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0022 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0023 
0024 class HcalDDDSimConstants {
0025 public:
0026   HcalDDDSimConstants(const HcalParameters* hp);
0027   ~HcalDDDSimConstants();
0028 
0029   HcalCellType::HcalCell cell(
0030       const int& det, const int& zside, const int& depth, const int& etaR, const int& iphi) const;
0031   int findDepth(const int& det, const int& eta, const int& phi, const int& zside, const int& lay) const;
0032   unsigned int findLayer(const int& layer, const std::vector<HcalParameters::LayerItem>& layerGroup) const;
0033   std::vector<std::pair<double, double> > getConstHBHE(const int& type) const;
0034   int getDepthEta16(const int& det, const int& phi, const int& zside) const;
0035   int getDepthEta16M(const int& det) const;
0036   int getDepthEta29(const int& phi, const int& zside, const int& i) const;
0037   int getDepthEta29M(const int& i, const bool& planOne) const;
0038   std::pair<int, double> getDetEta(const double& eta, const int& depth) const;
0039   int getEta(const int& det, const int& lay, const double& hetaR) const;
0040   std::pair<int, int> getEtaDepth(
0041       const int& det, int etaR, const int& phi, const int& zside, int depth, const int& lay) const;
0042   double getEtaHO(const double& etaR, const double& x, const double& y, const double& z) const;
0043   std::pair<int, int> getiEtaRange(const int& i) const { return std::pair<int, int>(hpar->etaMin[i], hpar->etaMax[i]); }
0044   const std::vector<double>& getEtaTableHF() const { return hpar->etaTableHF; }
0045   const std::vector<double>& getGparHF() const { return hpar->gparHF; }
0046   const std::vector<HcalDetId>& getIdHF2QIE() const { return idHF2QIE; }
0047   double getLayer0Wt(const int& det, const int& phi, const int& zside) const;
0048   int getFrontLayer(const int& det, const int& eta) const;
0049   int getLastLayer(const int& det, const int& eta) const;
0050   int getLayerFront(const int& det, const int& eta, const int& phi, const int& zside, const int& depth) const;
0051   int getLayerBack(const int& det, const int& eta, const int& phi, const int& zside, const int& depth) const;
0052   int getLayerMax(const int& eta, const int& depth) const;
0053   int getMaxDepth(const int& type) const { return maxDepth[type]; }
0054   int getMaxDepth(const int& det, const int& eta, const int& phi, const int& zside, const bool& partialOnly) const;
0055   std::pair<int, int> getMaxDepthDet(const int& i) const { return ((i == 1) ? depthMaxDf_ : depthMaxSp_); }
0056   int getMinDepth(const int& det, const int& eta, const int& phi, const int& zside, const bool& partialOnly) const;
0057   std::pair<int, int> getModHalfHBHE(const int& type) const;
0058   std::pair<double, double> getPhiCons(const int& det, const int& ieta) const;
0059   std::vector<std::pair<int, double> > getPhis(const int& subdet, const int& ieta) const;
0060   const std::vector<double>& getPhiTableHF() const { return hpar->phitable; }
0061   const std::vector<double>& getRTableHF() const { return hpar->rTable; }
0062   std::vector<HcalCellType> HcalCellTypes() const;
0063   std::vector<HcalCellType> HcalCellTypes(const HcalSubdetector&, int ieta = -1, int depth = -1) const;
0064   bool isBH() const { return isBH_; }
0065   bool isHE() const { return (hpar->etaMax[1] > hpar->etaMin[1]); }
0066   const HcalLayerDepthMap* ldMap() const { return &ldmap_; }
0067   int maxHFDepth(const int& ieta, const int& iphi) const;
0068   unsigned int numberOfCells(const HcalSubdetector&) const;
0069   const HcalParameters* parameter() const { return hpar; }
0070   int phiNumber(const int& phi, const int& unit) const;
0071   void printTiles() const;
0072   int unitPhi(const int& det, const int& etaR) const;
0073   int unitPhi(const double& dphi) const;
0074 
0075 private:
0076   static const int nDepthMax = 9;
0077   static const int maxLayer_ = 18;
0078   static const int maxLayerHB_ = 16;
0079 
0080   void initialize();
0081   double deltaEta(const int& det, const int& eta, const int& depth) const;
0082   double getEta(const int& det, const int& etaR, const int& zside, int depth = 1) const;
0083   double getEta(const double& r, const double& z) const;
0084   int getShift(const HcalSubdetector& subdet, const int& depth) const;
0085   double getGain(const HcalSubdetector& subdet, const int& depth) const;
0086   void printTileHB(const int& eta, const int& phi, const int& zside, const int& depth) const;
0087   void printTileHE(const int& eta, const int& phi, const int& zside, const int& depth) const;
0088   unsigned int layerGroupSize(int eta) const;
0089   unsigned int layerGroup(int eta, int i) const;
0090   unsigned int layerGroup(int det, int eta, int phi, int zside, int i) const;
0091 
0092   const HcalParameters* hpar;
0093   HcalLayerDepthMap ldmap_;
0094 
0095   std::vector<int> maxDepth;                     // Maximum depths in HB/HE/HF/HO
0096   int nEta;                                      // Number of bins in eta for HB and HE
0097   int nR;                                        // Number of bins in r
0098   int nPhiF;                                     // Number of bins in phitable
0099   std::vector<int> depths[nDepthMax];            // Maximum layer number for a depth
0100   int nDepth;                                    // Number of bins in depth0
0101   int nzHB, nmodHB;                              // Number of halves and modules in HB
0102   int nzHE, nmodHE;                              // Number of halves and modules in HE
0103   double etaHO[4], rminHO;                       // eta in HO ring boundaries
0104   double zVcal;                                  // Z-position  of the front of HF
0105   double dzVcal;                                 // Half length of the HF
0106   double dlShort;                                // Diference of length between long and short
0107   int depthEta16[2];                             // depth index of ieta=16 for HBmax, HEMin
0108   int depthEta29[2];                             // maximum depth index for ieta=29
0109   int layFHB[2];                                 // first layers in HB (normal, special 16)
0110   int layFHE[3];                                 // first layers in HE (normal, special 16, 18)
0111   int layBHB[3];                                 // last layers in HB (normal, special 15, 16)
0112   int layBHE[4];                                 // last layers in HE (normal, special 16, 17, 18)
0113   bool isBH_;                                    // if HE is BH
0114   std::vector<HcalDetId> idHF2QIE;               // DetId's of HF modules with 2 QIE's
0115   std::pair<int, int> depthMaxDf_, depthMaxSp_;  // (subdet,maximum depth) default,special
0116 };
0117 
0118 #endif