18 bool testSpike,
double tMin,
double tMax,
20 std::vector<EcalRecHitCollection::const_iterator>
hits;
26 bool flag = (!testSpike) ?
true :
29 for (
const auto&
hit : hits) {
31 if (
hit != hitsEC->
end()) {
36 if (debug)
std::cout <<
" " << tt <<
" " << en;
38 if (tt > tMin && tt < tMax) ener += en;
41 if (!flag && debug)
std::cout <<
" detected to be a spike";
44 return std::pair<double,bool>(ener,
flag);
47 std::pair<double,bool>
energyECAL(
const std::vector<DetId>& vdets,
50 bool noThrCut,
bool testSpike,
double eThr,
51 double tMin,
double tMax,
bool debug) {
55 for (
const auto&
id : vdets) {
60 if (!ecalEn.second) flag =
false;
61 if ((ecalEn.first>eThr) || noThrCut) energySum += ecalEn.first;
65 if (debug)
std::cout <<
"energyECAL: energySum = " << energySum
66 <<
" flag = " << flag << std::endl;
78 int ieta,
int iphi,
double ebThr,
79 double eeThr,
double tMin,
double tMax,
82 std::vector<DetId> vdets;
86 std::cout <<
"Inside eECALmatrix " << 2*ieta+1 <<
"X" << 2*iphi+1
87 <<
" nXtals " << vdets.size() << std::endl;
91 for (
const auto&
id : vdets) {
100 return std::pair<double,bool>(
spr::energyECAL(vdets,hitsEB,hitsEE,ebThr,eeThr,tMin,tMax,debug),
flag);
111 int ieta,
int iphi,
double ebThr,
112 double eeThr,
double tMin,
double tMax,
115 std::vector<DetId> vdets;
119 std::cout <<
"Inside eECALmatrix " << 2*ieta+1 <<
"X" << 2*iphi+1
120 <<
" nXtals " << vdets.size() << std::endl;
126 for (
const auto &
id : vdets) {
130 bool ok = (
id.subdetId()==
EcalBarrel) ? (eTower > ebThr) : (eTower > eeThr);
132 if (debug && (!ok))
std::cout <<
"Crystal 0x" << std::hex <<
id()
133 <<
std::dec <<
" Flag " << ok <<std::endl;
136 std::pair<double,bool> ecalEn = (
id.subdetId()==
EcalBarrel) ?
139 if (!ecalEn.second) flag =
false;
140 energySum += ecalEn.first;
145 if (debug)
std::cout <<
"energyECAL: energySum = " << energySum
146 <<
" flag = " << flag << std::endl;
157 double ebThr,
double eeThr,
double tMin,
158 double tMax,
bool debug) {
164 std::cout <<
"eECALmatrix: " << detId <<
" belongs to " << tower
165 <<
" which has " << ids.size() <<
" constituents" << std::endl;
166 for (
unsigned int i=0;
i<ids.size(); ++
i) {
182 std::vector<DetId> idEBEE;
184 for (
const auto&
id : ids) {
186 idEBEE.emplace_back(
id);
190 idEBEE.emplace_back(
id);
197 std::cout <<
"eECALmatrix: with " << idEBEE.size() <<
" EB+EE hits and " 198 <<
"spike flag " << flag << std::endl;
200 double etot = (!idEBEE.empty()) ?
202 return std::pair<double,bool>(etot,
flag);
double energyECAL(std::vector< DetId > &vdets, edm::Handle< T > &hitsEB, edm::Handle< T > &hitsEE, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false)
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
std::vector< typename T::const_iterator > findHit(edm::Handle< T > &hits, DetId thisDet, bool debug=false)
void matrixECALIds(const DetId &det, int ieta, int iphi, const CaloGeometry *geo, const CaloTopology *caloTopology, std::vector< DetId > &vdets, bool debug=false, bool igNoreTransition=true)
std::vector< DetId > constituentsOf(const CaloTowerDetId &id) const
Get the constituent detids for this tower id ( not yet implemented )
CaloTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
const_iterator end() const
T const * product() const
double energySum(const DataFrame &df, int fs, int ls)
double energyECALTower(const DetId &detId, edm::Handle< T > &hitsEB, edm::Handle< T > &hitsEE, const EcalTrigTowerConstituentsMap &ttMap, bool debug=false)
double eECALmatrix(const DetId &detId, edm::Handle< T > &hitsEB, edm::Handle< T > &hitsEE, const CaloGeometry *geo, const CaloTopology *caloTopology, int ieta, int iphi, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false)