12 std::vector<PCaloHit>&
hits,
int ieta,
int iphi,
13 bool includeHO,
double hbThr,
double heThr,
14 double hfThr,
double hoThr,
double tMin,
double tMax,
bool 21 HcalDetId hcid(hcid0.subdet(),hcid0.ieta(),hcid0.iphi(),1);
22 DetId det(hcid.rawId());
24 if (
debug)
std::cout <<
"Inside eHCALmatrix " << 2*ieta+1 <<
"X" << 2*iphi+1 <<
" Inclusion of HO Flag " << includeHO << std::endl;
27 std::vector<DetId> dets(1,det);
28 std::vector<DetId> vdets =
spr::matrixHCALIds(dets, topology, ieta, iphi, includeHO,
false);
31 std::cout <<
"matrixHCALIds::Total number of cells found is " 32 << vdets.size() << std::endl;
37 for (
unsigned int i=0;
i<vdets.size();
i++) {
38 std::vector<std::vector<PCaloHit>::const_iterator>
hit =
spr::findHit(hits, vdets[
i]);
40 int subdet = ((
HcalDetId)(vdets[i].rawId())).subdet();
42 for (
unsigned int ihit=0; ihit<hit.size(); ihit++) {
43 if (hit[ihit] != hits.end()) {
46 if (
debug)
std::cout <<
"energyHCAL:: Hit " << khit <<
" " << (
HcalDetId)vdets[i] <<
" E " << hit[ihit]->energy() <<
" t " << hit[ihit]->time() << std::endl;
48 if (hit[ihit]->
time() > tMin && hit[ihit]->
time() < tMax) {
49 energy += hit[ihit]->energy();
53 if (energy>eThr) energySum += energy;
57 if (
debug)
std::cout <<
"eHCALmatrix::Total energy " << energySum << std::endl;
63 const DetId& det0, std::vector<PCaloHit>&
hits,
int ieta,
67 HcalDetId hcid(hcid0.subdet(),hcid0.ieta(),hcid0.iphi(),1);
68 DetId det(hcid.rawId());
69 std::vector<DetId> dets(1,det);
70 std::vector<DetId> vdets =
spr::matrixHCALIds(dets, topology, ieta, iphi, includeHO, debug);
73 std::vector<std::vector<PCaloHit>::const_iterator> hitlist;
74 for (
unsigned int i=0;
i<vdets.size();
i++) {
75 std::vector<std::vector<PCaloHit>::const_iterator>
hit =
spr::findHit(hits, vdets[
i]);
76 hitlist.insert(hitlist.end(), hit.begin(), hit.end());
80 for (
unsigned int ihit=0; ihit<hitlist.size(); ihit++)
81 energySum += hitlist[ihit]->energy();
85 std::vector<double> energies;
86 for (
unsigned int ihit=0; ihit<hitlist.size(); ihit++) {
87 double energy = hitlist[ihit]->energy();
92 for (
unsigned int idet=0; idet<dets.size(); ++idet) {
94 energies[idet] += energy;
101 energies.push_back(energy);
105 double energyMax(-99.);
106 for (
unsigned int ihit=0; ihit<dets.size(); ihit++) {
107 if (energies[ihit] > energyMax) {
108 energyMax = energies[ihit];
116 std::vector<std::pair<double,int> >& energyCell,
117 int maxDepth,
double hbThr,
double heThr,
double hfThr,
118 double hoThr,
double tMin,
double tMax,
int depthHE,
bool 125 int subdet = detId.
subdet();
130 std::cout <<
"energyHCALCell: input ID " << detId <<
" MaxDepth " << maxDepth <<
" Threshold (E) " << eThr <<
" (T) " << tMin <<
":" << tMax << std::endl;
135 DetId det(hcid.rawId());
136 std::vector<std::vector<PCaloHit>::const_iterator>
hit =
spr::findHit(hits, det);
138 for (
unsigned int ihit=0; ihit<hit.size(); ++ihit) {
139 if (hit[ihit]->
time() > tMin && hit[ihit]->time() < tMax)
140 energy += hit[ihit]->energy();
143 std::cout <<
"energyHCALCell:: Hit[" << ihit <<
"] " << hcid <<
" E " << hit[ihit]->energy() <<
" t " << hit[ihit]->time() << std::endl;
148 std::cout <<
"energyHCALCell:: Cell " << hcid <<
" E " << energy <<
" from " << hit.size() <<
" threshold " << eThr << std::endl;
150 if (energy>eThr && !hit.empty()) {
151 energyCell.push_back(std::pair<double,int>(energy,
i+1));
156 std::cout <<
"energyHCALCell:: " << energyCell.size() <<
" entries from " 157 << maxDepth <<
" depths:";
158 for (
unsigned int i=0;
i<energyCell.size(); ++
i) {
159 std::cout <<
" [" <<
i <<
"] (" << energyCell[
i].first <<
":" 160 << energyCell[
i].second <<
")";
169 std::vector<HcalDetId> dets;
170 std::vector<double> energies;
171 for (
unsigned int ihit=0; ihit<hit.size(); ihit++) {
174 if ((id0.subdet() !=
HcalOuter) || includeHO) {
177 for (
unsigned int idet=0; idet<dets.size(); ++idet) {
178 if (
id1 == dets[idet]) {
179 energies[idet] += energy;
186 energies.push_back(energy);
190 double energyMax(-99.);
192 for (
unsigned int ihit=0; ihit<dets.size(); ihit++) {
193 if (energies[ihit] > energyMax) {
194 energyMax = energies[ihit];
195 hotCell = dets[ihit];
203 std::vector<HcalDetId> dets;
204 std::vector<double> energies;
205 for (
unsigned int ihit=0; ihit<
hit.size(); ihit++) {
206 double energy =
hit.at(ihit)->energy();
211 for (
unsigned int idet=0; idet<dets.size(); ++idet) {
212 if (
id1 == dets[idet]) {
213 energies[idet] += energy;
220 energies.push_back(energy);
224 double energyMax(-99.);
226 for (
unsigned int ihit=0; ihit<dets.size(); ihit++) {
227 if (energies[ihit] > energyMax) {
228 energyMax = energies[ihit];
229 hotCell = dets[ihit];
238 if (subdet == (
int)(
HcalEndcap)) eThr = heThr;
239 else if (subdet == (
int)(
HcalForward)) eThr = hfThr;
240 else if (subdet == (
int)(
HcalOuter)) eThr = hoThr;
HcalSubdetector subdet() const
get the subdetector
std::vector< typename T::const_iterator > findHit(edm::Handle< T > &hits, DetId thisDet, bool debug=false)
CaloTopology const * topology(0)
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, bool useRaw=false, bool debug=false)
void debugHcalDets(unsigned int, std::vector< DetId > &)
double eHCALThreshold(int subdet, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100)
double getRawEnergy(HBHERecHitCollection::const_iterator hit, bool useRaw=false)
uint32_t rawId() const
get the raw id
int ieta() const
get the cell ieta
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, bool useRaw=false, int depthHE=3, bool debug=false)
int ietaAbs() const
get the absolute value of the cell ieta
int iphi() const
get the cell iphi
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)
HcalDetId getHotCell(std::vector< HBHERecHitCollection::const_iterator > &hit, bool includeHO, bool useRaw=false, bool debug=false)