CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions
HcalObjRepresent::ADataRepr Class Referenceabstract

#include <HcalObjRepresent.h>

Public Member Functions

 ADataRepr (unsigned int d)
 
void fillOneGain (std::vector< TH2F > &graphData, std::string units="")
 
virtual ~ADataRepr ()
 

Public Attributes

std::stringstream filename
 
unsigned int id
 
unsigned int nr
 
std::stringstream plotname
 
std::stringstream rootname
 

Protected Member Functions

virtual void doFillIn (std::vector< TH2F > &graphData)=0
 

Protected Attributes

int depth
 
HcalDetId hcal_id
 
int ieta
 
int iphi
 
unsigned int m_total
 

Private Member Functions

void draw (std::vector< TH2F > &graphData, std::string filename)
 
void setBinLabels (std::vector< TH2F > &depth)
 
void setup (std::vector< TH2F > &depth, std::string name, std::string units="")
 

Detailed Description

Definition at line 1207 of file HcalObjRepresent.h.

Constructor & Destructor Documentation

◆ ADataRepr()

HcalObjRepresent::ADataRepr::ADataRepr ( unsigned int  d)
inline

Definition at line 1210 of file HcalObjRepresent.h.

1210 : m_total(d){};
d
Definition: ztail.py:151

◆ ~ADataRepr()

virtual HcalObjRepresent::ADataRepr::~ADataRepr ( )
inlinevirtual

Definition at line 1211 of file HcalObjRepresent.h.

1211 {};

Member Function Documentation

◆ doFillIn()

virtual void HcalObjRepresent::ADataRepr::doFillIn ( std::vector< TH2F > &  graphData)
protectedpure virtual

Referenced by fillOneGain().

◆ draw()

void HcalObjRepresent::ADataRepr::draw ( std::vector< TH2F > &  graphData,
std::string  filename 
)
inlineprivate

Definition at line 1265 of file HcalObjRepresent.h.

References svgfig::canvas(), filename, compareTotals::pad1, and compareTotals::pad2.

Referenced by fillOneGain().

1265  {
1266  //Drawing...
1267  // use David's palette
1268  gStyle->SetPalette(1);
1269  const Int_t NCont = 999;
1270  gStyle->SetNumberContours(NCont);
1271  TCanvas canvas("CC map", "CC map", 840, 369 * 4);
1272 
1273  TPad pad1("pad1", "pad1", 0.0, 0.75, 1.0, 1.0);
1274  pad1.Draw();
1275  TPad pad2("pad2", "pad2", 0.0, 0.5, 1.0, 0.75);
1276  pad2.Draw();
1277  TPad pad3("pad3", "pad3", 0.0, 0.25, 1.0, 0.5);
1278  pad3.Draw();
1279  TPad pad4("pad4", "pad4", 0.0, 0.0, 1.0, 0.25);
1280  pad4.Draw();
1281 
1282  pad1.cd();
1283  graphData[0].SetStats(false);
1284  graphData[0].Draw("colz");
1285 
1286  pad2.cd();
1287  graphData[1].SetStats(false);
1288  graphData[1].Draw("colz");
1289 
1290  pad3.cd();
1291  graphData[2].SetStats(false);
1292  graphData[2].Draw("colz");
1293 
1294  pad4.cd();
1295  graphData[3].SetStats(false);
1296  graphData[3].Draw("colz");
1297 
1298  canvas.SaveAs(filename.c_str());
1299  }
def canvas(sub, attr)
Definition: svgfig.py:482

◆ fillOneGain()

void HcalObjRepresent::ADataRepr::fillOneGain ( std::vector< TH2F > &  graphData,
std::string  units = "" 
)
inline

Definition at line 1215 of file HcalObjRepresent.h.

References ztail::d, doFillIn(), draw(), filename, HcalObjRepresent::FillUnphysicalHEHFBins(), m_total, nr, plotname, rootname, setup(), and contentValuesCheck::ss.

