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;
100 dets.push_back(
DetId(id1));
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,
bool 125 int subdet = detId.
subdet();
128 int depthHE = (maxDepth <= 6) ? 3 : 4;
131 std::cout <<
"energyHCALCell: input ID " << detId <<
" MaxDepth " << maxDepth <<
" Threshold (E) " << eThr <<
" (T) " << tMin <<
":" << tMax << std::endl;
136 DetId det(hcid.rawId());
137 std::vector<std::vector<PCaloHit>::const_iterator>
hit =
spr::findHit(hits, det);
139 for (
unsigned int ihit=0; ihit<hit.size(); ++ihit) {
140 if (hit[ihit]->
time() > tMin && hit[ihit]->time() < tMax)
141 energy += hit[ihit]->energy();
144 std::cout <<
"energyHCALCell:: Hit[" << ihit <<
"] " << hcid <<
" E " << hit[ihit]->energy() <<
" t " << hit[ihit]->time() << std::endl;
149 std::cout <<
"energyHCALCell:: Cell " << hcid <<
" E " << energy <<
" from " << hit.size() <<
" threshold " << eThr << std::endl;
151 if (energy>eThr && hit.size() > 0) {
152 energyCell.push_back(std::pair<double,int>(energy,
i+1));
157 std::cout <<
"energyHCALCell:: " << energyCell.size() <<
" entries from " 158 << maxDepth <<
" depths:";
159 for (
unsigned int i=0;
i<energyCell.size(); ++
i) {
160 std::cout <<
" [" <<
i <<
"] (" << energyCell[
i].first <<
":" 161 << energyCell[
i].second <<
")";
170 std::vector<HcalDetId> dets;
171 std::vector<double> energies;
172 for (
unsigned int ihit=0; ihit<hit.size(); ihit++) {
175 if ((id0.subdet() !=
HcalOuter) || includeHO) {
176 HcalDetId id1(id0.subdet(),id0.ieta(),id0.iphi(),1);
178 for (
unsigned int idet=0; idet<dets.size(); ++idet) {
179 if (id1 == dets[idet]) {
180 energies[idet] += energy;
187 energies.push_back(energy);
191 double energyMax(-99.);
193 for (
unsigned int ihit=0; ihit<dets.size(); ihit++) {
194 if (energies[ihit] > energyMax) {
195 energyMax = energies[ihit];
196 hotCell = dets[ihit];
204 std::vector<HcalDetId> dets;
205 std::vector<double> energies;
206 for (
unsigned int ihit=0; ihit<
hit.size(); ihit++) {
207 double energy =
hit.at(ihit)->energy();
212 for (
unsigned int idet=0; idet<dets.size(); ++idet) {
213 if (id1 == dets[idet]) {
214 energies[idet] += energy;
221 energies.push_back(energy);
225 double energyMax(-99.);
227 for (
unsigned int ihit=0; ihit<dets.size(); ihit++) {
228 if (energies[ihit] > energyMax) {
229 energyMax = energies[ihit];
230 hotCell = dets[ihit];
239 if (subdet == (
int)(
HcalEndcap)) eThr = heThr;
240 else if (subdet == (
int)(
HcalForward)) eThr = hfThr;
241 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, 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)