CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
WordHist Class Reference

Public Member Functions

bool fillWord (int, int)
 
void formatWordHist ()
 
void setPad ()
 
 WordHist (string theVarName, int theNBits, double theXCornerVal, double theYCornerVal)
 

Public Attributes

TPad * pad
 

Private Member Functions

void setFormatValues ()
 

Private Attributes

int fillColor
 
TH2F * hist
 
double leftMargin
 
int lineColor
 
const int nBits
 
double rightMargin
 
double tPadHeight
 
double tPadLength
 
string varName
 
double xCornerVal
 
double yaxisLabelOffset
 
double yaxisTitleOffset
 
double yCornerVal
 

Detailed Description

Definition at line 77 of file DiagMaker.cc.

Constructor & Destructor Documentation

WordHist::WordHist ( string  theVarName,
int  theNBits,
double  theXCornerVal,
double  theYCornerVal 
)

Definition at line 489 of file DiagMaker.cc.

References gather_cfg::cout, cmsRelvalreport::exit, fillColor, hist, leftMargin, lineColor, nBits, pad, rightMargin, setFormatValues(), tPadHeight, tPadLength, varName, xCornerVal, and yCornerVal.

489  : nBits(theNBits)
490 {
491  varName = theVarName;
492  xCornerVal = theXCornerVal;
493  yCornerVal = theYCornerVal;
494  tPadHeight = 0.15;
495  lineColor = kBlack;
496  fillColor = kWhite;
497  setFormatValues();
498 
499  if(tPadLength + xCornerVal > 1.0)
500  {
501  cout << "Error: pad length is too long for x corner value.\n";
502  exit(1);
503  }
504 
506  hist = new TH2F("hist","",nBits,0,nBits,3,-1.5,1.5);
507 
508  pad -> SetFillColor(fillColor);
509  pad -> SetLineColor(lineColor);
510  pad -> SetBottomMargin(0.4);
511  pad -> SetRightMargin(rightMargin);
512  pad -> SetLeftMargin(leftMargin);
513  pad -> Draw();
514  pad -> cd();
515 
516 }
double xCornerVal
Definition: DiagMaker.cc:88
double leftMargin
Definition: DiagMaker.cc:94
double tPadHeight
Definition: DiagMaker.cc:93
const int nBits
Definition: DiagMaker.cc:87
double tPadLength
Definition: DiagMaker.cc:92
double rightMargin
Definition: DiagMaker.cc:95
void setFormatValues()
Definition: DiagMaker.cc:628
double yCornerVal
Definition: DiagMaker.cc:89
int fillColor
Definition: DiagMaker.cc:91
TPad * pad
Definition: DiagMaker.cc:84
TH2F * hist
Definition: DiagMaker.cc:99
string varName
Definition: DiagMaker.cc:86
tuple cout
Definition: gather_cfg.py:145
int lineColor
Definition: DiagMaker.cc:90

Member Function Documentation

bool WordHist::fillWord ( int  wordData,
int  wordEmu 
)

Definition at line 452 of file DiagMaker.cc.

References HcalObjRepresent::Fill(), estimatePileup::hist, and i.

453 {
454  int lowBit = -1;
455  int numBits = 0;
456  if (lowBit < 0)
457  lowBit = hist -> GetBinError(0);
458 
459  if (numBits < 1)
460  numBits = hist -> GetNbinsX();
461 
462  wordData = wordData >> lowBit;
463  wordEmu = wordEmu >> lowBit;
464 
465  int yFill;
466 
467  bool matchFlag = true;
468 
469  for (int i = 0; i < numBits; i++)
470  {
471 
472  yFill = (wordData & 0x1) - (wordEmu & 0x1);
473 
474  matchFlag |= (yFill == 0);
475 
476  hist -> Fill (numBits - i - 0.5, yFill);
477 
478  wordData = wordData >> 1;
479  wordEmu = wordEmu >> 1;
480 
481  }
482 
483  return matchFlag;
484 }
int i
Definition: DBlmapReader.cc:9
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
TH2F * hist
Definition: DiagMaker.cc:99
void WordHist::formatWordHist ( )

cout << "Creating the functions.\n";

cout << "Setting axis color, doing ah col.\n";

cout << "Creating xtick stuff.\n";

cout << "Creating xaxis stuff.\n";

cout << "Creating yaxis stuff.\n";

