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="")
 

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

Constructor & Destructor Documentation

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

Definition at line 752 of file HcalObjRepresent.h.

Member Function Documentation

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

Referenced by fillOneGain().

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

Definition at line 807 of file HcalObjRepresent.h.

References svgfig::canvas().

Referenced by fillOneGain(), and Vispa.Gui.PortConnection.PointToPointConnection::paintEvent().

807  {
808  //Drawing...
809  // use David's palette
810  gStyle->SetPalette(1);
811  const Int_t NCont = 999;
812  gStyle->SetNumberContours(NCont);
813  TCanvas canvas("CC map","CC map",840,369*4);
814 
815  TPad pad1("pad1","pad1", 0.0, 0.75, 1.0, 1.0);
816  pad1.Draw();
817  TPad pad2("pad2","pad2", 0.0, 0.5, 1.0, 0.75);
818  pad2.Draw();
819  TPad pad3("pad3","pad3", 0.0, 0.25, 1.0, 0.5);
820  pad3.Draw();
821  TPad pad4("pad4","pad4", 0.0, 0.0, 1.0, 0.25);
822  pad4.Draw();
823 
824 
825  pad1.cd();
826  graphData[0].SetStats(0);
827  graphData[0].Draw("colz");
828 
829  pad2.cd();
830  graphData[1].SetStats(0);
831  graphData[1].Draw("colz");
832 
833  pad3.cd();
834  graphData[2].SetStats(0);
835  graphData[2].Draw("colz");
836 
837  pad4.cd();
838  graphData[3].SetStats(0);
839  graphData[3].Draw("colz");
840 
841  canvas.SaveAs(filename.c_str());
842  }
def canvas(sub, attr)
Definition: svgfig.py:481
void HcalObjRepresent::ADataRepr::fillOneGain ( std::vector< TH2F > &  graphData,
std::string  units = "" 
)
inline

Definition at line 756 of file HcalObjRepresent.h.

References edmIntegrityCheck::d, doFillIn(), draw(), HcalObjRepresent::FillUnphysicalHEHFBins(), m_total, and setup().

756  {
757  std::stringstream ss("");
758 
759  if (m_total == 1)
760  ss << rootname.str() << " for HCAL depth ";
761  else
762  ss << rootname.str() << nr << " for HCAL depth ";
763 
764  setup(graphData, ss.str());
765 
766  // Change the titles of each individual histogram
767  for (unsigned int d=0;d < graphData.size();++d){
768  graphData[d].Reset();
769 
770  ss.str("");
771  if (m_total == 1)
772  ss << plotname.str() << " for HCAL depth " << d+1;
773  else
774  ss << plotname.str() << nr << " for HCAL depth " << d+1;
775 
776 
777  //BUG CAN BE HERE:
778  //if (ChannelStatus->depth[d])
779  graphData[d].SetTitle(ss.str().c_str()); // replace "setTitle" with "SetTitle", since you are using TH2F objects instead of MonitorElements
780  ss.str("");
781  }
782  //overload this function:
783  doFillIn(graphData);
784 
785  FillUnphysicalHEHFBins(graphData);
786 
787  ss.str("");
788  if (m_total == 1)
789  ss << filename.str() << ".png";
790  else
791  ss << filename.str() << nr << ".png";
792  draw(graphData, ss.str());
793  //FOR DEBUGGING:
794  //std::cout << "ieta: " << ieta << "; iphi: " << iphi << "; logstatus: " << logstatus << "; channelBits: " << channelBits<< std::endl;
795  }
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)
void FillUnphysicalHEHFBins(std::vector< TH2F > &hh)
void HcalObjRepresent::ADataRepr::setBinLabels ( std::vector< TH2F > &  depth)
inlineprivate

Definition at line 902 of file HcalObjRepresent.h.

References mps_fire::i, and diffTwoXMLs::label.

Referenced by setup().

903  {
904  // Set labels for all depth histograms
905  for (unsigned int i=0;i<depth.size();++i)
906  {
907  depth[i].SetXTitle("i#eta");
908  depth[i].SetYTitle("i#phi");
909  }
910 
911  std::stringstream label;
912 
913  // set label on every other bin
914  for (int i=-41;i<=-29;i=i+2)
915  {
916  label<<i;
917  depth[0].GetXaxis()->SetBinLabel(i+42,label.str().c_str());
918  depth[1].GetXaxis()->SetBinLabel(i+42,label.str().c_str());
919  label.str("");
920  }
921  depth[0].GetXaxis()->SetBinLabel(14,"-29HE");
922  depth[1].GetXaxis()->SetBinLabel(14,"-29HE");
923 
924  // offset by one for HE
925  for (int i=-27;i<=27;i=i+2)
926  {
927  label<<i;
928  depth[0].GetXaxis()->SetBinLabel(i+43,label.str().c_str());
929  label.str("");
930  }
931  depth[0].GetXaxis()->SetBinLabel(72,"29HE");
932  for (int i=29;i<=41;i=i+2)
933  {
934  label<<i;
935  depth[0].GetXaxis()->SetBinLabel(i+44,label.str().c_str());
936  label.str("");
937  }
938  for (int i=16;i<=28;i=i+2)
939  {
940  label<<i-43;
941  depth[1].GetXaxis()->SetBinLabel(i,label.str().c_str());
942  label.str("");
943  }
944  depth[1].GetXaxis()->SetBinLabel(29,"NULL");
945  for (int i=15;i<=27;i=i+2)
946  {
947  label<<i;
948  depth[1].GetXaxis()->SetBinLabel(i+15,label.str().c_str());
949  label.str("");
950  }
951 
952  depth[1].GetXaxis()->SetBinLabel(44,"29HE");
953  for (int i=29;i<=41;i=i+2)
954  {
955  label<<i;
956  depth[1].GetXaxis()->SetBinLabel(i+16,label.str().c_str());
957  label.str("");
958  }
959 
960  // HE depth 3 labels;
961  depth[2].GetXaxis()->SetBinLabel(1,"-28");
962  depth[2].GetXaxis()->SetBinLabel(2,"-27");
963  depth[2].GetXaxis()->SetBinLabel(3,"Null");
964  depth[2].GetXaxis()->SetBinLabel(4,"-16");
965  depth[2].GetXaxis()->SetBinLabel(5,"Null");
966  depth[2].GetXaxis()->SetBinLabel(6,"16");
967  depth[2].GetXaxis()->SetBinLabel(7,"Null");
968  depth[2].GetXaxis()->SetBinLabel(8,"27");
969  depth[2].GetXaxis()->SetBinLabel(9,"28");
970  }
void HcalObjRepresent::ADataRepr::setup ( std::vector< TH2F > &  depth,
std::string  name,
std::string  units = "" 
)
inlineprivate

