CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  nEvents(0) {
25 
26  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask")
27  << "[DTScalerInfoTask]: Constructor"<<endl;
28 
29  scalerToken_ = consumes<LumiScalersCollection>(
30  ps.getUntrackedParameter<InputTag>("inputTagScaler"));
31  theParams = ps;
33 
34 }
35 
36 
38 
39  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask")
40  << "[DTScalerInfoTask]: analyzed " << nEvents << " events" << endl;
41 
42 }
43 
44 
46 
47  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask")
48  << "[DTScalerInfoTask]: BeginJob" << endl;
49 
50 }
51 
52 
54 
55  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask")
56  << "[DTScalerInfoTask]: BeginRun" << endl;
57 
58  bookHistos();
59 
60 }
61 
62 
64 
65  nEventsInLS=0;
66 
67  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask")
68  << "[DTScalerInfoTask]: Begin of LS transition" << endl;
69 
70  }
71 
72 void DTScalerInfoTask::endLuminosityBlock(const LuminosityBlock& lumiSeg, const EventSetup& context) {
73 
74  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask")
75  << "[DTScalerInfoTask]: End of LS transition" << endl;
76 
77 
78  int block = lumiSeg.luminosityBlock();
79 
80  map<string,DTTimeEvolutionHisto* >::const_iterator histoIt = trendHistos.begin();
81  map<string,DTTimeEvolutionHisto* >::const_iterator histoEnd = trendHistos.end();
82  for(;histoIt!=histoEnd;++histoIt) {
83  histoIt->second->updateTimeSlot(block, nEventsInLS);
84  }
85 
86 }
87 
88 
90 
91  LogVerbatim("DTDQM|DTMonitorModule|DTScalerInfoTask")
92  << "[DTScalerInfoTask]: analyzed " << nEvents << " events" << endl;
93 
94 }
95 
96 
98 
99  nEvents++;
100  nEventsInLS++;
102 
103  //retrieve the luminosity
105  e.getByToken(scalerToken_, lumiScalers);
106  LumiScalersCollection::const_iterator lumiIt = lumiScalers->begin();
107  trendHistos["AvgLumivsLumiSec"]->accumulateValueTimeSlot(lumiIt->instantLumi());
108 
109 }
110 
111 
113 
114  theDQMStore->setCurrentFolder("DT/EventInfo/Counters");
115  nEventMonitor = theDQMStore->bookFloat("nProcessedEventsScalerInfo");
116 
117  theDQMStore->setCurrentFolder("DT/00-DataIntegrity/ScalerInfo");
118 
119  string histoName = "AvgLumivsLumiSec";
120  string histoTitle = "Average Lumi vs LumiSec";
121  trendHistos[histoName] = new DTTimeEvolutionHisto(theDQMStore,histoName,histoTitle,200,10,true,0);
122 
123 }
124 
125 // Local Variables:
126 // show-trailing-whitespace: t
127 // truncate-lines: t
128 // End:
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * nEventMonitor
DTScalerInfoTask(const edm::ParameterSet &ps)
Constructor.
edm::EDGetTokenT< LumiScalersCollection > scalerToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
To reset the MEs.
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:879
virtual ~DTScalerInfoTask()
Destructor.
void Fill(long long x)
LuminosityBlockNumber_t luminosityBlock() const
DQMStore * theDQMStore
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
Perform trend plot operations.
void beginRun(const edm::Run &, const edm::EventSetup &)
Beginrun.
void bookHistos()
Book the histograms.
#define LogTrace(id)
void endJob(void)
EndJob.
std::map< std::string,DTTimeEvolutionHisto * > trendHistos
UInt_t nEvents
Definition: hcalCalib.cc:42
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
Definition: Run.h:41
edm::ParameterSet theParams