1215  {
1216  std::stringstream ss("");
1217 
1218  if (m_total == 1)
1219  ss << rootname.str() << " for HCAL depth ";
1220  else
1221  ss << rootname.str() << nr << " for HCAL depth ";
1222 
1223  setup(graphData, ss.str());
1224 
1225  // Change the titles of each individual histogram
1226  for (unsigned int d = 0; d < graphData.size(); ++d) {
1227  graphData[d].Reset();
1228 
1229  ss.str("");
1230  if (m_total == 1)
1231  ss << plotname.str() << " for HCAL depth " << d + 1;
1232  else
1233  ss << plotname.str() << nr << " for HCAL depth " << d + 1;
1234 
1235  //BUG CAN BE HERE:
1236  //if (ChannelStatus->depth[d])
1237  graphData[d].SetTitle(
1238  ss.str()
1239  .c_str()); // replace "setTitle" with "SetTitle", since you are using TH2F objects instead of MonitorElements
1240  ss.str("");
1241  }
1242  //overload this function:
1243  doFillIn(graphData);
1244 
1245  FillUnphysicalHEHFBins(graphData);
1246 
1247  ss.str("");
1248  if (m_total == 1)
1249  ss << filename.str() << ".png";
1250  else
1251  ss << filename.str() << nr << ".png";
1252  draw(graphData, ss.str());
1253  //FOR DEBUGGING:
1254  //std::cout << "ieta: " << ieta << "; iphi: " << iphi << "; logstatus: " << logstatus << "; channelBits: " << channelBits<< std::endl;
1255  }
virtual void doFillIn(std::vector< TH2F > &graphData)=0
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void draw(std::vector< TH2F > &graphData, std::string filename)
d
Definition: ztail.py:151
void FillUnphysicalHEHFBins(std::vector< TH2F > &hh)

◆ setBinLabels()

void HcalObjRepresent::ADataRepr::setBinLabels ( std::vector< TH2F > &  depth)
inlineprivate

Definition at line 1369 of file HcalObjRepresent.h.

References depth, mps_fire::i, and label.

Referenced by setup().

1369  {
1370  // Set labels for all depth histograms
1371  for (unsigned int i = 0; i < depth.size(); ++i) {
1372  depth[i].SetXTitle("i#eta");
1373  depth[i].SetYTitle("i#phi");
1374  }
1375 
1376  std::stringstream label;
1377 
1378  // set label on every other bin
1379  for (int i = -41; i <= -29; i = i + 2) {
1380  label << i;
1381  depth[0].GetXaxis()->SetBinLabel(i + 42, label.str().c_str());
1382  depth[1].GetXaxis()->SetBinLabel(i + 42, label.str().c_str());
1383  label.str("");
1384  }
1385  depth[0].GetXaxis()->SetBinLabel(14, "-29HE");
1386  depth[1].GetXaxis()->SetBinLabel(14, "-29HE");
1387 
1388  // offset by one for HE
1389  for (int i = -27; i <= 27; i = i + 2) {
1390  label << i;
1391  depth[0].GetXaxis()->SetBinLabel(i + 43, label.str().c_str());
1392  label.str("");
1393  }
1394  depth[0].GetXaxis()->SetBinLabel(72, "29HE");
1395  for (int i = 29; i <= 41; i = i + 2) {
1396  label << i;
1397  depth[0].GetXaxis()->SetBinLabel(i + 44, label.str().c_str());
1398  label.str("");
1399  }
1400  for (int i = 16; i <= 28; i = i + 2) {
1401  label << i - 43;
1402  depth[1].GetXaxis()->SetBinLabel(i, label.str().c_str());
1403  label.str("");
1404  }
1405  depth[1].GetXaxis()->SetBinLabel(29, "NULL");
1406  for (int i = 15; i <= 27; i = i + 2) {
1407  label << i;
1408  depth[1].GetXaxis()->SetBinLabel(i + 15, label.str().c_str());
1409  label.str("");
1410  }
1411 
1412  depth[1].GetXaxis()->SetBinLabel(44, "29HE");
1413  for (int i = 29; i <= 41; i = i + 2) {
1414  label << i;
1415  depth[1].GetXaxis()->SetBinLabel(i + 16, label.str().c_str());
1416  label.str("");
1417  }
1418 
1419  // HE depth 3 labels;
1420  depth[2].GetXaxis()->SetBinLabel(1, "-28");
1421  depth[2].GetXaxis()->SetBinLabel(2, "-27");
1422  depth[2].GetXaxis()->SetBinLabel(3, "Null");
1423  depth[2].GetXaxis()->SetBinLabel(4, "-16");
1424  depth[2].GetXaxis()->SetBinLabel(5, "Null");
1425  depth[2].GetXaxis()->SetBinLabel(6, "16");
1426  depth[2].GetXaxis()->SetBinLabel(7, "Null");
1427  depth[2].GetXaxis()->SetBinLabel(8, "27");
1428  depth[2].GetXaxis()->SetBinLabel(9, "28");
1429  }
char const * label

◆ setup()

void HcalObjRepresent::ADataRepr::setup ( std::vector< TH2F > &  depth,
std::string  name,
std::string  units = "" 
)
inlineprivate

Definition at line 1301 of file HcalObjRepresent.h.

References depth, mps_fire::i, Skims_PA_cff::name, setBinLabels(), AlCaHLTBitMon_QueryRunRegistry::string, units(), and fw3dlego::xbins.

