CMS 3D CMS Logo

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

#include <ESDcsInfoTask.h>

Inheritance diagram for ESDcsInfoTask:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 ESDcsInfoTask (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~ESDcsInfoTask () override
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
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)
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 Analyze. More...
 
void beginJob (void) override
 BeginJob. More...
 
void beginLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup) override
 BeginLuminosityBlock. More...
 
void cleanup (void)
 Cleanup. More...
 
void endJob (void) override
 EndJob. More...
 
void endLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup) override
 EndLuminosityBlock. More...
 
void reset (void)
 Reset. More...
 
- 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)
 

Private Attributes

edm::EDGetTokenT< DcsStatusCollectiondcsStatustoken_
 
DQMStoredqmStore_
 
bool enableCleanup_
 
int ievt_
 
MonitorElementmeESDcsActiveMap_
 
MonitorElementmeESDcsFraction_
 
bool mergeRuns_
 
std::string prefixME_
 

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 ()
 

Detailed Description

Definition at line 13 of file ESDcsInfoTask.h.

Constructor & Destructor Documentation

ESDcsInfoTask::ESDcsInfoTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 20 of file ESDcsInfoTask.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and Utilities::operator.

20  {
21 
23 
24  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
25 
26  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
27 
28  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
29 
30  dcsStatustoken_ = consumes<DcsStatusCollection>(ps.getParameter<InputTag>("DcsStatusLabel"));
31 
32  meESDcsFraction_ = nullptr;
33  meESDcsActiveMap_ = nullptr;
34 
35 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meESDcsFraction_
Definition: ESDcsInfoTask.h:58
MonitorElement * meESDcsActiveMap_
Definition: ESDcsInfoTask.h:59
edm::EDGetTokenT< DcsStatusCollection > dcsStatustoken_
Definition: ESDcsInfoTask.h:56
DQMStore * dqmStore_
Definition: ESDcsInfoTask.h:48
std::string prefixME_
Definition: ESDcsInfoTask.h:50
ESDcsInfoTask::~ESDcsInfoTask ( )
override

Destructor.

Definition at line 37 of file ESDcsInfoTask.cc.

37  {
38 
39 }

Member Function Documentation

void ESDcsInfoTask::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotected

Analyze.

Definition at line 105 of file ESDcsInfoTask.cc.

References DEFINE_FWK_MODULE, DcsStatus::ESm, DcsStatus::ESp, objects.autophobj::float, edm::Event::getByToken(), and edm::HandleBase::isValid().

105  {
106 
107  ievt_++;
108 
109  float ESpDcsStatus = 0;
110  float ESmDcsStatus = 0;
111 
112  Handle<DcsStatusCollection> dcsStatus;
113  e.getByToken(dcsStatustoken_, dcsStatus);
114  if (dcsStatus.isValid()) {
115  for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin(); dcsStatusItr != dcsStatus->end(); ++dcsStatusItr) {
116  ESpDcsStatus = dcsStatusItr->ready(DcsStatus::ESp);
117  ESmDcsStatus = dcsStatusItr->ready(DcsStatus::ESm);
118  }
119 
120  ESpDcsStatus = (ESpDcsStatus + float(ievt_-1)*meESDcsActiveMap_->getBinContent(1))/float(ievt_);
121  ESmDcsStatus = (ESmDcsStatus + float(ievt_-1)*meESDcsActiveMap_->getBinContent(2))/float(ievt_);
122  }
123 
124  meESDcsActiveMap_->setBinContent(1, ESpDcsStatus);
125  meESDcsActiveMap_->setBinContent(2, ESmDcsStatus);
126 
127  meESDcsFraction_->Fill( (ESpDcsStatus + ESmDcsStatus)/2. );
128 
129 }
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * meESDcsFraction_
Definition: ESDcsInfoTask.h:58
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
MonitorElement * meESDcsActiveMap_
Definition: ESDcsInfoTask.h:59
void Fill(long long x)
edm::EDGetTokenT< DcsStatusCollection > dcsStatustoken_
Definition: ESDcsInfoTask.h:56
bool isValid() const
Definition: HandleBase.h:74
double getBinContent(int binx) const
get content of bin (1-D)
void ESDcsInfoTask::beginJob ( void  )
overrideprotectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 41 of file ESDcsInfoTask.cc.

References trackerHits::histo.

