CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
SiStripBadModuleConfigurableFakeESSource Class Reference
Inheritance diagram for SiStripBadModuleConfigurableFakeESSource:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Types

typedef std::shared_ptr< SiStripBadStripReturnType
 
- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 

Public Member Functions

ReturnType produce (const SiStripBadModuleRcd &)
 
void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity) override
 
 SiStripBadModuleConfigurableFakeESSource (const edm::ParameterSet &)
 
 ~SiStripBadModuleConfigurableFakeESSource () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 

Private Types

using Parameters = std::vector< edm::ParameterSet >
 

Private Member Functions

std::vector< uint32_t > selectDetectors (const TrackerTopology *tTopo, const std::vector< uint32_t > &detIds) const
 

Private Attributes

Parameters m_badComponentList
 
edm::FileInPath m_file
 
bool m_printDebug
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 

Detailed Description

Description: "fake" SiStripBadStrip ESProducer - configurable list of bad modules

Implementation: Port of SiStripBadModuleGenerator and templated fake ESSource to an edm::ESProducer

Definition at line 26 of file SiStripBadModuleConfigurableFakeESSource.cc.

Member Typedef Documentation

Definition at line 37 of file SiStripBadModuleConfigurableFakeESSource.cc.

Definition at line 33 of file SiStripBadModuleConfigurableFakeESSource.cc.

Constructor & Destructor Documentation

SiStripBadModuleConfigurableFakeESSource::SiStripBadModuleConfigurableFakeESSource ( const edm::ParameterSet iConfig)

Definition at line 50 of file SiStripBadModuleConfigurableFakeESSource.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_badComponentList, m_file, m_printDebug, and edm::ESProducer::setWhatProduced().