Referenced by o2olib.O2OTool::execute(), and fillOneGain().

1301  {
1302  std::string unittitle, unitname;
1303  if (units.empty()) {
1304  unitname = units;
1305  unittitle = "No Units";
1306  } else {
1307  unitname = " " + units;
1308  unittitle = units;
1309  }
1310 
1311  // Push back depth plots
1313  //1. create first plot
1314  depth.push_back(TH2F(("HB HE HF Depth 1 " + name + unitname).c_str(),
1315  (name + " Depth 1 -- HB HE HF (" + unittitle + ")").c_str(),
1316  85,
1317  -42.5,
1318  42.5,
1319  72,
1320  0.5,
1321  72.5));
1322 
1323  //2.1 prepare second plot
1324  float ybins[73];
1325  for (int i = 0; i <= 72; i++)
1326  ybins[i] = (float)(i + 0.5);
1327  float xbinsd2[] = {-42.5, -41.5, -40.5, -39.5, -38.5, -37.5, -36.5, -35.5, -34.5, -33.5, -32.5, -31.5,
1328  -30.5, -29.5, -28.5, -27.5, -26.5, -25.5, -24.5, -23.5, -22.5, -21.5, -20.5, -19.5,
1329  -18.5, -17.5, -16.5, -15.5, -14.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5,
1330  21.5, 22.5, 23.5, 24.5, 25.5, 26.5, 27.5, 28.5, 29.5, 30.5, 31.5, 32.5,
1331  33.5, 34.5, 35.5, 36.5, 37.5, 38.5, 39.5, 40.5, 41.5, 42.5};
1332 
1333  //2.2 create second plot
1334  depth.push_back(TH2F(("HB HE HF Depth 2 " + name + unitname).c_str(),
1335  (name + " Depth 2 -- HB HE HF (" + unittitle + ")").c_str(),
1336  57,
1337  xbinsd2,
1338  72,
1339  ybins));
1340 
1341  //3.1 Set up variable-sized bins for HE depth 3 (MonitorElement also requires phi bins to be entered in array format)
1342  float xbins[] = {-28.5, -27.5, -26.5, -16.5, -15.5, 15.5, 16.5, 26.5, 27.5, 28.5};
1343  //3.2
1344  depth.push_back(TH2F(("HE Depth 3 " + name + unitname).c_str(),
1345  (name + " Depth 3 -- HE (" + unittitle + ")").c_str(),
1346  // Use variable-sized eta bins
1347  9,
1348  xbins,
1349  72,
1350  ybins));
1351 
1352  //4.1 HO bins are fixed width, but cover a smaller eta range (-15 -> 15)
1353  depth.push_back(TH2F(("HO Depth 4 " + name + unitname).c_str(),
1354  (name + " Depth 4 -- HO (" + unittitle + ")").c_str(),
1355  31,
1356  -15.5,
1357  15.5,
1358  72,
1359  0.5,
1360  72.5));
1361 
1362  for (unsigned int i = 0; i < depth.size(); ++i)
1363  depth[i].Draw("colz");
1364 
1365  setBinLabels(depth); // set axis titles, special bins
1366  }
const double xbins[]
void setBinLabels(std::vector< TH2F > &depth)
TString units(TString variable, Char_t axis)

Member Data Documentation

◆ depth

int HcalObjRepresent::ADataRepr::depth
protected

◆ filename

std::stringstream HcalObjRepresent::ADataRepr::filename

◆ hcal_id

HcalDetId HcalObjRepresent::ADataRepr::hcal_id
protected

Definition at line 1259 of file HcalObjRepresent.h.

◆ id

unsigned int HcalObjRepresent::ADataRepr::id

Definition at line 1211 of file HcalObjRepresent.h.

◆ ieta

int HcalObjRepresent::ADataRepr::ieta
protected

Definition at line 1260 of file HcalObjRepresent.h.

◆ iphi

int HcalObjRepresent::ADataRepr::iphi
protected

Definition at line 1260 of file HcalObjRepresent.h.

◆ m_total

unsigned int HcalObjRepresent::ADataRepr::m_total
protected

Definition at line 1258 of file HcalObjRepresent.h.

Referenced by fillOneGain().

◆ nr

unsigned int HcalObjRepresent::ADataRepr::nr

Definition at line 1211 of file HcalObjRepresent.h.

Referenced by fillOneGain().

◆ plotname

std::stringstream HcalObjRepresent::ADataRepr::plotname

Definition at line 1213 of file HcalObjRepresent.h.

Referenced by fillOneGain().

◆ rootname

std::stringstream HcalObjRepresent::ADataRepr::rootname

Definition at line 1213 of file HcalObjRepresent.h.

Referenced by fillOneGain().