CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DQMDcsInfoClient.cc
Go to the documentation of this file.
1 
2 /*
3  * \file DQMDcsInfoClient.cc
4  * \author Andreas Meyer
5  * Last Update:
6  * $Date: 2012/08/02 07:59:10 $
7  * $Revision: 1.8 $
8  * $Author: rovere $
9  *
10 */
11 
14 
15 // -----------------------------
16 // constructors and destructor
17 // -----------------------------
18 
20 
21  parameters_ = ps;
22 
24 
25  subsystemname_ = parameters_.getUntrackedParameter<std::string>("subSystemFolder", "Info") ;
26  dcsinfofolder_ = parameters_.getUntrackedParameter<std::string>("dcsInfoFolder", "DcsInfo") ;
27 
28 }
29 
30 
32 
33 }
34 
35 void
37 {
38  // Fetch GlobalTag information and fill the string/ME.
39  dbe_->cd();
40  dbe_->setCurrentFolder(subsystemname_ +"/CMSSWInfo/");
41  const edm::ParameterSet &globalTagPSet = edm::getProcessParameterSet()
42  .getParameterSet("PoolDBESSource@GlobalTag");
43 
44  dbe_->bookString("globalTag_Harvesting", globalTagPSet.getParameter<std::string>("globaltag"));
45 
46  DCS.clear();
47  DCS.resize(10); // start with 10 LS, resize later
48  processedLS_.clear();
49 }
50 
51 void
53 {
54  return;
55 }
56 
57 void
59 {
60  if (!dbe_) return;
61 
62  unsigned int nlumi = l.id().luminosityBlock() ;
63  processedLS_.insert(nlumi);
64  // cout << " in lumi section " << nlumi << endl;
65 
66  if (nlumi+1 > DCS.size())
67  DCS.resize(nlumi+1);
68  // cout << "DCS size: " << DCS.size() << endl;
69 
70  MonitorElement* DCSbyLS_ =
71  dbe_->get(subsystemname_ + "/" + dcsinfofolder_ + "/DCSbyLS" );
72 
73  if ( DCSbyLS_ )
74  {
75  if ( TH1F * h1 = DCSbyLS_->getTH1F())
76  {
77  int word = 0;
78  for (int i = 0; i < 25 ; i++)
79  {
80 
81  if ( h1->GetBinContent(i+1) != 0 )
82  word |= (0x0 << i); // set to 0 because HV was off (!)
83  else
84  word |= (0x1 << i); // set to 1 because HV was on (!)
85  }
86  DCS[nlumi] = word;
87  }
88  }
89  return;
90 }
91 
92 void
94 {
95 
96  // book
97  dbe_->cd();
98  dbe_->setCurrentFolder(subsystemname_ +"/EventInfo/");
99 
100  unsigned int nlsmax = DCS.size();
101  reportSummary_=dbe_->bookFloat("reportSummary");
102  reportSummary_->Fill(1.);
103 
104  reportSummaryMap_ = dbe_->get(subsystemname_ +"/EventInfo/reportSummaryMap");
106 
107  reportSummaryMap_ = dbe_->book2D("reportSummaryMap",
108  "HV and GT vs Lumi", nlsmax, 1., nlsmax+1, 25, 0., 25.);
109  unsigned int lastProcessedLS = *(--processedLS_.end());
110  meProcessedLS_ = dbe_->book1D("ProcessedLS",
111  "Processed Lumisections",
112  lastProcessedLS+1,
113  0.,lastProcessedLS+1);
114  reportSummaryMap_->setBinLabel(1," CSC+",2);
115  reportSummaryMap_->setBinLabel(2," CSC-",2);
116  reportSummaryMap_->setBinLabel(3," DT0",2);
117  reportSummaryMap_->setBinLabel(4," DT+",2);
118  reportSummaryMap_->setBinLabel(5," DT-",2);
119  reportSummaryMap_->setBinLabel(6," EB+",2);
120  reportSummaryMap_->setBinLabel(7," EB-",2);
121  reportSummaryMap_->setBinLabel(8," EE+",2);
122  reportSummaryMap_->setBinLabel(9," EE-",2);
123  reportSummaryMap_->setBinLabel(10,"ES+",2);
124  reportSummaryMap_->setBinLabel(11,"ES-",2);
125  reportSummaryMap_->setBinLabel(12,"HBHEa",2);
126  reportSummaryMap_->setBinLabel(13,"HBHEb",2);
127  reportSummaryMap_->setBinLabel(14,"HBHEc",2);
128  reportSummaryMap_->setBinLabel(15,"HF",2);
129  reportSummaryMap_->setBinLabel(16,"HO",2);
130  reportSummaryMap_->setBinLabel(17,"BPIX",2);
131  reportSummaryMap_->setBinLabel(18,"FPIX",2);
132  reportSummaryMap_->setBinLabel(19,"RPC",2);
133  reportSummaryMap_->setBinLabel(20,"TIBTID",2);
134  reportSummaryMap_->setBinLabel(21,"TOB",2);
135  reportSummaryMap_->setBinLabel(22,"TECp",2);
136  reportSummaryMap_->setBinLabel(23,"TECm",2);
137  reportSummaryMap_->setBinLabel(24,"CASTOR",2);
138  reportSummaryMap_->setBinLabel(25,"PhysDecl",2);
139  reportSummaryMap_->setAxisTitle("Luminosity Section");
140 
141  // fill
142  for (unsigned int i = 0 ; i < DCS.size() ; i++ )
143  {
144  for ( int j = 0 ; j < 25 ; j++ )
145  {
146  if (DCS[i] & (0x1 << j))
148  else
150  }
151  }
152 
153  std::set<unsigned int>::iterator it,ite;
154  it = processedLS_.begin();
155  ite = processedLS_.end();
156  unsigned int lastAccessed = 0;
157 
158  for (; it!=ite; it++)
159  {
160  while (lastAccessed < (*it))
161  {
162  // std::cout << "Filling " << lastAccessed << " with -1" << std::endl;
163  meProcessedLS_->Fill(lastAccessed, -1.);
164  lastAccessed++;
165  }
166  // std::cout << "Filling " << *it << " with 1" << std::endl;
167  meProcessedLS_->Fill(*it);
168  lastAccessed = (*it)+1;
169  }
170 
171 }
LuminosityBlockID id() const
void analyze(const edm::Event &e, const edm::EventSetup &c)
T getParameter(std::string const &) const
std::string dcsinfofolder_
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
void endRun(const edm::Run &r, const edm::EventSetup &c)
void setBinContent(int binx, double content)
set content of bin (1-D)
std::set< unsigned int > processedLS_
edm::ParameterSet parameters_
std::string subsystemname_
void endLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &c)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:411
MonitorElement * meProcessedLS_
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:659
void Fill(long long x)
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:688
DQMDcsInfoClient(const edm::ParameterSet &ps)
void removeElement(const std::string &name)
Definition: DQMStore.cc:2577
int j
Definition: DBlmapReader.cc:9
MonitorElement * reportSummary_
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
std::vector< int > DCS
ParameterSet const & getProcessParameterSet()
Definition: Registry.cc:34
ParameterSet const & getParameterSet(std::string const &) const
TH1F * getTH1F(void) const
LuminosityBlockNumber_t luminosityBlock() const
void beginRun(const edm::Run &r, const edm::EventSetup &c)
MonitorElement * reportSummaryMap_
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:850
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
Definition: Run.h:36