cout << "Creating xtop stuff.\n";

cout << "Creating yright stuff.\n";

cout << "Creating arrays xPoints yPoints ex ey\n";

cout << "Creating gridgraph.\n";

cout << "Updating the pad.\n";

cout << "Deleting f1 and f2.\n";

Definition at line 518 of file DiagMaker.cc.

References validate-o2o-wbm::f1, validate-o2o-wbm::f2, hist, i, lineColor, nBits, varName, yaxisLabelOffset, and yaxisTitleOffset.

519 {
521  TF1 *f1 = new TF1("f1","12-x",1,nBits+1);
522  TF1 *f2 = new TF1("f2","x",-1,2);
523 
525  hist -> SetAxisColor(lineColor);
526  hist -> SetStats(kFALSE);
527  hist -> Draw("ah col");
528 
530  TGaxis *xtick = new TGaxis(0, -1.5,nBits,-1.5,
531  "f1",nBits+1,"US");
532 
533  xtick -> SetLineWidth(2.5);
534  xtick -> SetTickSize(0.12);
535  xtick -> Draw("same");
536 
538  TGaxis *xaxis = new TGaxis(-1, -1.5,nBits-1,-1.5,
539  "f1",nBits+1,"MNIBS");
540 
541  xaxis -> SetTickSize(0);
542  xaxis -> SetLabelSize(0.14);
543  xaxis -> SetLabelColor(lineColor);
544 
545  if(nBits > 3) xaxis -> SetTitle((varName + " word bit").c_str());
546  if(nBits == 3) xaxis -> SetTitle((" " + varName + " word bit").c_str());
547  if(nBits == 2) xaxis -> SetTitle((" " + varName + " word bit").c_str());
548  if(nBits == 1) xaxis -> SetTitle((" " + varName + " word bit").c_str());
549 
550  xaxis -> SetTitleColor(lineColor);
551  xaxis -> SetTitleSize(0.16);
552  xaxis -> CenterTitle();
553 
554  xaxis -> Draw("same");
555 
557  TGaxis *yaxis = new TGaxis(0, -1.5,0,1.5,
558  "f2",4,"MNI");
559 
560  yaxis -> SetTickSize(-1);
561 
562  yaxis -> SetLabelColor(lineColor);
563  yaxis -> SetLineWidth(2.5);
564  yaxis -> SetLabelSize(0.14);
565  yaxis -> SetLabelOffset(yaxisLabelOffset);
566 
567  yaxis -> SetTitle("data - emul");
568  yaxis -> SetTitleColor(lineColor);
569  yaxis -> SetTitleSize(0.15);
570  yaxis -> SetTitleOffset(yaxisTitleOffset);
571 
572  yaxis -> Draw("same");
573 
575  TGaxis *xtop = new TGaxis(0,1.5,nBits,1.5,"f1",nBits+1,"US-");
576  xtop -> SetLineColor(lineColor);
577  xtop -> SetTickSize(0.12);
578  xtop -> SetLineWidth(2.5);
579  xtop -> Draw("same");
580 
582  TGaxis *yright = new TGaxis(nBits,-1.5,nBits,1.5,"f2",4,"+US");
583  yright -> SetLineColor(lineColor);
584  yright -> SetLineWidth(2.5);
585  yright -> Draw("same");
586 
588  double xPoints[(nBits-1)*2];
589  double yPoints[(nBits-1)*2];
590  double ex[(nBits-1)*2];
591  double ey[(nBits-1)*2];
592 
593  for (int i = 0; i < nBits-1; i++){
594 
595  xPoints[2*i] = i+1;
596  xPoints[2*i+1] = i+1;
597 
598  yPoints[2*i] = -0.5;
599  yPoints[2*i+1] = 0.5;
600 
601  }
602 
603  for (int i = 0; i < (nBits-1)*2; i++){
604 
605  ex[i] = 0.25;
606  ey[i] = 0.25;
607  }
609  TGraphErrors *gridGraph;
610 
611  gridGraph = new TGraphErrors((nBits-1)*2, xPoints, yPoints, ex, ey);
612 
613  gridGraph -> SetLineColor(lineColor);
614  gridGraph -> SetLineWidth(0.4);
615 
616  gridGraph -> Draw("pz same");
618  //pad -> Update();
620  delete f1;
621  delete f2;
622 
623 }
int i
Definition: DBlmapReader.cc:9
double yaxisTitleOffset
Definition: DiagMaker.cc:96
const int nBits
Definition: DiagMaker.cc:87
double yaxisLabelOffset
Definition: DiagMaker.cc:97
TH2F * hist
Definition: DiagMaker.cc:99
string varName
Definition: DiagMaker.cc:86
int lineColor
Definition: DiagMaker.cc:90
void WordHist::setFormatValues ( )
private

