CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
SiStripBadChannelBuilder Class Reference

#include <SiStripBadChannelBuilder.h>

Inheritance diagram for SiStripBadChannelBuilder:
ConditionDBWriter< SiStripBadStrip > edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 SiStripBadChannelBuilder (const edm::ParameterSet &)
 
 ~SiStripBadChannelBuilder () override
 
- Public Member Functions inherited from ConditionDBWriter< SiStripBadStrip >
 ConditionDBWriter (const edm::ParameterSet &iConfig)
 
 ~ConditionDBWriter () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef std::vector< edm::ParameterSetParameters
 

Private Member Functions

std::unique_ptr< SiStripBadStripgetNewObject () override
 

Private Attributes

Parameters BadComponentList_
 
edm::FileInPath fp_
 
bool printdebug_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from ConditionDBWriter< SiStripBadStrip >
void setDoStore (const bool doStore)
 When set to false the payload will not be written to the db. More...
 
void storeOnDbNow ()
 
cond::Time_t timeOfLastIOV ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 19 of file SiStripBadChannelBuilder.h.

Member Typedef Documentation

◆ Parameters

Definition at line 30 of file SiStripBadChannelBuilder.h.

Constructor & Destructor Documentation

◆ SiStripBadChannelBuilder()

SiStripBadChannelBuilder::SiStripBadChannelBuilder ( const edm::ParameterSet iConfig)
explicit

◆ ~SiStripBadChannelBuilder()

SiStripBadChannelBuilder::~SiStripBadChannelBuilder ( )
override

Definition at line 14 of file SiStripBadChannelBuilder.cc.

14 {}

Member Function Documentation

◆ getNewObject()

std::unique_ptr< SiStripBadStrip > SiStripBadChannelBuilder::getNewObject ( )
overrideprivatevirtual

Implements ConditionDBWriter< SiStripBadStrip >.

Definition at line 16 of file SiStripBadChannelBuilder.cc.

