CMS 3D CMS Logo

DTScalerInfoTask.cc
Go to the documentation of this file.
1 /*
2  * \file DTScalerInfoTask.cc
3  *
4  * \author C. Battilana - CIEMAT
5  *
6 */
7 
9 
10 // Framework
12 
13 // DT DQM
15 
16 #include <sstream>
17 #include <iostream>
18 #include <fstream>
19 
20 using namespace edm;
21 using namespace std;
22 
24  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask") << "[DTScalerInfoTask]: Constructor" << endl;
25 
26  scalerToken_ = consumes<LumiScalersCollection>(ps.getUntrackedParameter<InputTag>("inputTagScaler"));
27  theParams = ps;
28 }
29 
31  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask") << "[DTScalerInfoTask]: analyzed " << nEvents << " events" << endl;
32 }
33 
35  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask") << "[DTScalerInfoTask]: BeginRun" << endl;
36 }
37 
39  nEventsInLS = 0;
40 
41  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask") << "[DTScalerInfoTask]: Begin of LS transition" << endl;
42 }
43 
44 void DTScalerInfoTask::endLuminosityBlock(const LuminosityBlock& lumiSeg, const EventSetup& context) {
45  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask") << "[DTScalerInfoTask]: End of LS transition" << endl;
46 
47  int block = lumiSeg.luminosityBlock();
48 
49  map<string, DTTimeEvolutionHisto*>::const_iterator histoIt = trendHistos.begin();
50  map<string, DTTimeEvolutionHisto*>::const_iterator histoEnd = trendHistos.end();
51  for (; histoIt != histoEnd; ++histoIt) {
52  histoIt->second->updateTimeSlot(block, nEventsInLS);
53  }
54 }
55 
57  nEvents++;
58  nEventsInLS++;
60 
61  //retrieve the luminosity
63  if (e.getByToken(scalerToken_, lumiScalers)) {
64  if (lumiScalers->begin() != lumiScalers->end()) {
65  LumiScalersCollection::const_iterator lumiIt = lumiScalers->begin();
66  trendHistos["AvgLumivsLumiSec"]->accumulateValueTimeSlot(lumiIt->instantLumi());
67  } else {
68  LogVerbatim("DTDQM|DTMonitorModule|DTScalerInfoTask")
69  << "[DTScalerInfoTask]: LumiScalersCollection size == 0" << endl;
70  }
71  } else {
72  LogVerbatim("DTDQM|DTMonitorModule|DTScalerInfoTask")
73  << "[DTScalerInfoTask]: LumiScalersCollection getByToken call failed" << endl;
74  }
75 }
76 
78  edm::Run const& iRun,
79  edm::EventSetup const& context) {
80  ibooker.setCurrentFolder("DT/EventInfo/Counters");
81  nEventMonitor = ibooker.bookFloat("nProcessedEventsScalerInfo");
82 
83  ibooker.setCurrentFolder("DT/00-DataIntegrity/ScalerInfo");
84 
85  string histoName = "AvgLumivsLumiSec";
86  string histoTitle = "Average Lumi vs LumiSec";
87  trendHistos[histoName] = new DTTimeEvolutionHisto(ibooker, histoName, histoTitle, 200, 10, true, 0);
88 }
89 
90 // Local Variables:
91 // show-trailing-whitespace: t
92 // truncate-lines: t
93 // End:
dqm::implementation::IBooker::bookFloat
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
V0Monitor_cfi.lumiScalers
lumiScalers
Definition: V0Monitor_cfi.py:9
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DTScalerInfoTask::endLuminosityBlock
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
Perform trend plot operations.
Definition: DTScalerInfoTask.cc:44
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
DTScalerInfoTask::nEventsInLS
int nEventsInLS
Definition: DTScalerInfoTask.h:65
DTScalerInfoTask::trendHistos
std::map< std::string, DTTimeEvolutionHisto * > trendHistos
Definition: DTScalerInfoTask.h:71
DTScalerInfoTask::dqmBeginRun
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Beginrun.
Definition: DTScalerInfoTask.cc:34
DTScalerInfoTask::beginLuminosityBlock
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
To reset the MEs.
Definition: DTScalerInfoTask.cc:38
edm::LuminosityBlockBase::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: LuminosityBlockBase.h:40
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
DTScalerInfoTask::nEvents
int nEvents
Definition: DTScalerInfoTask.h:64
DTScalerInfoTask::nEventMonitor
MonitorElement * nEventMonitor
Definition: DTScalerInfoTask.h:72
DTTimeEvolutionHisto.h
edm::ParameterSet
Definition: ParameterSet.h:47
DTScalerInfoTask::scalerToken_
edm::EDGetTokenT< LumiScalersCollection > scalerToken_
Definition: DTScalerInfoTask.h:69
DTScalerInfoTask::theParams
edm::ParameterSet theParams
Definition: DTScalerInfoTask.h:67
groupFilesInBlocks.block
block
Definition: groupFilesInBlocks.py:150
edm::EventSetup
Definition: EventSetup.h:57
DTScalerInfoTask::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: DTScalerInfoTask.cc:77
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
DTScalerInfoTask.h
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
DTTimeEvolutionHisto
Definition: DTTimeEvolutionHisto.h:15
HltBtagPostValidation_cff.histoName
histoName
Definition: HltBtagPostValidation_cff.py:17
EventSetup.h
DTScalerInfoTask::DTScalerInfoTask
DTScalerInfoTask(const edm::ParameterSet &ps)
Constructor.
Definition: DTScalerInfoTask.cc:23
dqm::implementation::IBooker
Definition: DQMStore.h:43
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
DTScalerInfoTask::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
Definition: DTScalerInfoTask.cc:56
nEvents
UInt_t nEvents
Definition: hcalCalib.cc:41
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
DTScalerInfoTask::~DTScalerInfoTask
~DTScalerInfoTask() override
Destructor.
Definition: DTScalerInfoTask.cc:30
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37