CMS 3D CMS Logo

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

#include <SiStripDetVOffFakeBuilder.h>

Inheritance diagram for SiStripDetVOffFakeBuilder:
edm::EDAnalyzer 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::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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

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

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 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 16 of file SiStripDetVOffFakeBuilder.h.

Constructor & Destructor Documentation

◆ SiStripDetVOffFakeBuilder()

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

Definition at line 20 of file SiStripDetVOffFakeBuilder.cc.

21  : printdebug_(iConfig.getUntrackedParameter<bool>("printDebug", false)), tkGeomToken_(esConsumes()) {}

◆ ~SiStripDetVOffFakeBuilder()

SiStripDetVOffFakeBuilder::~SiStripDetVOffFakeBuilder ( )
override

Definition at line 23 of file SiStripDetVOffFakeBuilder.cc.

23 {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 46 of file SiStripDetVOffFakeBuilder.cc.

46  {
47  initialize(iSetup);
48 
49  unsigned int run = evt.id().run();
50 
51  edm::LogInfo("SiStripDetVOffFakeBuilder")
52  << "... creating dummy SiStripDetVOff Data for Run " << run << "\n " << std::endl;
53 
54  SiStripDetVOff* SiStripDetVOff_ = new SiStripDetVOff();
55 
56  // std::vector<uint32_t> TheDetIdHVVector;
57 
58  for (std::vector<uint32_t>::const_iterator it = detids.begin(); it != detids.end(); it++) {
59  //Generate HV and LV for each channel, if at least one of the two is off fill the value
60  int hv = rand() % 20;
61  int lv = rand() % 20;
62  if (hv <= 2) {
63  edm::LogInfo("SiStripDetVOffFakeBuilder") << "detid: " << *it << " HV\t OFF" << std::endl;
64  SiStripDetVOff_->put(*it, 1, -1);
65  // TheDetIdHVVector.push_back(*it);
66  }
67  if (lv <= 2) {
68  edm::LogInfo("SiStripDetVOffFakeBuilder") << "detid: " << *it << " LV\t OFF" << std::endl;
69  SiStripDetVOff_->put(*it, -1, 1);
70  // TheDetIdHVVector.push_back(*it);
71  }
72  if (lv <= 2 || hv <= 2)
73  edm::LogInfo("SiStripDetVOffFakeBuilder") << "detid: " << *it << " V\t OFF" << std::endl;
74  }
75 
76  // SiStripDetVOff_->put(TheDetIdHVVector);
77 
78  //End now write DetVOff data in DB
80 
81  if (mydbservice.isAvailable()) {
82  try {
83  if (mydbservice->isNewTagRequest("SiStripDetVOffRcd")) {
84  mydbservice->createNewIOV<SiStripDetVOff>(
85  SiStripDetVOff_, mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripDetVOffRcd");
86  } else {
87  mydbservice->appendSinceTime<SiStripDetVOff>(SiStripDetVOff_, mydbservice->currentTime(), "SiStripDetVOffRcd");
88  }
89  } catch (const cond::Exception& er) {
90  edm::LogError("SiStripDetVOffFakeBuilder") << er.what() << std::endl;
91  } catch (const std::exception& er) {
92  edm::LogError("SiStripDetVOffFakeBuilder") << "caught std::exception " << er.what() << std::endl;
93  }
94  } else {
95  edm::LogError("SiStripDetVOffFakeBuilder") << "Service is unavailable" << std::endl;
96  }
97 }

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::currentTime(), detids, cond::service::PoolDBOutputService::endOfTime(), 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().

◆ initialize()

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

Definition at line 25 of file SiStripDetVOffFakeBuilder.cc.

25  {
26  const auto& tkGeom = iSetup.getData(tkGeomToken_);
27  edm::LogInfo("SiStripDetVOffFakeBuilder") << " There are " << tkGeom.detUnits().size() << " detectors" << std::endl;
28 
29  for (const auto& it : tkGeom.detUnits()) {
30  if (dynamic_cast<StripGeomDetUnit const*>(it) != nullptr) {
31  uint32_t detid = (it->geographicalId()).rawId();
32  const StripTopology& p = dynamic_cast<StripGeomDetUnit const*>(it)->specificTopology();
33  unsigned short Nstrips = p.nstrips();
34  if (Nstrips < 1 || Nstrips > 768) {
35  edm::LogError("SiStripDetVOffFakeBuilder")
36  << " Problem with Number of strips in detector.. " << p.nstrips() << " Exiting program" << endl;
37  exit(1);
38  }
39  detids.push_back(detid);
40  if (printdebug_)
41  edm::LogInfo("SiStripDetVOffFakeBuilder") << "detid " << detid;
42  }
43  }
44 }

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

Referenced by analyze().

Member Data Documentation

◆ detids

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

Definition at line 29 of file SiStripDetVOffFakeBuilder.h.

Referenced by analyze(), and initialize().

◆ printdebug_

bool SiStripDetVOffFakeBuilder::printdebug_
private

Definition at line 27 of file SiStripDetVOffFakeBuilder.h.

Referenced by initialize().

◆ tkGeomToken_

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

Definition at line 28 of file SiStripDetVOffFakeBuilder.h.

Referenced by initialize().

cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
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
cms::Exception::what
char const * what() const noexcept override
Definition: Exception.cc:103
SiStripDetVOffFakeBuilder::printdebug_
bool printdebug_
Definition: SiStripDetVOffFakeBuilder.h:27
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:116
SiStripDetVOffFakeBuilder::tkGeomToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
Definition: SiStripDetVOffFakeBuilder.h:28
edm::EventID::run
RunNumber_t run() const
Definition: EventID.h:38
SiStripDetVOffFakeBuilder::initialize
virtual void initialize(const edm::EventSetup &)
Definition: SiStripDetVOffFakeBuilder.cc:25
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
SiStripDetVOffFakeBuilder::detids
std::vector< uint32_t > detids
Definition: SiStripDetVOffFakeBuilder.h:29
edm::Service< cond::service::PoolDBOutputService >
SiStripDetVOff::put
bool put(const uint32_t DetId, const int HVoff, const int LVoff)
Insert information for a single detId.
Definition: SiStripDetVOff.cc:24
SiStripDetVOff
Definition: SiStripDetVOff.h:31
cond::persistency::Exception
Base exception class for the object to relational access.
Definition: Exception.h:11
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:213
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::EventBase::id
edm::EventID id() const
Definition: EventBase.h:59
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:128
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:202
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
StripTopology
Definition: StripTopology.h:11
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:217