12 std::vector<PCaloHit>& hits,
24 HcalDetId hcid(hcid0.subdet(), hcid0.ieta(), hcid0.iphi(), 1);
25 DetId det(hcid.rawId());
27 edm::LogVerbatim(
"IsoTrack") <<
"Inside eHCALmatrix " << 2 * ieta + 1 <<
"X" << 2 * iphi + 1
28 <<
" Inclusion of HO Flag " << includeHO;
31 std::vector<DetId> dets(1, det);
32 std::vector<DetId> vdets =
spr::matrixHCALIds(dets, topology, ieta, iphi, includeHO,
false);
34 edm::LogVerbatim(
"IsoTrack") <<
"matrixHCALIds::Total number of cells found is " << vdets.size();
39 for (
unsigned int i = 0;
i < vdets.size();
i++) {
40 std::vector<std::vector<PCaloHit>::const_iterator>
hit =
spr::findHit(hits, vdets[
i]);
42 int subdet = ((
HcalDetId)(vdets[i].rawId())).subdet();
44 for (
unsigned int ihit = 0; ihit < hit.size(); ihit++) {
45 if (hit[ihit] != hits.end()) {
49 << hit[ihit]->
energy() <<
" t " << hit[ihit]->time();
51 if (hit[ihit]->time() > tMin && hit[ihit]->time() < tMax) {
52 energy += hit[ihit]->energy();
68 std::vector<PCaloHit>& hits,
75 HcalDetId hcid(hcid0.subdet(), hcid0.ieta(), hcid0.iphi(), 1);
76 DetId det(hcid.rawId());
77 std::vector<DetId> dets(1, det);
78 std::vector<DetId> vdets =
spr::matrixHCALIds(dets, topology, ieta, iphi, includeHO, debug);
81 std::vector<std::vector<PCaloHit>::const_iterator> hitlist;
82 for (
unsigned int i = 0;
i < vdets.size();
i++) {
83 std::vector<std::vector<PCaloHit>::const_iterator>
hit =
spr::findHit(hits, vdets[
i]);
84 hitlist.insert(hitlist.end(), hit.begin(), hit.end());
88 for (
unsigned int ihit = 0; ihit < hitlist.size(); ihit++)
89 energySum += hitlist[ihit]->
energy();
93 std::vector<double> energies;
94 for (
unsigned int ihit = 0; ihit < hitlist.size(); ihit++) {
95 double energy = hitlist[ihit]->energy();
100 for (
unsigned int idet = 0; idet < dets.size(); ++idet) {
108 dets.push_back(
DetId(id1));
109 energies.push_back(energy);
113 double energyMax(-99.);
114 for (
unsigned int ihit = 0; ihit < dets.size(); ihit++) {
115 if (energies[ihit] > energyMax) {
116 energyMax = energies[ihit];
124 std::vector<PCaloHit>& hits,
136 int subdet = detId.
subdet();
138 bool hbhe = (detId.
ietaAbs() == 16);
140 edm::LogVerbatim(
"IsoTrack") <<
"energyHCALCell: input ID " << detId <<
" MaxDepth " << maxDepth
141 <<
" Threshold (E) " << eThr <<
" (T) " << tMin <<
":" << tMax;
146 DetId det(hcid.rawId());
147 std::vector<std::vector<PCaloHit>::const_iterator>
hit =
spr::findHit(hits, det);
149 for (
unsigned int ihit = 0; ihit < hit.size(); ++ihit) {
150 if (hit[ihit]->time() > tMin && hit[ihit]->time() < tMax)
151 energy += hit[ihit]->
energy();
153 edm::LogVerbatim(
"IsoTrack") <<
"energyHCALCell:: Hit[" << ihit <<
"] " << hcid <<
" E "
154 << hit[ihit]->energy() <<
" t " << hit[ihit]->time();
158 edm::LogVerbatim(
"IsoTrack") <<
"energyHCALCell:: Cell " << hcid <<
" E " << energy <<
" from " << hit.size()
159 <<
" threshold " << eThr;
160 if (energy > eThr && !hit.empty()) {
161 energyCell.push_back(std::pair<double, int>(energy,
i + 1));
166 std::ostringstream st1;
167 st1 <<
"energyHCALCell:: " << energyCell.size() <<
" entries from " << maxDepth <<
" depths:";
168 for (
unsigned int i = 0;
i < energyCell.size(); ++
i) {
169 st1 <<
" [" <<
i <<
"] (" << energyCell[
i].first <<
":" << energyCell[
i].second <<
")";
176 std::vector<HcalDetId> dets;
177 std::vector<double> energies;
178 for (
unsigned int ihit = 0; ihit < hit.size(); ihit++) {
181 if ((id0.subdet() !=
HcalOuter) || includeHO) {
182 HcalDetId id1(id0.subdet(), id0.ieta(), id0.iphi(), 1);
184 for (
unsigned int idet = 0; idet < dets.size(); ++idet) {
185 if (id1 == dets[idet]) {
193 energies.push_back(energy);
197 double energyMax(-99.);
199 for (
unsigned int ihit = 0; ihit < dets.size(); ihit++) {
200 if (energies[ihit] > energyMax) {
201 energyMax = energies[ihit];
202 hotCell = dets[ihit];
209 std::vector<HcalDetId> dets;
210 std::vector<double> energies;
211 for (
unsigned int ihit = 0; ihit <
hit.size(); ihit++) {
217 for (
unsigned int idet = 0; idet < dets.size(); ++idet) {
218 if (id1 == dets[idet]) {
226 energies.push_back(energy);
230 double energyMax(-99.);
232 for (
unsigned int ihit = 0; ihit < dets.size(); ihit++) {
233 if (energies[ihit] > energyMax) {
234 energyMax = energies[ihit];
235 hotCell = dets[ihit];
241 double eHCALThreshold(
int subdet,
double hbThr,
double heThr,
double hfThr,
double hoThr) {
Log< level::Info, true > LogVerbatim
constexpr int ietaAbs() const
get the absolute value of the cell ieta
std::vector< typename T::const_iterator > findHit(edm::Handle< T > &hits, DetId thisDet, bool debug=false)
constexpr uint32_t rawId() const
get the raw id
void debugHcalDets(unsigned int, std::vector< DetId > &)
HcalDetId getHotCell(std::vector< HBHERecHitCollection::const_iterator > &hit, bool includeHO, int useRaw=0, bool debug=false)
double eHCALThreshold(int subdet, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100)
constexpr HcalSubdetector subdet() const
get the subdetector
constexpr int iphi() const
get the cell iphi
constexpr int ieta() const
get the cell ieta
double getRawEnergy(HBHERecHitCollection::const_iterator hit, int useRaw=0)
std::vector< DetId > matrixHCALIds(std::vector< DetId > &dets, const HcalTopology *topology, int ieta, int iphi, bool includeHO=false, bool debug=false)
double energySum(const DataFrame &df, int fs, int ls)
void energyHCALCell(HcalDetId detId, edm::Handle< T > &hits, std::vector< std::pair< double, int > > &energyCell, int maxDepth=1, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, int useRaw=0, int depthHE=3, bool debug=false)
double eHCALmatrix(const HcalTopology *topology, const DetId &det, edm::Handle< T > &hits, int ieta, int iphi, bool includeHO=false, bool algoNew=true, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, int useRaw=0, bool debug=false)