CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TCSCTFClient.cc
Go to the documentation of this file.
2 
11 #include "TRandom.h"
12 using namespace edm;
13 using namespace std;
14 
16  parameters=ps;
17  initialize();
18 }
19 
21 
22 //--------------------------------------------------------
24  counterLS = 0;
25  counterEvt = 0;
26 
27  // get back-end interface
28  dbe = Service<DQMStore>().operator->();
29 
30  input_dir = parameters.getUntrackedParameter<string>("input_dir","");
31  output_dir = parameters.getUntrackedParameter<string>("output_dir","");
32  prescaleLS = parameters.getUntrackedParameter<int>("prescaleLS",-1);
33  prescaleEvt = parameters.getUntrackedParameter<int>("prescaleEvt",-1);
34 
35  m_runInEventLoop = parameters.getUntrackedParameter<bool>("runInEventLoop", false);
36  m_runInEndLumi = parameters.getUntrackedParameter<bool>("runInEndLumi", false);
37  m_runInEndRun = parameters.getUntrackedParameter<bool>("runInEndRun", false);
38  m_runInEndJob = parameters.getUntrackedParameter<bool>("runInEndJob", false);
39 
40 }
41 
42 //--------------------------------------------------------
44  // get backendinterface
45  dbe = Service<DQMStore>().operator->();
46 
47  // do your thing
48  dbe->setCurrentFolder(output_dir);
49  csctferrors_ = dbe->book1D("csctferrors_","CSCTF Errors",6,0,6);
50  dbe->setCurrentFolder(input_dir);
51 }
52 
53 //--------------------------------------------------------
54 void L1TCSCTFClient::beginRun(const Run& r, const EventSetup& context) {}
55 
56 //--------------------------------------------------------
57 void L1TCSCTFClient::beginLuminosityBlock(const LuminosityBlock& lumiSeg, const EventSetup& context) {
58  // optionally reset histograms here
59 }
60 
62 
63  if (m_runInEndLumi) {
64 
65  processHistograms();
66  }
67 
68 }
69 
70 //--------------------------------------------------------
71 void L1TCSCTFClient::analyze(const Event& e, const EventSetup& context){
72 
73  counterEvt++;
74  if (prescaleEvt<1) return;
75  if (prescaleEvt>0 && counterEvt%prescaleEvt!=0) return;
76 
77  // there is no loop on events in the offline harvesting step
78  // code here will not be executed offline
79 
80  if (m_runInEventLoop) {
81 
82  processHistograms();
83  }
84 
85 }
86 
87 //--------------------------------------------------------
88 void L1TCSCTFClient::endRun(const Run& r, const EventSetup& context) {
89 
90  if (m_runInEndRun) {
91 
92  processHistograms();
93  }
94 
95 }
96 
97 //--------------------------------------------------------
99 
100  if (m_runInEndJob) {
101 
102  processHistograms();
103  }
104 
105 }
106 
107 //--------------------------------------------------------
109 
110  dbe->setCurrentFolder(input_dir);
111 
112  vector<string> meVec = dbe->getMEs();
113  for(vector<string>::const_iterator it=meVec.begin(); it!=meVec.end(); it++){
114  string full_path = input_dir + "/" + (*it);
115  MonitorElement *me =dbe->get(full_path);
116  if( !me ){
117  LogInfo("TriggerDQM")<<full_path<<" NOT FOUND.";
118  continue;
119  }
120 
121  // But for now we only do a simple workaround
122  if( (*it) != "CSCTF_errors" ) continue;
123  TH1F *errors = me->getTH1F();
124  csctferrors_->getTH1F()->Reset();
125  if(!errors) continue;
126  for(int bin=1; bin<=errors->GetXaxis()->GetNbins(); bin++)
127  csctferrors_->Fill(bin-0.5,errors->GetBinContent(bin));
128  }
129 
130 }
131 
dictionary parameters
Definition: Parameters.py:2
virtual ~L1TCSCTFClient()
Destructor.
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
DQM Client Diagnostic.
void processHistograms()
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
L1TCSCTFClient(const edm::ParameterSet &ps)
Constructor.
void endJob()
Endjob.
void analyze(const edm::Event &e, const edm::EventSetup &c)
Fake Analyze.
TH1F * getTH1F(void) const
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
void beginJob(void)
BeginJob.
string output_dir
Definition: o2o.py:33
void endRun(const edm::Run &r, const edm::EventSetup &c)
EndRun.
Definition: Run.h:41