CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HcalObjRepresent::HcalDataContainer< Items, Item > Class Template Reference

#include <HcalObjRepresent.h>

Public Types

typedef std::tuple< int, int, int > Coord
 
typedef std::map< std::pair< std::string, int >, TH2F * > DepthMap
 
typedef std::map< Coord, Item > tHcalValCont
 

Public Member Functions

void Divide (HcalDataContainer *dataCont2)
 
void FillCanv (TCanvas *canvas, std::string subDetName, int startDepth=1, int startCanv=1, std::string plotForm="2DHist")
 
void fillValConts ()
 
TCanvas * getCanvasAll (std::string profile="2DHist")
 
TCanvas * getCanvasHBHO ()
 
TCanvas * getCanvasHE ()
 
TCanvas * getCanvasHF ()
 
DepthMap GetDepths ()
 
Item * getItemFromValCont (std::string subDetName, int depth, int ieta, int iphi, bool throwOnFail)
 
TH1D * GetProjection (TH2F *hist, std::string plotType, const char *newName, std::string subDetName, int depth)
 
std::pair< float, float > GetRange (TH1 *hist)
 
unsigned int GetRun ()
 
std::map< std::string, int > GetSubDetDepths ()
 
std::string GetTopoMode ()
 
std::string GetUnit (std::string type)
 
virtual float getValue (Item *item)
 
 HcalDataContainer (std::shared_ptr< Items > payload, unsigned int run)
 
void initGraphics ()
 
void Subtract (HcalDataContainer *dataCont2)
 
virtual ~HcalDataContainer ()
 

Private Member Functions

tHcalValContgetContFromString (std::string subDetString)
 
void setTopoModeFromValConts (bool throwOnFail=false)
 

Private Attributes

tHcalValCont CALIBvalContainer
 
tHcalValCont CASTORvalContainer
 
DepthMap depths_
 
tHcalValCont HBvalContainer
 
tHcalValCont HEvalContainer
 
tHcalValCont HFvalContainer
 
tHcalValCont HOvalContainer
 
tHcalValCont HTvalContainer
 
std::shared_ptr< Items > payload_
 
std::string PlotMode_
 
unsigned int run_
 
std::map< std::string, int > subDetDepths_
 
std::string TopoMode_
 
std::map< std::string, std::string > units_
 
tHcalValCont ZDCvalContainer
 

Detailed Description

template<class Items, class Item>
class HcalObjRepresent::HcalDataContainer< Items, Item >

Definition at line 39 of file HcalObjRepresent.h.

Member Typedef Documentation

◆ Coord

template<class Items , class Item >
typedef std::tuple<int, int, int> HcalObjRepresent::HcalDataContainer< Items, Item >::Coord

Definition at line 45 of file HcalObjRepresent.h.

◆ DepthMap

template<class Items , class Item >
typedef std::map<std::pair<std::string, int>, TH2F*> HcalObjRepresent::HcalDataContainer< Items, Item >::DepthMap

Definition at line 50 of file HcalObjRepresent.h.

◆ tHcalValCont

template<class Items , class Item >
typedef std::map<Coord, Item> HcalObjRepresent::HcalDataContainer< Items, Item >::tHcalValCont

Definition at line 48 of file HcalObjRepresent.h.

Constructor & Destructor Documentation

◆ HcalDataContainer()

template<class Items , class Item >
HcalObjRepresent::HcalDataContainer< Items, Item >::HcalDataContainer ( std::shared_ptr< Items >  payload,
unsigned int  run 
)
inline

◆ ~HcalDataContainer()

template<class Items , class Item >
virtual HcalObjRepresent::HcalDataContainer< Items, Item >::~HcalDataContainer ( )
inlinevirtual

Definition at line 45 of file HcalObjRepresent.h.

45 {};

Member Function Documentation

◆ Divide()

template<class Items , class Item >
void HcalObjRepresent::HcalDataContainer< Items, Item >::Divide ( HcalDataContainer< Items, Item > *  dataCont2)
inline

Definition at line 142 of file HcalObjRepresent.h.

References Exception, HcalObjRepresent::HcalDataContainer< Items, Item >::GetDepths(), HcalObjRepresent::HcalDataContainer< Items, Item >::GetRun(), crabWrapper::key, HcalObjRepresent::HcalDataContainer< Items, Item >::payload_, HcalObjRepresent::HcalDataContainer< Items, Item >::PlotMode_, and cond::impl::to_string().

