File indexing completed on 2024-05-10 02:20:50
0001
0002
0003
0004
0005
0006 #include "Geometry/HcalCommonData/interface/HcalCellType.h"
0007
0008 #include <CLHEP/Units/SystemOfUnits.h>
0009 #include <algorithm>
0010 #include <iomanip>
0011
0012 HcalCellType::HcalCellType(HcalSubdetector detType,
0013 int etaBin,
0014 int zside,
0015 int depthSegment,
0016 const HcalCellType::HcalCell& cell,
0017 int readoutDirection,
0018 double samplingFactor,
0019 double halfSize)
0020 : theDetType(detType),
0021 theEtaBin(etaBin),
0022 theSide(zside),
0023 theDepthSegment(depthSegment),
0024 theActualReadoutDirection(readoutDirection),
0025 theSamplingFactor(samplingFactor) {
0026 theEtaMin = cell.eta - cell.deta;
0027 theEtaMax = cell.eta + cell.deta;
0028 theRzFlag = cell.flagrz;
0029 theDepthMin = (cell.rz - cell.drz) / CLHEP::cm;
0030 theDepthMax = (cell.rz + cell.drz) / CLHEP::cm;
0031 thePhiBinWidth = 2 * (cell.dphi) / CLHEP::deg;
0032 thePhiOffset = 0;
0033 theUnitPhi = 1;
0034 theHalfSize = halfSize / CLHEP::cm;
0035 }
0036
0037 HcalCellType::HcalCellType(const HcalCellType& right) {
0038 theDetType = right.theDetType;
0039 theEtaBin = right.theEtaBin;
0040 theSide = right.theSide;
0041 theUnitPhi = right.theUnitPhi;
0042 theDepthSegment = right.theDepthSegment;
0043 theActualReadoutDirection = right.theActualReadoutDirection;
0044 theRzFlag = right.theRzFlag;
0045 theEtaMin = right.theEtaMin;
0046 theEtaMax = right.theEtaMax;
0047 theDepthMin = right.theDepthMin;
0048 theDepthMax = right.theDepthMax;
0049 thePhiBinWidth = right.thePhiBinWidth;
0050 thePhiOffset = right.thePhiOffset;
0051 theHalfSize = right.theHalfSize;
0052 theSamplingFactor = right.theSamplingFactor;
0053 thePhis = right.thePhis;
0054 }
0055
0056 const HcalCellType& HcalCellType::operator=(const HcalCellType& right) {
0057 theDetType = right.theDetType;
0058 theEtaBin = right.theEtaBin;
0059 theSide = right.theSide;
0060 theUnitPhi = right.theUnitPhi;
0061 theDepthSegment = right.theDepthSegment;
0062 theActualReadoutDirection = right.theActualReadoutDirection;
0063 theRzFlag = right.theRzFlag;
0064 theEtaMin = right.theEtaMin;
0065 theEtaMax = right.theEtaMax;
0066 theDepthMin = right.theDepthMin;
0067 theDepthMax = right.theDepthMax;
0068 thePhiBinWidth = right.thePhiBinWidth;
0069 thePhiOffset = right.thePhiOffset;
0070 theHalfSize = right.theHalfSize;
0071 theSamplingFactor = right.theSamplingFactor;
0072 thePhis = right.thePhis;
0073
0074 return *this;
0075 }
0076
0077 HcalCellType::~HcalCellType() {}
0078
0079 void HcalCellType::setEta(int bin, double etamin, double etamax) {
0080 theEtaBin = bin;
0081 theEtaMin = etamin;
0082 theEtaMax = etamax;
0083 }
0084
0085 void HcalCellType::setDepth(int bin, double dmin, double dmax) {
0086 theDepthSegment = bin;
0087 theDepthMin = dmin;
0088 theDepthMax = dmax;
0089 }
0090
0091 void HcalCellType::setPhi(const std::vector<std::pair<int, double> >& phis,
0092 const std::vector<int>& iphiMiss,
0093 double foff,
0094 double dphi,
0095 int unit) {
0096 thePhiBinWidth = dphi;
0097 thePhiOffset = foff;
0098 theUnitPhi = unit;
0099 thePhis.clear();
0100 for (const auto& phi : phis) {
0101 if (std::find(iphiMiss.begin(), iphiMiss.end(), phi.first) == iphiMiss.end()) {
0102 thePhis.emplace_back(phi);
0103 }
0104 }
0105 }
0106
0107 std::ostream& operator<<(std::ostream& os, const HcalCellType& cell) {
0108 os << "Detector " << cell.detType() << " Eta " << cell.etaBin() << " (" << cell.etaMin() << ":" << cell.etaMax()
0109 << ") Zside " << cell.zside() << " Depth " << cell.depthSegment() << " (" << cell.depthMin() << ":"
0110 << cell.depthMax() << "; " << cell.depthType() << ") Phi " << cell.nPhiBins() << " ("
0111 << cell.phiOffset() / CLHEP::deg << ", " << cell.phiBinWidth() / CLHEP::deg << ", " << cell.unitPhi() << ", "
0112 << cell.nPhiModule() << ") Direction " << cell.actualReadoutDirection() << " Half size " << cell.halfSize()
0113 << " Sampling Factor " << cell.samplingFactor();
0114 return os;
0115 }