41  {
42 
43  char histo[200];
44 
45  if ( dqmStore_ ) {
46 
47  dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");
48 
49  sprintf(histo, "DCSSummary");
50  meESDcsFraction_ = dqmStore_->bookFloat(histo);
51  meESDcsFraction_->Fill(-1.0);
52 
53  sprintf(histo, "DCSSummaryMap");
54  meESDcsActiveMap_ = dqmStore_->book1D(histo,histo, 2, 0., 2.);
55  meESDcsActiveMap_->setAxisTitle("(ES+/ES-)", 1);
56 
57 
58  }
59 
60 }
MonitorElement * meESDcsFraction_
Definition: ESDcsInfoTask.h:58
MonitorElement * meESDcsActiveMap_
Definition: ESDcsInfoTask.h:59
void Fill(long long x)
DQMStore * dqmStore_
Definition: ESDcsInfoTask.h:48
std::string prefixME_
Definition: ESDcsInfoTask.h:50
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void ESDcsInfoTask::beginLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup iSetup 
)
overrideprotected

BeginLuminosityBlock.

Definition at line 68 of file ESDcsInfoTask.cc.

References mps_fire::i, and reset().

68  {
69 
70  this->reset();
71 
72  for( int i = 0; i < 2; i++) {
74  }
75 
76 }
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * meESDcsActiveMap_
Definition: ESDcsInfoTask.h:59
void reset(void)
Reset.
void ESDcsInfoTask::cleanup ( void  )
protected

Cleanup.

Definition at line 91 of file ESDcsInfoTask.cc.

Referenced by esMonitoring.FDJsonServer::handle_close().

91  {
92 
93  if ( dqmStore_ ) {
94 
95  dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");
96 
97  if ( meESDcsFraction_ ) dqmStore_->removeElement( meESDcsFraction_->getName() );
98 
99  if ( meESDcsActiveMap_ ) dqmStore_->removeElement( meESDcsActiveMap_->getName() );
100 
101  }
102 
103 }
MonitorElement * meESDcsFraction_
Definition: ESDcsInfoTask.h:58
const std::string & getName() const
get name of ME
MonitorElement * meESDcsActiveMap_
Definition: ESDcsInfoTask.h:59
DQMStore * dqmStore_
Definition: ESDcsInfoTask.h:48
std::string prefixME_
Definition: ESDcsInfoTask.h:50
void ESDcsInfoTask::endJob ( void  )
overrideprotectedvirtual

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 62 of file ESDcsInfoTask.cc.

References edm::cleanup().

62  {
63 
64  if ( enableCleanup_ ) this->cleanup();
65 
66 }
void cleanup(void)
Cleanup.
void ESDcsInfoTask::endLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup iSetup 
)
overrideprotected

EndLuminosityBlock.

Definition at line 78 of file ESDcsInfoTask.cc.

78  {
79 
80 }
void ESDcsInfoTask::reset ( void  )
protected

Reset.

Definition at line 82 of file ESDcsInfoTask.cc.

82  {
83 
85 
87 
88 }
MonitorElement * meESDcsFraction_
Definition: ESDcsInfoTask.h:58
MonitorElement * meESDcsActiveMap_
Definition: ESDcsInfoTask.h:59
void Reset()
reset ME (ie. contents, errors, etc)

Member Data Documentation

edm::EDGetTokenT<DcsStatusCollection> ESDcsInfoTask::dcsStatustoken_
private

Definition at line 56 of file ESDcsInfoTask.h.

DQMStore* ESDcsInfoTask::dqmStore_
private

Definition at line 48 of file ESDcsInfoTask.h.

bool ESDcsInfoTask::enableCleanup_
private

Definition at line 52 of file ESDcsInfoTask.h.

int ESDcsInfoTask::ievt_
private

Definition at line 61 of file ESDcsInfoTask.h.

MonitorElement* ESDcsInfoTask::meESDcsActiveMap_
private

Definition at line 59 of file ESDcsInfoTask.h.

MonitorElement* ESDcsInfoTask::meESDcsFraction_
private

Definition at line 58 of file ESDcsInfoTask.h.

bool ESDcsInfoTask::mergeRuns_
private

Definition at line 54 of file ESDcsInfoTask.h.

std::string ESDcsInfoTask::prefixME_
private

Definition at line 50 of file ESDcsInfoTask.h.