CMS 3D CMS Logo

ESDcsInfoTask.cc
Go to the documentation of this file.
1 #include <iostream>
2 
5 
8 
10 
12 
14 
15 using namespace cms;
16 using namespace edm;
17 using namespace std;
18 
20  dqmStore_ = Service<DQMStore>().operator->();
21 
22  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
23 
24  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
25 
26  dcsStatustoken_ = consumes<DcsStatusCollection>(ps.getParameter<InputTag>("DcsStatusLabel"));
27 
28  meESDcsFraction_ = nullptr;
29  meESDcsActiveMap_ = nullptr;
30 }
31 
33 
35  char histo[200];
36 
37  if (dqmStore_) {
38  dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");
39 
40  sprintf(histo, "DCSSummary");
41  meESDcsFraction_ = dqmStore_->bookFloat(histo);
42  meESDcsFraction_->Fill(-1.0);
43 
44  sprintf(histo, "DCSSummaryMap");
45  meESDcsActiveMap_ = dqmStore_->book1D(histo, histo, 2, 0., 2.);
46  meESDcsActiveMap_->setAxisTitle("(ES+/ES-)", 1);
47  }
48 }
49 
50 void ESDcsInfoTask::endJob(void) {}
51 
53  this->reset();
54 
55  for (int i = 0; i < 2; i++) {
56  meESDcsActiveMap_->setBinContent(i + 1, -1.0);
57  }
58 }
59 
61  if (meESDcsFraction_)
62  meESDcsFraction_->Reset();
63 
64  if (meESDcsActiveMap_)
65  meESDcsActiveMap_->Reset();
66 }
67 
68 void ESDcsInfoTask::analyze(const Event& e, const EventSetup& c) {
69  ievt_++;
70 
71  float ESpDcsStatus = 0;
72  float ESmDcsStatus = 0;
73 
75  e.getByToken(dcsStatustoken_, dcsStatus);
76  if (dcsStatus.isValid()) {
77  for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin(); dcsStatusItr != dcsStatus->end();
78  ++dcsStatusItr) {
79  ESpDcsStatus = dcsStatusItr->ready(DcsStatus::ESp);
80  ESmDcsStatus = dcsStatusItr->ready(DcsStatus::ESm);
81  }
82 
83  ESpDcsStatus = (ESpDcsStatus + float(ievt_ - 1) * meESDcsActiveMap_->getBinContent(1)) / float(ievt_);
84  ESmDcsStatus = (ESmDcsStatus + float(ievt_ - 1) * meESDcsActiveMap_->getBinContent(2)) / float(ievt_);
85  }
86 
87  meESDcsActiveMap_->setBinContent(1, ESpDcsStatus);
88  meESDcsActiveMap_->setBinContent(2, ESmDcsStatus);
89 
90  meESDcsFraction_->Fill((ESpDcsStatus + ESmDcsStatus) / 2.);
91 }
92 
93 //define this as a plug-in
DcsStatus::ESp
Definition: DcsStatus.h:57
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
ESDcsInfoTask::reset
void reset(void)
Reset.
Definition: ESDcsInfoTask.cc:60
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm
HLT enums.
Definition: AlignableModifier.h:19
ESDcsInfoTask::beginLuminosityBlock
void beginLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup) override
BeginLuminosityBlock.
Definition: ESDcsInfoTask.cc:52
ESDcsInfoTask::endJob
void endJob(void) override
EndJob.
Definition: ESDcsInfoTask.cc:50
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
DQMStore.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
DcsStatus::ESm
Definition: DcsStatus.h:58
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
ESDcsInfoTask::~ESDcsInfoTask
~ESDcsInfoTask() override
Destructor.
Definition: ESDcsInfoTask.cc:32
edm::Service
Definition: Service.h:30
ESDcsInfoTask.h
edm::EventSetup
Definition: EventSetup.h:58
std
Definition: JetResolutionObject.h:76
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ESDcsInfoTask
Definition: ESDcsInfoTask.h:11
reset
void reset(double vett[256])
Definition: TPedValues.cc:11
ESDcsInfoTask::ESDcsInfoTask
ESDcsInfoTask(const edm::ParameterSet &ps)
Constructor.
Definition: ESDcsInfoTask.cc:19
ParameterSet.h
ESDcsInfoTask::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
Definition: ESDcsInfoTask.cc:68
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
ESDcsInfoTask::beginJob
void beginJob(void) override
BeginJob.
Definition: ESDcsInfoTask.cc:34
edm::InputTag
Definition: InputTag.h:15
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37