19 #include <sys/types.h>
74 template <
typename CollT,
typename ItemT>
77 typename CollT::const_iterator res =
std::find( coll.begin(), coll.end(), item );
78 return ( res != coll.end() );
83 std::vector< edm::Handle<EBDetIdCollection> > ebDetIdColls;
84 std::vector< edm::Handle<EEDetIdCollection> > eeDetIdColls;
85 std::vector< edm::Handle<EcalElectronicsIdCollection> > ttColls;
87 std::auto_ptr< std::set<EBDetId> > ebDetIdToRecover(
new std::set<EBDetId> );
88 std::auto_ptr< std::set<EEDetId> > eeDetIdToRecover(
new std::set<EEDetId> );
89 std::auto_ptr< std::set<EcalTrigTowerDetId> > ebTTDetIdToRecover(
new std::set<EcalTrigTowerDetId> );
90 std::auto_ptr< std::set<EcalScDetId> > eeSCDetIdToRecover(
new std::set<EcalScDetId> );
107 ebDetIdColls.push_back( ebIntegrityGainErrors );
111 ebDetIdColls.push_back( ebIntegrityGainSwitchErrors );
115 ebDetIdColls.push_back( ebIntegrityChIdErrors );
119 eeDetIdColls.push_back( eeIntegrityGainErrors );
123 eeDetIdColls.push_back( eeIntegrityGainSwitchErrors );
129 eeDetIdColls.push_back( eeIntegrityChIdErrors );
136 ttColls.push_back( integrityTTIdErrors );
140 ttColls.push_back( integrityBlockSizeErrors );
149 const int flag = it->value();
154 const std::vector<DetId> vid =
ttMap_->constituentsOf( ttId );
156 for ( std::vector<DetId>::const_iterator itId = vid.begin(); itId != vid.end(); ++itId ) {
165 const int flag = it->value();
173 std::vector<DetId> vid;
174 for(
int dx=1; dx<=5; ++dx){
175 for(
int dy=1; dy<=5; ++dy){
176 const int ix = (scId.ix()-1)*5 + dx;
177 const int iy = (scId.iy()-1)*5 + dy;
178 const int iz = scId.
zside();
180 vid.push_back(
EEDetId(ix, iy, iz));
186 for ( std::vector<DetId>::const_iterator itId = vid.begin(); itId != vid.end(); ++itId ) {
192 if ( ebSrFlags->size() == 0 ) {
195 if ( eeSrFlags->size() == 0 ) {
209 ebDetIdToRecover->insert( *jt );
217 eeDetIdToRecover->insert( *jt );
229 const int flag = (*chit).getStatusCode();
230 if ( flag >= 10 && flag <= 12) {
231 ebDetIdToRecover->insert( *itId );
232 }
else if ( flag == 13 || flag == 14 ) {
233 ebTTDetIdToRecover->insert( (*itId).tower() );
236 edm::LogError(
"EcalDetIdToBeRecoveredProducer") <<
"No channel status found for xtal "
238 <<
"! something wrong with EcalChannelStatus in your DB? ";
245 int flag = (*chit).getStatusCode() ;
246 if ( flag >= 10 && flag <= 12) {
247 eeDetIdToRecover->insert( *itId );
248 }
else if ( flag == 13 || flag == 14 ) {
249 eeSCDetIdToRecover->insert(
EcalScDetId(1+((*itId).ix()-1)/5,1+((*itId).iy()-1)/5,(*itId).zside()) );
252 edm::LogError(
"EcalDetIdToBeRecoveredProducer") <<
"No channel status found for xtal "
254 <<
"! something wrong with EcalChannelStatus in your DB? ";
260 for (
size_t t = 0;
t < ttColls.size(); ++
t) {
263 for (
size_t i = 0;
i < coll.
size(); ++
i)
272 const std::vector<DetId>& vid =
ttMap_->constituentsOf(
ttId);
274 for (
size_t j = 0;
j < vid.size(); ++
j) {
276 if (
include(ebSrpDetId, ebdi)) {
277 ebDetIdToRecover->insert(ebdi);
278 ebTTDetIdToRecover->insert(ebdi.
tower());
285 std::vector<DetId> vid;
286 for(
int dx=1; dx<=5; ++dx) {
287 for(
int dy=1; dy<=5; ++dy) {
288 const int ix = (scId.
ix()-1)*5 + dx;
289 const int iy = (scId.
iy()-1)*5 + dy;
290 const int iz = scId.
zside();
292 vid.push_back(
EEDetId(ix, iy, iz));
296 for (
size_t j = 0;
j < vid.size(); ++
j) {
298 if (
include(eeSrpDetId, eedi)) {
299 eeDetIdToRecover->insert(eedi);
306 <<
"Incorrect EcalSubdetector = " << subdet
307 <<
" in EcalElectronicsIdCollection collection ";
T getParameter(std::string const &) const
std::string ebDetIdCollection_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void produce(edm::Event &evt, const edm::EventSetup &es) overridefinal
#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< EBSrFlag >::const_iterator const_iterator
std::string scDetIdCollection_
void push_back(T const &t)
edm::EDGetTokenT< EBDetIdCollection > ebIntegrityGainErrorsToken_
virtual void beginRun(edm::Run const &run, const edm::EventSetup &es) overridefinal
edm::EDGetTokenT< EcalElectronicsIdCollection > integrityTTIdErrorsToken_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
unsigned ttId(DetId const &)
edm::EDGetTokenT< EEDetIdCollection > eeIntegrityGainSwitchErrorsToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
~EcalDetIdToBeRecoveredProducer()
static const int SRF_FULL
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
EcalDetIdToBeRecoveredProducer(const edm::ParameterSet &ps)
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
DetId getDetId(const EcalElectronicsId &id) const
Get the detid given an electronicsId.
std::string eeDetIdCollection_
edm::EDGetTokenT< EEDetIdCollection > eeIntegrityGainErrorsToken_
bool include(const CollT &coll, const ItemT &item)
const_iterator find(uint32_t rawId) const
edm::EDGetTokenT< EESrFlagCollection > eeSrFlagToken_
const_iterator end() const
edm::EDGetTokenT< EBDetIdCollection > ebIntegrityChIdErrorsToken_
const EcalChannelStatusMap * chStatus_
const EcalElectronicsMapping * ecalMapping_
std::vector< EBDetId >::const_iterator const_iterator