Definition at line 844 of file HcalObjRepresent.h.

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

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

844  {
845  std::string unittitle, unitname;
846  if (units.empty())
847  {
848  unitname = units;
849  unittitle = "No Units";
850  }
851  else
852  {
853  unitname = " " + units;
854  unittitle = units;
855  }
856 
857  // Push back depth plots
859  //1. create first plot
860  depth.push_back(TH2F(("HB HE HF Depth 1 "+name+unitname).c_str(),
861  (name+" Depth 1 -- HB HE HF ("+unittitle+")").c_str(),
862  85,-42.5,42.5,
863  72,0.5,72.5));
864 
865  //2.1 prepare second plot
866  float ybins[73];
867  for (int i=0;i<=72;i++) ybins[i]=(float)(i+0.5);
868  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,-30.5,-29.5,
869  -28.5,-27.5,-26.5,-25.5,-24.5,-23.5,-22.5,-21.5,-20.5,-19.5,-18.5,-17.5,-16.5,
870  -15.5,-14.5,
871  14.5, 15.5,
872  16.5,17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5,25.5,26.5,27.5,28.5,29.5,30.5,
873  31.5,32.5,33.5,34.5,35.5,36.5,37.5,38.5,39.5,40.5,41.5,42.5};
874 
875  //2.2 create second plot
876  depth.push_back(TH2F(("HB HE HF Depth 2 "+name+unitname).c_str(),
877  (name+" Depth 2 -- HB HE HF ("+unittitle+")").c_str(),
878  57, xbinsd2, 72, ybins));
879 
880  //3.1 Set up variable-sized bins for HE depth 3 (MonitorElement also requires phi bins to be entered in array format)
881  float xbins[]={-28.5,-27.5,-26.5,-16.5,-15.5,
882  15.5,16.5,26.5,27.5,28.5};
883  //3.2
884  depth.push_back(TH2F(("HE Depth 3 "+name+unitname).c_str(),
885  (name+" Depth 3 -- HE ("+unittitle+")").c_str(),
886  // Use variable-sized eta bins
887  9, xbins, 72, ybins));
888 
889  //4.1 HO bins are fixed width, but cover a smaller eta range (-15 -> 15)
890  depth.push_back(TH2F(("HO Depth 4 "+name+unitname).c_str(),
891  (name+" Depth 4 -- HO ("+unittitle+")").c_str(),
892  31,-15.5,15.5,
893  72,0.5,72.5));
894 
895  for (unsigned int i=0;i<depth.size();++i)
896  depth[i].Draw("colz");
897 
898  setBinLabels(depth); // set axis titles, special bins
899  }
const double xbins[]
void setBinLabels(std::vector< TH2F > &depth)
TString units(TString variable, Char_t axis)

Member Data Documentation

int HcalObjRepresent::ADataRepr::depth
protected
std::stringstream HcalObjRepresent::ADataRepr::filename
HcalDetId HcalObjRepresent::ADataRepr::hcal_id
protected

Definition at line 799 of file HcalObjRepresent.h.

unsigned int HcalObjRepresent::ADataRepr::id

Definition at line 752 of file HcalObjRepresent.h.

int HcalObjRepresent::ADataRepr::ieta
protected

Definition at line 800 of file HcalObjRepresent.h.

int HcalObjRepresent::ADataRepr::iphi
protected

Definition at line 800 of file HcalObjRepresent.h.

unsigned int HcalObjRepresent::ADataRepr::m_total
protected

Definition at line 798 of file HcalObjRepresent.h.

Referenced by fillOneGain().

unsigned int HcalObjRepresent::ADataRepr::nr

Definition at line 752 of file HcalObjRepresent.h.

std::stringstream HcalObjRepresent::ADataRepr::plotname

Definition at line 754 of file HcalObjRepresent.h.

std::stringstream HcalObjRepresent::ADataRepr::rootname

Definition at line 754 of file HcalObjRepresent.h.