|
|
Go to the documentation of this file.
7 #include <Math/Transform3D.h>
8 #include <Math/EulerAngles.h>
18 : m_topology(topology), m_mergePosition(topology.getMergePositionFlag()) {
29 <<
"HcalGeometry::init() "
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);
112 static const double z_long = 1100.0;
113 double abseta = fabs(
r.eta());
114 double absz = fabs(
r.z());
120 }
else if (absz >= z_long) {
129 int etaring =
etaRing(bc, abseta);
131 int phibin =
phiBin(bc, etaring,
r.phi());
134 int etabin = (
r.z() > 0) ? etaring : -etaring;
137 static const double z_short = 1137.0;
141 HcalDetId bestId(bc, etabin, phibin, ((fabs(
r.z()) - z_short > -0.1) ? (2) : (1)));
145 int zside = (
r.z() > 0) ? 1 : -1;
147 double pointrz(0), drz(99999.);
148 HcalDetId currentId(bc, etabin, phibin, dbin);
155 std::shared_ptr<const CaloCellGeometry> cell =
getGeometry(currentId);
156 if (cell ==
nullptr) {
162 rz =
std::abs(cell->getPosition().z());
164 rz = cell->getPosition().mag();
175 return (ignoreCorrect ? bestId :
correctId(bestId));
191 int sign = (
z == 0) ? (-1) : (1);
193 auto hcId = ((
id.subdet == static_cast<int>(
HcalBarrel))
195 : ((
id.subdet == static_cast<int>(
HcalEndcap))
197 : ((
id.subdet == static_cast<int>(
HcalOuter))
212 std::vector<HcalDetId> ids;
222 int sign = (
z == 0) ? (-1) : (1);
224 auto hcId = ((
id.subdet == static_cast<int>(
HcalBarrel))
226 : ((
id.subdet == static_cast<int>(
HcalEndcap))
228 : ((
id.subdet == static_cast<int>(
HcalOuter))
243 std::vector<HcalDetId> ids;
248 for (
unsigned int k = 0;
k < 4; ++
k) {
249 mcorners[
k] = mcf[
k];
250 mcorners[
k + 4] = mcb[
k + 4];
269 const double dR2(
dR *
dR);
270 const double reta(
r.eta());
271 const double rphi(
r.phi());
272 const double lowEta(reta -
dR);
273 const double highEta(reta +
dR);
274 const double lowPhi(rphi -
dR);
275 const double highPhi(rphi +
dR);
279 if (highEta > -hfEtaHi && lowEta < hfEtaHi) {
282 for (
unsigned int is(0); is != 4; ++is) {
283 const int sign(reta > 0 ? 1 : -1);
284 const int ieta_center(
sign *
etaRing(hs[is], fabs(reta)));
287 const int iphi_lo(
phiBin(hs[is], ieta_center, lowPhi));
288 const int iphi_hi(
phiBin(hs[is], ieta_center, highPhi));
289 const int jphi_lo(iphi_lo > iphi_hi ? iphi_lo - 72 : iphi_lo);
290 const int jphi_hi(iphi_hi);
292 const int idep_lo(1 == is ? 4 : 1);
296 for (
int jphi(jphi_lo); jphi <= jphi_hi; ++jphi) {
297 const int iphi(1 > jphi ? jphi + 72 : jphi);
298 for (
int idep(idep_lo); idep <= idep_hi; ++idep) {
302 if (
nullptr != cell) {
304 const double eta(
p.eta());
305 const double phi(
p.phi());
322 unsigned int hxsize(0);
341 const int iphi(1 + (4 *
i) % 72);
348 const int iphi(1 + (4 *
i) % 72);
355 const int iphi(1 + (4 *
i) % 72);
361 const int ring(
i / 12);
383 const unsigned int iphi(hid.
iphi());
385 const unsigned int index((0 <
ieta ? nD / 2 : 0) + (
iphi + 1) % 72 / 4);
457 <<
" newCell subdet " << detId.
subdetId() <<
", raw ID " << detId.
rawId() <<
", hid " << hid <<
", din "
458 <<
din <<
", index " << std::endl;
509 return ((
nullptr == cell ||
nullptr == cell->
param()) ?
nullptr : cell);
522 for (
float iv :
pv) {
523 dVec.emplace_back(
iv);
531 if (
nullptr != ptr) {
532 dinsVec.emplace_back(
i);
536 unsigned int ishape(9999);
538 for (
unsigned int ivv(0); ivv !=
parVecVec().size(); ++ivv) {
542 ok =
ok && (fabs(par[
k] -
pv[
k]) < 1.e-6);
552 if (iVec.size() <
nn)
553 iVec.emplace_back(ishape);
555 ptr->getTransform(tr, (
Pt3DVec*)
nullptr);
559 tr = HepGeom::Translate3D(
gp.x(),
gp.y(),
gp.z());
562 const CLHEP::Hep3Vector
tt(tr.getTranslation());
563 tVec.emplace_back(
tt.x());
564 tVec.emplace_back(
tt.y());
565 tVec.emplace_back(
tt.z());
567 const CLHEP::HepRotation
rr(tr.getRotation());
568 const ROOT::Math::Transform3D rtr(
569 rr.xx(),
rr.xy(),
rr.xz(),
tt.x(),
rr.yx(),
rr.yy(),
rr.yz(),
tt.y(),
rr.zx(),
rr.zy(),
rr.zz(),
tt.z());
572 tVec.emplace_back(ea.Phi());
573 tVec.emplace_back(ea.Theta());
574 tVec.emplace_back(ea.Psi());
HepGeom::Transform3D Tr3D
std::vector< Pt3D > Pt3DVec
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
void increaseReserve(unsigned int extra)
CaloCellGeometry::Pt3D Pt3D
static unsigned int numberOfAlignments()
HcalDetId idFront(const HcalDetId &id) const
std::set< DetId > DetIdSet
constexpr int iphi() const
get the cell iphi
std::vector< CCGFloat > DimVec
CaloCellGeometry::Pt3DVec Pt3DVec
unsigned int newCellImpl(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
constexpr Detector det() const
get the detector field from this detid
CaloCellGeometry::Pt3DVec Pt3DVec
std::vector< CCGFloat > TrVec
virtual unsigned int numberOfTransformParms() const
void newCellFast(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
HcalDetId mergedDepthDetId(const HcalDetId &id) const
static unsigned int alignmentBarrelIndexLocal(const DetId &id)
static unsigned int alignmentTransformIndexLocal(const DetId &id)
static unsigned int alignmentEndcapIndexLocal(const DetId &id)
std::vector< unsigned int > IVec
static unsigned int numberOfBarrelAlignments()
std::vector< IdealObliquePrism > HOCellVec
bool getMergePositionFlag() const
static DetId detIdFromBarrelAlignmentIndex(unsigned int i)
int etaRing(HcalSubdetector subdet, double eta) const
eta and phi index from eta, phi values
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)
unsigned int numberOfParametersPerShape() const override
const HcalTopology & m_topology
static unsigned int numberOfOuterAlignments()
edm::AtomicPtrCache< std::vector< DetId > > m_emptyIds
unsigned int getHESize() const
bool set(std::unique_ptr< T > iNewValue) const
GlobalPoint getBackPosition(const DetId &id) const
void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
CaloCellGeometry::CCGFloat CCGFloat
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
std::vector< IdealObliquePrism > HECellVec
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
static DetId detIdFromForwardAlignmentIndex(unsigned int i)
bool isHF(int etabin, int depth)
std::vector< DetId > m_validIds
CaloCellGeometry::Tr3D Tr3D
int phiBin(HcalSubdetector bc, int etaring, double phi) const
static unsigned int alignmentOuterIndexLocal(const DetId &id)
unsigned int detId2denseId(const DetId &id) const override
return a linear packed id
HepGeom::Point3D< CCGFloat > Pt3D
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 void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
int getMinDepth(const int &itype, const int &ieta, const int &iphi, const int &zside) const
DetId denseId2detId(unsigned int) const override
return a linear packed id
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
CaloCellGeometry::Tr3D Tr3D
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.
unsigned int getHFSize() const
constexpr int ieta() const
get the cell ieta
std::vector< IdealObliquePrism > HBCellVec
GlobalPoint getPosition(const DetId &id) const
CaloCellGeometry::CornersVec getCorners(const DetId &id) const
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
unsigned int getHOSize() const
unsigned int getHBSize() const
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const HcalDDDRecConstants * dddConstants() const
const CCGFloat * param() const
constexpr HcalSubdetector subdet() const
get the subdetector
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
void addValidID(const DetId &id)
CaloCellGeometry::CCGFloat CCGFloat
bool isHE(int etabin, int depth)
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
static unsigned int numberOfForwardAlignments()
AlgebraicVector EulerAngles
CaloSubdetectorGeometry::IVec m_dins
static unsigned int alignmentForwardIndexLocal(const DetId &id)
CaloSubdetectorGeometry::DetIdSet getCells(const GlobalPoint &r, double dR) const override
Get a list of all cells within a dR of the given cell.
bool valid(const DetId &id) const override
static unsigned int alignmentBarEndForIndexLocal(const DetId &id, unsigned int nD)
HcalGeometry(const HcalTopology &topology)
double etaMax(HcalSubdetector subdet) const
edm::AtomicPtrCache< std::vector< DetId > > m_hbIds
edm::AtomicPtrCache< std::vector< DetId > > m_hoIds
constexpr uint32_t rawId() const
get the raw id
CaloCellGeometry::CornersMgr * cornersMgr()
CaloCellGeometry::Pt3D Pt3D
bool incrementDepth(HcalDetId &id) const
static DetId detIdFromLocalAlignmentIndex(unsigned int i)
static unsigned int numberOfEndcapAlignments()
void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
unsigned int getHxSize(const int type) const
unsigned int ncells() const override
return a count of valid cells (for dense indexing use)
int etaRing(HcalSubdetector bc, double abseta) const
helper methods for getClosestCell
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
Abs< T >::type abs(const T &t)
std::vector< IdealZPrism > HFCellVec
~HcalGeometry() override
The HcalGeometry will delete all its cell geometries at destruction time.
std::shared_ptr< const CaloCellGeometry > getGeometryBase(const DetId &id) const
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const
edm::AtomicPtrCache< std::vector< DetId > > m_heIds
static DetId detIdFromOuterAlignmentIndex(unsigned int i)
edm::AtomicPtrCache< std::vector< DetId > > m_hfIds
DetId correctId(const DetId &id) const
unsigned int numberOfShapes() const override
bool isHB(int etabin, int depth)
int phiBin(HcalSubdetector subdet, int etaRing, double phi) const
static DetId detIdFromEndcapAlignmentIndex(unsigned int i)
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
DetId getClosestCell(const GlobalPoint &r) const override