16  {
17  edm::LogInfo("SiStripBadChannelBuilder") << "... creating dummy SiStripBadStrip Data" << std::endl;
18 
19  auto obj = std::make_unique<SiStripBadStrip>();
20 
21  const auto detInfo = SiStripDetInfoFileReader::read(fp_.fullPath());
22 
23  for (Parameters::iterator iBadComponent = BadComponentList_.begin(); iBadComponent != BadComponentList_.end();
24  ++iBadComponent) {
25  uint32_t BadModule_ = iBadComponent->getParameter<uint32_t>("BadModule");
26  std::vector<uint32_t> BadChannelList_ = iBadComponent->getParameter<std::vector<uint32_t> >("BadChannelList");
27 
28  std::vector<unsigned int> theSiStripVector;
29  unsigned int NStrips = detInfo.getNumberOfApvsAndStripLength(BadModule_).first * 128;
30 
31  uint32_t lastBad = 999;
32  unsigned short firstBadStrip = 0, NconsecutiveBadStrips = 0;
33  unsigned int theBadStripRange;
34 
35  for (std::vector<uint32_t>::const_iterator is = BadChannelList_.begin(); is != BadChannelList_.end(); ++is) {
36  if (*is > NStrips - 1)
37  break;
38  if (*is != lastBad + 1) {
39  //new set
40 
41  if (lastBad != 999) {
42  //save previous set
43  theBadStripRange = obj->encode(firstBadStrip, NconsecutiveBadStrips);
44 
45  if (printdebug_)
46  edm::LogInfo("SiStripBadChannelBuilder")
47  << "detid " << BadModule_ << " \t"
48  << " firstBadStrip " << firstBadStrip << "\t "
49  << " NconsecutiveBadStrips " << NconsecutiveBadStrips << "\t "
50  << " packed integer " << std::hex << theBadStripRange << std::dec << std::endl;
51 
52  theSiStripVector.push_back(theBadStripRange);
53  }
54 
55  firstBadStrip = *is;
56  NconsecutiveBadStrips = 0;
57  }
58  NconsecutiveBadStrips++;
59  lastBad = *is;
60  }
61 
62  theBadStripRange = obj->encode(firstBadStrip, NconsecutiveBadStrips);
63  if (printdebug_)
64  edm::LogInfo("SiStripBadChannelBuilder")
65  << "detid " << BadModule_ << " \t"
66  << " firstBadStrip " << firstBadStrip << "\t "
67  << " NconsecutiveBadStrips " << NconsecutiveBadStrips << "\t "
68  << " packed integer " << std::hex << theBadStripRange << std::dec << std::endl;
69 
70  theSiStripVector.push_back(theBadStripRange);
71 
72  SiStripBadStrip::Range range(theSiStripVector.begin(), theSiStripVector.end());
73  if (!obj->put(BadModule_, range))
74  edm::LogError("SiStripBadChannelBuilder")
75  << "[SiStripBadChannelBuilder::analyze] detid already exists" << std::endl;
76  }
77  //End now write sistripbadChannel data in DB
79 
80  if (mydbservice.isAvailable()) {
81  if (mydbservice->isNewTagRequest("SiStripBadStripRcd")) {
82  mydbservice->createNewIOV<SiStripBadStrip>(
83  obj.get(), mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripBadStripRcd");
84  } else {
85  //mydbservice->createNewIOV<SiStripBadStrip>(obj.get(),mydbservice->currentTime(),"SiStripBadStripRcd");
86  mydbservice->appendSinceTime<SiStripBadStrip>(obj.get(), mydbservice->currentTime(), "SiStripBadStripRcd");
87  }
88  } else {
89  edm::LogError("SiStripBadStripBuilder") << "Service is unavailable" << std::endl;
90  }
91 
92  return obj;
93 }

References cond::service::PoolDBOutputService::appendSinceTime(), BadComponentList_, cond::service::PoolDBOutputService::beginOfTime(), cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::currentTime(), TauDecayModes::dec, cond::service::PoolDBOutputService::endOfTime(), fp_, edm::FileInPath::fullPath(), SiStripDetInfo::getNumberOfApvsAndStripLength(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), getGTfromDQMFile::obj, printdebug_, FastTimerService_cff::range, and SiStripDetInfoFileReader::read().

Member Data Documentation

◆ BadComponentList_

Parameters SiStripBadChannelBuilder::BadComponentList_
private

Definition at line 31 of file SiStripBadChannelBuilder.h.

Referenced by getNewObject(), and SiStripBadChannelBuilder().

◆ fp_

edm::FileInPath SiStripBadChannelBuilder::fp_
private

Definition at line 27 of file SiStripBadChannelBuilder.h.

Referenced by getNewObject(), and SiStripBadChannelBuilder().

◆ printdebug_

bool SiStripBadChannelBuilder::printdebug_
private

Definition at line 28 of file SiStripBadChannelBuilder.h.

Referenced by getNewObject(), and SiStripBadChannelBuilder().

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
cond::service::PoolDBOutputService::appendSinceTime
void appendSinceTime(const T *payloadObj, cond::Time_t sinceTime, const std::string &recordName)
Definition: PoolDBOutputService.h:141
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
SiStripDetInfoFileReader::read
SiStripDetInfo read(std::string filePath)
Definition: SiStripDetInfoFileReader.cc:11
SiStripBadStrip
Definition: SiStripBadStrip.h:30
edm::FileInPath
Definition: FileInPath.h:61
SiStripBadStrip::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripBadStrip.h:53
ConditionDBWriter< SiStripBadStrip >
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:116
SiStripBadChannelBuilder::printdebug_
bool printdebug_
Definition: SiStripBadChannelBuilder.h:28
SiStripDetInfo::getNumberOfApvsAndStripLength
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
Definition: SiStripDetInfo.cc:19
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
SiStripBadChannelBuilder::fp_
edm::FileInPath fp_
Definition: SiStripBadChannelBuilder.h:27
edm::Service< cond::service::PoolDBOutputService >
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:213
SiStripDetInfoFileReader::kDefaultFile
constexpr static char const *const kDefaultFile
Definition: SiStripDetInfoFileReader.h:10
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:128
SiStripBadChannelBuilder::BadComponentList_
Parameters BadComponentList_
Definition: SiStripBadChannelBuilder.h:31
Parameters
vector< ParameterSet > Parameters
Definition: HLTMuonPlotter.cc:25
edm::Log
Definition: MessageLogger.h:70
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:217
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161