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>>();
138 const int flag = it->value();
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();
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();
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();
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) {
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();
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)
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.
#define DEFINE_FWK_MODULE(type)
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_
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)
T const * product() const
edm::EDGetTokenT< EEDetIdCollection > eeIntegrityGainSwitchErrorsToken_
void produce(edm::Event &evt, const edm::EventSetup &es) final
static const int SRF_FULL
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
eeIntegrityGainSwitchErrors
const EcalElectronicsMapping * ecalMapping_
const_iterator end() const
ebIntegrityGainSwitchErrors
DetId getDetId(const EcalElectronicsId &id) const
Get the detid given an electronicsId.
edm::ESGetToken< EcalChannelStatusMap, EcalChannelStatusRcd > channelStatusToken_
std::vector< T >::const_iterator const_iterator