51 const std::set<DetId>& sId,
52 const std::vector<DetId>& vId,
114 rechitMaker_ = std::make_unique<EcalRecHitSimpleAlgo>();
190 for (std::vector<DetId>::const_iterator dit =
vid.begin(); dit !=
vid.end(); ++dit) {
201 std::vector<DetId> eeC;
202 for (
int dx = 1;
dx <= 5; ++
dx) {
203 for (
int dy = 1;
dy <= 5; ++
dy) {
204 int ix = (sc.
ix() - 1) * 5 +
dx;
205 int iy = (sc.
iy() - 1) * 5 +
dy;
212 for (
size_t i = 0;
i < eeC.size(); ++
i) {
227 bool AcceptRecHit =
true;
232 if (
hit.energy() != 0 and AcceptRecHit ==
true) {
245 bool AcceptRecHit =
true;
249 if (
hit.energy() != 0 and AcceptRecHit ==
true) {
274 if (
tp != tpDigis->
end()) {
278 float tpEt = ecalScale.getTPGInGeV(
tp->compressedEt(),
tp->id());
280 if (tpEt > tpEtThreshEB) {
281 edm::LogWarning(
"EnergyInDeadEB_FE") <<
"TP energy in the dead TT = " << tpEt <<
" at " << ttDetId;
286 for (std::vector<DetId>::const_iterator dit =
vid.begin(); dit !=
vid.end(); ++dit) {
290 float tpEt = ecalScale.getTPGInGeV(
tp->compressedEt(),
tp->id());
294 if (
tp->compressedEt() == 0xFF)
304 for (std::vector<DetId>::const_iterator dit =
vid.begin(); dit !=
vid.end(); ++dit) {
325 for (
int dx = 1;
dx <= 5; ++
dx) {
326 for (
int dy = 1;
dy <= 5; ++
dy) {
327 int ix = (sc.ix() - 1) * 5 +
dx;
328 int iy = (sc.iy() - 1) * 5 +
dy;
345 std::set<EcalTrigTowerDetId> aTT;
346 for (std::set<DetId>::const_iterator
it = eeC.begin();
it != eeC.end(); ++
it) {
355 std::set<DetId> aTTC;
356 bool atLeastOneTPSaturated =
false;
357 for (std::set<EcalTrigTowerDetId>::const_iterator
it = aTT.begin();
it != aTT.end(); ++
it) {
360 if (itTP != tpDigis->
end()) {
364 std::vector<DetId>::iterator ttcons =
v.begin();
365 while (ttcons !=
v.end()) {
367 ttcons =
v.erase(ttcons);
373 if (itTP->compressedEt() == 0xFF) {
374 atLeastOneTPSaturated =
396 totE += ((
it->ietaAbs() > 26) ? 2 : 1) * ecalScale.
getTPGInGeV(itTP->compressedEt(), itTP->id());
401 if (itTP->compressedEt() == 0) {
402 for (
size_t i = 0;
i <
v.size(); ++
i)
404 }
else if (itTP->compressedEt() != 0xFF) {
406 for (
size_t j = 0;
j <
v.size(); ++
j) {
416 for (std::set<DetId>::const_iterator
it = eeC.begin();
it != eeC.end(); ++
it) {
421 for (std::set<DetId>::const_iterator
it = aTTC.begin();
it != aTTC.end(); ++
it) {
423 if (jt !=
hits->end()) {
424 float energy = jt->energy();
426 float pf = 1.0 / cosh(
eta);
434 if (scEt > scEtThreshEE) {
435 edm::LogWarning(
"EnergyInDeadEE_FE") <<
"TP energy in the dead TT = " << scEt <<
" at " << sc;
441 for (std::set<DetId>::const_iterator
it = eeC.begin();
it != eeC.end(); ++
it) {
443 float pf = 1.0 / cosh(
eta);
446 if (atLeastOneTPSaturated)
459 const std::set<DetId>& sId,
460 const std::vector<DetId>& vId,
464 for (std::vector<DetId>::const_iterator vIdit = vId.begin(); vIdit != vId.end(); ++vIdit) {
465 std::set<DetId>::const_iterator sIdit = sId.find(*vIdit);
466 if (sIdit == sId.end()) {
469 float pf = 1.0 / cosh(
eta);
481 return etsat / cosh(
ieta) * (
ieta > 26 ? 2 : 1);
483 return xtalE * ((vId.size() / (
float)
count) - 1) * (
ieta > 26 ? 2 : 1);
489 edm::LogWarning(
"EcalRecHitWorkerRecover") <<
"DetId already recovered! Skipping...";
505 edm::LogError(
"EcalRecHitWorkerRecover::InvalidDetId") <<
"Invalid DetId " <<
hit.
id().rawId();
516 edm::LogError(
"EcalRecHitWorkerRecover::InvalidDetId") <<
"Invalid DetId " <<
id.rawId();
533 uint16_t dbStatus = 0;
535 dbStatus = chIt->getEncodedStatusCode();
537 edm::LogError(
"ObjectNotFound") <<
"No channel status found for xtal " <<
id.rawId()
538 <<
"! something wrong with EcalChannelStatus in your DB? ";
541 for (std::vector<int>::const_iterator
status = statusestoexclude.begin();
status != statusestoexclude.end();
std::string singleRecoveryMethod_
double singleRecoveryThreshold_
edm::ESGetToken< CaloSubdetectorGeometry, EcalBarrelGeometryRecord > pEBGeomToken_
double logWarningEtThreshold_EB_FE_
T getParameter(std::string const &) const
bool recoverEEIsolatedChannels_
const edm::EventSetup * eventSetup_
float estimateEnergy(int ieta, EcalRecHitCollection *hits, const std::set< DetId > &sId, const std::vector< DetId > &vId, const EcalTPGScale &tpgscale)
bool alreadyInserted(const DetId &id)
bool run(const edm::Event &evt, const EcalUncalibratedRecHit &uncalibRH, EcalRecHitCollection &result) override
std::vector< DetId > constituentsOf(const EcalTrigTowerDetId &id) const
Get the constituent detids for this tower id.
EcalDeadChannelRecoveryAlgos< EEDetId > eeDeadChannelCorrector
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > pEcalMappingToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
Sin< T >::type sin(const T &t)
T const * product() const
std::vector< T >::const_iterator const_iterator
std::vector< int > dbStatusToBeExcludedEE_
edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecord > laserToken_
edm::ESHandle< EcalElectronicsMapping > pEcalMapping_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > chStatusToken_
edm::ESHandle< CaloTopology > caloTopology_
EcalTPGScale::Tokens tpgscaleTokens_
Log< level::Error, false > LogError
float recCheckCalib(float energy, int ieta)
void setCaloTopology(const CaloTopology *topology)
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
void insertRecHit(const EcalRecHit &hit, EcalRecHitCollection &collection)
double logWarningEtThreshold_EE_FE_
EcalTPGScale::Tokens ecalScaleTokens_
std::unique_ptr< EcalRecHitSimpleAlgo > rechitMaker_
T const * product() const
EcalChannelStatusMap EcalChannelStatus
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
void setParameters(const edm::ParameterSet &ps)
edm::ESHandle< CaloSubdetectorGeometry > pEBGeom_
const CaloGeometry * geo_
bool recoverEBIsolatedChannels_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const CaloSubdetectorGeometry * ebGeom_
std::vector< EcalRecHit >::iterator iterator
const_iterator end() const
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
void set(const edm::EventSetup &es) override
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > ttMapToken_
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
edm::EDGetTokenT< EcalTrigPrimDigiCollection > tpDigiToken_
std::vector< Item >::const_iterator const_iterator
std::set< DetId > recoveredDetIds_EE_
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi) const
iterator find(key_type k)
EcalRecHitWorkerRecover(const edm::ParameterSet &, edm::ConsumesCollector &c)
edm::ESHandle< CaloGeometry > caloGeometry_
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< int > dbStatusToBeExcludedEB_
float correct(const DetIdT id, const EcalRecHitCollection &hit_collection, std::string algo, double single8Cut, double sum8Cut, bool *accFlag)
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_
double sum8RecoveryThreshold_
Log< level::Warning, false > LogWarning
EcalDeadChannelRecoveryAlgos< EBDetId > ebDeadChannelCorrector
Geom::Theta< T > theta() const
edm::ESHandle< EcalChannelStatus > chStatus_
edm::ESHandle< EcalLaserDbService > laser
const EcalElectronicsMapping * ecalMapping_
bool checkChannelStatus(const DetId &id, const std::vector< int > &statusestoexclude)
std::set< DetId > recoveredDetIds_EB_