CMS 3D CMS Logo

HGCalCassette.cc
Go to the documentation of this file.
3 #include <algorithm>
4 #include <sstream>
5 
6 //#define EDM_ML_DEBUG
7 
8 void HGCalCassette::setParameter(int cassette, const std::vector<double>& shifts) {
9  cassette_ = cassette;
10  typeHE_ = (cassette_ >= 12);
11  shifts_.insert(shifts_.end(), shifts.begin(), shifts.end());
12 #ifdef EDM_ML_DEBUG
13  edm::LogVerbatim("HGCalGeom") << "# of cassettes = " << cassette_ << " Type " << typeHE_;
14  for (uint32_t j1 = 0; j1 < shifts.size(); j1 += 12) {
15  std::ostringstream st1;
16  if (j1 == 0)
17  st1 << " Shifts:";
18  else
19  st1 << " ";
20  uint32_t j2 = std::min((j1 + 12), static_cast<uint32_t>(shifts.size()));
21  for (uint32_t j = j1; j < j2; ++j)
22  st1 << ":" << shifts[j];
23  edm::LogVerbatim("HGCalGeom") << st1.str();
24  }
25 #endif
26 }
27 
28 std::pair<double, double> HGCalCassette::getShift(int layer, int zside, int cassette) const {
29  int locc = (zside < 0) ? (cassette - 1) : (typeHE_ ? positHE_[cassette - 1] : positEE_[cassette - 1]);
30  int loc = 2 * (cassette_ * (layer - 1) + locc);
31  std::pair<double, double> xy = std::make_pair(-zside * shifts_[loc], shifts_[loc + 1]);
32 #ifdef EDM_ML_DEBUG
33  edm::LogVerbatim("HGCalGeom") << "HGCalCassette::getShift: Layer " << layer << " zside " << zside << " type "
34  << typeHE_ << " cassette " << cassette << " Loc " << locc << ":" << loc << " shift "
35  << xy.first << ":" << xy.second;
36 #endif
37  return xy;
38 }
39 
40 int HGCalCassette::cassetteIndex(int det, int layer, int side, int cassette) {
41  int zs = (side > 0) ? factor_ : 0;
42  return (((zs + det) * factor_ + layer) * factor_ + cassette);
43 }
44 
45 int HGCalCassette::cassetteType(int det, int zside, int cassette) {
46  int type = (zside < 0) ? cassette : ((det == 0) ? (1 + positEE_[cassette - 1]) : (1 + positHE_[cassette - 1]));
47  return type;
48 }
Log< level::Info, true > LogVerbatim
static int cassetteIndex(int det, int layer, int zside, int cassette)
static constexpr int32_t factor_
Definition: HGCalCassette.h:24
std::pair< double, double > getShift(int layer, int zside, int cassette) const
static constexpr int positHE_[12]
Definition: HGCalCassette.h:20
int zside(DetId const &)
static constexpr int positEE_[6]
Definition: HGCalCassette.h:19
std::vector< double > shifts_
Definition: HGCalCassette.h:23
static int cassetteType(int det, int zside, int cassette)
void setParameter(int cassette, const std::vector< double > &shifts)
Definition: HGCalCassette.cc:8