48 if (recoverEBIsolatedChannels_ && singleRecoveryMethod_ ==
"BDTG")
73 uint32_t flags = (0xF & uncalibRH.
flags());
94 std::vector<DetId> vid =
ttMap_->constituentsOf(ttDetId);
95 for (std::vector<DetId>::const_iterator dit = vid.begin(); dit != vid.end(); ++dit) {
106 std::vector<DetId> eeC;
107 for (
int dx = 1;
dx <= 5; ++
dx) {
108 for (
int dy = 1;
dy <= 5; ++
dy) {
109 int ix = (sc.
ix() - 1) * 5 +
dx;
110 int iy = (sc.
iy() - 1) * 5 +
dy;
113 eeC.push_back(
EEDetId(ix, iy, iz));
117 for (
size_t i = 0;
i < eeC.size(); ++
i) {
132 bool AcceptRecHit =
true;
137 if (hit.
energy() != 0 and AcceptRecHit ==
true) {
150 bool AcceptRecHit =
true;
154 if (hit.
energy() != 0 and AcceptRecHit ==
true) {
179 if (tp != tpDigis->
end()) {
182 std::vector<DetId> vid =
ttMap_->constituentsOf(ttDetId);
183 float tpEt = ecalScale.getTPGInGeV(tp->compressedEt(), tp->id());
185 if (tpEt > tpEtThreshEB) {
186 edm::LogWarning(
"EnergyInDeadEB_FE") <<
"TP energy in the dead TT = " << tpEt <<
" at " << ttDetId;
191 for (std::vector<DetId>::const_iterator dit = vid.begin(); dit != vid.end(); ++dit) {
195 float tpEt = ecalScale.getTPGInGeV(tp->compressedEt(), tp->id());
199 if (tp->compressedEt() == 0xFF)
208 std::vector<DetId> vid =
ttMap_->constituentsOf(ttDetId);
209 for (std::vector<DetId>::const_iterator dit = vid.begin(); dit != vid.end(); ++dit) {
230 for (
int dx = 1;
dx <= 5; ++
dx) {
231 for (
int dy = 1;
dy <= 5; ++
dy) {
232 int ix = (sc.ix() - 1) * 5 +
dx;
233 int iy = (sc.iy() - 1) * 5 +
dy;
250 std::set<EcalTrigTowerDetId> aTT;
251 for (std::set<DetId>::const_iterator it = eeC.begin(); it != eeC.end(); ++it) {
252 aTT.insert(
ttMap_->towerOf(*it));
260 std::set<DetId> aTTC;
261 bool atLeastOneTPSaturated =
false;
262 for (std::set<EcalTrigTowerDetId>::const_iterator it = aTT.begin(); it != aTT.end(); ++it) {
265 if (itTP != tpDigis->
end()) {
266 std::vector<DetId>
v =
ttMap_->constituentsOf(*it);
269 std::vector<DetId>::iterator ttcons = v.begin();
270 while (ttcons != v.end()) {
272 ttcons = v.erase(ttcons);
278 if (itTP->compressedEt() == 0xFF) {
279 atLeastOneTPSaturated =
301 totE += ((it->ietaAbs() > 26) ? 2 : 1) * ecalScale.
getTPGInGeV(itTP->compressedEt(), itTP->id());
306 if (itTP->compressedEt() == 0) {
307 for (
size_t i = 0;
i < v.size(); ++
i)
309 }
else if (itTP->compressedEt() != 0xFF) {
311 for (
size_t j = 0;
j < v.size(); ++
j) {
321 for (std::set<DetId>::const_iterator it = eeC.begin(); it != eeC.end(); ++it) {
326 for (std::set<DetId>::const_iterator it = aTTC.begin(); it != aTTC.end(); ++it) {
328 if (jt != hits->
end()) {
329 float energy = jt->energy();
331 float pf = 1.0 / cosh(eta);
339 if (scEt > scEtThreshEE) {
340 edm::LogWarning(
"EnergyInDeadEE_FE") <<
"TP energy in the dead TT = " << scEt <<
" at " << sc;
346 for (std::set<DetId>::const_iterator it = eeC.begin(); it != eeC.end(); ++it) {
348 float pf = 1.0 / cosh(eta);
351 if (atLeastOneTPSaturated)
364 const std::set<DetId>& sId,
365 const std::vector<DetId>& vId,
369 for (std::vector<DetId>::const_iterator vIdit = vId.begin(); vIdit != vId.end(); ++vIdit) {
370 std::set<DetId>::const_iterator sIdit = sId.find(*vIdit);
371 if (sIdit == sId.end()) {
374 float pf = 1.0 / cosh(eta);
375 xtalE += energy * pf;
383 ttMap_->towerOf(*vId.begin()));
386 return etsat / cosh(ieta) * (ieta > 26 ? 2 : 1);
388 return xtalE * ((vId.size() / (float)count) - 1) * (ieta > 26 ? 2 : 1);
394 edm::LogWarning(
"EcalRecHitWorkerRecover") <<
"DetId already recovered! Skipping...";
398 if (it == collection.
end()) {
421 edm::LogError(
"EcalRecHitWorkerRecover::InvalidDetId") <<
"Invalid DetId " <<
id.rawId();
438 uint16_t dbStatus = 0;
440 dbStatus = chIt->getEncodedStatusCode();
442 edm::LogError(
"ObjectNotFound") <<
"No channel status found for xtal " <<
id.rawId()
443 <<
"! something wrong with EcalChannelStatus in your DB? ";
446 for (std::vector<int>::const_iterator
status = statusestoexclude.begin();
status != statusestoexclude.end();
std::string singleRecoveryMethod_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
double singleRecoveryThreshold_
edm::ESGetToken< CaloSubdetectorGeometry, EcalBarrelGeometryRecord > pEBGeomToken_
double logWarningEtThreshold_EB_FE_
bool recoverEEIsolatedChannels_
const edm::EventSetup * eventSetup_
const edm::EventSetup & c
float estimateEnergy(int ieta, EcalRecHitCollection *hits, const std::set< DetId > &sId, const std::vector< DetId > &vId, const EcalTPGScale &tpgscale)
bool alreadyInserted(const DetId &id)
uint16_t *__restrict__ id
bool run(const edm::Event &evt, const EcalUncalibratedRecHit &uncalibRH, EcalRecHitCollection &result) override
EcalDeadChannelRecoveryAlgos< EEDetId > eeDeadChannelCorrector
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > pEcalMappingToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
Sin< T >::type sin(const T &t)
constexpr uint32_t rawId() const
get the raw id
std::vector< T >::const_iterator const_iterator
Geom::Theta< T > theta() const
std::vector< int > dbStatusToBeExcludedEE_
void push_back(T const &t)
edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecord > laserToken_
edm::ESHandle< EcalElectronicsMapping > pEcalMapping_
void setFlag(int flag)
set the flags (from Flags or ESFlags)
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)
void insertRecHit(const EcalRecHit &hit, EcalRecHitCollection &collection)
double logWarningEtThreshold_EE_FE_
EcalTPGScale::Tokens ecalScaleTokens_
std::unique_ptr< EcalRecHitSimpleAlgo > rechitMaker_
EcalChannelStatusMap EcalChannelStatus
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
void setParameters(const edm::ParameterSet &ps)
edm::ESHandle< CaloSubdetectorGeometry > pEBGeom_
const CaloGeometry * geo_
bool recoverEBIsolatedChannels_
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi) const
const CaloSubdetectorGeometry * ebGeom_
std::vector< EcalRecHit >::iterator iterator
const_iterator end() const
void set(const edm::EventSetup &es) override
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > ttMapToken_
DetId id() const
get the id
T const * product() 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.
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_
T const * product() const
T getParameter(std::string const &) const
iterator find(key_type k)
EcalRecHitWorkerRecover(const edm::ParameterSet &, edm::ConsumesCollector &c)
edm::ESHandle< CaloGeometry > caloGeometry_
#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_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Log< level::Warning, false > LogWarning
EcalDeadChannelRecoveryAlgos< EBDetId > ebDeadChannelCorrector
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_