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> );
108 ebDetIdColls.push_back( ebIntegrityGainErrors );
112 ebDetIdColls.push_back( ebIntegrityGainSwitchErrors );
116 ebDetIdColls.push_back( ebIntegrityChIdErrors );
120 eeDetIdColls.push_back( eeIntegrityGainErrors );
124 eeDetIdColls.push_back( eeIntegrityGainSwitchErrors );
130 eeDetIdColls.push_back( eeIntegrityChIdErrors );
137 ttColls.push_back( integrityTTIdErrors );
141 ttColls.push_back( integrityBlockSizeErrors );
150 const int flag = it->value();
155 const std::vector<DetId> vid =
ttMap_->constituentsOf( ttId );
157 for ( std::vector<DetId>::const_iterator itId = vid.begin(); itId != vid.end(); ++itId ) {
166 const int flag = it->value();
174 std::vector<DetId> vid;
175 for(
int dx=1; dx<=5; ++dx){
176 for(
int dy=1; dy<=5; ++dy){
177 const int ix = (scId.ix()-1)*5 + dx;
178 const int iy = (scId.iy()-1)*5 + dy;
179 const int iz = scId.
zside();
181 vid.push_back(
EEDetId(ix, iy, iz));
187 for ( std::vector<DetId>::const_iterator itId = vid.begin(); itId != vid.end(); ++itId ) {
193 if ( ebSrFlags->size() == 0 ) {
196 if ( eeSrFlags->size() == 0 ) {
210 ebDetIdToRecover->insert( *jt );
218 eeDetIdToRecover->insert( *jt );
230 const int flag = (*chit).getStatusCode();
231 if ( flag >= 10 && flag <= 12) {
232 ebDetIdToRecover->insert( *itId );
233 }
else if ( flag == 13 || flag == 14 ) {
234 ebTTDetIdToRecover->insert( (*itId).tower() );
237 edm::LogError(
"EcalDetIdToBeRecoveredProducer") <<
"No channel status found for xtal "
239 <<
"! something wrong with EcalChannelStatus in your DB? ";
246 int flag = (*chit).getStatusCode() ;
247 if ( flag >= 10 && flag <= 12) {
248 eeDetIdToRecover->insert( *itId );
249 }
else if ( flag == 13 || flag == 14 ) {
250 eeSCDetIdToRecover->insert(
EcalScDetId(1+((*itId).ix()-1)/5,1+((*itId).iy()-1)/5,(*itId).zside()) );
253 edm::LogError(
"EcalDetIdToBeRecoveredProducer") <<
"No channel status found for xtal "
255 <<
"! something wrong with EcalChannelStatus in your DB? ";
261 for (
size_t t = 0;
t < ttColls.size(); ++
t) {
264 for (
size_t i = 0;
i < coll.
size(); ++
i)
273 const std::vector<DetId>& vid =
ttMap_->constituentsOf(
ttId);
275 for (
size_t j = 0;
j < vid.size(); ++
j) {
277 if (
include(ebSrpDetId, ebdi)) {
278 ebDetIdToRecover->insert(ebdi);
279 ebTTDetIdToRecover->insert(ebdi.
tower());
286 std::vector<DetId> vid;
287 for(
int dx=1; dx<=5; ++dx) {
288 for(
int dy=1; dy<=5; ++dy) {
289 const int ix = (scId.
ix()-1)*5 + dx;
290 const int iy = (scId.
iy()-1)*5 + dy;
291 const int iz = scId.
zside();
293 vid.push_back(
EEDetId(ix, iy, iz));
297 for (
size_t j = 0;
j < vid.size(); ++
j) {
299 if (
include(eeSrpDetId, eedi)) {
300 eeDetIdToRecover->insert(eedi);
307 <<
"Incorrect EcalSubdetector = " << subdet
308 <<
" in EcalElectronicsIdCollection collection ";
335 descriptions.
add(
"ecalDetIdToBeRecovered",desc);
T getParameter(std::string const &) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::string ebDetIdCollection_
tuple ebIntegrityGainSwitchErrors
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 [...
tuple ebIntegrityGainErrors
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_
tuple eeIntegrityChIdErrors
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)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
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
void add(std::string const &label, ParameterSetDescription const &psetDescription)
tuple integrityBlockSizeErrors
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
tuple eeIntegrityGainErrors
edm::EDGetTokenT< EBDetIdCollection > ebIntegrityChIdErrorsToken_
const EcalChannelStatusMap * chStatus_
tuple integrityTTIdErrors
const EcalElectronicsMapping * ecalMapping_
tuple eeIntegrityGainSwitchErrors
tuple ebIntegrityChIdErrors
std::vector< EBDetId >::const_iterator const_iterator