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

Definition at line 41 of file HcalObjRepresent.h.

41  : payload_(payload), run_(run) {
42  PlotMode_ = "Map";
43  }

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

◆ ~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.

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  }

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

◆ 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.

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  }

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_FULL_cff::maxDepth, mps_merge::newName, HcalObjRepresent::HcalDataContainer< Items, Item >::payload_, HcalObjRepresent::HcalDataContainer< Items, Item >::PlotMode_, FastTimerService_cff::range, HcalObjRepresent::HcalDataContainer< Items, Item >::run_, and HcalObjRepresent::HcalDataContainer< Items, Item >::subDetDepths_.

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

◆ fillValConts()

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

Definition at line 68 of file HcalObjRepresent.h.

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  }

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(), and AlCaHLTBitMon_QueryRunRegistry::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().

◆ 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.

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  }

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.

◆ getCanvasHBHO()

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

Definition at line 387 of file HcalObjRepresent.h.

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  }

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

◆ getCanvasHE()

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

Definition at line 379 of file HcalObjRepresent.h.

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  }

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

◆ getCanvasHF()

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

Definition at line 371 of file HcalObjRepresent.h.

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  }

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

◆ getContFromString()

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

Definition at line 436 of file HcalObjRepresent.h.

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  }

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().

◆ GetDepths()

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

Definition at line 59 of file HcalObjRepresent.h.

59  {
60  fillValConts();
61  //std::cout << "Got depths with run number = " << std::to_string(GetRun()) << std::endl;
62  return depths_;
63  }

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

Referenced by HcalObjRepresent::HcalDataContainer< Items, Item >::Divide(), and HcalObjRepresent::HcalDataContainer< Items, Item >::Subtract().

◆ 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.

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  }

References LEDCalibrationChannels::depth, Exception, HcalObjRepresent::HcalDataContainer< Items, Item >::getContFromString(), LEDCalibrationChannels::ieta, if(), LEDCalibrationChannels::iphi, and HcalObjRepresent::HcalDataContainer< Items, Item >::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.

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  }

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().

◆ 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.

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  }

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

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

◆ 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

◆ 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.

401  {
403  if (unit.empty())
404  return "";
405  else
406  return "(" + unit + ")";
407  }

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

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

◆ getValue()

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

Definition at line 112 of file HcalObjRepresent.h.

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

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

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

◆ initGraphics()

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

Definition at line 222 of file HcalObjRepresent.h.

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  }

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

◆ setTopoModeFromValConts()

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

Definition at line 459 of file HcalObjRepresent.h.

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  }

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().

◆ 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.

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  }

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

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
HcalObjRepresent::HcalDataContainer::TopoMode_
std::string TopoMode_
Definition: HcalObjRepresent.h:413
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
HcalObjRepresent::HcalDataContainer::FillCanv
void FillCanv(TCanvas *canvas, std::string subDetName, int startDepth=1, int startCanv=1, std::string plotForm="2DHist")
Definition: HcalObjRepresent.h:284
ALCARECOTkAlBeamHalo_cff.etaMin
etaMin
GeV.
Definition: ALCARECOTkAlBeamHalo_cff.py:32
mps_fire.i
i
Definition: mps_fire.py:428
HcalDetId::iphi
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
HcalObjRepresent::HcalDataContainer::getContFromString
tHcalValCont * getContFromString(std::string subDetString)
Definition: HcalObjRepresent.h:436
HcalObjRepresent::HcalDataContainer::GetProjection
TH1D * GetProjection(TH2F *hist, std::string plotType, const char *newName, std::string subDetName, int depth)
Definition: HcalObjRepresent.h:242
HcalObjRepresent::HcalDataContainer::GetRun
unsigned int GetRun()
Definition: HcalObjRepresent.h:53
if
if(0==first)
Definition: CAHitNtupletGeneratorKernelsImpl.h:58
generateEDF.cont
cont
load Luminosity info ##
Definition: generateEDF.py:628
HcalObjRepresent::HcalDataContainer::HBvalContainer
tHcalValCont HBvalContainer
Definition: HcalObjRepresent.h:417
HcalDetId::depth
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164
HcalObjRepresent::HcalDataContainer::fillValConts
void fillValConts()
Definition: HcalObjRepresent.h:68
HcalObjRepresent::HcalDataContainer::GetDepths
DepthMap GetDepths()
Definition: HcalObjRepresent.h:59
HLT_FULL_cff.maxDepth
maxDepth
Definition: HLT_FULL_cff.py:8665
HcalObjRepresent::HcalDataContainer::DepthMap
std::map< std::pair< std::string, int >, TH2F * > DepthMap
Definition: HcalObjRepresent.h:50
HcalObjRepresent::HcalDataContainer::ZDCvalContainer
tHcalValCont ZDCvalContainer
Definition: HcalObjRepresent.h:422
HcalObjRepresent::HcalDataContainer::HFvalContainer
tHcalValCont HFvalContainer
Definition: HcalObjRepresent.h:420
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
photonAnalyzer_cfi.xMin
xMin
Definition: photonAnalyzer_cfi.py:82
HcalObjRepresent::HcalDataContainer::subDetDepths_
std::map< std::string, int > subDetDepths_
Definition: HcalObjRepresent.h:425
HcalObjRepresent::HcalDataContainer::units_
std::map< std::string, std::string > units_
Definition: HcalObjRepresent.h:426
HcalObjRepresent::HcalDataContainer::tHcalValCont
std::map< Coord, Item > tHcalValCont
Definition: HcalObjRepresent.h:48
AlignmentTrackSelector_cfi.phiMin
phiMin
Definition: AlignmentTrackSelector_cfi.py:18
AlignmentTrackSelector_cfi.phiMax
phiMax
Definition: AlignmentTrackSelector_cfi.py:17
multiplicitycorr_cfi.xBins
xBins
Definition: multiplicitycorr_cfi.py:5
jets_cff.payload
payload
Definition: jets_cff.py:32
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
PostProcessor_cff.profile
profile
Definition: PostProcessor_cff.py:38
HcalObjRepresent::HcalDataContainer::depths_
DepthMap depths_
Definition: HcalObjRepresent.h:410
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
HcalDetId::ieta
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
HcalObjRepresent::HcalDataContainer::GetUnit
std::string GetUnit(std::string type)
Definition: HcalObjRepresent.h:401
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
gpuVertexFinder::hist
__shared__ Hist hist
Definition: gpuClusterTracksDBSCAN.h:48
HcalObjRepresent::HcalDataContainer::GetRange
std::pair< float, float > GetRange(TH1 *hist)
Definition: HcalObjRepresent.h:184
HcalObjRepresent::HcalDataContainer::PlotMode_
std::string PlotMode_
Definition: HcalObjRepresent.h:415
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
HcalObjRepresent::HcalDataContainer::Coord
std::tuple< int, int, int > Coord
Definition: HcalObjRepresent.h:45
HcalDetId
Definition: HcalDetId.h:12
HE
Definition: GlobalHaloAlgo.cc:15
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
HcalObjRepresent::HcalDataContainer::payload_
std::shared_ptr< Items > payload_
Definition: HcalObjRepresent.h:411
HcalObjRepresent::HcalDataContainer::HEvalContainer
tHcalValCont HEvalContainer
Definition: HcalObjRepresent.h:418
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalObjRepresent::HcalDataContainer::CASTORvalContainer
tHcalValCont CASTORvalContainer
Definition: HcalObjRepresent.h:424
mps_merge.newName
string newName
Definition: mps_merge.py:86
unit
Basic3DVector unit() const
Definition: Basic3DVectorLD.h:162
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
HcalObjRepresent::HcalDataContainer::HOvalContainer
tHcalValCont HOvalContainer
Definition: HcalObjRepresent.h:419
HcalObjRepresent::HcalDataContainer::initGraphics
void initGraphics()
Definition: HcalObjRepresent.h:222
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Exception
Definition: hltDiff.cc:245
ALCARECOTkAlBeamHalo_cff.etaMax
etaMax
Definition: ALCARECOTkAlBeamHalo_cff.py:33
multiplicitycorr_cfi.xMax
xMax
Definition: multiplicitycorr_cfi.py:5
HcalObjRepresent::HcalDataContainer::HTvalContainer
tHcalValCont HTvalContainer
Definition: HcalObjRepresent.h:421
HcalObjRepresent::HcalDataContainer::GetTopoMode
std::string GetTopoMode()
Definition: HcalObjRepresent.h:55
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
HcalObjRepresent::HcalDataContainer::setTopoModeFromValConts
void setTopoModeFromValConts(bool throwOnFail=false)
Definition: HcalObjRepresent.h:459
DigiToRawDM_cff.HF
HF
Definition: DigiToRawDM_cff.py:22
crabWrapper.key
key
Definition: crabWrapper.py:19
label
const char * label
Definition: PFTauDecayModeTools.cc:11
HcalObjRepresent::HcalDataContainer::getValue
virtual float getValue(Item *item)
Definition: HcalObjRepresent.h:112
HcalObjRepresent::HcalDataContainer::run_
unsigned int run_
Definition: HcalObjRepresent.h:412
HcalObjRepresent::HcalDataContainer::CALIBvalContainer
tHcalValCont CALIBvalContainer
Definition: HcalObjRepresent.h:423