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;
92 return spr::energyECAL(vdets,hitsEB,sevlv,
false,
true,ebThr,tMin,tMax,debug);
94 return spr::energyECAL(vdets,hitsEE,sevlv,
false,
false,eeThr,tMin,tMax,debug);
96 return std::pair<double,bool>(0,
true);
108 int ieta,
int iphi,
double ebThr,
109 double eeThr,
double tMin,
double tMax,
112 std::vector<DetId> vdets;
116 std::cout <<
"Inside eECALmatrix " << 2*ieta+1 <<
"X" << 2*iphi+1
117 <<
" nXtals " << vdets.size() << std::endl;
123 for (
const auto &
id : vdets) {
127 bool ok = (
id.subdetId()==
EcalBarrel) ? (eTower > ebThr) : (eTower > eeThr);
129 if (debug && (!ok))
std::cout <<
"Crystal 0x" << std::hex <<
id()
130 <<
std::dec <<
" Flag " << ok <<std::endl;
133 std::pair<double,bool> ecalEn = (
id.subdetId()==
EcalBarrel) ?
136 if (!ecalEn.second) flag =
false;
137 energySum += ecalEn.first;
142 if (debug)
std::cout <<
"energyECAL: energySum = " << energySum
143 <<
" flag = " << flag << std::endl;
154 double ebThr,
double eeThr,
double tMin,
155 double tMax,
bool debug) {
161 std::cout <<
"eECALmatrix: " << detId <<
" belongs to " << tower
162 <<
" which has " << ids.size() <<
" constituents" << std::endl;
163 for (
unsigned int i=0;
i<ids.size(); ++
i) {
181 return spr::energyECAL(ids,hitsEB,sevlv,
false,
true,ebThr,tMin,tMax,debug);
183 return spr::energyECAL(ids,hitsEE,sevlv,
false,
false,eeThr,tMin,tMax,debug);
185 return std::pair<double,bool>(0,
true);
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)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
const_iterator end() const
T const * product() const
double energySum(const DataFrame &df, int fs, int ls)
Detector det() const
get the detector field from this detid
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)