CMS 3D CMS Logo

HGCalCalibrationCell.cc
Go to the documentation of this file.
4 
5 #include <algorithm>
6 #include <sstream>
7 
8 //#define EDM_ML_DEBUG
9 
11  wafer_ = std::make_unique<HGCalCell>(
13 
15  cells_[0].insert(
17  cells_[1].insert(
20  cells_[2].insert(
22  cells_[3].insert(
24  for (int k = 0; k < 2; ++k)
25  radius_[k] *= radius_[k];
26 
27 #ifdef EDM_ML_DEBUG
28  edm::LogVerbatim("HGCalGeom") << "HGCalCalibrationCell: " << cells_[0].size() << " HD calibration cells of radius "
29  << std::sqrt(radius_[0]);
30  for (unsigned int k = 0; k < cells_[0].size(); ++k)
31  edm::LogVerbatim("HGCalGeom") << " [" << k << "] " << cells_[0][k] << ":" << cells_[1][k];
32  edm::LogVerbatim("HGCalGeom") << "HGCalCalibrationCell: " << cells_[2].size() << " LD calibration cells of radius "
33  << std::sqrt(radius_[1]);
34  for (unsigned int k = 0; k < cells_[2].size(); ++k)
35  edm::LogVerbatim("HGCalGeom") << " [" << k << "] " << cells_[2][k] << ":" << cells_[3][k];
36 #endif
37 }
38 
40  int zside, int layer, int waferU, int waferV, int cellUV, const std::pair<double, double>& xy) const {
41  const auto& info = cons_->waferInfo(layer, waferU, waferV);
42  int ld = (info.type == HGCalTypes::WaferFineThin) ? 1 : 0;
43  int part = (info.part == HGCalTypes::WaferFull) ? 1 : 0;
44  int indx = 2 * ld + part;
45 #ifdef EDM_ML_DEBUG
46  std::ostringstream st1;
47  st1 << "HGCalCalibrationCell::findCell::input " << layer << ":" << waferU << ":" << waferV << ":" << cellUV << ":"
48  << xy.first << ":" << xy.second << " Type:Part " << info.type << ":" << info.part << ":" << ld << ":" << part
49  << ":" << indx;
50 #endif
51  bool ok = (std::find(cells_[indx].begin(), cells_[indx].end(), cellUV) != cells_[indx].end());
52  int retval(-1);
53  if (ok) {
54  int layertype = (cons_->layerType(layer) == HGCalTypes::WaferCenterB) ? 1 : 0;
55  int place = HGCalCell::cellPlacementIndex(zside, layertype, info.orient);
56  int cellU = (cellUV / 100) % 100;
57  int cellV = cellUV % 100;
58  auto xyc = wafer_->cellUV2XY1(cellU, cellV, place, (1 - ld));
59  double xx = xy.first - xyc.first;
60  double yy = xy.second - xyc.second;
61  double r2 = (xx * xx + yy * yy);
62  retval = (r2 > radius_[ld]) ? 0 : 1;
63 #ifdef EDM_ML_DEBUG
64  st1 << " layertype:place:cellU:cellV " << layertype << ":" << place << ":" << cellU << ":" << cellV << " xx "
65  << xy.first << ":" << xyc.first << ":" << xx << " yy " << xy.second << ":" << xyc.second << ":" << yy << " R2 "
66  << r2 << ":" << radius_[ld];
67 #endif
68  }
69 #ifdef EDM_ML_DEBUG
70  st1 << " Return Value " << ok << ":" << retval;
71  edm::LogVerbatim("HGCalGeom") << st1.str();
72 #endif
73  return retval;
74 }
Log< level::Info, true > LogVerbatim
static int32_t cellPlacementIndex(int32_t iz, int32_t frontBack, int32_t orient)
Definition: HGCalCell.cc:237
static const TGPicture * info(bool iBackgroundIsBlack)
const HGCalParameters * getParameter() const
int32_t waferU(const int32_t index)
HGCalParameters::waferInfo waferInfo(int lay, int waferU, int waferV) const
std::unique_ptr< HGCalCell > wafer_
int zside(DetId const &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
static constexpr int32_t WaferFull
Definition: HGCalTypes.h:35
T sqrt(T t)
Definition: SSEVec.h:19
std::vector< int > calibCellPartHD_
std::vector< int > calibCellFullHD_
const HGCalDDDConstants * cons_
part
Definition: HCALResponse.h:20
int32_t waferV(const int32_t index)
std::vector< int > cells_[4]
std::vector< int > calibCellPartLD_
static constexpr int32_t WaferFineThin
Definition: HGCalTypes.h:30
static constexpr int32_t WaferCenterB
Definition: HGCalTypes.h:26
int findCell(int zside, int layer, int waferU, int waferV, int cellUV, const std::pair< double, double > &xy) const
int layerType(int lay) const
std::vector< int > calibCellFullLD_