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  * $Date: 2011/10/19 10:05:54 $
5  * $Revision: 1.1 $
6  * \author C. Battilana - CIEMAT
7  *
8 */
9 
11 
12 // Framework
14 
15 // DT DQM
17 
20 
21 #include <sstream>
22 #include <iostream>
23 #include <fstream>
24 
25 using namespace edm;
26 using namespace std;
27 
29  nEvents(0) {
30 
31  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask")
32  << "[DTScalerInfoTask]: Constructor"<<endl;
33 
34  theScalerTag = ps.getUntrackedParameter<InputTag>("inputTagScaler");
35  theParams = ps;
37 
38 }
39 
40 
42 
43  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask")
44  << "[DTScalerInfoTask]: analyzed " << nEvents << " events" << endl;
45 
46 }
47 
48 
50 
51  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask")
52  << "[DTScalerInfoTask]: BeginJob" << endl;
53 
54 }
55 
56 
58 
59  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask")
60  << "[DTScalerInfoTask]: BeginRun" << endl;
61 
62  bookHistos();
63 
64 }
65 
66 
68 
69  nEventsInLS=0;
70 
71  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask")
72  << "[DTScalerInfoTask]: Begin of LS transition" << endl;
73 
74  }
75 
76 void DTScalerInfoTask::endLuminosityBlock(const LuminosityBlock& lumiSeg, const EventSetup& context) {
77 
78  LogTrace("DTDQM|DTMonitorModule|DTScalerInfoTask")
79  << "[DTScalerInfoTask]: End of LS transition" << endl;
80 
81 
82  int block = lumiSeg.luminosityBlock();
83 
84  map<string,DTTimeEvolutionHisto* >::const_iterator histoIt = trendHistos.begin();
85  map<string,DTTimeEvolutionHisto* >::const_iterator histoEnd = trendHistos.end();
86  for(;histoIt!=histoEnd;++histoIt) {
87  histoIt->second->updateTimeSlot(block, nEventsInLS);
88  }
89 
90 }
91 
92 
94 
95  LogVerbatim("DTDQM|DTMonitorModule|DTScalerInfoTask")
96  << "[DTScalerInfoTask]: analyzed " << nEvents << " events" << endl;
97 
98 }
99 
100 
102 
103  nEvents++;
104  nEventsInLS++;
106 
107  //retrieve the luminosity
109  e.getByLabel(theScalerTag, lumiScalers);
110  LumiScalersCollection::const_iterator lumiIt = lumiScalers->begin();
111  trendHistos["AvgLumivsLumiSec"]->accumulateValueTimeSlot(lumiIt->instantLumi());
112 
113 }
114 
115 
117 
118  theDQMStore->setCurrentFolder("DT/EventInfo/Counters");
119  nEventMonitor = theDQMStore->bookFloat("nProcessedEventsScalerInfo");
120 
121  theDQMStore->setCurrentFolder("DT/00-DataIntegrity/ScalerInfo");
122 
123  string histoName = "AvgLumivsLumiSec";
124  string histoTitle = "Average Lumi vs LumiSec";
125  trendHistos[histoName] = new DTTimeEvolutionHisto(theDQMStore,histoName,histoTitle,200,10,true,0);
126 
127 }
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * nEventMonitor
DTScalerInfoTask(const edm::ParameterSet &ps)
Constructor.
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:654
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.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
#define LogTrace(id)
void endJob(void)
EndJob.
std::map< std::string,DTTimeEvolutionHisto * > trendHistos
UInt_t nEvents
Definition: hcalCalib.cc:43
edm::InputTag theScalerTag
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
Definition: Run.h:33
edm::ParameterSet theParams