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 ()
 
const std::vector< std::pair< std::string, std::vector< Item > > > getAllItems ()
 
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 (const 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 146 of file HcalObjRepresent.h.

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

146  {
147  //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
148 
149  PlotMode_ = "Ratio";
150  DepthMap::iterator depth1;
151  std::pair<std::string, int> key;
152  DepthMap myDepths = this->GetDepths();
153  DepthMap theirDepths = dataCont2->GetDepths();
154  for (depth1 = myDepths.begin(); depth1 != myDepths.end(); depth1++) {
155  key = depth1->first;
156  if (theirDepths.count(key) != 0) {
157  myDepths.at(key)->Divide((const TH1*)theirDepths.at(key));
158  } else {
159  throw cms::Exception("Unaligned Conditions")
160  << "trying to plot conditions for " << payload_->myname() << "; found value for " << std::get<0>(key)
161  << " depth " << std::to_string(std::get<1>(key)) << " in run " << GetRun() << " but not in run "
162  << dataCont2->GetRun();
163  }
164  }
165  }
static std::string to_string(const XMLCh *ch)
key
prepare the HTCondor submission files and eventually submit them
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 288 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_2024v13_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 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().

292  {
293  const char* newName;
294  std::pair<float, float> range;
295  int padNum;
296  int maxDepth = (subDetName == "HO") ? 4 : subDetDepths_[subDetName];
297  TH1D* projection;
298  TLatex label;
299  for (int i = startDepth; i <= maxDepth; i++) {
300  //skip if data not obtained; TODO: Maybe add text on plot saying data not found?
301  if (depths_.count(std::make_pair(subDetName, i)) == 0) {
302  return;
303  }
304 
305  padNum = i + startCanv - 1;
306  if (subDetName == "HO")
307  padNum = padNum - 3;
308  canvas->cd(padNum);
309  canvas->GetPad(padNum)->SetGridx(1);
310  canvas->GetPad(padNum)->SetGridy(1);
311 
312  if (plotForm == "2DHist") {
313  canvas->GetPad(padNum)->SetRightMargin(0.13);
314  range = GetRange(depths_[std::make_pair(subDetName, i)]);
315  depths_[std::make_pair(subDetName, i)]->Draw("colz");
316  depths_[std::make_pair(subDetName, i)]->SetContour(100);
317  depths_[std::make_pair(subDetName, i)]->GetXaxis()->SetTitle("ieta");
318  depths_[std::make_pair(subDetName, i)]->GetYaxis()->SetTitle("iphi");
319  depths_[std::make_pair(subDetName, i)]->GetXaxis()->CenterTitle();
320  depths_[std::make_pair(subDetName, i)]->GetYaxis()->CenterTitle();
321  depths_[std::make_pair(subDetName, i)]->GetZaxis()->SetRangeUser(std::get<0>(range), std::get<1>(range));
322  depths_[std::make_pair(subDetName, i)]->GetYaxis()->SetTitleSize(0.06);
323  depths_[std::make_pair(subDetName, i)]->GetYaxis()->SetTitleOffset(0.80);
324  depths_[std::make_pair(subDetName, i)]->GetXaxis()->SetTitleSize(0.06);
325  depths_[std::make_pair(subDetName, i)]->GetXaxis()->SetTitleOffset(0.80);
326  depths_[std::make_pair(subDetName, i)]->GetYaxis()->SetLabelSize(0.055);
327  depths_[std::make_pair(subDetName, i)]->GetXaxis()->SetLabelSize(0.055);
328  } else {
329  canvas->GetPad(padNum)->SetLeftMargin(0.152);
330  canvas->GetPad(padNum)->SetRightMargin(0.02);
331  //gStyle->SetTitleOffset(1.6,"Y");
332  newName = ("run_" + std::to_string(run_) + "_" + subDetName + "_d" + std::to_string(i) + "_" +
333  (plotForm == "EtaProfile" ? "ieta" : "iphi"))
334  .c_str();
335  //projection = ((TH2F*)(depths_[std::make_pair(subDetName,i)]->Clone("temp")))->ProjectionX(newName);
336  projection = GetProjection(depths_[std::make_pair(subDetName, i)], plotForm, newName, subDetName, i);
337  range = GetRange(projection);
338  projection->Draw("hist");
339  projection->GetXaxis()->SetTitle((plotForm == "EtaProfile" ? "ieta" : "iphi"));
340  projection->GetXaxis()->CenterTitle();
341  projection->GetYaxis()->SetTitle(
342  (payload_->myname() + " " + (PlotMode_ == "Map" ? "" : PlotMode_) + " " + GetUnit(payload_->myname()))
343  .c_str());
344  label.SetNDC();
345  label.SetTextAlign(26);
346  label.SetTextSize(0.05);
347  label.DrawLatex(
348  0.3, 0.95, ("run_" + std::to_string(run_) + "_" + subDetName + "_d" + std::to_string(i)).c_str());
349  projection->GetYaxis()->CenterTitle();
350  projection->GetXaxis()->SetTitleSize(0.06);
351  projection->GetYaxis()->SetTitleSize(0.06);
352  projection->GetXaxis()->SetTitleOffset(0.80);
353  projection->GetXaxis()->SetLabelSize(0.055);
354  projection->GetYaxis()->SetTitleOffset(1.34);
355  projection->GetYaxis()->SetLabelSize(0.055);
356  }
357  }
358  }
string newName
Definition: mps_merge.py:86
static std::string to_string(const XMLCh *ch)
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, hcalRecHitTable_cff::depth, HcalObjRepresent::HcalDataContainer< Items, Item >::depths_, hcalRecHitTable_cff::detId, HcalObjRepresent::HcalDataContainer< Items, Item >::getContFromString(), HcalObjRepresent::HcalDataContainer< Items, Item >::getValue(), hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::iphi, B2GTnPMonitor_cfi::item, HcalObjRepresent::HcalDataContainer< Items, Item >::run_, HcalObjRepresent::HcalDataContainer< Items, Item >::setTopoModeFromValConts(), AlCaHLTBitMon_QueryRunRegistry::string, and 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;
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  }
std::tuple< int, int, int > Coord
void setTopoModeFromValConts(bool throwOnFail=false)
static std::string to_string(const XMLCh *ch)
virtual float getValue(const Item *item)
tHcalValCont * getContFromString(std::string subDetString)
cont
load Luminosity info ##
Definition: generateEDF.py:620

