CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
SiPixelBadModuleByHandBuilder Class Reference
Inheritance diagram for SiPixelBadModuleByHandBuilder:
ConditionDBWriter< SiPixelQuality > edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 SiPixelBadModuleByHandBuilder (const edm::ParameterSet &)
 
 ~SiPixelBadModuleByHandBuilder () override
 
- Public Member Functions inherited from ConditionDBWriter< SiPixelQuality >
 ConditionDBWriter (const edm::ParameterSet &iConfig)
 
 ~ConditionDBWriter () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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::ParameterSet
Parameters
 

Private Member Functions

void algoBeginRun (const edm::Run &run, const edm::EventSetup &es) override
 
std::unique_ptr< SiPixelQualitygetNewObject () override
 

Private Attributes

Parameters BadModuleList_
 
const bool printdebug_
 
const std::string ROCListFile_
 
const edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
tkTopoToken_
 
std::unique_ptr< TrackerTopologytTopo_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from ConditionDBWriter< SiPixelQuality >
static void fillPSetDescription (edm::ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from ConditionDBWriter< SiPixelQuality >
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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 22 of file SiPixelBadModuleByHandBuilder.cc.

Member Typedef Documentation

Definition at line 39 of file SiPixelBadModuleByHandBuilder.cc.

Constructor & Destructor Documentation

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

Definition at line 45 of file SiPixelBadModuleByHandBuilder.cc.

47  tkTopoToken_(esConsumes<edm::Transition::BeginRun>()),
48  printdebug_(iConfig.getUntrackedParameter<bool>("printDebug", false)),
49  BadModuleList_(iConfig.getUntrackedParameter<Parameters>("BadModuleList")),
50  ROCListFile_(iConfig.getUntrackedParameter<std::string>("ROCListFile")) {}
T getUntrackedParameter(std::string const &, T const &) const
vector< ParameterSet > Parameters
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tkTopoToken_
SiPixelBadModuleByHandBuilder::~SiPixelBadModuleByHandBuilder ( )
overridedefault

Member Function Documentation

void SiPixelBadModuleByHandBuilder::algoBeginRun ( const edm::Run run,
const edm::EventSetup es 
)
inlineoverrideprivatevirtual

Reimplemented from ConditionDBWriter< SiPixelQuality >.

Definition at line 30 of file SiPixelBadModuleByHandBuilder.cc.

References edm::EventSetup::getData(), tkTopoToken_, and tTopo_.

30  {
31  if (!tTopo_) {
32  tTopo_ = std::make_unique<TrackerTopology>(es.getData(tkTopoToken_));
33  }
34  };
bool getData(T &iHolder) const
Definition: EventSetup.h:122
std::unique_ptr< TrackerTopology > tTopo_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tkTopoToken_
std::unique_ptr< SiPixelQuality > SiPixelBadModuleByHandBuilder::getNewObject ( )
overrideprivatevirtual

Implements ConditionDBWriter< SiPixelQuality >.

Definition at line 54 of file SiPixelBadModuleByHandBuilder.cc.

References BadModuleList_, SiPixelQuality::disabledModuleType::BadRocs, SiPixelQuality::disabledModuleType::DetID, SiPixelQuality::disabledModuleType::errorType, PixelBarrelName::getDetId(), PixelEndcapName::getDetId(), mergeVDriftHistosByStation::name, getGTfromDQMFile::obj, printdebug_, PixelMapPlotter::roc, ROCListFile_, AlCaHLTBitMon_QueryRunRegistry::string, and tTopo_.

54  {
55  auto obj = std::make_unique<SiPixelQuality>();
56 
57  for (Parameters::iterator it = BadModuleList_.begin(); it != BadModuleList_.end(); ++it) {
58  if (printdebug_) {
59  edm::LogInfo("SiPixelBadModuleByHandBuilder") << " BadModule " << *it << " \t" << std::endl;
60  }
61 
63  BadModule.errorType = 3;
64  BadModule.BadRocs = 0;
65  BadModule.DetID = it->getParameter<uint32_t>("detid");
66  std::string errorstring = it->getParameter<std::string>("errortype");
67  if (printdebug_) {
68  edm::LogInfo("SiPixelBadModuleByHandBuilder")
69  << "now looking at detid " << BadModule.DetID << ", string " << errorstring << std::endl;
70  }
71 
73  // errortype "whole" = int 0 in DB //
74  // errortype "tbmA" = int 1 in DB //
75  // errortype "tbmB" = int 2 in DB //
76  // errortype "none" = int 3 in DB //
78 
80  //each bad roc correspond to a bit to 1: num= //
81  // 0 <-> all good rocs //
82  // 1 <-> only roc 0 bad //
83  // 2<-> only roc 1 bad //
84  // 3<-> roc 0 and 1 bad //
85  // 4 <-> only roc 2 bad //
86  // ... //
88 
89  if (errorstring == "whole") {
90  BadModule.errorType = 0;
91  BadModule.BadRocs = 65535;
92  } //corresponds to all rocs being bad
93  else if (errorstring == "tbmA") {
94  BadModule.errorType = 1;
95  BadModule.BadRocs = 255;
96  } //corresponds to Rocs 0-7 being bad
97  else if (errorstring == "tbmB") {
98  BadModule.errorType = 2;
99  BadModule.BadRocs = 65280;
100  } //corresponds to Rocs 8-15 being bad
101  else if (errorstring == "none") {
102  BadModule.errorType = 3;
103  // badroclist_ = iConfig.getUntrackedParameter<std::vector<uint32_t> >("badroclist");
104  std::vector<uint32_t> BadRocList = it->getParameter<std::vector<uint32_t> >("badroclist");
105  short badrocs = 0;
106  for (std::vector<uint32_t>::iterator iter = BadRocList.begin(); iter != BadRocList.end(); ++iter) {
107  badrocs += 1 << *iter; // 1 << *iter = 2^{*iter} using bitwise shift
108  }
109  BadModule.BadRocs = badrocs;
110  }
111 
112  else
113  edm::LogError("SiPixelQuality") << "trying to fill error type " << errorstring << ", which is not defined!";
114  obj->addDisabledModule(BadModule);
115  }
116 
117  // fill DB from DQM list
118  if (!ROCListFile_.empty()) {
119  std::map<uint32_t, uint32_t> disabledModules;
120  std::ifstream aFile(ROCListFile_.c_str());
121  std::string aLine;
122  while (std::getline(aFile, aLine)) {
123  char name[100];
124  int roc;
125  sscanf(aLine.c_str(), "%s %d", name, &roc);
126  uint32_t detId;
127  if (name[0] == 'B') {
128  PixelBarrelName bn(name, true);
129  detId = bn.getDetId(tTopo_.get());
130  } else {
131  PixelEndcapName en(name, true);
132  detId = en.getDetId(tTopo_.get());
133  }
134  std::map<uint32_t, uint32_t>::iterator it = disabledModules.find(detId);
135  if (it == disabledModules.end())
136  it = disabledModules.insert(disabledModules.begin(), std::make_pair(detId, 0));
137  it->second |= 1 << roc;
138  //edm::LogPrint("SiPixelBadModuleByHandBuilder")<<"New module read "<<name<<" "<<roc<<" --> "<<detId<<" "<<std::bitset<32>(it->second)<<std::endl;
139  }
140 
141  for (const auto& it : disabledModules) {
143  BadModule.DetID = it.first;
144  if (it.second == 65535) { // "whole"
145  BadModule.errorType = 0;
146  BadModule.BadRocs = 65535;
147  } //corresponds to all rocs being bad
148  else if (it.second == 255) { // "tbmA"
149  BadModule.errorType = 1;
150  BadModule.BadRocs = 255;
151  } //corresponds to Rocs 0-7 being bad
152  else if (it.second == 65280) { // "tbmB"
153  BadModule.errorType = 2;
154  BadModule.BadRocs = 65280;
155  } //corresponds to Rocs 8-15 being bad
156  else { // "none"
157  BadModule.errorType = 3;
158  BadModule.BadRocs = it.second;
159  }
160 
161  obj->addDisabledModule(BadModule);
162  if (printdebug_) {
163  edm::LogVerbatim("SiPixelBadModuleByHandBuilder")
164  << "New module added: " << tTopo_->print(BadModule.DetID) << ", errorType: " << BadModule.errorType
165  << ", BadRocs: " << std::bitset<16>(it.second) << std::endl;
166  }
167  }
168  }
169 
170  return obj;
171 }
Log< level::Info, true > LogVerbatim
Log< level::Error, false > LogError
Log< level::Info, false > LogInfo
std::unique_ptr< TrackerTopology > tTopo_

Member Data Documentation

Parameters SiPixelBadModuleByHandBuilder::BadModuleList_
private

Definition at line 40 of file SiPixelBadModuleByHandBuilder.cc.

Referenced by getNewObject().

const bool SiPixelBadModuleByHandBuilder::printdebug_
private

Definition at line 38 of file SiPixelBadModuleByHandBuilder.cc.

Referenced by getNewObject().

const std::string SiPixelBadModuleByHandBuilder::ROCListFile_
private

Definition at line 41 of file SiPixelBadModuleByHandBuilder.cc.

Referenced by getNewObject().

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiPixelBadModuleByHandBuilder::tkTopoToken_
private

Definition at line 34 of file SiPixelBadModuleByHandBuilder.cc.

Referenced by algoBeginRun().

std::unique_ptr<TrackerTopology> SiPixelBadModuleByHandBuilder::tTopo_
private

Definition at line 42 of file SiPixelBadModuleByHandBuilder.cc.

Referenced by algoBeginRun(), and getNewObject().