29 bool operator()(
const double c1,
const double c2)
const {
return c1 > c2; }
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};
40 double maximumRenergy,
43 bool forcePulseFlagMC,
45 m_seedThreshold = seedThreshold;
46 m_minTowerEnergy = minTowerEnergy;
47 m_maximumSL = maximumSL;
48 m_usePMTFlag = usePMTflag;
49 m_usePulseFlag = usePulseflag;
50 m_forcePulseFlagMC = forcePulseFlagMC;
51 m_maximumRenergy = maximumRenergy;
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) {
112 edm::LogWarning(
"HFClusterAlgo") <<
"Strange invalid HF hit: " << j->id();
116 if (m_cutByEta[iz] < 0) {
118 m_cutByEta[iz] = m_seedThreshold * cosh(eta);
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)) {
162 for (k = seeds.begin(); isok && k != seeds.end(); k++) {
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);
217 std::vector<double> coreCanid;
218 std::vector<double>::const_iterator ci;
220 std::vector<DetId> usedHits;
226 bool clusterOk =
true;
230 bool edge_type1 = seedid.
ietaAbs() == 39 && (seedid.
iphi() % 4) == 3;
232 double e_seed = si->energy() * m_correctionByEta[
indexByEta(si->id())];
234 for (de = -2; de <= 2; de++)
235 for (dp = -4; dp <= 4; dp += 2) {
236 phiWrap = seedid.
iphi() + dp;
243 if (edge_type1 && de == seedid.
zside()) {
248 }
else if (dp == -4) {
260 double e_short = 0.0;
262 e_long = il->energy() * m_correctionByEta[
indexByEta(il->id())];
263 if (e_long <= m_minTowerEnergy)
266 e_short = is->energy() * m_correctionByEta[
indexByEta(is->id())];
267 if (e_short <= m_minTowerEnergy)
269 double eRatio = (e_long - e_short) /
std::max(1.0, (e_long + e_short));
272 if ((
abs(eRatio) > m_maximumSL) && (
std::max(e_long, e_short) > m_maximumRenergy)) {
273 if (dp == 0 && de == 0)
278 if ((il != hf.
end()) && (isPMTHit(*il))) {
279 if (dp == 0 && de == 0)
284 if (e_long > m_minTowerEnergy && il != hf.
end()) {
286 usedHits.push_back(idl.rawId());
290 if ((de > -2) && (de < 2) && (dp > -4) && (dp < 4)) {
294 if ((dp == 0) && (de == 0)) {
299 if ((de > -2) && (de < 2) && (dp > -4) && (dp < 4) && (e_long > (.5 * e_seed))) {
300 coreCanid.push_back(e_long);
306 double d_p = p.
phi() - sp.
phi();
311 double d_e = p.
eta() - sp.
eta();
321 w_x += (p.
x()) * wgt;
322 w_y += (p.
y()) * wgt;
323 w_z += (p.
z()) * wgt;
327 if (dp == 0 && de == 0)
331 if (e_short > m_minTowerEnergy && is != hf.
end()) {
333 usedHits.push_back(ids.rawId());
337 if ((de > -2) && (de < 2) && (dp > -4) && (dp < 4)) {
341 if ((dp == 0) && (de == 0)) {
351 std::sort(coreCanid.begin(), coreCanid.end(),
CompareHFCore());
352 for (ci = coreCanid.begin(); ci != coreCanid.end(); ci++) {
353 if (ci == coreCanid.begin()) {
355 }
else if (*ci > .5 * l_1e) {
365 double eta = xyzclus.eta();
367 double phi = xyzclus.phi();
375 int idx = fabs(seedid.
ieta()) - 29;
376 int ipx = seedid.
iphi();
377 double Cphi = (phi - m_seedmnPhi[ipx]) / (m_seedMXphi[ipx] - m_seedmnPhi[ipx]);
378 double Ceta = (fabs(eta) - m_seedmnEta[idx]) / (m_seedMXeta[idx] - m_seedmnEta[idx]);
381 HFEMClusterShape myClusShp(l_1, s_1, l_3, s_3, l_5, s_5, l_1e, Ceta, Cphi, seedid);
394 if (!(m_isMC && !m_forcePulseFlagMC))
402 for (
int ii = 0;
ii < 13;
ii++) {
403 m_cutByEta.push_back(-1);
404 m_seedmnEta.push_back(99);
405 m_seedMXeta.push_back(-1);
void clusterize(const HFRecHitCollection &hf, const CaloGeometry &geom, reco::HFEMClusterShapeCollection &clusters, reco::SuperClusterCollection &SuperClusters)
static std::vector< std::string > checklist log
constexpr int ietaAbs() const
get the absolute value of the cell ieta
constexpr int zside() const
get the z-side of the cell (1/-1)
Geom::Phi< T > phi() const
std::vector< T >::const_iterator const_iterator
std::vector< HFEMClusterShape > HFEMClusterShapeCollection
static const double MCMaterialCorrections_3XX[]
bool operator()(const HFClusterAlgo::HFCompleteHit &h1, const HFClusterAlgo::HFCompleteHit &h2) const
constexpr int iphi() const
get the cell iphi
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Abs< T >::type abs(const T &t)
constexpr int ieta() const
get the cell ieta
const_iterator end() const
static int indexByEta(HcalDetId id)
Log< level::Info, false > LogInfo
constexpr uint32_t flagField(int base, int width=1) const
bool operator()(const double c1, const double c2) const
XYZPointD XYZPoint
point in space with cartesian internal representation
iterator find(key_type k)
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
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)
const_iterator begin() const