◆ getAllItems()

template<class Items , class Item >
const std::vector<std::pair<std::string, std::vector<Item> > > HcalObjRepresent::HcalDataContainer< Items, Item >::getAllItems ( )
inline

Definition at line 111 of file HcalObjRepresent.h.

111  {
112  return (*payload_).getAllContainers();
113  }

◆ getCanvasAll()

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

Definition at line 363 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.

363  {
364  fillValConts();
365  initGraphics();
366  TCanvas* HAll = new TCanvas("HAll", "HAll", 1680, (GetTopoMode() == "2015/2016") ? 1680 : 2500);
367  HAll->Divide(3, (GetTopoMode() == "2015/2016") ? 3 : 6, 0.02, 0.01);
368  FillCanv(HAll, "HB", 1, 1, profile);
369  FillCanv(HAll, "HO", 4, 3, profile);
370  FillCanv(HAll, "HF", 1, 4, profile);
371  FillCanv(HAll, "HE", 1, (GetTopoMode() == "2015/2016") ? 7 : 10, profile);
372  return HAll;
373  }
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 391 of file HcalObjRepresent.h.

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

391  {
392  fillValConts();
393  initGraphics();
394  TCanvas* HBHO = new TCanvas("HBHO", "HBHO", 1680, 1680);
395  HBHO->Divide(3, 3, 0.02, 0.01);
396  FillCanv(HBHO, "HB");
397  FillCanv(HBHO, "HO", 4, 3);
398  FillCanv(HBHO, "HB", 1, 4, "EtaProfile");
399  FillCanv(HBHO, "HO", 4, 6, "EtaProfile");
400  FillCanv(HBHO, "HB", 1, 7, "PhiProfile");
401  FillCanv(HBHO, "HO", 4, 9, "PhiProfile");
402  return HBHO;
403  }
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 383 of file HcalObjRepresent.h.

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