142  {
143  //TODO: Do something like looping over this and that depths setting every empty bin (which I think means content=0) to -999. Then replacing the divide call with another manual loop that sets all bins with content -999 to 0
144 
145  PlotMode_ = "Ratio";
146  DepthMap::iterator depth1;
147  std::pair<std::string, int> key;
148  DepthMap myDepths = this->GetDepths();
149  DepthMap theirDepths = dataCont2->GetDepths();
150  for (depth1 = myDepths.begin(); depth1 != myDepths.end(); depth1++) {
151  key = depth1->first;
152  if (theirDepths.count(key) != 0) {
153  myDepths.at(key)->Divide((const TH1*)theirDepths.at(key));
154  } else {
155  throw cms::Exception("Unaligned Conditions")
156  << "trying to plot conditions for " << payload_->myname() << "; found value for " << std::get<0>(key)
157  << " depth " << std::to_string(std::get<1>(key)) << " in run " << GetRun() << " but not in run "
158  << dataCont2->GetRun();
159  }
160  }
161  }
std::string to_string(const V &value)
Definition: OMSAccess.h:71
std::map< std::pair< std::string, int >, TH2F * > DepthMap
std::shared_ptr< Items > payload_

◆ FillCanv()

template<class Items , class Item >
void HcalObjRepresent::HcalDataContainer< Items, Item >::FillCanv ( TCanvas *  canvas,
std::string  subDetName,
int  startDepth = 1,
int  startCanv = 1,
std::string  plotForm = "2DHist" 
)
inline

Definition at line 284 of file HcalObjRepresent.h.

References svgfig::canvas(), HcalObjRepresent::HcalDataContainer< Items, Item >::depths_, HcalObjRepresent::HcalDataContainer< Items, Item >::GetProjection(), HcalObjRepresent::HcalDataContainer< Items, Item >::GetRange(), HcalObjRepresent::HcalDataContainer< Items, Item >::GetUnit(), mps_fire::i, label, HLT_2022v14_cff::maxDepth, mps_merge::newName, HcalObjRepresent::HcalDataContainer< Items, Item >::payload_, HcalObjRepresent::HcalDataContainer< Items, Item >::PlotMode_, FastTimerService_cff::range, HcalObjRepresent::HcalDataContainer< Items, Item >::run_, HcalObjRepresent::HcalDataContainer< Items, Item >::subDetDepths_, and cond::impl::to_string().

Referenced by HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasAll(), HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasHBHO(), HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasHE(), and HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasHF().

288  {
289  const char* newName;
290  std::pair<float, float> range;
291  int padNum;
292  int maxDepth = (subDetName == "HO") ? 4 : subDetDepths_[subDetName];
293  TH1D* projection;
294  TLatex label;
295  for (int i = startDepth; i <= maxDepth; i++) {
296  //skip if data not obtained; TODO: Maybe add text on plot saying data not found?
297  if (depths_.count(std::make_pair(subDetName, i)) == 0) {
298  return;
299  }
300 
301  padNum = i + startCanv - 1;
302  if (subDetName == "HO")
303  padNum = padNum - 3;
304  canvas->cd(padNum);
305  canvas->GetPad(padNum)->SetGridx(1);
306  canvas->GetPad(padNum)->SetGridy(1);
307 
308  if (plotForm == "2DHist") {
309  canvas->GetPad(padNum)->SetRightMargin(0.13);
310  range = GetRange(depths_[std::make_pair(subDetName, i)]);
311  depths_[std::make_pair(subDetName, i)]->Draw("colz");
312  depths_[std::make_pair(subDetName, i)]->SetContour(100);
313  depths_[std::make_pair(subDetName, i)]->GetXaxis()->SetTitle("ieta");
314  depths_[std::make_pair(subDetName, i)]->GetYaxis()->SetTitle("iphi");
315  depths_[std::make_pair(subDetName, i)]->GetXaxis()->CenterTitle();
316  depths_[std::make_pair(subDetName, i)]->GetYaxis()->CenterTitle();
317  depths_[std::make_pair(subDetName, i)]->GetZaxis()->SetRangeUser(std::get<0>(range), std::get<1>(range));
318  depths_[std::make_pair(subDetName, i)]->GetYaxis()->SetTitleSize(0.06);
319  depths_[std::make_pair(subDetName, i)]->GetYaxis()->SetTitleOffset(0.80);
320  depths_[std::make_pair(subDetName, i)]->GetXaxis()->SetTitleSize(0.06);
321  depths_[std::make_pair(subDetName, i)]->GetXaxis()->SetTitleOffset(0.80);
322  depths_[std::make_pair(subDetName, i)]->GetYaxis()->SetLabelSize(0.055);
323  depths_[std::make_pair(subDetName, i)]->GetXaxis()->SetLabelSize(0.055);
324  } else {
325  canvas->GetPad(padNum)->SetLeftMargin(0.152);
326  canvas->GetPad(padNum)->SetRightMargin(0.02);
327  //gStyle->SetTitleOffset(1.6,"Y");
328  newName = ("run_" + std::to_string(run_) + "_" + subDetName + "_d" + std::to_string(i) + "_" +
329  (plotForm == "EtaProfile" ? "ieta" : "iphi"))
330  .c_str();
331  //projection = ((TH2F*)(depths_[std::make_pair(subDetName,i)]->Clone("temp")))->ProjectionX(newName);
332  projection = GetProjection(depths_[std::make_pair(subDetName, i)], plotForm, newName, subDetName, i);
333  range = GetRange(projection);
334  projection->Draw("hist");
335  projection->GetXaxis()->SetTitle((plotForm == "EtaProfile" ? "ieta" : "iphi"));
336  projection->GetXaxis()->CenterTitle();
337  projection->GetYaxis()->SetTitle(
338  (payload_->myname() + " " + (PlotMode_ == "Map" ? "" : PlotMode_) + " " + GetUnit(payload_->myname()))
339  .c_str());
340  label.SetNDC();
341  label.SetTextAlign(26);
342  label.SetTextSize(0.05);
343  label.DrawLatex(
344  0.3, 0.95, ("run_" + std::to_string(run_) + "_" + subDetName + "_d" + std::to_string(i)).c_str());
345  projection->GetYaxis()->CenterTitle();
346  projection->GetXaxis()->SetTitleSize(0.06);
347  projection->GetYaxis()->SetTitleSize(0.06);
348  projection->GetXaxis()->SetTitleOffset(0.80);
349  projection->GetXaxis()->SetLabelSize(0.055);
350  projection->GetYaxis()->SetTitleOffset(1.34);
351  projection->GetYaxis()->SetLabelSize(0.055);
352  }
353  }
354  }
std::string to_string(const V &value)
Definition: OMSAccess.h:71
string newName
Definition: mps_merge.py:86
char const * label
std::map< std::string, int > subDetDepths_
TH1D * GetProjection(TH2F *hist, std::string plotType, const char *newName, std::string subDetName, int depth)
std::pair< float, float > GetRange(TH1 *hist)
def canvas(sub, attr)
Definition: svgfig.py:482
std::shared_ptr< Items > payload_
std::string GetUnit(std::string type)

