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 1203 of file HcalObjRepresent.h.

Constructor & Destructor Documentation

◆ ADataRepr()

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

Definition at line 1206 of file HcalObjRepresent.h.

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

◆ ~ADataRepr()

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

Definition at line 1207 of file HcalObjRepresent.h.

1207 {};

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 1261 of file HcalObjRepresent.h.

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

Referenced by fillOneGain().

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

◆ fillOneGain()

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

Definition at line 1211 of file HcalObjRepresent.h.

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

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

References depth, mps_fire::i, and label.

Referenced by setup().

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

◆ setup()

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

Definition at line 1297 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().

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

◆ id

unsigned int HcalObjRepresent::ADataRepr::id

Definition at line 1207 of file HcalObjRepresent.h.

◆ ieta

int HcalObjRepresent::ADataRepr::ieta
protected

Definition at line 1256 of file HcalObjRepresent.h.

◆ iphi

int HcalObjRepresent::ADataRepr::iphi
protected

Definition at line 1256 of file HcalObjRepresent.h.

◆ m_total

unsigned int HcalObjRepresent::ADataRepr::m_total
protected

Definition at line 1254 of file HcalObjRepresent.h.

Referenced by fillOneGain().

◆ nr

unsigned int HcalObjRepresent::ADataRepr::nr

Definition at line 1207 of file HcalObjRepresent.h.

Referenced by fillOneGain().

◆ plotname

std::stringstream HcalObjRepresent::ADataRepr::plotname

Definition at line 1209 of file HcalObjRepresent.h.

Referenced by fillOneGain().

◆ rootname

std::stringstream HcalObjRepresent::ADataRepr::rootname

Definition at line 1209 of file HcalObjRepresent.h.

Referenced by fillOneGain().