383  {
384  fillValConts();
385  initGraphics();
386  TCanvas* HE = new TCanvas("HE", "HE", 1680, 1680);
387  HE->Divide(3, 3, 0.02, 0.01);
388  FillCanv(HE, "HE");
389  return HE;
390  }
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 375 of file HcalObjRepresent.h.

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

375  {
376  fillValConts();
377  initGraphics();
378  TCanvas* HF = new TCanvas("HF", "HF", 1600, 1000);
379  HF->Divide(3, 2, 0.02, 0.01);
380  FillCanv(HF, "HF");
381  return HF;
382  }
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 440 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().

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

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

References hcalRecHitTable_cff::depth, Exception, HcalObjRepresent::HcalDataContainer< Items, Item >::getContFromString(), hcalRecHitTable_cff::ieta, ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::if(), hcalRecHitTable_cff::iphi, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and HcalObjRepresent::HcalDataContainer< Items, Item >::payload_.

122  {
123  Item* cell = nullptr;
124  Coord coord = std::make_tuple(depth, ieta, iphi);
125  tHcalValCont* valContainer = getContFromString(subDetName);
126 
127  auto it = valContainer->find(coord);
128  if (it != valContainer->end())
129  cell = &it->second;
130 
131  if ((!cell)) {
132  if (throwOnFail) {
133  throw cms::Exception("Conditions not found")
134  << "Unavailable Conditions of type " << payload_->myname() << " for cell " << subDetName << " (" << depth
135  << ", " << ieta << ", " << iphi << ")";
136  }
137  }
138  return cell;
139  }
std::tuple< int, int, int > Coord
std::map< Coord, Item > tHcalValCont
tHcalValCont * getContFromString(std::string subDetString)
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
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 246 of file HcalObjRepresent.h.

References newFWLiteAna::bin, ALCARECOTkAlBeamHalo_cff::etaMax, ALCARECOTkAlBeamHalo_cff::etaMin, compareTotals::hist, mps_fire::i, hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::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().

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

◆ GetRange()

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

Definition at line 188 of file HcalObjRepresent.h.

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

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

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

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

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

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

405  {
407  if (unit.empty())
408  return "";
409  else
410  return "(" + unit + ")";
411  }
Basic3DVector unit() const
std::map< std::string, std::string > units_

◆ getValue()

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

Definition at line 116 of file HcalObjRepresent.h.

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

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

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

◆ initGraphics()

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

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

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

◆ setTopoModeFromValConts()

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

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

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

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

168  {
169  PlotMode_ = "Diff";
170  DepthMap::iterator depth1;
171  std::pair<std::string, int> key;
172  DepthMap myDepths = this->GetDepths();
173  DepthMap theirDepths = dataCont2->GetDepths();
174  for (depth1 = myDepths.begin(); depth1 != myDepths.end(); depth1++) {
175  key = depth1->first;
176  if (theirDepths.count(key) != 0) {
177  myDepths.at(key)->Add(myDepths.at(key), theirDepths.at(key), 1, -1);
178  } else {
179  throw cms::Exception("Unaligned Conditions")
180  << "trying to plot conditions for " << payload_->myname() << "; found value for " << std::get<0>(key)
181  << " depth " << std::to_string(std::get<1>(key)) << " in run " << GetRun() << " but not in run "
182  << dataCont2->GetRun();
183  }
184  }
185  }
static std::string to_string(const XMLCh *ch)
key
prepare the HTCondor submission files and eventually submit them
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 430 of file HcalObjRepresent.h.

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

◆ ZDCvalContainer

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