CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SiStripDetVOffFakeBuilder Class Reference
Inheritance diagram for SiStripDetVOffFakeBuilder:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void initialize (const edm::EventSetup &)
 
 SiStripDetVOffFakeBuilder (const edm::ParameterSet &iConfig)
 
 ~SiStripDetVOffFakeBuilder () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::vector< uint32_t > detids
 
bool printdebug_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtkGeomToken_
 

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 edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 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 21 of file SiStripDetVOffFakeBuilder.cc.

Constructor & Destructor Documentation

◆ SiStripDetVOffFakeBuilder()

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

Definition at line 40 of file SiStripDetVOffFakeBuilder.cc.

41  : printdebug_(iConfig.getUntrackedParameter<bool>("printDebug", false)), tkGeomToken_(esConsumes()) {}
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_

◆ ~SiStripDetVOffFakeBuilder()

SiStripDetVOffFakeBuilder::~SiStripDetVOffFakeBuilder ( )
overridedefault

Member Function Documentation

◆ analyze()

void SiStripDetVOffFakeBuilder::analyze ( const edm::Event evt,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 66 of file SiStripDetVOffFakeBuilder.cc.

References cond::service::PoolDBOutputService::appendOneIOV(), cond::service::PoolDBOutputService::beginOfTime(), cond::service::PoolDBOutputService::createOneIOV(), cond::service::PoolDBOutputService::currentTime(), detids, cppFunctionSkipper::exception, edm::EventBase::id(), initialize(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), SiStripDetVOff::put(), writedatasetfile::run, edm::EventID::run(), and cms::Exception::what().

66  {
67  initialize(iSetup);
68 
69  unsigned int run = evt.id().run();
70 
71  edm::LogInfo("SiStripDetVOffFakeBuilder")
72  << "... creating dummy SiStripDetVOff Data for Run " << run << "\n " << std::endl;
73 
74  SiStripDetVOff SiStripDetVOff_;
75 
76  // std::vector<uint32_t> TheDetIdHVVector;
77 
78  for (std::vector<uint32_t>::const_iterator it = detids.begin(); it != detids.end(); it++) {
79  //Generate HV and LV for each channel, if at least one of the two is off fill the value
80  int hv = rand() % 20;
81  int lv = rand() % 20;
82  if (hv <= 2) {
83  edm::LogInfo("SiStripDetVOffFakeBuilder") << "detid: " << *it << " HV\t OFF" << std::endl;
84  SiStripDetVOff_.put(*it, 1, -1);
85  // TheDetIdHVVector.push_back(*it);
86  }
87  if (lv <= 2) {
88  edm::LogInfo("SiStripDetVOffFakeBuilder") << "detid: " << *it << " LV\t OFF" << std::endl;
89  SiStripDetVOff_.put(*it, -1, 1);
90  // TheDetIdHVVector.push_back(*it);
91  }
92  if (lv <= 2 || hv <= 2)
93  edm::LogInfo("SiStripDetVOffFakeBuilder") << "detid: " << *it << " V\t OFF" << std::endl;
94  }
95 
96  // SiStripDetVOff_.put(TheDetIdHVVector);
97 
98  //End now write DetVOff data in DB
100 
101  if (mydbservice.isAvailable()) {
102  try {
103  if (mydbservice->isNewTagRequest("SiStripDetVOffRcd")) {
104  mydbservice->createOneIOV<SiStripDetVOff>(SiStripDetVOff_, mydbservice->beginOfTime(), "SiStripDetVOffRcd");
105  } else {
106  mydbservice->appendOneIOV<SiStripDetVOff>(SiStripDetVOff_, mydbservice->currentTime(), "SiStripDetVOffRcd");
107  }
108  } catch (const cond::Exception& er) {
109  edm::LogError("SiStripDetVOffFakeBuilder") << er.what() << std::endl;
110  } catch (const std::exception& er) {
111  edm::LogError("SiStripDetVOffFakeBuilder") << "caught std::exception " << er.what() << std::endl;
112  }
113  } else {
114  edm::LogError("SiStripDetVOffFakeBuilder") << "Service is unavailable" << std::endl;
115  }
116 }
Base exception class for the object to relational access.
Definition: Exception.h:11
bool put(const uint32_t DetId, const int HVoff, const int LVoff)
Insert information for a single detId.
Log< level::Error, false > LogError
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
bool isNewTagRequest(const std::string &recordName)
edm::EventID id() const
Definition: EventBase.h:63
Log< level::Info, false > LogInfo
RunNumber_t run() const
Definition: EventID.h:38
bool isAvailable() const
Definition: Service.h:40
char const * what() const noexcept override
Definition: Exception.cc:107
virtual void initialize(const edm::EventSetup &)

◆ initialize()

void SiStripDetVOffFakeBuilder::initialize ( const edm::EventSetup iSetup)
virtual

Definition at line 45 of file SiStripDetVOffFakeBuilder.cc.

References runTheMatrix::const, detids, beamvalidation::exit(), edm::EventSetup::getData(), AlCaHLTBitMon_ParallelJobs::p, printdebug_, nano_mu_digi_cff::rawId, and tkGeomToken_.

Referenced by analyze().

45  {
46  const auto& tkGeom = iSetup.getData(tkGeomToken_);
47  edm::LogInfo("SiStripDetVOffFakeBuilder") << " There are " << tkGeom.detUnits().size() << " detectors" << std::endl;
48 
49  for (const auto& it : tkGeom.detUnits()) {
50  if (dynamic_cast<StripGeomDetUnit const*>(it) != nullptr) {
51  uint32_t detid = (it->geographicalId()).rawId();
52  const StripTopology& p = dynamic_cast<StripGeomDetUnit const*>(it)->specificTopology();
53  unsigned short Nstrips = p.nstrips();
54  if (Nstrips < 1 || Nstrips > 768) {
55  edm::LogError("SiStripDetVOffFakeBuilder")
56  << " Problem with Number of strips in detector.. " << p.nstrips() << " Exiting program" << endl;
57  exit(1);
58  }
59  detids.push_back(detid);
60  if (printdebug_)
61  edm::LogInfo("SiStripDetVOffFakeBuilder") << "detid " << detid;
62  }
63  }
64 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
Log< level::Error, false > LogError
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
Log< level::Info, false > LogInfo
def exit(msg="")

Member Data Documentation

◆ detids

std::vector<uint32_t> SiStripDetVOffFakeBuilder::detids
private

Definition at line 34 of file SiStripDetVOffFakeBuilder.cc.

Referenced by analyze(), and initialize().

◆ printdebug_

bool SiStripDetVOffFakeBuilder::printdebug_
private

Definition at line 32 of file SiStripDetVOffFakeBuilder.cc.

Referenced by initialize().

◆ tkGeomToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiStripDetVOffFakeBuilder::tkGeomToken_
private

Definition at line 33 of file SiStripDetVOffFakeBuilder.cc.

Referenced by initialize().