CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalTPGTowerStatusPyWrapper.cc
Go to the documentation of this file.
4 #include "TROOT.h"
5 #include "TH2F.h"
6 #include "TCanvas.h"
7 #include "TStyle.h"
8 #include "TColor.h"
9 #include "TLine.h"
13 
16 
17 #include <string>
18 #include <sstream>
19 #include <algorithm>
20 #include <numeric>
21 #include <iterator>
22 #include <boost/ref.hpp>
23 #include <boost/bind.hpp>
24 #include <boost/function.hpp>
25 #include <boost/iterator/transform_iterator.hpp>
26 
27 #include <fstream>
28 
29 namespace cond {
30  template<>
32  std::stringstream ss;
35  return ss.str();
36  }
37 
38  template<>
40  std::stringstream ss;
41 
42  const EcalTPGTowerStatusMap &towerMap = object().getMap();
44  int NbMaskedTT = 0;
45  for(it = towerMap.begin(); it != towerMap.end(); ++it)
46  if((*it).second > 0) NbMaskedTT++;
47  ss <<"Barrel masked Trigger Towers " << NbMaskedTT <<std::endl;
48  return ss.str();
49  }
50 
51  template<>
52  std::string PayLoadInspector<EcalTPGTowerStatus>::plot(std::string const & filename,
53  std::string const &,
54  std::vector<int> const&,
55  std::vector<float> const& ) const {
56  gStyle->SetPalette(1);
57 
58  TCanvas canvas("CC map","CC map",800, 400);
59 
60  TH2F* barrel = new TH2F("EB","EB TPG Tower Status", 72, 0, 72, 34, -17, 17);
61 
62  const EcalTPGTowerStatusMap &towerMap = object().getMap();
63  std::cout << " tower map size " << towerMap.size() << std::endl;
65  for(it = towerMap.begin(); it != towerMap.end(); ++it) {
66  if((*it).second > 0) {
67  EcalTrigTowerDetId ttId((*it).first);
68  int ieta = ttId.ieta();
69  if(ieta < 0) ieta--; // 1 to 17
70  int iphi = ttId.iphi() - 1; // 0 to 71
71  barrel->Fill(iphi, ieta, (*it).second);
72  }
73  }
74  TLine* l = new TLine(0., 0., 0., 0.);
75  l->SetLineWidth(1);
76  canvas.cd();
77  barrel->SetStats(0);
78  barrel->Draw("col");
79  for(int i = 0; i <17; i++) {
80  Double_t x = 4.+ (i * 4);
81  l = new TLine(x, -17., x, 17.);
82  l->Draw();
83  }
84  l = new TLine(0., 0., 72., 0.);
85  l->Draw();
86 
87  canvas.SaveAs(filename.c_str());
88  return filename;
89  } // plot
90 }
std::map< uint32_t, uint16_t >::const_iterator EcalTPGTowerStatusMapIterator
int i
Definition: DBlmapReader.cc:9
std::map< uint32_t, uint16_t > EcalTPGTowerStatusMap
std::string plot(std::string const &, std::string const &, std::vector< int > const &, std::vector< float > const &) const
#define PYTHON_WRAPPER(_class, _name)
int ieta() const
get the tower ieta
def canvas
Definition: svgfig.py:481
std::string summary() const
static std::string dumpXML(const EcalCondHeader &header, const EcalTPGTowerStatus &record)
int iphi() const
get the tower iphi
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
list object
Definition: dbtoconf.py:77
unsigned ttId(const DetId &)
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
x
Definition: VDTMath.h:216
std::string dump() const