34 1.005, 0.986, 1.086, 1.000, 1.000, 1.086, 0.986, 1.005, 0.981,
35 0.958, 0.956, 0.975, 0.965, 0.970, 1.105, 1.000, 1.000};
45 m_seedThreshold = seedThreshold;
48 m_usePMTFlag = usePMTflag;
49 m_usePulseFlag = usePulseflag;
52 m_correctionSet = correctionSet;
54 for (
int ii = 0;
ii < 13;
ii++) {
55 m_cutByEta.push_back(-1);
56 m_seedmnEta.push_back(99);
57 m_seedMXeta.push_back(-1);
59 for (
int ii = 0;
ii < 73;
ii++) {
60 double minphi = 0.0872664 * (
ii - 1);
61 double maxphi = 0.0872664 * (
ii + 1);
62 while (minphi < -
M_PI)
66 while (maxphi < -
M_PI)
72 m_seedmnPhi.push_back(minphi);
73 m_seedMXphi.push_back(maxphi);
77 for (
int ii = 0;
ii < 13 * 2;
ii++)
78 m_correctionByEta.push_back(1.0);
79 if (m_correctionSet == 1) {
80 for (
int ii = 0;
ii < 13 * 2;
ii++)
91 std::vector<HFCompleteHit> protoseeds,
seeds;
93 std::vector<HFCompleteHit>::iterator
i;
94 std::vector<HFCompleteHit>::iterator
k;
100 bool doCluster =
false;
102 for (
j =
hf.begin();
j !=
hf.end();
j++) {
103 const int aieta =
j->id().ietaAbs();
104 int iz = (aieta - 29);
106 if (
j->id().depth() != 1)
108 if (aieta == 40 || aieta == 41 || aieta == 29)
111 if (iz < 0 || iz > 12) {
116 if (m_cutByEta[iz] < 0) {
118 m_cutByEta[iz] = m_seedThreshold * cosh(
eta);
119 auto ccg =
geom->getGeometry(
j->id());
121 for (
size_t sc = 0; sc < CellCorners.
size(); sc++) {
122 if (fabs(CellCorners[sc].z()) < 1200) {
123 if (fabs(CellCorners[sc].
eta()) < m_seedmnEta[iz])
124 m_seedmnEta[iz] = fabs(CellCorners[sc].
eta());
125 if (fabs(CellCorners[sc].
eta()) > m_seedMXeta[iz])
126 m_seedMXeta[iz] = fabs(CellCorners[sc].
eta());
130 double elong =
j->energy() * m_correctionByEta[
indexByEta(
j->id())];
131 if (elong > m_cutByEta[iz]) {
133 double eshort = (j2 ==
hf.end()) ? (0) : (j2->energy());
135 eshort *= m_correctionByEta[
indexByEta(j2->id())];
136 if (((elong - eshort) / (elong + eshort)) > m_maximumSL)
148 protoseeds.push_back(ahit);
152 if (!protoseeds.empty()) {
154 for (
i = protoseeds.begin();
i != protoseeds.end();
i++) {
158 if ((
i == protoseeds.begin()) && (isok)) {
164 for (dE = -2; dE <= 2; dE++)
165 for (dP = -4; dP <= 4; dP += 2) {
166 PWrap =
k->id.iphi() + dP;
172 if ((
i->id.iphi() == PWrap) && (
i->id.ieta() ==
k->id.ieta() + dE))
183 bool clusterOk = makeCluster(
i->id(),
hf,
geom, clusShp, Sclus);
185 clusterShapes.push_back(clusShp);
186 SuperClusters.push_back(Sclus);
213 std::vector<double> coreCanid;
214 std::vector<double>::const_iterator ci;
216 std::vector<DetId> usedHits;
222 bool clusterOk =
true;
226 bool edge_type1 = seedid.
ietaAbs() == 39 && (seedid.
iphi() % 4) == 3;
228 double e_seed = si->energy() * m_correctionByEta[
indexByEta(si->id())];
230 for (de = -2; de <= 2; de++)
231 for (
dp = -4;
dp <= 4;
dp += 2) {
232 phiWrap = seedid.
iphi() +
dp;
239 if (edge_type1 && de == seedid.
zside()) {
244 }
else if (
dp == -4) {
256 double e_short = 0.0;
258 e_long = il->energy() * m_correctionByEta[
indexByEta(il->id())];
259 if (e_long <= m_minTowerEnergy)
262 e_short = is->energy() * m_correctionByEta[
indexByEta(is->id())];
263 if (e_short <= m_minTowerEnergy)
265 double eRatio = (e_long - e_short) /
std::max(1.0, (e_long + e_short));
268 if ((
abs(eRatio) > m_maximumSL) && (
std::max(e_long, e_short) > m_maximumRenergy)) {
269 if (
dp == 0 && de == 0)
274 if ((il !=
hf.end()) && (isPMTHit(*il))) {
275 if (
dp == 0 && de == 0)
280 if (e_long > m_minTowerEnergy && il !=
hf.end()) {
282 usedHits.push_back(idl.rawId());
286 if ((de > -2) && (de < 2) && (dp > -4) && (
dp < 4)) {
290 if ((
dp == 0) && (de == 0)) {
295 if ((de > -2) && (de < 2) && (dp > -4) && (
dp < 4) && (e_long > (.5 * e_seed))) {
296 coreCanid.push_back(e_long);
302 double d_p =
p.phi() - sp.
phi();
312 w_x += (
p.x()) * wgt;
313 w_y += (
p.y()) * wgt;
314 w_z += (
p.z()) * wgt;
318 if (
dp == 0 && de == 0)
322 if (e_short > m_minTowerEnergy && is !=
hf.end()) {
324 usedHits.push_back(ids.rawId());
328 if ((de > -2) && (de < 2) && (dp > -4) && (
dp < 4)) {
332 if ((
dp == 0) && (de == 0)) {
343 for (ci = coreCanid.begin(); ci != coreCanid.end(); ci++) {
344 if (ci == coreCanid.begin()) {
346 }
else if (*ci > .5 * l_1e) {
356 double eta = xyzclus.eta();
358 double phi = xyzclus.phi();
366 int idx = fabs(seedid.
ieta()) - 29;
367 int ipx = seedid.
iphi();
368 double Cphi = (phi - m_seedmnPhi[ipx]) / (m_seedMXphi[ipx] - m_seedmnPhi[ipx]);
369 double Ceta = (fabs(
eta) - m_seedmnEta[
idx]) / (m_seedMXeta[
idx] - m_seedmnEta[
idx]);
372 HFEMClusterShape myClusShp(l_1, s_1, l_3, s_3, l_5, s_5, l_1e, Ceta, Cphi, seedid);
385 if (!(m_isMC && !m_forcePulseFlagMC))
393 for (
int ii = 0;
ii < 13;
ii++) {
394 m_cutByEta.push_back(-1);
395 m_seedmnEta.push_back(99);
396 m_seedMXeta.push_back(-1);
void clusterize(const HFRecHitCollection &hf, const CaloGeometry &geom, reco::HFEMClusterShapeCollection &clusters, reco::SuperClusterCollection &SuperClusters)
constexpr int zside() const
get the z-side of the cell (1/-1)
constexpr int ietaAbs() const
get the absolute value of the cell ieta
Geom::Phi< T > phi() const
std::vector< T >::const_iterator const_iterator
bool operator()(const HFClusterAlgo::HFCompleteHit &h1, const HFClusterAlgo::HFCompleteHit &h2) const
std::vector< HFEMClusterShape > HFEMClusterShapeCollection
static const double MCMaterialCorrections_3XX[]
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ietaAbs(uint32_t id)
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
constexpr int ieta() const
get the cell ieta
Abs< T >::type abs(const T &t)
static int indexByEta(HcalDetId id)
Log< level::Info, false > LogInfo
bool operator()(const double c1, const double c2) const
XYZPointD XYZPoint
point in space with cartesian internal representation
constexpr uint32_t flagField(int base, int width=1) const
Log< level::Warning, false > LogWarning
bool makeCluster(const HcalDetId &seedid, const HFRecHitCollection &hf, const CaloGeometry *geom, reco::HFEMClusterShape &clusShp, reco::SuperCluster &SClus)
bool isPMTHit(const HFRecHit &hfr)
void setup(double minTowerEnergy, double seedThreshold, double maximumSL, double m_maximumRenergy, bool usePMTflag, bool usePulseflag, bool forcePulseFlagMC, int correctionSet)
constexpr int iphi() const
get the cell iphi