20 #include <sys/types.h>
75 template <
typename CollT,
typename ItemT>
78 typename CollT::const_iterator res =
std::find( coll.begin(), coll.end(), item );
79 return ( res != coll.end() );
84 std::vector< edm::Handle<EBDetIdCollection> > ebDetIdColls;
85 std::vector< edm::Handle<EEDetIdCollection> > eeDetIdColls;
86 std::vector< edm::Handle<EcalElectronicsIdCollection> > ttColls;
88 std::auto_ptr< std::set<EBDetId> > ebDetIdToRecover(
new std::set<EBDetId> );
89 std::auto_ptr< std::set<EEDetId> > eeDetIdToRecover(
new std::set<EEDetId> );
90 std::auto_ptr< std::set<EcalTrigTowerDetId> > ebTTDetIdToRecover(
new std::set<EcalTrigTowerDetId> );
91 std::auto_ptr< std::set<EcalScDetId> > eeSCDetIdToRecover(
new std::set<EcalScDetId> );
112 if ( ebIntegrityGainErrors.
isValid() ) {
113 ebDetIdColls.push_back( ebIntegrityGainErrors );
119 if ( ebIntegrityGainSwitchErrors.
isValid() ) {
120 ebDetIdColls.push_back( ebIntegrityGainSwitchErrors );
126 if ( ebIntegrityChIdErrors.
isValid() ) {
127 ebDetIdColls.push_back( ebIntegrityChIdErrors );
134 if ( eeIntegrityGainErrors.
isValid() ) {
135 eeDetIdColls.push_back( eeIntegrityGainErrors );
141 if ( eeIntegrityGainSwitchErrors.
isValid() ) {
142 eeDetIdColls.push_back( eeIntegrityGainSwitchErrors );
148 if ( eeIntegrityChIdErrors.
isValid() ) {
149 eeDetIdColls.push_back( eeIntegrityChIdErrors );
156 if ( integrityTTIdErrors.
isValid() ) {
157 ttColls.push_back( integrityTTIdErrors );
163 if ( integrityBlockSizeErrors.
isValid() ) {
164 ttColls.push_back( integrityBlockSizeErrors );
176 const int flag = it->value();
181 const std::vector<DetId> vid =
ttMap_->constituentsOf( ttId );
183 for ( std::vector<DetId>::const_iterator itId = vid.begin(); itId != vid.end(); ++itId ) {
192 const int flag = it->value();
200 std::vector<DetId> vid;
201 for(
int dx=1; dx<=5; ++dx){
202 for(
int dy=1; dy<=5; ++dy){
203 const int ix = (scId.ix()-1)*5 + dx;
204 const int iy = (scId.iy()-1)*5 + dy;
205 const int iz = scId.
zside();
207 vid.push_back(
EEDetId(ix, iy, iz));
213 for ( std::vector<DetId>::const_iterator itId = vid.begin(); itId != vid.end(); ++itId ) {
219 if ( ebSrFlags->size() == 0 ) {
222 if ( eeSrFlags->size() == 0 ) {
236 ebDetIdToRecover->insert( *jt );
244 eeDetIdToRecover->insert( *jt );
256 const int flag = (*chit).getStatusCode() & 0x001F;
257 if ( flag >= 10 && flag <= 12) {
258 ebDetIdToRecover->insert( *itId );
259 }
else if ( flag == 13 || flag == 14 ) {
260 ebTTDetIdToRecover->insert( (*itId).tower() );
263 edm::LogError(
"EcalDetIdToBeRecoveredProducer") <<
"No channel status found for xtal "
265 <<
"! something wrong with EcalChannelStatus in your DB? ";
272 int flag = (*chit).getStatusCode() & 0x001F;
273 if ( flag >= 10 && flag <= 12) {
274 eeDetIdToRecover->insert( *itId );
275 }
else if ( flag == 13 || flag == 14 ) {
276 eeSCDetIdToRecover->insert(
EcalScDetId(1+((*itId).ix()-1)/5,1+((*itId).iy()-1)/5,(*itId).zside()) );
279 edm::LogError(
"EcalDetIdToBeRecoveredProducer") <<
"No channel status found for xtal "
281 <<
"! something wrong with EcalChannelStatus in your DB? ";
287 for (
size_t t = 0;
t < ttColls.size(); ++
t) {
290 for (
size_t i = 0;
i < coll.
size(); ++
i)
299 const std::vector<DetId>& vid =
ttMap_->constituentsOf(
ttId);
301 for (
size_t j = 0;
j < vid.size(); ++
j) {
303 if (
include(ebSrpDetId, ebdi)) {
304 ebDetIdToRecover->insert(ebdi);
305 ebTTDetIdToRecover->insert(ebdi.
tower());
312 std::vector<DetId> vid;
313 for(
int dx=1; dx<=5; ++dx) {
314 for(
int dy=1; dy<=5; ++dy) {
315 const int ix = (scId.
ix()-1)*5 + dx;
316 const int iy = (scId.
iy()-1)*5 + dy;
317 const int iz = scId.
zside();
319 vid.push_back(
EEDetId(ix, iy, iz));
323 for (
size_t j = 0;
j < vid.size(); ++
j) {
325 if (
include(eeSrpDetId, eedi)) {
326 eeDetIdToRecover->insert(eedi);
333 <<
"Incorrect EcalSubdetector = " << subdet
334 <<
" in EcalElectronicsIdCollection collection ";
T getParameter(std::string const &) const
std::string ebDetIdCollection_
#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
std::vector< T >::const_iterator const_iterator
std::string scDetIdCollection_
edm::InputTag eeIntegrityChIdErrorsCollection_
void push_back(T const &t)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
virtual void beginRun(edm::Run &run, const edm::EventSetup &es)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
virtual void produce(edm::Event &evt, const edm::EventSetup &es)
edm::InputTag ebIntegrityChIdErrorsCollection_
edm::InputTag ebIntegrityGainSwitchErrorsCollection_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
~EcalDetIdToBeRecoveredProducer()
edm::InputTag integrityTTIdErrorsCollection_
static const int SRF_FULL
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
edm::InputTag eeSrFlagCollection_
EcalDetIdToBeRecoveredProducer(const edm::ParameterSet &ps)
edm::InputTag ebIntegrityGainErrorsCollection_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
EcalSubdetector subdet() const
get the subdet
std::string ttDetIdCollection_
edm::InputTag ebSrFlagCollection_
edm::InputTag eeIntegrityGainSwitchErrorsCollection_
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
const_iterator begin() const
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_
unsigned ttId(const DetId &)
edm::InputTag integrityBlockSizeErrorsCollection_
bool include(const CollT &coll, const ItemT &item)
edm::InputTag eeIntegrityGainErrorsCollection_
const_iterator find(uint32_t rawId) const
const_iterator end() const
const EcalChannelStatusMap * chStatus_
const EcalElectronicsMapping * ecalMapping_
std::vector< T >::const_iterator const_iterator