◆ fillValConts()

template<class Items , class Item >
void HcalObjRepresent::HcalDataContainer< Items, Item >::fillValConts ( )
inline

Definition at line 68 of file HcalObjRepresent.h.

References generateEDF::cont, LEDCalibrationChannels::depth, HcalDetId::depth(), HcalObjRepresent::HcalDataContainer< Items, Item >::depths_, HcalObjRepresent::HcalDataContainer< Items, Item >::getContFromString(), HcalObjRepresent::HcalDataContainer< Items, Item >::getValue(), LEDCalibrationChannels::ieta, HcalDetId::ieta(), LEDCalibrationChannels::iphi, HcalDetId::iphi(), B2GTnPMonitor_cfi::item, HcalObjRepresent::HcalDataContainer< Items, Item >::run_, HcalObjRepresent::HcalDataContainer< Items, Item >::setTopoModeFromValConts(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::impl::to_string().

Referenced by HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasAll(), HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasHBHO(), HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasHE(), HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasHF(), and HcalObjRepresent::HcalDataContainer< Items, Item >::GetDepths().

68  {
69  if (!depths_.empty())
70  return;
71  int iphi, ieta, depth;
72  HcalDetId detId;
73 
74  std::string subDetName;
75  std::vector<Item> itemsVec;
76  std::pair<std::string, int> depthKey;
77  const char* histLabel;
78  for (std::pair<std::string, std::vector<Item> > cont : (*payload_).getAllContainers()) {
79  subDetName = std::get<0>(cont);
80  itemsVec = std::get<1>(cont);
81 
82  auto valContainer = getContFromString(subDetName);
83 
84  for (Item item : itemsVec) {
85  detId = HcalDetId(item.rawId());
86  iphi = detId.iphi();
87  ieta = detId.ieta();
88  depth = detId.depth();
89  Coord coord = std::make_tuple(depth, ieta, iphi);
90  //Add hist if it's not there, AND if it is one we care about: HO,HB,HE,HF, AND it's not an empty entry (depth = 0 in HO)
91  if (subDetName[0] == 'H' && depth != 0) {
92  valContainer->insert(std::pair<std::tuple<int, int, int>, Item>(coord, item));
93 
94  depthKey = std::make_pair(subDetName, depth);
95 
96  auto depthVal = depths_.find(depthKey);
97  if (depthVal == depths_.end()) {
98  histLabel = ("run" + std::to_string(run_) + "_" + subDetName + "_d" + std::to_string(depth)).c_str();
99  depths_.insert(std::make_pair(std::make_pair(subDetName, depth),
100  new TH2F(histLabel, histLabel, 83, -42.5, 41.5, 71, 0.5, 71.5)));
101  }
102  depths_[depthKey]->Fill(ieta, iphi, getValue(&item));
103  }
104  }
105  }
106 
107  //Still need to know which hists to take when done; decide now
109  }
virtual float getValue(Item *item)
std::string to_string(const V &value)
Definition: OMSAccess.h:71
std::tuple< int, int, int > Coord
void setTopoModeFromValConts(bool throwOnFail=false)
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
tHcalValCont * getContFromString(std::string subDetString)
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
cont
load Luminosity info ##
Definition: generateEDF.py:628
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164

◆ getCanvasAll()

template<class Items , class Item >
TCanvas* HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasAll ( std::string  profile = "2DHist")
inline

Definition at line 359 of file HcalObjRepresent.h.

References HcalObjRepresent::HcalDataContainer< Items, Item >::FillCanv(), HcalObjRepresent::HcalDataContainer< Items, Item >::fillValConts(), HcalObjRepresent::HcalDataContainer< Items, Item >::GetTopoMode(), HcalObjRepresent::HcalDataContainer< Items, Item >::initGraphics(), and PostProcessor_cff::profile.

359  {
360  fillValConts();
361  initGraphics();
362  TCanvas* HAll = new TCanvas("HAll", "HAll", 1680, (GetTopoMode() == "2015/2016") ? 1680 : 2500);
363  HAll->Divide(3, (GetTopoMode() == "2015/2016") ? 3 : 6, 0.02, 0.01);
364  FillCanv(HAll, "HB", 1, 1, profile);
365  FillCanv(HAll, "HO", 4, 3, profile);
366  FillCanv(HAll, "HF", 1, 4, profile);
367  FillCanv(HAll, "HE", 1, (GetTopoMode() == "2015/2016") ? 7 : 10, profile);
368  return HAll;
369  }
void FillCanv(TCanvas *canvas, std::string subDetName, int startDepth=1, int startCanv=1, std::string plotForm="2DHist")

◆ getCanvasHBHO()

template<class Items , class Item >
TCanvas* HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasHBHO ( )
inline

Definition at line 387 of file HcalObjRepresent.h.

References HcalObjRepresent::HcalDataContainer< Items, Item >::FillCanv(), HcalObjRepresent::HcalDataContainer< Items, Item >::fillValConts(), and HcalObjRepresent::HcalDataContainer< Items, Item >::initGraphics().

387  {
388  fillValConts();
389  initGraphics();
390  TCanvas* HBHO = new TCanvas("HBHO", "HBHO", 1680, 1680);
391  HBHO->Divide(3, 3, 0.02, 0.01);
392  FillCanv(HBHO, "HB");
393  FillCanv(HBHO, "HO", 4, 3);
394  FillCanv(HBHO, "HB", 1, 4, "EtaProfile");
395  FillCanv(HBHO, "HO", 4, 6, "EtaProfile");
396  FillCanv(HBHO, "HB", 1, 7, "PhiProfile");
397  FillCanv(HBHO, "HO", 4, 9, "PhiProfile");
398  return HBHO;
399  }
void FillCanv(TCanvas *canvas, std::string subDetName, int startDepth=1, int startCanv=1, std::string plotForm="2DHist")

◆ getCanvasHE()

template<class Items , class Item >
TCanvas* HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasHE ( )
inline

Definition at line 379 of file HcalObjRepresent.h.

References HcalObjRepresent::HcalDataContainer< Items, Item >::FillCanv(), HcalObjRepresent::HcalDataContainer< Items, Item >::fillValConts(), HE, and HcalObjRepresent::HcalDataContainer< Items, Item >::initGraphics().

379  {
380  fillValConts();
381  initGraphics();
382  TCanvas* HE = new TCanvas("HE", "HE", 1680, 1680);
383  HE->Divide(3, 3, 0.02, 0.01);
384  FillCanv(HE, "HE");
385  return HE;
386  }
void FillCanv(TCanvas *canvas, std::string subDetName, int startDepth=1, int startCanv=1, std::string plotForm="2DHist")

◆ getCanvasHF()

template<class Items , class Item >
TCanvas* HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasHF ( )
inline

Definition at line 371 of file HcalObjRepresent.h.

References HcalObjRepresent::HcalDataContainer< Items, Item >::FillCanv(), HcalObjRepresent::HcalDataContainer< Items, Item >::fillValConts(), tpScales_cff::HF, and HcalObjRepresent::HcalDataContainer< Items, Item >::initGraphics().

371  {
372  fillValConts();
373  initGraphics();
374  TCanvas* HF = new TCanvas("HF", "HF", 1600, 1000);
375  HF->Divide(3, 2, 0.02, 0.01);
376  FillCanv(HF, "HF");
377  return HF;
378  }
void FillCanv(TCanvas *canvas, std::string subDetName, int startDepth=1, int startCanv=1, std::string plotForm="2DHist")

◆ getContFromString()

template<class Items , class Item >
tHcalValCont* HcalObjRepresent::HcalDataContainer< Items, Item >::getContFromString ( std::string  subDetString)
inlineprivate

Definition at line 436 of file HcalObjRepresent.h.

References HcalObjRepresent::HcalDataContainer< Items, Item >::CALIBvalContainer, HcalObjRepresent::HcalDataContainer< Items, Item >::CASTORvalContainer, Exception, HcalObjRepresent::HcalDataContainer< Items, Item >::HBvalContainer, HcalObjRepresent::HcalDataContainer< Items, Item >::HEvalContainer, HcalObjRepresent::HcalDataContainer< Items, Item >::HFvalContainer, HcalObjRepresent::HcalDataContainer< Items, Item >::HOvalContainer, HcalObjRepresent::HcalDataContainer< Items, Item >::HTvalContainer, and HcalObjRepresent::HcalDataContainer< Items, Item >::ZDCvalContainer.

Referenced by HcalObjRepresent::HcalDataContainer< Items, Item >::fillValConts(), and HcalObjRepresent::HcalDataContainer< Items, Item >::getItemFromValCont().

436  {
437  if (subDetString == "HB")
438  return &HBvalContainer;
439  else if (subDetString == "HE")
440  return &HEvalContainer;
441  else if (subDetString == "HF")
442  return &HFvalContainer;
443  else if (subDetString == "HO")
444  return &HOvalContainer;
445  else if (subDetString == "HT")
446  return &HTvalContainer;
447  else if (subDetString == "CALIB")
448  return &CALIBvalContainer;
449  else if (subDetString == "CASTOR")
450  return &CASTORvalContainer;
451  //else return &ZDCvalContainer;
452  else if (subDetString == "ZDC_EM" || subDetString == "ZDC" || subDetString == "ZDC_HAD" ||
453  subDetString == "ZDC_LUM")
454  return &ZDCvalContainer;
455  else
456  throw cms::Exception("subDetString " + subDetString + " not found in Item");
457  }

◆ GetDepths()

template<class Items , class Item >
DepthMap HcalObjRepresent::HcalDataContainer< Items, Item >::GetDepths ( )
inline

◆ getItemFromValCont()

template<class Items , class Item >
Item* HcalObjRepresent::HcalDataContainer< Items, Item >::getItemFromValCont ( std::string  subDetName,
int  depth,
int  ieta,
int  iphi,
bool  throwOnFail 
)
inline

Definition at line 118 of file HcalObjRepresent.h.

References LEDCalibrationChannels::depth, Exception, HcalObjRepresent::HcalDataContainer< Items, Item >::getContFromString(), LEDCalibrationChannels::ieta, if(), LEDCalibrationChannels::iphi, and HcalObjRepresent::HcalDataContainer< Items, Item >::payload_.

118  {
119  Item* cell = nullptr;
120  Coord coord = std::make_tuple(depth, ieta, iphi);
121  tHcalValCont* valContainer = getContFromString(subDetName);
122 
123  auto it = valContainer->find(coord);
124  if (it != valContainer->end())
125  cell = &it->second;
126 
127  if ((!cell)) {
128  if (throwOnFail) {
129  throw cms::Exception("Conditions not found")
130  << "Unavailable Conditions of type " << payload_->myname() << " for cell " << subDetName << " (" << depth
131  << ", " << ieta << ", " << iphi << ")";
132  }
133  }
134  return cell;
135  }
std::tuple< int, int, int > Coord
std::map< Coord, Item > tHcalValCont
tHcalValCont * getContFromString(std::string subDetString)
std::shared_ptr< Items > payload_

◆ GetProjection()

template<class Items , class Item >
TH1D* HcalObjRepresent::HcalDataContainer< Items, Item >::GetProjection ( TH2F *  hist,
std::string  plotType,
const char *  newName,
std::string  subDetName,
int  depth 
)
inline

Definition at line 242 of file HcalObjRepresent.h.

References newFWLiteAna::bin, ALCARECOTkAlBeamHalo_cff::etaMax, ALCARECOTkAlBeamHalo_cff::etaMin, gpuVertexFinder::hist, mps_fire::i, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, dqmiolumiharvest::j, mps_merge::newName, AlignmentTrackSelector_cfi::phiMax, AlignmentTrackSelector_cfi::phiMin, multiplicitycorr_cfi::xBins, multiplicitycorr_cfi::xMax, and photonAnalyzer_cfi::xMin.

Referenced by HcalObjRepresent::HcalDataContainer< Items, Item >::FillCanv().

242  {
243  //TODO: Also want average for standard projection of 2DHist (not ratio or diff)?
244  //if (PlotMode_ != "Ratio") return (plotType=="EtaProfile") ? ((TH2F*)(hist->Clone("temp")))->ProjectionX(newName) : ((TH2F*)(hist->Clone("temp")))->ProjectionY(newName);
245 
246  //TH1D* projection = ((TH2F*)(depths_[std::make_pair(subDetName,depth)]->Clone("temp")))->ProjectionX(newName);
247 
248  int xBins = (plotType == "EtaProfile") ? 83 : 71;
249  int etaMin = -42, etaMax = 42, phiMin = 1, phiMax = 72;
250  int xMin = (plotType == "EtaProfile") ? etaMin : phiMin;
251  int xMax = (plotType == "EtaProfile") ? etaMax : phiMax;
252  int otherMin = (plotType == "EtaProfile") ? phiMin : etaMin;
253  int otherMax = (plotType == "EtaProfile") ? phiMax : etaMax;
254  TH1D* retHist = new TH1D(newName, newName, xBins, xMin, xMax);
255  int numChannels;
256  Double_t sumVal;
257  Double_t channelVal;
258  int ieta, iphi;
259  int bin = 0;
260  for (int i = xMin; i <= xMax; i++ && bin++) {
261  numChannels = 0;
262  sumVal = 0;
263  for (int j = otherMin; j <= otherMax; j++) {
264  ieta = (plotType == "EtaProfile") ? i : j;
265  ieta += 42;
266  iphi = (plotType == "EtaProfile") ? j : i;
267  iphi += -1;
268  channelVal = hist->GetBinContent(ieta, iphi);
269  //std::cout << "(ieta, iphi) : (" << std::to_string(ieta) << ", " << std::to_string(iphi) << ")" << std::endl;
270  if (channelVal != 0) {
271  sumVal += channelVal;
272  numChannels++;
273  }
274  }
275  //if(sumVal !=0) projection->SetBinContent(i, sumVal/((Double_t)numChannels));//retHist->Fill(i,sumVal/((Double_t)numChannels));
276  if (sumVal != 0)
277  retHist->Fill(i, sumVal / ((Double_t)numChannels));
278  }
279  return retHist;
280  //return projection;
281  }
string newName
Definition: mps_merge.py:86
__shared__ Hist hist

◆ GetRange()

template<class Items , class Item >
std::pair<float, float> HcalObjRepresent::HcalDataContainer< Items, Item >::GetRange ( TH1 *  hist)
inline

Definition at line 184 of file HcalObjRepresent.h.

References gpuVertexFinder::hist, mps_fire::i, dqmiolumiharvest::j, SiStripPI::max, and HcalObjRepresent::HcalDataContainer< Items, Item >::PlotMode_.

Referenced by HcalObjRepresent::HcalDataContainer< Items, Item >::FillCanv().

184  {
185  if (PlotMode_ == "Ratio") {
186  float amp;
187  Double_t adjustMin = 1;
188  Double_t tempMin;
189  int nBinsX = hist->GetXaxis()->GetNbins();
190  int nBinsY = hist->GetYaxis()->GetNbins();
191  for (int i = 0; i < nBinsX; i++) {
192  for (int j = 0; j < nBinsY; j++) {
193  tempMin = hist->GetBinContent(i, j);
194  if ((tempMin != 0) && (tempMin < adjustMin))
195  adjustMin = tempMin;
196  }
197  }
198  amp = std::max((1 - adjustMin), (hist->GetMaximum() - 1));
199  //amp = std::max((1 - hist->GetMinimum()),(hist->GetMaximum() - 1) );
200  return std::make_pair(1 - amp, 1 + amp);
201  } else if (PlotMode_ == "Diff") {
202  float amp;
203  amp = std::max((0 - hist->GetMinimum()), hist->GetMaximum());
204  return std::make_pair((-1 * amp), amp);
205  } else {
206  Double_t adjustMin = 10000;
207  Double_t tempMin;
208  int nBinsX = hist->GetXaxis()->GetNbins();
209  int nBinsY = hist->GetYaxis()->GetNbins();
210  for (int i = 0; i < nBinsX; i++) {
211  for (int j = 0; j < nBinsY; j++) {
212  tempMin = hist->GetBinContent(i, j);
213  if ((tempMin != 0) && (tempMin < adjustMin))
214  adjustMin = tempMin;
215  }
216  }
217  return std::make_pair(((adjustMin == 10000) ? hist->GetMinimum() : adjustMin), hist->GetMaximum());
218  }
219  }
__shared__ Hist hist

◆ GetRun()

template<class Items , class Item >
unsigned int HcalObjRepresent::HcalDataContainer< Items, Item >::GetRun ( )
inline

◆ GetSubDetDepths()

template<class Items , class Item >
std::map<std::string, int> HcalObjRepresent::HcalDataContainer< Items, Item >::GetSubDetDepths ( )
inline

Definition at line 57 of file HcalObjRepresent.h.

References HcalObjRepresent::HcalDataContainer< Items, Item >::subDetDepths_.

57 { return subDetDepths_; }
std::map< std::string, int > subDetDepths_

◆ GetTopoMode()

template<class Items , class Item >
std::string HcalObjRepresent::HcalDataContainer< Items, Item >::GetTopoMode ( )
inline

◆ GetUnit()

template<class Items , class Item >
std::string HcalObjRepresent::HcalDataContainer< Items, Item >::GetUnit ( std::string  type)
inline

Definition at line 401 of file HcalObjRepresent.h.

References AlCaHLTBitMon_QueryRunRegistry::string, unit(), and HcalObjRepresent::HcalDataContainer< Items, Item >::units_.

Referenced by HcalObjRepresent::HcalDataContainer< Items, Item >::FillCanv().

401  {
403  if (unit.empty())
404  return "";
405  else
406  return "(" + unit + ")";
407  }
Basic3DVector unit() const
std::map< std::string, std::string > units_

◆ getValue()

template<class Items , class Item >
virtual float HcalObjRepresent::HcalDataContainer< Items, Item >::getValue ( Item *  item)
inlinevirtual

Definition at line 112 of file HcalObjRepresent.h.

References Exception, and HcalObjRepresent::HcalDataContainer< Items, Item >::payload_.

Referenced by HcalObjRepresent::HcalDataContainer< Items, Item >::fillValConts().

112  {
113  throw cms::Exception("Value definition not found") << "getValue definition not found for " << payload_->myname();
114  };
std::shared_ptr< Items > payload_

◆ initGraphics()

template<class Items , class Item >
void HcalObjRepresent::HcalDataContainer< Items, Item >::initGraphics ( )
inline

Definition at line 222 of file HcalObjRepresent.h.

Referenced by HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasAll(), HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasHBHO(), HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasHE(), and HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasHF().

222  {
223  gStyle->SetOptStat(0);
224  gStyle->SetPalette(1);
225  gStyle->SetOptFit(0);
226  gStyle->SetLabelFont(42);
227  gStyle->SetLabelFont(42);
228  gStyle->SetTitleFont(42);
229  gStyle->SetTitleFont(42);
230  gStyle->SetMarkerSize(0);
231  gStyle->SetTitleOffset(1.3, "Y");
232  gStyle->SetTitleOffset(1.0, "X");
233  gStyle->SetNdivisions(510);
234  gStyle->SetStatH(0.11);
235  gStyle->SetStatW(0.33);
236  gStyle->SetTitleW(0.4);
237  gStyle->SetTitleX(0.13);
238  gStyle->SetPadTickX(1);
239  gStyle->SetPadTickY(1);
240  }

◆ setTopoModeFromValConts()

template<class Items , class Item >
void HcalObjRepresent::HcalDataContainer< Items, Item >::setTopoModeFromValConts ( bool  throwOnFail = false)
inlineprivate

Definition at line 459 of file HcalObjRepresent.h.

References HcalObjRepresent::HcalDataContainer< Items, Item >::depths_, HcalObjRepresent::HcalDataContainer< Items, Item >::HEvalContainer, HcalObjRepresent::HcalDataContainer< Items, Item >::subDetDepths_, and HcalObjRepresent::HcalDataContainer< Items, Item >::TopoMode_.

Referenced by HcalObjRepresent::HcalDataContainer< Items, Item >::fillValConts().

459  {
460  // Check HEP17 alternate channel for 2017, just by checking if the 7th depth is there, or if HF has 4 depths
461  if (depths_.count(std::make_pair("HF", 4)) != 0 || depths_.count(std::make_pair("HE", 7)) != 0)
462  TopoMode_ = "2017";
463  // Check endcap depth unique to 2018
464  else if (HEvalContainer.count(std::make_tuple(7, -26, 63)) != 0)
465  TopoMode_ = "2018";
466  // if not 2017 or 2018, 2015 and 2016 are the same
467  else
468  TopoMode_ = "2015/2016";
469  //NOTE: HO's one depth is labeled depth 4
470  if (TopoMode_ == "2018" || TopoMode_ == "2017") {
471  subDetDepths_.insert(std::pair<std::string, int>("HB", 2));
472  subDetDepths_.insert(std::pair<std::string, int>("HE", 7));
473  subDetDepths_.insert(std::pair<std::string, int>("HF", 4));
474  subDetDepths_.insert(std::pair<std::string, int>("HO", 1));
475  } else if (TopoMode_ == "2015/2016") {
476  subDetDepths_.insert(std::pair<std::string, int>("HB", 2));
477  subDetDepths_.insert(std::pair<std::string, int>("HE", 3));
478  subDetDepths_.insert(std::pair<std::string, int>("HF", 2));
479  subDetDepths_.insert(std::pair<std::string, int>("HO", 1));
480  }
481  }
std::map< std::string, int > subDetDepths_

◆ Subtract()

template<class Items , class Item >
void HcalObjRepresent::HcalDataContainer< Items, Item >::Subtract ( HcalDataContainer< Items, Item > *  dataCont2)
inline

Definition at line 164 of file HcalObjRepresent.h.

References Exception, HcalObjRepresent::HcalDataContainer< Items, Item >::GetDepths(), HcalObjRepresent::HcalDataContainer< Items, Item >::GetRun(), crabWrapper::key, HcalObjRepresent::HcalDataContainer< Items, Item >::payload_, HcalObjRepresent::HcalDataContainer< Items, Item >::PlotMode_, and cond::impl::to_string().

164  {
165  PlotMode_ = "Diff";
166  DepthMap::iterator depth1;
167  std::pair<std::string, int> key;
168  DepthMap myDepths = this->GetDepths();
169  DepthMap theirDepths = dataCont2->GetDepths();
170  for (depth1 = myDepths.begin(); depth1 != myDepths.end(); depth1++) {
171  key = depth1->first;
172  if (theirDepths.count(key) != 0) {
173  myDepths.at(key)->Add(myDepths.at(key), theirDepths.at(key), 1, -1);
174  } else {
175  throw cms::Exception("Unaligned Conditions")
176  << "trying to plot conditions for " << payload_->myname() << "; found value for " << std::get<0>(key)
177  << " depth " << std::to_string(std::get<1>(key)) << " in run " << GetRun() << " but not in run "
178  << dataCont2->GetRun();
179  }
180  }
181  }
std::string to_string(const V &value)
Definition: OMSAccess.h:71
std::map< std::pair< std::string, int >, TH2F * > DepthMap
std::shared_ptr< Items > payload_

Member Data Documentation

◆ CALIBvalContainer

template<class Items , class Item >
tHcalValCont HcalObjRepresent::HcalDataContainer< Items, Item >::CALIBvalContainer
private

◆ CASTORvalContainer

template<class Items , class Item >
tHcalValCont HcalObjRepresent::HcalDataContainer< Items, Item >::CASTORvalContainer
private

◆ depths_

template<class Items , class Item >
DepthMap HcalObjRepresent::HcalDataContainer< Items, Item >::depths_
private

◆ HBvalContainer

template<class Items , class Item >
tHcalValCont HcalObjRepresent::HcalDataContainer< Items, Item >::HBvalContainer
private

◆ HEvalContainer

template<class Items , class Item >
tHcalValCont HcalObjRepresent::HcalDataContainer< Items, Item >::HEvalContainer
private

◆ HFvalContainer

template<class Items , class Item >
tHcalValCont HcalObjRepresent::HcalDataContainer< Items, Item >::HFvalContainer
private

◆ HOvalContainer

template<class Items , class Item >
tHcalValCont HcalObjRepresent::HcalDataContainer< Items, Item >::HOvalContainer
private

◆ HTvalContainer

template<class Items , class Item >
tHcalValCont HcalObjRepresent::HcalDataContainer< Items, Item >::HTvalContainer
private

◆ payload_

template<class Items , class Item >
std::shared_ptr<Items> HcalObjRepresent::HcalDataContainer< Items, Item >::payload_
private

◆ PlotMode_

template<class Items , class Item >
std::string HcalObjRepresent::HcalDataContainer< Items, Item >::PlotMode_
private

◆ run_

template<class Items , class Item >
unsigned int HcalObjRepresent::HcalDataContainer< Items, Item >::run_
private

◆ subDetDepths_

template<class Items , class Item >
std::map<std::string, int> HcalObjRepresent::HcalDataContainer< Items, Item >::subDetDepths_
private

◆ TopoMode_

template<class Items , class Item >
std::string HcalObjRepresent::HcalDataContainer< Items, Item >::TopoMode_
private

◆ units_

template<class Items , class Item >
std::map<std::string, std::string> HcalObjRepresent::HcalDataContainer< Items, Item >::units_
private
Initial value:
= {{"HcalPedestals", "ADC"},
{"HcalGains", ""},
{"HcalL1TriggerObjects", ""},
{"HcalPedestalWidths", "ADC"},
{"HcalRespCorrs", ""},
{"Dark Current", ""},
{"fcByPE", ""},
{"crossTalk", ""},
{"parLin", ""}}

Definition at line 426 of file HcalObjRepresent.h.

Referenced by HcalObjRepresent::HcalDataContainer< Items, Item >::GetUnit().

◆ ZDCvalContainer

template<class Items , class Item >
tHcalValCont HcalObjRepresent::HcalDataContainer< Items, Item >::ZDCvalContainer
private