8 #include <Math/Transform3D.h> 9 #include <Math/EulerAngles.h> 19 : m_topology(topology), m_mergePosition(topology.getMergePositionFlag()) {
43 std::unique_ptr<std::vector<DetId>> p_hbIds{
new std::vector<DetId>};
44 std::unique_ptr<std::vector<DetId>> p_heIds{
new std::vector<DetId>};
45 std::unique_ptr<std::vector<DetId>> p_hoIds{
new std::vector<DetId>};
46 std::unique_ptr<std::vector<DetId>> p_hfIds{
new std::vector<DetId>};
47 std::unique_ptr<std::vector<DetId>> p_emptyIds{
new std::vector<DetId>};
50 for (
unsigned int i(0);
i != baseIds.size(); ++
i) {
53 p_hbIds->emplace_back(
id);
55 p_heIds->emplace_back(
id);
57 p_hoIds->emplace_back(
id);
59 p_hfIds->emplace_back(
id);
62 std::sort(p_hbIds->begin(), p_hbIds->end());
63 std::sort(p_heIds->begin(), p_heIds->end());
64 std::sort(p_hoIds->begin(), p_hoIds->end());
65 std::sort(p_hfIds->begin(), p_hfIds->end());
66 p_emptyIds->resize(0);
91 std::ostringstream st1;
114 static const double z_long = 1100.0;
115 double abseta = fabs(
r.eta());
116 double absz = fabs(
r.z());
122 }
else if (absz >= z_long) {
131 int etaring =
etaRing(bc, abseta);
133 int phibin =
phiBin(bc, etaring,
r.phi());
136 int etabin = (
r.z() > 0) ? etaring : -etaring;
139 static const double z_short = 1137.0;
143 HcalDetId bestId(bc, etabin, phibin, ((fabs(
r.z()) - z_short > -0.1) ? (2) : (1)));
147 int zside = (
r.z() > 0) ? 1 : -1;
149 double pointrz(0), drz(99999.);
150 HcalDetId currentId(bc, etabin, phibin, dbin);
157 std::shared_ptr<const CaloCellGeometry> cell =
getGeometry(currentId);
158 if (cell ==
nullptr) {
164 rz =
std::abs(cell->getPosition().z());
166 rz = cell->getPosition().mag();
177 return (ignoreCorrect ? bestId :
correctId(bestId));
193 int sign = (
z == 0) ? (-1) : (1);
195 auto hcId = ((
id.subdet ==
static_cast<int>(
HcalBarrel))
197 : ((
id.subdet ==
static_cast<int>(
HcalEndcap))
199 : ((
id.subdet ==
static_cast<int>(
HcalOuter))
214 std::vector<HcalDetId> ids;
224 int sign = (
z == 0) ? (-1) : (1);
226 auto hcId = ((
id.subdet ==
static_cast<int>(
HcalBarrel))
228 : ((
id.subdet ==
static_cast<int>(
HcalEndcap))
230 : ((
id.subdet ==
static_cast<int>(
HcalOuter))
245 std::vector<HcalDetId> ids;
250 for (
unsigned int k = 0;
k < 4; ++
k) {
251 mcorners[
k] = mcf[
k];
252 mcorners[
k + 4] = mcb[
k + 4];
271 const double dR2(
dR *
dR);
272 const double reta(
r.eta());
273 const double rphi(
r.phi());
274 const double lowEta(reta -
dR);
275 const double highEta(reta +
dR);
276 const double lowPhi(rphi -
dR);
277 const double highPhi(rphi +
dR);
281 if (highEta > -hfEtaHi && lowEta < hfEtaHi) {
284 for (
unsigned int is(0); is != 4; ++is) {
285 const int sign(reta > 0 ? 1 : -1);
286 const int ieta_center(
sign *
etaRing(hs[is], fabs(reta)));
289 const int iphi_lo(
phiBin(hs[is], ieta_center, lowPhi));
290 const int iphi_hi(
phiBin(hs[is], ieta_center, highPhi));
291 const int jphi_lo(iphi_lo > iphi_hi ? iphi_lo - 72 : iphi_lo);
292 const int jphi_hi(iphi_hi);
294 const int idep_lo(1 == is ? 4 : 1);
298 for (
int jphi(jphi_lo); jphi <= jphi_hi; ++jphi) {
299 const int iphi(1 > jphi ? jphi + 72 : jphi);
300 for (
int idep(idep_lo); idep <= idep_hi; ++idep) {
304 if (
nullptr != cell) {
306 const double eta(
p.eta());
307 const double phi(
p.phi());
324 unsigned int hxsize(0);
343 const int iphi(1 + (4 *
i) % 72);
350 const int iphi(1 + (4 *
i) % 72);
357 const int iphi(1 + (4 *
i) % 72);
363 const int ring(
i / 12);
385 const unsigned int iphi(hid.
iphi());
387 const unsigned int index((0 <
ieta ? nD / 2 : 0) + (
iphi + 1) % 72 / 4);
459 <<
", hid " << hid <<
", din " <<
din <<
", index ";
510 return ((
nullptr == cell ||
nullptr == cell->
param()) ?
nullptr : cell);
523 for (
float iv :
pv) {
524 dVec.emplace_back(
iv);
532 if (
nullptr != ptr) {
533 dinsVec.emplace_back(
i);
537 unsigned int ishape(9999);
539 for (
unsigned int ivv(0); ivv !=
parVecVec().size(); ++ivv) {
543 ok =
ok && (fabs(par[
k] -
pv[
k]) < 1.e-6);
553 if (iVec.size() <
nn)
554 iVec.emplace_back(ishape);
556 ptr->getTransform(tr, (
Pt3DVec*)
nullptr);
560 tr = HepGeom::Translate3D(
gp.x(),
gp.y(),
gp.z());
563 const CLHEP::Hep3Vector
tt(tr.getTranslation());
564 tVec.emplace_back(
tt.x());
565 tVec.emplace_back(
tt.y());
566 tVec.emplace_back(
tt.z());
568 const CLHEP::HepRotation
rr(tr.getRotation());
569 const ROOT::Math::Transform3D rtr(
570 rr.xx(),
rr.xy(),
rr.xz(),
tt.x(),
rr.yx(),
rr.yy(),
rr.yz(),
tt.y(),
rr.zx(),
rr.zy(),
rr.zz(),
tt.z());
573 tVec.emplace_back(ea.Phi());
574 tVec.emplace_back(ea.Theta());
575 tVec.emplace_back(ea.Psi());
static unsigned int numberOfBarrelAlignments()
int getMinDepth(const int &itype, const int &ieta, const int &iphi, const int &zside) const
Log< level::Info, true > LogVerbatim
bool getMergePositionFlag() const
std::set< DetId > DetIdSet
static unsigned int alignmentTransformIndexLocal(const DetId &id)
DetId correctId(const DetId &id) const
std::vector< CCGFloat > DimVec
CaloCellGeometry::Pt3DVec Pt3DVec
GlobalPoint getBackPosition(const DetId &id) const
edm::AtomicPtrCache< std::vector< DetId > > m_heIds
const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const override
Get a list of valid detector ids (for the given subdetector)
static unsigned int alignmentEndcapIndexLocal(const DetId &id)
std::shared_ptr< const CaloCellGeometry > getGeometryBase(const DetId &id) const
bool set(std::unique_ptr< T > iNewValue) const
static DetId detIdFromOuterAlignmentIndex(unsigned int i)
DetId getClosestCell(const GlobalPoint &r) const override
virtual unsigned int numberOfTransformParms() const
bool valid(const DetId &id) const override
unsigned int getHESize() const
const HcalTopology & m_topology
std::vector< unsigned int > IVec
edm::AtomicPtrCache< std::vector< DetId > > m_emptyIds
unsigned int detId2denseId(const DetId &id) const override
return a linear packed id
bool isHE(int etabin, int depth)
std::vector< CCGFloat > TrVec
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const override
Get the cell geometry of a given detector id. Should return false if not found.
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
HepGeom::Transform3D Tr3D
std::vector< IdealObliquePrism > HECellVec
unsigned int getHBSize() const
std::vector< Pt3D > Pt3DVec
int phiBin(HcalSubdetector bc, int etaring, double phi) const
bool isHB(int etabin, int depth)
CaloCellGeometry::CCGFloat CCGFloat
unsigned int getHOSize() const
constexpr Detector det() const
get the detector field from this detid
int etaRing(HcalSubdetector subdet, double eta) const
eta and phi index from eta, phi values
CaloCellGeometry::Tr3D Tr3D
constexpr HcalSubdetector subdet() const
get the subdetector
void newCellFast(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::CornersVec getCorners(const DetId &id) const
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
HcalDetId idFront(const HcalDetId &id) const
void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
constexpr int ieta() const
get the cell ieta
std::vector< DetId > m_validIds
std::vector< IdealObliquePrism > HOCellVec
static unsigned int numberOfOuterAlignments()
static DetId detIdFromForwardAlignmentIndex(unsigned int i)
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
static unsigned int alignmentBarrelIndexLocal(const DetId &id)
unsigned int numberOfParametersPerShape() const override
Abs< T >::type abs(const T &t)
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
static DetId detIdFromBarrelAlignmentIndex(unsigned int i)
DetId denseId2detId(unsigned int) const override
return a linear packed id
CaloCellGeometry::CCGFloat CCGFloat
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
unsigned int getHFSize() const
static DetId detIdFromLocalAlignmentIndex(unsigned int i)
CaloSubdetectorGeometry::IVec m_dins
HcalGeometry(const HcalTopology &topology)
unsigned int ncells() const override
return a count of valid cells (for dense indexing use)
void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
CaloSubdetectorGeometry::DetIdSet getCells(const GlobalPoint &r, double dR) const override
Get a list of all cells within a dR of the given cell.
int etaRing(HcalSubdetector bc, double abseta) const
helper methods for getClosestCell
static unsigned int alignmentOuterIndexLocal(const DetId &id)
std::vector< IdealZPrism > HFCellVec
~HcalGeometry() override
The HcalGeometry will delete all its cell geometries at destruction time.
static unsigned int numberOfEndcapAlignments()
CaloCellGeometry::Pt3D Pt3D
AlgebraicVector EulerAngles
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void addValidID(const DetId &id)
constexpr uint32_t rawId() const
get the raw id
unsigned int numberOfShapes() const override
CaloCellGeometry::CornersMgr * cornersMgr()
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
unsigned int getHxSize(const int type) const
HepGeom::Point3D< CCGFloat > Pt3D
bool isHF(int etabin, int depth)
std::vector< IdealObliquePrism > HBCellVec
CaloCellGeometry::Tr3D Tr3D
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
void increaseReserve(unsigned int extra)
HcalDetId mergedDepthDetId(const HcalDetId &id) const
edm::AtomicPtrCache< std::vector< DetId > > m_hfIds
GlobalPoint getPosition(const DetId &id) const
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
static unsigned int numberOfForwardAlignments()
const HcalDDDRecConstants * dddConstants() const
static unsigned int alignmentForwardIndexLocal(const DetId &id)
bool incrementDepth(HcalDetId &id) const
int phiBin(HcalSubdetector subdet, int etaRing, double phi) const
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const
static DetId detIdFromEndcapAlignmentIndex(unsigned int i)
static unsigned int alignmentBarEndForIndexLocal(const DetId &id, unsigned int nD)
edm::AtomicPtrCache< std::vector< DetId > > m_hoIds
CaloCellGeometry::Pt3D Pt3D
double etaMax(HcalSubdetector subdet) const
unsigned int newCellImpl(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
constexpr int iphi() const
get the cell iphi
edm::AtomicPtrCache< std::vector< DetId > > m_hbIds
static unsigned int numberOfAlignments()
const CCGFloat * param() const