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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
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 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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 20 of file SiStripBadChannelBuilder.h.

Member Typedef Documentation

Definition at line 31 of file SiStripBadChannelBuilder.h.

Constructor & Destructor Documentation

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

Definition at line 7 of file SiStripBadChannelBuilder.cc.

References BadComponentList_, fp_, edm::ParameterSet::getUntrackedParameter(), and printdebug_.

10  "file", edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"));
11  printdebug_ = iConfig.getUntrackedParameter<bool>("printDebug", false);
12  BadComponentList_ = iConfig.getUntrackedParameter<Parameters>("BadComponentList");
13 }
T getUntrackedParameter(std::string const &, T const &) const
vector< ParameterSet > Parameters
SiStripBadChannelBuilder::~SiStripBadChannelBuilder ( )
override

Definition at line 15 of file SiStripBadChannelBuilder.cc.

15 {}

Member Function Documentation

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

Implements ConditionDBWriter< SiStripBadStrip >.

Definition at line 17 of file SiStripBadChannelBuilder.cc.

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(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), getGTfromDQMFile::obj, printdebug_, FastTimerService_cff::range, and DQM::reader.

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

Member Data Documentation

Parameters SiStripBadChannelBuilder::BadComponentList_
private

Definition at line 32 of file SiStripBadChannelBuilder.h.

Referenced by getNewObject(), and SiStripBadChannelBuilder().

edm::FileInPath SiStripBadChannelBuilder::fp_
private

Definition at line 28 of file SiStripBadChannelBuilder.h.

Referenced by getNewObject(), and SiStripBadChannelBuilder().

bool SiStripBadChannelBuilder::printdebug_
private

Definition at line 29 of file SiStripBadChannelBuilder.h.

Referenced by getNewObject(), and SiStripBadChannelBuilder().