CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
TkVoltageMapCreator Class Reference
Inheritance diagram for TkVoltageMapCreator:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 TkVoltageMapCreator (const edm::ParameterSet &)
 
 ~TkVoltageMapCreator () 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 Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endJob () override
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 

Private Attributes

const std::string _hvfile
 
const std::string _hvtkmapname
 
const std::string _lvfile
 
const std::string _lvtkmapname
 

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 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 32 of file TkVoltageMapCreator.cc.

Constructor & Destructor Documentation

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

Definition at line 63 of file TkVoltageMapCreator.cc.

64  : _lvfile(iConfig.getParameter<std::string>("LVStatusFile")),
65  _lvtkmapname(iConfig.getParameter<std::string>("LVTkMapName")),
66  _hvfile(iConfig.getParameter<std::string>("HVStatusFile")),
67  _hvtkmapname(iConfig.getParameter<std::string>("HVTkMapName"))
68 
69 {
70  //now do what ever initialization is needed
71 }
T getParameter(std::string const &) const
const std::string _hvfile
const std::string _lvtkmapname
const std::string _hvtkmapname
const std::string _lvfile
TkVoltageMapCreator::~TkVoltageMapCreator ( )
override

Definition at line 73 of file TkVoltageMapCreator.cc.

73  {
74  // do anything here that needs to be done at desctruction time
75  // (e.g. close files, deallocate resources etc.)
76 }

Member Function Documentation

void TkVoltageMapCreator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 83 of file TkVoltageMapCreator.cc.

83 { using namespace edm; }
HLT enums.
void TkVoltageMapCreator::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 141 of file TkVoltageMapCreator.cc.

141 {}
void TkVoltageMapCreator::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 85 of file TkVoltageMapCreator.cc.

References _hvfile, _hvtkmapname, _lvfile, _lvtkmapname, TkHistoMap::dumpInTkMap(), TkHistoMap::fill(), edm::EventSetup::get(), edm::ESHandle< T >::product(), TkHistoMap::save(), TrackerMap::save(), TrackerMap::setPalette(), and AlCaHLTBitMon_QueryRunRegistry::string.

85  {
86  edm::ESHandle<TkDetMap> tkDetMapHandle;
87  iSetup.get<TrackerTopologyRcd>().get(tkDetMapHandle);
88  const TkDetMap* tkDetMap = tkDetMapHandle.product();
89 
90  TrackerMap lvmap, hvmap;
91 
92  TkHistoMap lvhisto(tkDetMap, "LV_Status", "LV_Status", -1);
93  TkHistoMap hvhisto(tkDetMap, "HV_Status", "HV_Status", -1);
94 
95  std::ifstream lvdata(_lvfile.c_str());
96  std::ifstream hvdata(_hvfile.c_str());
97 
98  // HV channel map filling
99 
100  unsigned int detid;
101  std::string lvstatus;
102 
103  while (lvdata >> detid >> lvstatus) {
104  double cha = 0.;
105  if (lvstatus == "ON")
106  cha = 0.5; //GREEN
107  if (lvstatus == "OFF")
108  cha = 1.; //RED
109  lvhisto.fill(detid, cha);
110  }
111 
112  std::string hvstatus;
113 
114  while (hvdata >> detid >> hvstatus) {
115  double cha = 0.;
116  if (hvstatus == "ON")
117  cha = 0.5; //GREEN
118  if (hvstatus == "OFF")
119  cha = 1.; //RED
120  hvhisto.fill(detid, cha);
121  }
122 
123  lvmap.setPalette(1);
124  hvmap.setPalette(1);
125 
126  lvhisto.dumpInTkMap(&lvmap);
127  hvhisto.dumpInTkMap(&hvmap);
128 
129  lvmap.save(true, 0, 0, _lvtkmapname);
130  hvmap.save(true, 0, 0, _hvtkmapname);
131 
132  //TODO could make the root file name a parameter to avoid overwriting everytime...
133  std::string rootmapname = "VoltageStatus.root";
134  lvhisto.save(rootmapname);
135  hvhisto.save(rootmapname);
136 }
const std::string _hvfile
const std::string _lvtkmapname
const std::string _hvtkmapname
void setPalette(int numpalette)
Definition: TrackerMap.h:129
void save(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
Definition: TrackerMap.cc:699
T get() const
Definition: EventSetup.h:71
T const * product() const
Definition: ESHandle.h:86
const std::string _lvfile
void TkVoltageMapCreator::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 144 of file TkVoltageMapCreator.cc.

References DEFINE_FWK_MODULE.

Referenced by o2olib.O2ORunMgr::executeJob().

144 {}
void TkVoltageMapCreator::endRun ( const edm::Run iRun,
const edm::EventSetup  
)
overrideprivate

Definition at line 138 of file TkVoltageMapCreator.cc.

138 {}

Member Data Documentation

const std::string TkVoltageMapCreator::_hvfile
private

Definition at line 48 of file TkVoltageMapCreator.cc.

Referenced by beginRun().

const std::string TkVoltageMapCreator::_hvtkmapname
private

Definition at line 49 of file TkVoltageMapCreator.cc.

Referenced by beginRun().

const std::string TkVoltageMapCreator::_lvfile
private

Definition at line 46 of file TkVoltageMapCreator.cc.

Referenced by beginRun().

const std::string TkVoltageMapCreator::_lvtkmapname
private

Definition at line 47 of file TkVoltageMapCreator.cc.

Referenced by beginRun().