Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-01-08 23:50:35

0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 #include "Geometry/HGCalCommonData/interface/HGCalCassette.h"
0003 #include <algorithm>
0004 #include <sstream>
0005 
0006 //#define EDM_ML_DEBUG
0007 
0008 void HGCalCassette::setParameter(int cassette, const std::vector<double>& shifts) {
0009   cassette_ = cassette;
0010   typeHE_ = (cassette_ >= 12);
0011   shifts_.insert(shifts_.end(), shifts.begin(), shifts.end());
0012 #ifdef EDM_ML_DEBUG
0013   edm::LogVerbatim("HGCalGeom") << "# of cassettes = " << cassette_ << " Type " << typeHE_;
0014   for (uint32_t j1 = 0; j1 < shifts.size(); j1 += 12) {
0015     std::ostringstream st1;
0016     if (j1 == 0)
0017       st1 << " Shifts:";
0018     else
0019       st1 << "        ";
0020     uint32_t j2 = std::min((j1 + 12), static_cast<uint32_t>(shifts.size()));
0021     for (uint32_t j = j1; j < j2; ++j)
0022       st1 << ":" << shifts[j];
0023     edm::LogVerbatim("HGCalGeom") << st1.str();
0024   }
0025 #endif
0026 }
0027 
0028 std::pair<double, double> HGCalCassette::getShift(int layer, int zside, int cassette) const {
0029   int locc = (zside < 0) ? (cassette - 1) : (typeHE_ ? positHE_[cassette - 1] : positEE_[cassette - 1]);
0030   int loc = 2 * (cassette_ * (layer - 1) + locc);
0031   std::pair<double, double> xy = std::make_pair(shifts_[loc], shifts_[loc + 1]);
0032 #ifdef EDM_ML_DEBUG
0033   edm::LogVerbatim("HGCalGeom") << "HGCalCassette::getShift: Layer " << layer << " zside " << zside << " cassette "
0034                                 << cassette << " Loc " << locc << ":" << loc << " shift " << xy.first << ":"
0035                                 << xy.second;
0036 #endif
0037   return xy;
0038 }
0039 
0040 int HGCalCassette::cassetteIndex(int det, int layer, int side, int cassette) {
0041   int zs = (side > 0) ? factor_ : 0;
0042   return (((zs + det) * factor_ + layer) * factor_ + cassette);
0043 }