Definition at line 628 of file DiagMaker.cc.

References leftMargin, nBits, rightMargin, tPadLength, yaxisLabelOffset, and yaxisTitleOffset.

Referenced by WordHist().

629 {
630 
631  // Setting the nBits-dependent histogram format values
632  if (nBits > 3)
633  {
634  tPadLength = 0.0206*nBits + 0.046;
635  leftMargin = 1.0 / (0.5542*nBits + 1.23);
636  rightMargin = 1.0 / (2.624*nBits + 0.113);
637  yaxisTitleOffset = 1.0 / (0.1942*nBits + 0.3902);
638  yaxisLabelOffset = 1.0 / (4.0931*nBits + 1.732);
639  }
640  else
641  {
642  switch(nBits)
643  {
644  case 3:
645  {
646  tPadLength = 0.1274;
647  leftMargin = 0.292;
648  rightMargin = 0.225;
649  yaxisTitleOffset = 0.80;
650  yaxisLabelOffset = 0.05;
651  }
652  break;
653  case 2:
654  {
655  tPadLength = 0.1274;
656  leftMargin = 0.3708;
657  rightMargin = 0.3034;
658  yaxisTitleOffset = 1.0;
659  yaxisLabelOffset = 0.05;
660  }
661  break;
662  case 1:
663  {
664  tPadLength = 0.1274;
665  leftMargin = 0.4494;
666  rightMargin = 0.3820;
667  yaxisTitleOffset = 1.50;
668  yaxisLabelOffset = 0.05;
669  }
670  break;
671  }
672  }
673 }
double yaxisTitleOffset
Definition: DiagMaker.cc:96
double leftMargin
Definition: DiagMaker.cc:94
const int nBits
Definition: DiagMaker.cc:87
double yaxisLabelOffset
Definition: DiagMaker.cc:97
double tPadLength
Definition: DiagMaker.cc:92
double rightMargin
Definition: DiagMaker.cc:95
void WordHist::setPad ( )

Member Data Documentation

int WordHist::fillColor
private

Definition at line 91 of file DiagMaker.cc.

Referenced by WordHist().

TH2F* WordHist::hist
private

Definition at line 99 of file DiagMaker.cc.

Referenced by formatWordHist(), and WordHist().

double WordHist::leftMargin
private

Definition at line 94 of file DiagMaker.cc.

Referenced by setFormatValues(), and WordHist().

int WordHist::lineColor
private

Definition at line 90 of file DiagMaker.cc.

Referenced by formatWordHist(), and WordHist().

const int WordHist::nBits
private

Definition at line 87 of file DiagMaker.cc.

Referenced by formatWordHist(), setFormatValues(), and WordHist().

TPad* WordHist::pad

Definition at line 84 of file DiagMaker.cc.

Referenced by WordHist().

double WordHist::rightMargin
private

Definition at line 95 of file DiagMaker.cc.

Referenced by setFormatValues(), and WordHist().

double WordHist::tPadHeight
private

Definition at line 93 of file DiagMaker.cc.

Referenced by WordHist().

double WordHist::tPadLength
private

Definition at line 92 of file DiagMaker.cc.

Referenced by setFormatValues(), and WordHist().

string WordHist::varName
private

Definition at line 86 of file DiagMaker.cc.

Referenced by formatWordHist(), and WordHist().

double WordHist::xCornerVal
private

Definition at line 88 of file DiagMaker.cc.

Referenced by WordHist().

double WordHist::yaxisLabelOffset
private

Definition at line 97 of file DiagMaker.cc.

Referenced by formatWordHist(), and setFormatValues().

double WordHist::yaxisTitleOffset
private

Definition at line 96 of file DiagMaker.cc.

Referenced by formatWordHist(), and setFormatValues().

double WordHist::yCornerVal
private

Definition at line 89 of file DiagMaker.cc.

Referenced by WordHist().