CMS 3D CMS Logo

EcalTPGFineGrainEBGroup_PayloadInspector.cc
Go to the documentation of this file.
8 
9 // the data format of the condition to be inspected
11 
12 #include "TH2F.h"
13 #include "TCanvas.h"
14 #include "TStyle.h"
15 #include "TLine.h"
16 #include "TLatex.h"
17 
18 #include <string>
19 
20 namespace {
21  enum { kEBTotalTowers = 2448, kEETotalTowers = 1584 };
22  enum { MIN_IETA = 1, MIN_IPHI = 1, MAX_IETA = 17, MAX_IPHI = 72 }; // barrel lower and upper bounds on eta and phi
23 
24  /***********************************************
25  2d plot of EcalTPGFineGrainEBGroup of 1 IOV
26  ************************************************/
27  class EcalTPGFineGrainEBGroupPlot : public cond::payloadInspector::PlotImage<EcalTPGFineGrainEBGroup> {
28  public:
29  EcalTPGFineGrainEBGroupPlot()
30  : cond::payloadInspector::PlotImage<EcalTPGFineGrainEBGroup>("EcalTPGFineGrainEBGroup - map ") {
31  setSingleIov(true);
32  }
33 
34  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs) override {
35  TH2F* barrel =
36  new TH2F("EB", "Ecal TPGFineGrain EB Group", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA);
37  int EBcount = 0;
38  double minEB = 0, maxEB = 1;
39 
40  auto iov = iovs.front();
41  std::shared_ptr<EcalTPGFineGrainEBGroup> payload = fetchPayload(std::get<1>(iov));
42  unsigned int run = std::get<0>(iov);
43  if (payload.get()) {
44  const EcalTPGFineGrainEBGroup::EcalTPGGroupsMap& towerMap = (*payload).getMap();
45 
47  for (it = towerMap.begin(); it != towerMap.end(); ++it) {
48  //EcalTrigTowerDetId ttId = EcalTrigTowerDetId::detIdFromDenseIndex((*it).first);
49  EcalTrigTowerDetId ttId((*it).first);
50  int ieta = ttId.ieta();
51  //ieta--;
52  if (ieta > 0)
53  ieta--; // -1 to -17
54  int iphi = ttId.iphi() - 1; // 0 to 71
55  // std::cout << " sub det " << ttId.subDet() << " phi " << iphi << " eta " << ieta << std::endl;
56  // ieta goes from -18 to -2 and 1 to 17. Change it to -17/-1 and 0/16
57 
58  //std::cout <<(*it).first<<std::endl;
59  //std::cout << " ieta " << ieta << " phi " << iphi << " value " << (*it).second << std::endl;
60 
61  if (ttId.subDet() == 1) { // barrel
62 
63  barrel->Fill(iphi, ieta, (*it).second);
64 
65  if (maxEB < (*it).second)
66  maxEB = (*it).second;
67  if (minEB > (*it).second)
68  minEB = (*it).second;
69 
70  EBcount++;
71  }
72  }
73  } // payload
74 
75  gStyle->SetPalette(1);
76  gStyle->SetOptStat(0);
77  // TCanvas canvas("CC map","CC map", 1600, 450);
78  Double_t w = 1400;
79  Double_t h = 1200;
80  TCanvas canvas("c", "c", w, h);
81  // canvas.SetWindowSize(w + (w - canvas.GetWw()), h + (h - canvas.GetWh()));
82 
83  TLatex t1;
84  t1.SetNDC();
85  t1.SetTextAlign(26);
86  t1.SetTextSize(0.05);
87  t1.DrawLatex(0.5, 0.96, Form("Ecal TPGFine GrainEBGroup, IOV %i", run));
88 
89  TPad** pad = new TPad*;
90  for (int obj = 0; obj < 1; obj++) {
91  pad[obj] = new TPad(Form("p_%i", obj), Form("p_%i", obj), 0.0, 0.04, 1.0, 0.94);
92  pad[obj]->Draw();
93  }
94  t1.SetTextSize(0.03);
95  t1.DrawLatex(0.2, 0.88, Form("%i towers", EBcount));
96  // canvas.cd();
97  pad[0]->cd();
98  //barrel->SetStats(0);
99  barrel->SetMinimum(minEB);
100  barrel->SetMaximum(maxEB);
101  barrel->Draw("colz");
102  TLine* l = new TLine(0., 0., 0., 0.);
103  l->SetLineWidth(1);
104  for (int i = 0; i < MAX_IETA; i++) {
105  Double_t x = 4. + (i * 4);
106  l = new TLine(x, -MAX_IETA, x, MAX_IETA);
107  l->Draw();
108  }
109  l = new TLine(0., 0., 72., 0.);
110  l->Draw();
111 
112  std::string ImageName(m_imageFileName);
113  canvas.SaveAs(ImageName.c_str());
114  return true;
115  } // fill method
116  };
117 
118 } // namespace
119 
120 // Register the classes as boost python plugin
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
mps_fire.i
i
Definition: mps_fire.py:355
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
EcalTPGGroups::EcalTPGGroupsMapItr
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:20
MAX_IPHI
Definition: EcalFloatCondObjectContainerUtils.h:14
PayloadInspector.h
EBDetId.h
EEDetId.h
ecaldqm::ttId
unsigned ttId(DetId const &)
Definition: EcalDQMCommonUtils.cc:101
PAYLOAD_INSPECTOR_CLASS
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
Definition: PayloadInspectorModule.h:10
DDAxes::x
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
PayloadInspectorModule.h
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
MIN_IETA
Definition: EcalFloatCondObjectContainerUtils.h:11
w
const double w
Definition: UKUtility.cc:23
jets_cff.payload
payload
Definition: jets_cff.py:34
h
PAYLOAD_INSPECTOR_MODULE
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
Definition: PayloadInspectorModule.h:8
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
EcalTrigTowerDetId.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalSubdetector.h
cond
Definition: plugin.cc:23
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
EcalTPGFineGrainEBGroup
Definition: EcalTPGFineGrainEBGroup.h:13
cond::payloadInspector::PlotImage::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:840
EcalTPGFineGrainEBGroup.h
MIN_IPHI
Definition: EcalFloatCondObjectContainerUtils.h:12
EcalDrawUtils.h
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
writedatasetfile.run
run
Definition: writedatasetfile.py:27
cond::payloadInspector::PlotImpl::fill
virtual bool fill()=0
cond::payloadInspector::PlotImage
Definition: PayloadInspector.h:829
EcalTPGGroups::EcalTPGGroupsMap
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:19
MAX_IETA
Definition: EcalFloatCondObjectContainerUtils.h:13