16 #include <sys/types.h>
20 ecalMappingToken_ = esConsumes<EcalElectronicsMapping, EcalMappingRcd, edm::Transition::BeginRun>();
21 channelStatusToken_ = esConsumes<EcalChannelStatusMap, EcalChannelStatusRcd, edm::Transition::BeginRun>();
22 ttMapToken_ = esConsumes<EcalTrigTowerConstituentsMap, IdealGeometryRecord, edm::Transition::BeginRun>();
70 template <
typename CollT,
typename ItemT>
72 typename CollT::const_iterator res =
std::find(coll.begin(), coll.end(),
item);
73 return (res != coll.end());
77 std::vector<edm::Handle<EBDetIdCollection>> ebDetIdColls;
78 std::vector<edm::Handle<EEDetIdCollection>> eeDetIdColls;
79 std::vector<edm::Handle<EcalElectronicsIdCollection>> ttColls;
81 auto ebDetIdToRecover = std::make_unique<std::set<EBDetId>>();
82 auto eeDetIdToRecover = std::make_unique<std::set<EEDetId>>();
83 auto ebTTDetIdToRecover = std::make_unique<std::set<EcalTrigTowerDetId>>();
84 auto eeSCDetIdToRecover = std::make_unique<std::set<EcalScDetId>>();
101 ebDetIdColls.push_back(ebIntegrityGainErrors);
105 ebDetIdColls.push_back(ebIntegrityGainSwitchErrors);
109 ebDetIdColls.push_back(ebIntegrityChIdErrors);
113 eeDetIdColls.push_back(eeIntegrityGainErrors);
117 eeDetIdColls.push_back(eeIntegrityGainSwitchErrors);
121 eeDetIdColls.push_back(eeIntegrityChIdErrors);
125 ttColls.push_back(integrityTTIdErrors);
129 ttColls.push_back(integrityBlockSizeErrors);
138 const int flag = it->value();
143 const std::vector<DetId> vid =
ttMap_->constituentsOf(ttId);
145 for (std::vector<DetId>::const_iterator itId = vid.begin(); itId != vid.end(); ++itId) {
154 const int flag = it->value();
162 std::vector<DetId> vid;
163 for (
int dx = 1;
dx <= 5; ++
dx) {
164 for (
int dy = 1;
dy <= 5; ++
dy) {
165 const int ix = (scId.ix() - 1) * 5 +
dx;
166 const int iy = (scId.iy() - 1) * 5 +
dy;
167 const int iz = scId.zside();
169 vid.push_back(
EEDetId(ix, iy, iz));
175 for (std::vector<DetId>::const_iterator itId = vid.begin(); itId != vid.end(); ++itId) {
181 if (ebSrFlags->empty()) {
184 if (eeSrFlags->empty()) {
198 ebDetIdToRecover->insert(*jt);
206 eeDetIdToRecover->insert(*jt);
218 const int flag = (*chit).getStatusCode();
219 if (flag >= 10 && flag <= 12) {
220 ebDetIdToRecover->insert(*itId);
221 }
else if (flag == 13 || flag == 14) {
222 ebTTDetIdToRecover->insert((*itId).tower());
225 edm::LogError(
"EcalDetIdToBeRecoveredProducer") <<
"No channel status found for xtal " << (*itId).rawId()
226 <<
"! something wrong with EcalChannelStatus in your DB? ";
233 int flag = (*chit).getStatusCode();
234 if (flag >= 10 && flag <= 12) {
235 eeDetIdToRecover->insert(*itId);
236 }
else if (flag == 13 || flag == 14) {
237 eeSCDetIdToRecover->insert(
238 EcalScDetId(1 + ((*itId).ix() - 1) / 5, 1 + ((*itId).iy() - 1) / 5, (*itId).zside()));
241 edm::LogError(
"EcalDetIdToBeRecoveredProducer") <<
"No channel status found for xtal " << (*itId).rawId()
242 <<
"! something wrong with EcalChannelStatus in your DB? ";
247 for (
size_t t = 0;
t < ttColls.size(); ++
t) {
250 for (
size_t i = 0;
i < coll.
size(); ++
i) {
258 const std::vector<DetId>& vid =
ttMap_->constituentsOf(
ttId);
260 for (
size_t j = 0;
j < vid.size(); ++
j) {
262 if (
include(ebSrpDetId, ebdi)) {
263 ebDetIdToRecover->insert(ebdi);
264 ebTTDetIdToRecover->insert(ebdi.
tower());
270 std::vector<DetId> vid;
271 for (
int dx = 1;
dx <= 5; ++
dx) {
272 for (
int dy = 1;
dy <= 5; ++
dy) {
273 const int ix = (scId.
ix() - 1) * 5 +
dx;
274 const int iy = (scId.
iy() - 1) * 5 +
dy;
275 const int iz = scId.
zside();
277 vid.push_back(
EEDetId(ix, iy, iz));
281 for (
size_t j = 0;
j < vid.size(); ++
j) {
283 if (
include(eeSrpDetId, eedi)) {
284 eeDetIdToRecover->insert(eedi);
290 <<
"Incorrect EcalSubdetector = " << subdet <<
" in EcalElectronicsIdCollection collection ";
317 descriptions.
add(
"ecalDetIdToBeRecovered", desc);
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::string ebDetIdCollection_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
tuple integrityTTIdErrors
#define DEFINE_FWK_MODULE(type)
const_iterator end() const
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
static const int SRF_FORCED_MASK
edm::EDGetTokenT< EcalElectronicsIdCollection > integrityBlockSizeErrorsToken_
std::vector< T >::const_iterator const_iterator
std::string scDetIdCollection_
~EcalDetIdToBeRecoveredProducer() override
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > ttMapToken_
void push_back(T const &t)
edm::EDGetTokenT< EBDetIdCollection > ebIntegrityGainErrorsToken_
tuple eeIntegrityGainErrors
edm::EDGetTokenT< EcalElectronicsIdCollection > integrityTTIdErrorsToken_
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
tuple ebIntegrityGainErrors
unsigned ttId(DetId const &, EcalElectronicsMapping const *)
tuple eeIntegrityGainSwitchErrors
tuple ebIntegrityGainSwitchErrors
edm::EDGetTokenT< EEDetIdCollection > eeIntegrityGainSwitchErrorsToken_
void produce(edm::Event &evt, const edm::EventSetup &es) final
tuple ebIntegrityChIdErrors
static const int SRF_FULL
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
EcalDetIdToBeRecoveredProducer(const edm::ParameterSet &ps)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
tuple eeIntegrityChIdErrors
edm::EDGetTokenT< EBSrFlagCollection > ebSrFlagToken_
EcalSubdetector subdet() const
get the subdet
edm::EDGetTokenT< EBDetIdCollection > ebIntegrityGainSwitchErrorsToken_
std::string ttDetIdCollection_
edm::EDGetTokenT< EEDetIdCollection > eeIntegrityChIdErrorsToken_
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
const_iterator begin() const
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
std::vector< Item >::const_iterator const_iterator
T const * product() const
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > ecalMappingToken_
DetId getDetId(const EcalElectronicsId &id) const
Get the detid given an electronicsId.
std::string eeDetIdCollection_
tuple integrityBlockSizeErrors
edm::EDGetTokenT< EEDetIdCollection > eeIntegrityGainErrorsToken_
bool include(const CollT &coll, const ItemT &item)
const_iterator find(uint32_t rawId) const
edm::EDGetTokenT< EESrFlagCollection > eeSrFlagToken_
void beginRun(edm::Run const &run, const edm::EventSetup &es) final
const_iterator end() const
edm::EDGetTokenT< EBDetIdCollection > ebIntegrityChIdErrorsToken_
const EcalChannelStatusMap * chStatus_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Log< level::Warning, false > LogWarning
const EcalElectronicsMapping * ecalMapping_
edm::ESGetToken< EcalChannelStatusMap, EcalChannelStatusRcd > channelStatusToken_
std::vector< T >::const_iterator const_iterator