51 {
52  setWhatProduced(this);
53  findingRecord<SiStripBadModuleRcd>();
54 
55  m_badComponentList = iConfig.getUntrackedParameter<Parameters>("BadComponentList");
56  m_file = iConfig.getParameter<edm::FileInPath>("file");
57  m_printDebug = iConfig.getUntrackedParameter<bool>("printDebug", false);
58 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
vector< ParameterSet > Parameters
SiStripBadModuleConfigurableFakeESSource::~SiStripBadModuleConfigurableFakeESSource ( )
override

Definition at line 60 of file SiStripBadModuleConfigurableFakeESSource.cc.

60 {}

Member Function Documentation

SiStripBadModuleConfigurableFakeESSource::ReturnType SiStripBadModuleConfigurableFakeESSource::produce ( const SiStripBadModuleRcd iRecord)

Definition at line 69 of file SiStripBadModuleConfigurableFakeESSource.cc.

References TauDecayModes::dec, edm::FileInPath::fullPath(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), mps_fire::i, m_file, m_printDebug, edm::ESHandle< T >::product(), jets_cff::quality, matplotRender::reader, selectDetectors(), AlCaHLTBitMon_QueryRunRegistry::string, SiStripDetId::TEC, SiStripDetId::TIB, SiStripDetId::TID, SiStripDetId::TOB, and SiStripDetId::UNKNOWN.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

70 {
71  using namespace edm::es;
72 
74  iRecord.getRecord<TrackerTopologyRcd>().get(tTopo);
75 
76  std::shared_ptr<SiStripQuality> quality{new SiStripQuality};
77 
79 
80  std::vector<uint32_t> selDetIds{selectDetectors(tTopo.product(), reader.getAllDetIds())};
81  edm::LogInfo("SiStripQualityConfigurableFakeESSource")<<"[produce] number of selected dets to be removed " << selDetIds.size() <<std::endl;
82 
83  std::stringstream ss;
84  for ( const auto selId : selDetIds ) {
85  SiStripQuality::InputVector theSiStripVector;
86 
87  unsigned short firstBadStrip{0};
88  unsigned short NconsecutiveBadStrips = reader.getNumberOfApvsAndStripLength(selId).first * 128;
89  unsigned int theBadStripRange{quality->encode(firstBadStrip,NconsecutiveBadStrips)};
90 
91  if (m_printDebug) {
92  ss << "detid " << selId << " \t"
93  << " firstBadStrip " << firstBadStrip << "\t "
94  << " NconsecutiveBadStrips " << NconsecutiveBadStrips << "\t "
95  << " packed integer " << std::hex << theBadStripRange << std::dec
96  << std::endl;
97  }
98 
99  theSiStripVector.push_back(theBadStripRange);
100 
101  if ( ! quality->put(selId,SiStripBadStrip::Range{theSiStripVector.begin(),theSiStripVector.end()}) ) {
102  edm::LogError("SiStripQualityConfigurableFakeESSource") << "[produce] detid already exists";
103  }
104  }
105  if (m_printDebug) {
106  edm::LogInfo("SiStripQualityConfigurableFakeESSource") << ss.str();
107  }
108  quality->cleanUp();
109  //quality->fillBadComponents();
110 
111  if (m_printDebug){
112  std::stringstream ss1;
113  for ( const auto& badComp : quality->getBadComponentList() ) {
114  ss1 << "bad module " << badComp.detid << " " << badComp.BadModule << "\n";
115  }
116  edm::LogInfo("SiStripQualityConfigurableFakeESSource") << ss1.str();
117  }
118 
119  return quality;
120 }
std::vector< uint32_t > selectDetectors(const TrackerTopology *tTopo, const std::vector< uint32_t > &detIds) const
std::pair< ContainerIterator, ContainerIterator > Range
std::string fullPath() const
Definition: FileInPath.cc:184
T const * product() const
Definition: ESHandle.h:86
Container InputVector
std::vector< uint32_t > SiStripBadModuleConfigurableFakeESSource::selectDetectors ( const TrackerTopology tTopo,
const std::vector< uint32_t > &  detIds 
) const
private

Definition at line 139 of file SiStripBadModuleConfigurableFakeESSource.cc.

References gather_cfg::cout, DEFINE_FWK_EVENTSETUP_SOURCE, spr::find(), m_badComponentList, m_printDebug, DetId::rawId(), AlCaHLTBitMon_QueryRunRegistry::string, SiStripDetId::TEC, TrackerTopology::tecIsFrontPetal(), TrackerTopology::tecIsStereo(), TrackerTopology::tecIsZPlusSide(), TrackerTopology::tecPetalNumber(), TrackerTopology::tecRing(), TrackerTopology::tecWheel(), SiStripDetId::TIB, TrackerTopology::tibIsInternalString(), TrackerTopology::tibIsRPhi(), TrackerTopology::tibIsStereo(), TrackerTopology::tibIsZPlusSide(), TrackerTopology::tibLayer(), TrackerTopology::tibString(), SiStripDetId::TID, TrackerTopology::tidIsRPhi(), TrackerTopology::tidIsStereo(), TrackerTopology::tidIsZPlusSide(), TrackerTopology::tidRing(), TrackerTopology::tidWheel(), SiStripDetId::TOB, TrackerTopology::tobIsRPhi(), TrackerTopology::tobIsStereo(), TrackerTopology::tobIsZPlusSide(), TrackerTopology::tobLayer(), TrackerTopology::tobRod(), and DetId::Tracker.

Referenced by produce().

140 {
141  std::vector<uint32_t> selList;
142  std::stringstream ss;
143  for ( const auto& badComp : m_badComponentList ) {
144  const std::string subDetStr{badComp.getParameter<std::string>("SubDet")};
145  if (m_printDebug) ss << "Bad SubDet " << subDetStr << " \t";
146  const SiStripDetId::SubDetector subDet = subDetFromString(subDetStr);
147 
148  const std::vector<uint32_t> genericBadDetIds{badComp.getUntrackedParameter<std::vector<uint32_t>>("detidList", std::vector<uint32_t>())};
149  const bool anySubDet{ ! genericBadDetIds.empty() };
150 
151  std::cout << "genericBadDetIds.size() = " << genericBadDetIds.size() << std::endl;
152 
153  using DetIdIt = std::vector<uint32_t>::const_iterator;
154  const DetIdIt beginDetIt = std::lower_bound(detIds.begin(), detIds.end(), DetId(DetId::Tracker, anySubDet ? SiStripDetId::TIB : subDet ).rawId());
155  const DetIdIt endDetIt = std::lower_bound(detIds.begin(), detIds.end(), DetId(DetId::Tracker, anySubDet ? SiStripDetId::TEC+1 : subDet+1).rawId());
156 
157  if ( anySubDet ) {
158  std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList),
159  [&genericBadDetIds] ( uint32_t detId ) {
160  std::cout << "AnySubDet" << detId << std::endl;
161  return std::find(genericBadDetIds.begin(), genericBadDetIds.end(), detId) != genericBadDetIds.end();
162  });
163  } else {
164  switch (subDet) {
165  case SiStripDetId::TIB:
166  std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList),
167  [tTopo,&badComp] ( uint32_t detectorId ) {
168  const DetId detId{detectorId};
169  return ( ( detId.subdetId() == SiStripDetId::TIB )
170  && _isSel(badComp.getParameter<uint32_t>("layer") , tTopo->tibLayer(detId))
171  && _isSel(badComp.getParameter<uint32_t>("bkw_frw"), tTopo->tibIsZPlusSide(detId) ? 2 : 1 )
172  && _isSel(badComp.getParameter<uint32_t>("int_ext"), tTopo->tibIsInternalString(detId) ? 1 : 2 )
173  && _isSel(badComp.getParameter<uint32_t>("ster") , tTopo->tibIsStereo(detId) ? 1 : ( tTopo->tibIsRPhi(detId) ? 2 : -1 ))
174  && _isSel(badComp.getParameter<uint32_t>("string_"), tTopo->tibString(detId))
175  && _isSel(badComp.getParameter<uint32_t>("detid") , detId.rawId())
176  );
177  } );
178  break;
179  case SiStripDetId::TID:
180  std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList),
181  [tTopo,&badComp] ( uint32_t detectorId ) {
182  const DetId detId{detectorId};
183  return ( ( detId.subdetId() == SiStripDetId::TID )
184  && _isSel(badComp.getParameter<uint32_t>("wheel"), tTopo->tidWheel(detId))
185  && _isSel(badComp.getParameter<uint32_t>("side") , tTopo->tidIsZPlusSide(detId) ? 2 : 1 )
186  && _isSel(badComp.getParameter<uint32_t>("ster") , tTopo->tidIsStereo(detId) ? 1 : ( tTopo->tidIsRPhi(detId) ? 2 : -1 ) )
187  && _isSel(badComp.getParameter<uint32_t>("ring") , tTopo->tidRing(detId))
188  && _isSel(badComp.getParameter<uint32_t>("detid"), detId.rawId())
189  );
190  } );
191  break;
192  case SiStripDetId::TOB:
193  std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList),
194  [tTopo,&badComp] ( uint32_t detectorId ) {
195  const DetId detId{detectorId};
196  return ( ( detId.subdetId() == SiStripDetId::TOB )
197  && _isSel(badComp.getParameter<uint32_t>("layer") , tTopo->tobLayer(detId))
198  && _isSel(badComp.getParameter<uint32_t>("bkw_frw"), tTopo->tobIsZPlusSide(detId) ? 2 : 1)
199  && _isSel(badComp.getParameter<uint32_t>("ster") , tTopo->tobIsStereo(detId) ? 1 : ( tTopo->tobIsRPhi(detId) ? 2 : -1 ))
200  && _isSel(badComp.getParameter<uint32_t>("rod") , tTopo->tobRod(detId))
201  && _isSel(badComp.getParameter<uint32_t>("detid") , detId.rawId())
202  );
203  } );
204  break;
205  case SiStripDetId::TEC:
206  std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList),
207  [tTopo,&badComp] ( uint32_t detectorId ) {
208  const DetId detId{detectorId};
209  return ( ( detId.subdetId() == SiStripDetId::TEC )
210  && _isSel(badComp.getParameter<uint32_t>("wheel") , tTopo->tecWheel(detId))
211  && _isSel(badComp.getParameter<uint32_t>("side") , tTopo->tecIsZPlusSide(detId) ? 2 : 1 )
212  && _isSel(badComp.getParameter<uint32_t>("ster") , tTopo->tecIsStereo(detId) ? 1 : 2 )
213  && _isSel(badComp.getParameter<uint32_t>("petal_bkw_frw"), tTopo->tecIsFrontPetal(detId) ? 2 : 2)
214  && _isSel(badComp.getParameter<uint32_t>("petal") , tTopo->tecPetalNumber(detId))
215  && _isSel(badComp.getParameter<uint32_t>("ring") , tTopo->tecRing(detId))
216  && _isSel(badComp.getParameter<uint32_t>("detid") , detId.rawId())
217  );
218  } );
219  break;
220  default:
221  break;
222  }
223  }
224  }
225  if (m_printDebug) {
226  edm::LogInfo("SiStripBadModuleGenerator") << ss.str();
227  }
228  return selList;
229 }
unsigned int tibLayer(const DetId &id) const
unsigned int tibString(const DetId &id) const
unsigned int tidRing(const DetId &id) const
bool tobIsStereo(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
unsigned int tidWheel(const DetId &id) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
bool tobIsRPhi(const DetId &id) const
bool tidIsStereo(const DetId &id) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
bool tibIsZPlusSide(const DetId &id) const
bool tecIsStereo(const DetId &id) const
bool tibIsRPhi(const DetId &id) const
bool tobIsZPlusSide(const DetId &id) const
bool tecIsFrontPetal(const DetId &id) const
Definition: DetId.h:18
bool tidIsRPhi(const DetId &id) const
bool tidIsZPlusSide(const DetId &id) const
bool tibIsStereo(const DetId &id) const
bool tecIsZPlusSide(const DetId &id) const
unsigned int tecPetalNumber(const DetId &id) const
unsigned int tobRod(const DetId &id) const
bool tibIsInternalString(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
unsigned int tobLayer(const DetId &id) const
void SiStripBadModuleConfigurableFakeESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue iov,
edm::ValidityInterval iValidity 
)
overridevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 62 of file SiStripBadModuleConfigurableFakeESSource.cc.

References edm::IOVSyncValue::beginOfTime(), and edm::IOVSyncValue::endOfTime().

63 {
64  iValidity = edm::ValidityInterval{iov.beginOfTime(), iov.endOfTime()};
65 }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
static const IOVSyncValue & beginOfTime()

Member Data Documentation

Parameters SiStripBadModuleConfigurableFakeESSource::m_badComponentList
private
edm::FileInPath SiStripBadModuleConfigurableFakeESSource::m_file
private
bool SiStripBadModuleConfigurableFakeESSource::m_printDebug
private