Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:08:11

0001 ///////////////////////////////////////////////////////////////////////////////
0002 // File: HcalCellType.h
0003 // Description: Hcal readout cell definition given by eta boundary and depth
0004 ///////////////////////////////////////////////////////////////////////////////
0005 #ifndef HcalCellType_h
0006 #define HcalCellType_h
0007 
0008 #include <vector>
0009 #include <iostream>
0010 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0011 #include "CLHEP/Units/GlobalSystemOfUnits.h"
0012 
0013 class HcalCellType {
0014 public:
0015   struct HcalCell {
0016     bool ok;
0017     double eta, deta, phi, dphi, rz, drz;
0018     bool flagrz;
0019     HcalCell(bool fl = false,
0020              double et = 0,
0021              double det = 0,
0022              double fi = 0,
0023              double dfi = 0,
0024              double rzv = 0,
0025              double drzv = 0,
0026              bool frz = true)
0027         : ok(fl), eta(et), deta(det), phi(fi), dphi(dfi), rz(rzv), drz(drzv), flagrz(frz) {}
0028   };
0029 
0030   HcalCellType(HcalSubdetector detType,
0031                int etaBin,
0032                int zside,
0033                int depthSegment,
0034                const HcalCell& cell,
0035                int readoutDirection = 0,
0036                double samplingFactor = 0,
0037                double halfSize = 0);
0038   HcalCellType(const HcalCellType& right);
0039   const HcalCellType& operator=(const HcalCellType& right);
0040   ~HcalCellType();
0041 
0042   /// 1=HB, 2=HE, 3=HO, 4=HF (sub detector type)
0043   /// as in DataFormats/HcalDetId/interface/HcalSubdetector.h
0044   HcalSubdetector detType() const { return theDetType; }
0045 
0046   /// which eta ring it belongs to, starting from one
0047   int etaBin() const { return theEtaBin; }
0048   int zside() const { return theSide; }
0049   void setEta(int bin, double etamin, double etamax);
0050 
0051   /// which depth segment it is, starting from 1
0052   /// absolute within the tower, so HE depth of the
0053   /// overlap doesn't start at 1.
0054   int depthSegment() const { return theDepthSegment; }
0055   void setDepth(int bin, double dmin, double dmax);
0056 
0057   /// the number of these cells in a ring
0058   int nPhiBins() const { return (int)(thePhis.size()); }
0059   int nPhiModule() const { return static_cast<int>(20. * CLHEP::deg / thePhiBinWidth); }
0060 
0061   /// phi bin width
0062   double phiBinWidth() const { return thePhiBinWidth; }
0063   double phiOffset() const { return thePhiOffset; }
0064   int unitPhi() const { return theUnitPhi; }
0065   void setPhi(const std::vector<std::pair<int, double>>& phis,
0066               const std::vector<int>& iphiMiss,
0067               double foff,
0068               double dphi,
0069               int unit);
0070   void setPhi(const std::vector<std::pair<int, double>>& phis) { thePhis = phis; }
0071 
0072   /// which cell will actually do the readout for this cell
0073   /// 1 means move hits in this cell up, and -1 means down
0074   /// 0 means do nothing
0075   int actualReadoutDirection() const { return theActualReadoutDirection; }
0076 
0077   /// lower cell edge.  Always positive
0078   double etaMin() const { return theEtaMin; }
0079 
0080   /// cell edge, always positive & greater than etaMin
0081   double etaMax() const { return theEtaMax; }
0082 
0083   /// Phi modules and the central phi values
0084   std::vector<std::pair<int, double>> phis() const { return thePhis; }
0085 
0086   /// z or r position, depending on whether it's barrel or endcap
0087   double depth() const { return (theDepthMin + theDepthMax) / 2; }
0088   double depthMin() const { return theDepthMin; }
0089   double depthMax() const { return theDepthMax; }
0090   bool depthType() const { return theRzFlag; }
0091   double halfSize() const { return theHalfSize; }
0092 
0093   /// ratio of real particle energy to deposited energy in the SimHi
0094   double samplingFactor() const { return theSamplingFactor; }
0095 
0096 protected:
0097   HcalCellType();
0098 
0099 private:
0100   HcalSubdetector theDetType;
0101   int theEtaBin;
0102   int theSide;
0103   int theDepthSegment;
0104   int theUnitPhi;
0105   int theActualReadoutDirection;
0106 
0107   bool theRzFlag;
0108 
0109   double theEtaMin;
0110   double theEtaMax;
0111   double theDepthMin;
0112   double theDepthMax;
0113   double thePhiOffset;
0114   double thePhiBinWidth;
0115   double theHalfSize;
0116   double theSamplingFactor;
0117 
0118   std::vector<std::pair<int, double>> thePhis;
0119 };
0120 
0121 std::ostream& operator<<(std::ostream&, const HcalCellType&);
0122 #endif