6 seleXtalMinEnergy_(0.
f),
12 seleS4S9GammaOne_(0.
f),
13 seleS4S9GammaTwo_(0.
f),
17 selePi0BeltDeta_(0.
f),
69 std::map<DetId, EcalRecHit> recHitsEB_map;
71 std::vector<EcalRecHit>
seeds;
72 std::vector<EBDetId> usedXtals;
77 std::vector<float> eClus;
78 std::vector<float> etClus;
79 std::vector<float> etaClus;
80 std::vector<float> phiClus;
81 std::vector<EBDetId> max_hit;
82 std::vector<std::vector<EcalRecHit> > RecHitsCluster;
83 std::vector<float> s4s9Clus;
90 std::pair<DetId, EcalRecHit> map_entry(
hit.
id(),
hit);
91 recHitsEB_map.insert(map_entry);
97 sort(
seeds.begin(),
seeds.end(), [](
auto&
x,
auto& y) {
return (
x.energy() > y.energy()); });
101 bool seedAlreadyUsed =
false;
102 for (
auto const& usedIds : usedXtals) {
103 if (usedIds == seed_id) {
104 seedAlreadyUsed =
true;
112 std::vector<std::pair<DetId, float> > clus_used;
114 std::vector<EcalRecHit> RecHitsInWindow;
116 double simple_energy = 0;
118 for (
auto const& det : clus_v) {
119 bool HitAlreadyUsed =
false;
120 for (
auto const& usedIds : usedXtals) {
121 if (usedIds == det) {
122 HitAlreadyUsed =
true;
128 if (recHitsEB_map.find(det) != recHitsEB_map.end()) {
129 std::map<DetId, EcalRecHit>::iterator aHit;
130 aHit = recHitsEB_map.find(det);
131 usedXtals.push_back(det);
132 RecHitsInWindow.push_back(aHit->second);
133 clus_used.push_back(std::pair<DetId, float>(det, 1.));
134 simple_energy = simple_energy + aHit->second.energy();
139 float theta_s = 2. * atan(
exp(-clus_pos.eta()));
140 float p0x_s = simple_energy *
sin(theta_s) *
cos(clus_pos.phi());
141 float p0y_s = simple_energy *
sin(theta_s) *
sin(clus_pos.phi());
142 float et_s =
sqrt(p0x_s * p0x_s + p0y_s * p0y_s);
144 eClus.push_back(simple_energy);
145 etClus.push_back(et_s);
146 etaClus.push_back(clus_pos.eta());
147 phiClus.push_back(clus_pos.phi());
148 max_hit.push_back(seed_id);
149 RecHitsCluster.push_back(RecHitsInWindow);
154 for (
int i = 0;
i < 4;
i++)
155 s4s9_[
i] =
seed.energy();
156 for (
unsigned int j = 0;
j < RecHitsInWindow.size();
j++) {
161 s4s9_[0] += RecHitsInWindow[
j].energy();
164 s4s9_[0] += RecHitsInWindow[
j].energy();
165 s4s9_[1] += RecHitsInWindow[
j].energy();
169 s4s9_[1] += RecHitsInWindow[
j].energy();
175 if (((
EBDetId)RecHitsInWindow[
j].
id()).iphi() == seed_id.
iphi() - 1 ||
177 s4s9_[0] += RecHitsInWindow[
j].energy();
178 s4s9_[3] += RecHitsInWindow[
j].energy();
182 s4s9_[1] += RecHitsInWindow[
j].energy();
183 s4s9_[2] += RecHitsInWindow[
j].energy();
187 if ((((
EBDetId)RecHitsInWindow[
j].
id()).
ieta() == seed_id.
ieta() + 1 && seed_id.
ieta() != -1) ||
191 s4s9_[3] += RecHitsInWindow[
j].energy();
194 s4s9_[2] += RecHitsInWindow[
j].energy();
195 s4s9_[3] += RecHitsInWindow[
j].energy();
199 s4s9_[2] += RecHitsInWindow[
j].energy();
204 edm::LogWarning(
"EcalDQM") <<
" (EBDetId)RecHitsInWindow[j].id()).ieta() " 205 << ((
EBDetId)RecHitsInWindow[
j].
id()).
ieta() <<
" seed_id.ieta() " 206 << seed_id.
ieta() <<
"\n" 207 <<
" Problem with S4 calculation\n";
213 s4s9Clus.push_back(*std::max_element(s4s9_, s4s9_ + 4) / simple_energy);
223 std::vector<EBDetId> scXtals;
228 for (Int_t
i = 0;
i < nClus;
i++) {
229 for (Int_t
j =
i + 1;
j < nClus;
j++) {
232 float theta_0 = 2. * atan(
exp(-etaClus[
i]));
233 float theta_1 = 2. * atan(
exp(-etaClus[
j]));
235 float p0x = eClus[
i] *
sin(theta_0) *
cos(phiClus[
i]);
236 float p1x = eClus[
j] *
sin(theta_1) *
cos(phiClus[
j]);
237 float p0y = eClus[
i] *
sin(theta_0) *
sin(phiClus[
i]);
238 float p1y = eClus[
j] *
sin(theta_1) *
sin(phiClus[
j]);
239 float p0z = eClus[
i] *
cos(theta_0);
240 float p1z = eClus[
j] *
cos(theta_1);
242 float pt_pi0 =
sqrt((p0x + p1x) * (p0x + p1x) + (p0y + p1y) * (p0y + p1y));
245 float m_inv =
sqrt((eClus[
i] + eClus[
j]) * (eClus[
i] + eClus[
j]) - (p0x + p1x) * (p0x + p1x) -
246 (p0y + p1y) * (p0y + p1y) - (p0z + p1z) * (p0z + p1z));
249 std::vector<int> IsoClus;
252 TVector3 pi0vect = TVector3((p0x + p1x), (p0y + p1y), (p0z + p1z));
253 for (Int_t
k = 0;
k < nClus;
k++) {
254 if (
k ==
i ||
k ==
j)
256 TVector3 Clusvect = TVector3(eClus[
k] *
sin(2. * atan(
exp(-etaClus[
k]))) *
cos(phiClus[
k]),
257 eClus[
k] *
sin(2. * atan(
exp(-etaClus[
k]))) *
sin(phiClus[
k]),
258 eClus[
k] *
cos(2. * atan(
exp(-etaClus[
k]))));
259 float dretaclpi0 = fabs(etaClus[
k] - pi0vect.Eta());
260 float drclpi0 = Clusvect.DeltaR(pi0vect);
263 Iso = Iso + etClus[
k];
264 IsoClus.push_back(
k);
#define DEFINE_ECALDQM_WORKER(TYPE)
bool filterRunType(short const *) override
void setParams(edm::ParameterSet const &) override
MESet & at(const std::string &key)
int iphi() const
get the crystal iphi
Sin< T >::type sin(const T &t)
edm::ParameterSet posCalcParameters_
CaloTopology const * GetTopology()
CaloGeometry const * GetGeometry()
int ieta() const
get the crystal ieta
void runOnEBRecHits(EcalRecHitCollection const &)
double seleXtalMinEnergy_
Cos< T >::type cos(const T &t)
math::XYZPoint Calculate_Location(const HitsAndFractions &iDetIds, const edm::SortedCollection< HitType > *iRecHits, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorGeometry *iESGeom=nullptr)
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
EcalDQMSetupObjects const getEcalDQMSetupObjects()
static constexpr int nDCC
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
XYZPointD XYZPoint
point in space with cartesian internal representation
Log< level::Warning, false > LogWarning
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly