35 #include <sys/types.h> 86 ttMapToken_ = esConsumes<EcalTrigTowerConstituentsMap, IdealGeometryRecord>();
122 template <
typename CollT,
typename ItemT>
124 typename CollT::const_iterator
res =
std::find(coll.begin(), coll.end(),
item);
125 return (
res != coll.end());
133 std::vector<edm::Handle<EBDetIdCollection>> ebDetIdColls;
134 std::vector<edm::Handle<EEDetIdCollection>> eeDetIdColls;
135 std::vector<edm::Handle<EcalElectronicsIdCollection>> ttColls;
137 auto ebDetIdToRecover = std::make_unique<std::set<EBDetId>>();
138 auto eeDetIdToRecover = std::make_unique<std::set<EEDetId>>();
139 auto ebTTDetIdToRecover = std::make_unique<std::set<EcalTrigTowerDetId>>();
140 auto eeSCDetIdToRecover = std::make_unique<std::set<EcalScDetId>>();
194 const int flag =
it->value();
201 for (std::vector<DetId>::const_iterator itId =
vid.begin(); itId !=
vid.end(); ++itId) {
210 const int flag =
it->value();
218 std::vector<DetId>
vid;
219 for (
int dx = 1;
dx <= 5; ++
dx) {
220 for (
int dy = 1;
dy <= 5; ++
dy) {
221 const int ix = (scId.ix() - 1) * 5 +
dx;
222 const int iy = (scId.iy() - 1) * 5 +
dy;
223 const int iz = scId.zside();
231 for (std::vector<DetId>::const_iterator itId =
vid.begin(); itId !=
vid.end(); ++itId) {
237 if (ebSrFlags->empty()) {
240 if (eeSrFlags->
empty()) {
254 ebDetIdToRecover->insert(*jt);
262 eeDetIdToRecover->insert(*jt);
274 const int flag = (*chit).getStatusCode();
276 ebDetIdToRecover->insert(*itId);
277 }
else if (
flag == 13 ||
flag == 14) {
278 ebTTDetIdToRecover->insert((*itId).tower());
281 edm::LogError(
"EcalDetIdToBeRecoveredProducer") <<
"No channel status found for xtal " << (*itId).rawId()
282 <<
"! something wrong with EcalChannelStatus in your DB? ";
289 int flag = (*chit).getStatusCode();
291 eeDetIdToRecover->insert(*itId);
292 }
else if (
flag == 13 ||
flag == 14) {
293 eeSCDetIdToRecover->insert(
294 EcalScDetId(1 + ((*itId).ix() - 1) / 5, 1 + ((*itId).iy() - 1) / 5, (*itId).zside()));
297 edm::LogError(
"EcalDetIdToBeRecoveredProducer") <<
"No channel status found for xtal " << (*itId).rawId()
298 <<
"! something wrong with EcalChannelStatus in your DB? ";
303 for (
size_t t = 0;
t < ttColls.size(); ++
t) {
306 for (
size_t i = 0;
i < coll.
size(); ++
i) {
316 for (
size_t j = 0;
j <
vid.size(); ++
j) {
318 if (
include(ebSrpDetId, ebdi)) {
319 ebDetIdToRecover->insert(ebdi);
320 ebTTDetIdToRecover->insert(ebdi.
tower());
326 std::vector<DetId>
vid;
327 for (
int dx = 1;
dx <= 5; ++
dx) {
328 for (
int dy = 1;
dy <= 5; ++
dy) {
329 const int ix = (scId.
ix() - 1) * 5 +
dx;
330 const int iy = (scId.
iy() - 1) * 5 +
dy;
331 const int iz = scId.
zside();
337 for (
size_t j = 0;
j <
vid.size(); ++
j) {
339 if (
include(eeSrpDetId, eedi)) {
340 eeDetIdToRecover->insert(eedi);
346 <<
"Incorrect EcalSubdetector = " << subdet <<
" in EcalElectronicsIdCollection collection ";
373 descriptions.
add(
"ecalDetIdToBeRecovered",
desc);
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
T getParameter(std::string const &) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
std::string ebDetIdCollection_
std::vector< DetId > constituentsOf(const EcalTrigTowerDetId &id) const
Get the constituent detids for this tower id.
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_
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > ttMapToken_
void push_back(T const &t)
edm::EDGetTokenT< EBDetIdCollection > ebIntegrityGainErrorsToken_
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)
unsigned ttId(DetId const &, EcalElectronicsMapping const *)
eeIntegrityGainSwitchErrors
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
edm::EDGetTokenT< EEDetIdCollection > eeIntegrityGainSwitchErrorsToken_
void produce(edm::Event &evt, const edm::EventSetup &es) final
static const int SRF_FULL
#define DEFINE_FWK_MODULE(type)
const_iterator begin() const
EcalDetIdToBeRecoveredProducer(const edm::ParameterSet &ps)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
edm::EDGetTokenT< EBSrFlagCollection > ebSrFlagToken_
edm::EDGetTokenT< EBDetIdCollection > ebIntegrityGainSwitchErrorsToken_
std::string ttDetIdCollection_
const_iterator find(uint32_t rawId) const
edm::EDGetTokenT< EEDetIdCollection > eeIntegrityChIdErrorsToken_
EcalSubdetector subdet() const
get the subdet
const_iterator begin() const
const_iterator end() const
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
ebIntegrityGainSwitchErrors
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
std::vector< Item >::const_iterator const_iterator
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > ecalMappingToken_
std::string eeDetIdCollection_
edm::EDGetTokenT< EEDetIdCollection > eeIntegrityGainErrorsToken_
bool include(const CollT &coll, const ItemT &item)
edm::EDGetTokenT< EESrFlagCollection > eeSrFlagToken_
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
const_iterator end() const
edm::EDGetTokenT< EBDetIdCollection > ebIntegrityChIdErrorsToken_
const EcalChannelStatusMap * chStatus_
Log< level::Warning, false > LogWarning
const EcalElectronicsMapping * ecalMapping_
const_iterator end() const
DetId getDetId(const EcalElectronicsId &id) const
Get the detid given an electronicsId.
edm::ESGetToken< EcalChannelStatusMap, EcalChannelStatusRcd > channelStatusToken_
std::vector< T >::const_iterator const_iterator