35 #include <sys/types.h> 85 ecalMappingToken_ = esConsumes<EcalElectronicsMapping, EcalMappingRcd, edm::Transition::BeginRun>();
86 channelStatusToken_ = esConsumes<EcalChannelStatusMap, EcalChannelStatusRcd, edm::Transition::BeginRun>();
87 ttMapToken_ = esConsumes<EcalTrigTowerConstituentsMap, IdealGeometryRecord, edm::Transition::BeginRun>();
133 template <
typename CollT,
typename ItemT>
135 typename CollT::const_iterator
res =
std::find(coll.begin(), coll.end(),
item);
136 return (
res != coll.end());
140 std::vector<edm::Handle<EBDetIdCollection>> ebDetIdColls;
141 std::vector<edm::Handle<EEDetIdCollection>> eeDetIdColls;
142 std::vector<edm::Handle<EcalElectronicsIdCollection>> ttColls;
144 auto ebDetIdToRecover = std::make_unique<std::set<EBDetId>>();
145 auto eeDetIdToRecover = std::make_unique<std::set<EEDetId>>();
146 auto ebTTDetIdToRecover = std::make_unique<std::set<EcalTrigTowerDetId>>();
147 auto eeSCDetIdToRecover = std::make_unique<std::set<EcalScDetId>>();
201 const int flag = it->value();
208 for (std::vector<DetId>::const_iterator itId =
vid.begin(); itId !=
vid.end(); ++itId) {
217 const int flag = it->value();
225 std::vector<DetId>
vid;
226 for (
int dx = 1;
dx <= 5; ++
dx) {
227 for (
int dy = 1;
dy <= 5; ++
dy) {
228 const int ix = (scId.ix() - 1) * 5 +
dx;
229 const int iy = (scId.iy() - 1) * 5 +
dy;
230 const int iz = scId.zside();
238 for (std::vector<DetId>::const_iterator itId =
vid.begin(); itId !=
vid.end(); ++itId) {
244 if (ebSrFlags->empty()) {
247 if (eeSrFlags->
empty()) {
261 ebDetIdToRecover->insert(*jt);
269 eeDetIdToRecover->insert(*jt);
281 const int flag = (*chit).getStatusCode();
283 ebDetIdToRecover->insert(*itId);
284 }
else if (
flag == 13 ||
flag == 14) {
285 ebTTDetIdToRecover->insert((*itId).tower());
288 edm::LogError(
"EcalDetIdToBeRecoveredProducer") <<
"No channel status found for xtal " << (*itId).rawId()
289 <<
"! something wrong with EcalChannelStatus in your DB? ";
296 int flag = (*chit).getStatusCode();
298 eeDetIdToRecover->insert(*itId);
299 }
else if (
flag == 13 ||
flag == 14) {
300 eeSCDetIdToRecover->insert(
301 EcalScDetId(1 + ((*itId).ix() - 1) / 5, 1 + ((*itId).iy() - 1) / 5, (*itId).zside()));
304 edm::LogError(
"EcalDetIdToBeRecoveredProducer") <<
"No channel status found for xtal " << (*itId).rawId()
305 <<
"! something wrong with EcalChannelStatus in your DB? ";
310 for (
size_t t = 0;
t < ttColls.size(); ++
t) {
313 for (
size_t i = 0;
i < coll.
size(); ++
i) {
323 for (
size_t j = 0;
j <
vid.size(); ++
j) {
325 if (
include(ebSrpDetId, ebdi)) {
326 ebDetIdToRecover->insert(ebdi);
327 ebTTDetIdToRecover->insert(ebdi.
tower());
333 std::vector<DetId>
vid;
334 for (
int dx = 1;
dx <= 5; ++
dx) {
335 for (
int dy = 1;
dy <= 5; ++
dy) {
336 const int ix = (scId.
ix() - 1) * 5 +
dx;
337 const int iy = (scId.
iy() - 1) * 5 +
dy;
338 const int iz = scId.
zside();
344 for (
size_t j = 0;
j <
vid.size(); ++
j) {
346 if (
include(eeSrpDetId, eedi)) {
347 eeDetIdToRecover->insert(eedi);
353 <<
"Incorrect EcalSubdetector = " << subdet <<
" in EcalElectronicsIdCollection collection ";
380 descriptions.
add(
"ecalDetIdToBeRecovered",
desc);
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
T getParameter(std::string const &) const
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
eeIntegrityGainSwitchErrors
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 *)
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
ebIntegrityGainSwitchErrors
T const * product() const
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
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_
void beginRun(edm::Run const &run, const edm::EventSetup &es) final
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