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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::vector< uint32_t > detids
 
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 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 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 13 of file SiStripDetVOffFakeBuilder.h.

Constructor & Destructor Documentation

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

Definition at line 23 of file SiStripDetVOffFakeBuilder.cc.

23  :
24  printdebug_(iConfig.getUntrackedParameter<bool>("printDebug",false)){}
T getUntrackedParameter(std::string const &, T const &) const
SiStripDetVOffFakeBuilder::~SiStripDetVOffFakeBuilder ( )
override

Definition at line 26 of file SiStripDetVOffFakeBuilder.cc.

26 {}

Member Function Documentation

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

Definition at line 52 of file SiStripDetVOffFakeBuilder.cc.

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::currentTime(), detids, cond::service::PoolDBOutputService::endOfTime(), cppFunctionSkipper::exception, AnalysisDataFormats_SUSYBSMObjects::hv, edm::EventBase::id(), initialize(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), SiStripDetVOff::put(), rand(), edm::EventID::run(), findQualityFiles::run, and cms::Exception::what().

53 {
54  initialize(iSetup);
55 
56  unsigned int run=evt.id().run();
57 
58  edm::LogInfo("SiStripDetVOffFakeBuilder") << "... creating dummy SiStripDetVOff Data for Run " << run << "\n " << std::endl;
59 
60 
61 
62  SiStripDetVOff* SiStripDetVOff_ = new SiStripDetVOff();
63 
64  // std::vector<uint32_t> TheDetIdHVVector;
65 
66  for(std::vector<uint32_t>::const_iterator it = detids.begin(); it != detids.end(); it++){
67 
68  //Generate HV and LV for each channel, if at least one of the two is off fill the value
69  int hv=rand() % 20;
70  int lv=rand() % 20;
71  if( hv<=2 ) {
72  edm::LogInfo("SiStripDetVOffFakeBuilder") << "detid: " << *it << " HV\t OFF" << std::endl;
73  SiStripDetVOff_->put( *it, 1, -1 );
74  // TheDetIdHVVector.push_back(*it);
75  }
76  if( lv<=2 ) {
77  edm::LogInfo("SiStripDetVOffFakeBuilder") << "detid: " << *it << " LV\t OFF" << std::endl;
78  SiStripDetVOff_->put( *it, -1, 1 );
79  // TheDetIdHVVector.push_back(*it);
80  }
81  if( lv<=2 || hv<=2 ) edm::LogInfo("SiStripDetVOffFakeBuilder") << "detid: " << *it << " V\t OFF" << std::endl;
82  }
83 
84  // SiStripDetVOff_->put(TheDetIdHVVector);
85 
86 
87 
88  //End now write DetVOff data in DB
90 
91  if( mydbservice.isAvailable() ){
92  try{
93  if( mydbservice->isNewTagRequest("SiStripDetVOffRcd") ){
94  mydbservice->createNewIOV<SiStripDetVOff>(SiStripDetVOff_,mydbservice->beginOfTime(),mydbservice->endOfTime(),"SiStripDetVOffRcd");
95  } else {
96  mydbservice->appendSinceTime<SiStripDetVOff>(SiStripDetVOff_,mydbservice->currentTime(),"SiStripDetVOffRcd");
97  }
98  }catch(const cond::Exception& er){
99  edm::LogError("SiStripDetVOffFakeBuilder")<<er.what()<<std::endl;
100  }catch(const std::exception& er){
101  edm::LogError("SiStripDetVOffFakeBuilder")<<"caught std::exception "<<er.what()<<std::endl;
102  }
103  }else{
104  edm::LogError("SiStripDetVOffFakeBuilder")<<"Service is unavailable"<<std::endl;
105  }
106 }
RunNumber_t run() const
Definition: EventID.h:39
Base exception class for the object to relational access.
Definition: Exception.h:11
char const * what() const override
Definition: Exception.cc:141
susybsm::HSCParticleRefVector hv
Definition: classes.h:28
bool put(const uint32_t DetId, const int HVoff, const int LVoff)
Insert information for a single detId.
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:46
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
std::vector< uint32_t > detids
edm::EventID id() const
Definition: EventBase.h:60
Signal rand(Signal arg)
Definition: vlib.cc:442
virtual void initialize(const edm::EventSetup &)
void SiStripDetVOffFakeBuilder::initialize ( const edm::EventSetup iSetup)
virtual

Definition at line 29 of file SiStripDetVOffFakeBuilder.cc.

References detids, TrackerGeometry::detUnits(), cmsRelvalreport::exit, edm::EventSetup::get(), StripTopology::nstrips(), AlCaHLTBitMon_ParallelJobs::p, and printdebug_.

Referenced by analyze().

29  {
30 
32  iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
33  edm::LogInfo("SiStripDetVOffFakeBuilder") <<" There are "<<pDD->detUnits().size() <<" detectors"<<std::endl;
34 
35  for( const auto& it : pDD->detUnits()) {
36 
37  if( dynamic_cast<StripGeomDetUnit const*>(it)!=nullptr){
38  uint32_t detid=(it->geographicalId()).rawId();
39  const StripTopology& p = dynamic_cast<StripGeomDetUnit const*>(it)->specificTopology();
40  unsigned short Nstrips = p.nstrips();
41  if(Nstrips<1 || Nstrips>768 ) {
42  edm::LogError("SiStripDetVOffFakeBuilder")<<" Problem with Number of strips in detector.. "<< p.nstrips() <<" Exiting program"<<endl;
43  exit(1);
44  }
45  detids.push_back(detid);
46  if (printdebug_)
47  edm::LogInfo("SiStripDetVOffFakeBuilder")<< "detid " << detid;
48  }
49  }
50 }
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
virtual int nstrips() const =0
const T & get() const
Definition: EventSetup.h:59
std::vector< uint32_t > detids

Member Data Documentation

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

Definition at line 27 of file SiStripDetVOffFakeBuilder.h.

Referenced by analyze(), and initialize().

bool SiStripDetVOffFakeBuilder::printdebug_
private

Definition at line 26 of file SiStripDetVOffFakeBuilder.h.

Referenced by initialize().