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

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 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 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 ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, 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)
 

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:55
MonitorElement * meESDcsActiveMap_
Definition: ESDcsInfoTask.h:56
edm::EDGetTokenT< DcsStatusCollection > dcsStatustoken_
Definition: ESDcsInfoTask.h:53
DQMStore * dqmStore_
Definition: ESDcsInfoTask.h:45
std::string prefixME_
Definition: ESDcsInfoTask.h:47
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 102 of file ESDcsInfoTask.cc.

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

102  {
103 
104  ievt_++;
105 
106  float ESpDcsStatus = 0;
107  float ESmDcsStatus = 0;
108 
109  Handle<DcsStatusCollection> dcsStatus;
110  e.getByToken(dcsStatustoken_, dcsStatus);
111  if (dcsStatus.isValid()) {
112  for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin(); dcsStatusItr != dcsStatus->end(); ++dcsStatusItr) {
113  ESpDcsStatus = dcsStatusItr->ready(DcsStatus::ESp);
114  ESmDcsStatus = dcsStatusItr->ready(DcsStatus::ESm);
115  }
116 
117  ESpDcsStatus = (ESpDcsStatus + float(ievt_-1)*meESDcsActiveMap_->getBinContent(1))/float(ievt_);
118  ESmDcsStatus = (ESmDcsStatus + float(ievt_-1)*meESDcsActiveMap_->getBinContent(2))/float(ievt_);
119  }
120 
121  meESDcsActiveMap_->setBinContent(1, ESpDcsStatus);
122  meESDcsActiveMap_->setBinContent(2, ESmDcsStatus);
123 
124  meESDcsFraction_->Fill( (ESpDcsStatus + ESmDcsStatus)/2. );
125 
126 }
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * meESDcsFraction_
Definition: ESDcsInfoTask.h:55
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
MonitorElement * meESDcsActiveMap_
Definition: ESDcsInfoTask.h:56
void Fill(long long x)
edm::EDGetTokenT< DcsStatusCollection > dcsStatustoken_
Definition: ESDcsInfoTask.h:53
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:55
MonitorElement * meESDcsActiveMap_
Definition: ESDcsInfoTask.h:56
void Fill(long long x)
DQMStore * dqmStore_
Definition: ESDcsInfoTask.h:45
std::string prefixME_
Definition: ESDcsInfoTask.h:47
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:56
void reset(void)
Reset.
void ESDcsInfoTask::cleanup ( void  )
protected

Cleanup.

Definition at line 88 of file ESDcsInfoTask.cc.

Referenced by esMonitoring.FDJsonServer::handle_close().

88  {
89 
90  if ( dqmStore_ ) {
91 
92  dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");
93 
94  if ( meESDcsFraction_ ) dqmStore_->removeElement( meESDcsFraction_->getName() );
95 
96  if ( meESDcsActiveMap_ ) dqmStore_->removeElement( meESDcsActiveMap_->getName() );
97 
98  }
99 
100 }
MonitorElement * meESDcsFraction_
Definition: ESDcsInfoTask.h:55
const std::string & getName() const
get name of ME
MonitorElement * meESDcsActiveMap_
Definition: ESDcsInfoTask.h:56
DQMStore * dqmStore_
Definition: ESDcsInfoTask.h:45
std::string prefixME_
Definition: ESDcsInfoTask.h:47
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::reset ( void  )
protected

Reset.

Definition at line 79 of file ESDcsInfoTask.cc.

79  {
80 
82 
84 
85 }
MonitorElement * meESDcsFraction_
Definition: ESDcsInfoTask.h:55
MonitorElement * meESDcsActiveMap_
Definition: ESDcsInfoTask.h:56
void Reset()
reset ME (ie. contents, errors, etc)

Member Data Documentation

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

Definition at line 53 of file ESDcsInfoTask.h.

DQMStore* ESDcsInfoTask::dqmStore_
private

Definition at line 45 of file ESDcsInfoTask.h.

bool ESDcsInfoTask::enableCleanup_
private

Definition at line 49 of file ESDcsInfoTask.h.

int ESDcsInfoTask::ievt_
private

Definition at line 58 of file ESDcsInfoTask.h.

MonitorElement* ESDcsInfoTask::meESDcsActiveMap_
private

Definition at line 56 of file ESDcsInfoTask.h.

MonitorElement* ESDcsInfoTask::meESDcsFraction_
private

Definition at line 55 of file ESDcsInfoTask.h.

bool ESDcsInfoTask::mergeRuns_
private

Definition at line 51 of file ESDcsInfoTask.h.

std::string ESDcsInfoTask::prefixME_
private

Definition at line 47 of file ESDcsInfoTask.h.