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

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

Definition at line 46 of file HcalObjRepresent.h.

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

Definition at line 51 of file HcalObjRepresent.h.

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

Definition at line 49 of file HcalObjRepresent.h.

Constructor & Destructor Documentation

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

Definition at line 46 of file HcalObjRepresent.h.

46 {};

Member Function Documentation

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

Definition at line 153 of file HcalObjRepresent.h.

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

153  {
154 
155  //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
156 
157  PlotMode_ = "Ratio";
158  DepthMap::iterator depth1;
159  std::pair<std::string,int> key;
160  DepthMap myDepths = this->GetDepths();
161  DepthMap theirDepths = dataCont2->GetDepths();
162  for(depth1 = myDepths.begin(); depth1 != myDepths.end(); depth1++){
163  key = depth1->first;
164  if(theirDepths.count(key) != 0) {
165  myDepths.at(key)->Divide((const TH1*)theirDepths.at(key));
166  } else {
167  throw cms::Exception ("Unaligned Conditions") << "trying to plot conditions for " << payload_->myname() << "; found value for " << std::get<0>(key) << " depth " << std::to_string(std::get<1>(key)) << " in run " << GetRun() << " but not in run " << dataCont2->GetRun();
168  }
169  }
170  }
std::map< std::pair< std::string, int >, TH2F * > DepthMap
std::shared_ptr< Items > payload_
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 292 of file HcalObjRepresent.h.

References HcalObjRepresent::HcalDataContainer< Items, Item >::depths_, HcalObjRepresent::HcalDataContainer< Items, Item >::GetProjection(), HcalObjRepresent::HcalDataContainer< Items, Item >::GetRange(), HcalObjRepresent::HcalDataContainer< Items, Item >::GetUnit(), mps_fire::i, label, CMSBoostedTauSeedingParameters_cfi::maxDepth, mps_merge::newName, HcalObjRepresent::HcalDataContainer< Items, Item >::payload_, HcalObjRepresent::HcalDataContainer< Items, Item >::PlotMode_, 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().

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

Definition at line 75 of file HcalObjRepresent.h.

References egammaForCoreTracking_cff::depth, HcalDetId::depth(), HcalObjRepresent::HcalDataContainer< Items, Item >::depths_, HcalObjRepresent::HcalDataContainer< Items, Item >::getContFromString(), HcalObjRepresent::HcalDataContainer< Items, Item >::getValue(), HcalDetId::ieta(), HcalDetId::iphi(), 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().

75  {
76  if(!depths_.empty()) return;
77  int iphi,ieta,depth;
78  HcalDetId detId;
79 
80  std::string subDetName;
81  std::vector<Item> itemsVec;
82  std::pair<std::string,int> depthKey;
83  const char* histLabel;
84  for(std::pair< std::string, std::vector<Item> > cont : (*payload_).getAllContainers()){
85  subDetName = std::get<0>(cont);
86  itemsVec = std::get<1>(cont);
87 
88  auto valContainer = getContFromString(subDetName);
89 
90  for(Item item : itemsVec){
91  detId = HcalDetId(item.rawId());
92  iphi = detId.iphi();
93  ieta = detId.ieta();
94  depth = detId.depth();
95  Coord coord = std::make_tuple(depth,ieta,iphi);
96  //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)
97  if(subDetName[0] == 'H' && depth != 0){
98  valContainer->insert( std::pair<std::tuple<int,int,int>,Item>(coord,item));
99 
100 
101  depthKey = std::make_pair(subDetName, depth);
102 
103  auto depthVal = depths_.find(depthKey);
104  if(depthVal == depths_.end()){
105  histLabel = ("run" + std::to_string(run_) + "_" + subDetName + "_d" + std::to_string(depth)).c_str();
106  depths_.insert(std::make_pair(std::make_pair(subDetName, depth), new TH2F(histLabel,histLabel, 83, -42.5, 41.5, 71, 0.5, 71.5)));
107  }
108  depths_[depthKey]->Fill(ieta, iphi, getValue(&item));
109  }
110  }
111  }
112 
113  //Still need to know which hists to take when done; decide now
115  }
virtual float getValue(Item *item)
std::tuple< int, int, int > Coord
void setTopoModeFromValConts(bool throwOnFail=false)
int depth() const
get the tower depth
Definition: HcalDetId.h:166
int ieta() const
get the cell ieta
Definition: HcalDetId.h:159
int iphi() const
get the cell iphi
Definition: HcalDetId.h:161
tHcalValCont * getContFromString(std::string subDetString)
template<class Items , class Item >
TCanvas* HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasAll ( std::string  profile = "2DHist")
inline

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

365  {
366  fillValConts();
367  initGraphics();
368  TCanvas *HAll = new TCanvas("HAll", "HAll", 1680, (GetTopoMode()=="2015/2016")?1680:2500);
369  HAll->Divide(3, (GetTopoMode()=="2015/2016")?3:6, 0.02,0.01);
370  FillCanv(HAll,"HB",1,1,profile);
371  FillCanv(HAll,"HO",4,3,profile);
372  FillCanv(HAll,"HF",1,4,profile);
373  FillCanv(HAll,"HE",1,(GetTopoMode()=="2015/2016")?7:10,profile);
374  return HAll;
375  }
void FillCanv(TCanvas *canvas, std::string subDetName, int startDepth=1, int startCanv=1, std::string plotForm="2DHist")
template<class Items , class Item >
TCanvas* HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasHBHO ( )
inline

Definition at line 395 of file HcalObjRepresent.h.

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

395  {
396  fillValConts();
397  initGraphics();
398  TCanvas *HBHO = new TCanvas("HBHO", "HBHO", 1680, 1680);
399  HBHO->Divide(3, 3,0.02,0.01);
400  FillCanv(HBHO,"HB");
401  FillCanv(HBHO,"HO",4,3);
402  FillCanv(HBHO,"HB",1,4,"EtaProfile");
403  FillCanv(HBHO,"HO",4,6,"EtaProfile");
404  FillCanv(HBHO,"HB",1,7,"PhiProfile");
405  FillCanv(HBHO,"HO",4,9,"PhiProfile");
406  return HBHO;
407  }
void FillCanv(TCanvas *canvas, std::string subDetName, int startDepth=1, int startCanv=1, std::string plotForm="2DHist")
template<class Items , class Item >
TCanvas* HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasHE ( )
inline

Definition at line 386 of file HcalObjRepresent.h.

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

386  {
387 
388  fillValConts();
389  initGraphics();
390  TCanvas *HE = new TCanvas("HE", "HE", 1680, 1680);
391  HE->Divide(3, 3,0.02,0.01);
392  FillCanv(HE,"HE");
393  return HE;
394  }
void FillCanv(TCanvas *canvas, std::string subDetName, int startDepth=1, int startCanv=1, std::string plotForm="2DHist")
template<class Items , class Item >
TCanvas* HcalObjRepresent::HcalDataContainer< Items, Item >::getCanvasHF ( )
inline

Definition at line 377 of file HcalObjRepresent.h.

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

377  {
378 
379  fillValConts();
380  initGraphics();
381  TCanvas *HF = new TCanvas("HF", "HF", 1600, 1000);
382  HF->Divide(3, 2,0.02,0.01);
383  FillCanv(HF,"HF");
384  return HF;
385  }
void FillCanv(TCanvas *canvas, std::string subDetName, int startDepth=1, int startCanv=1, std::string plotForm="2DHist")
template<class Items , class Item >
tHcalValCont* HcalObjRepresent::HcalDataContainer< Items, Item >::getContFromString ( std::string  subDetString)
inlineprivate

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

446  {
447 
448  if(subDetString == "HB") return &HBvalContainer;
449  else if(subDetString == "HE") return &HEvalContainer;
450  else if(subDetString == "HF") return &HFvalContainer;
451  else if(subDetString == "HO") return &HOvalContainer;
452  else if(subDetString == "HT") return &HTvalContainer;
453  else if(subDetString == "CALIB") return &CALIBvalContainer;
454  else if(subDetString == "CASTOR") return &CASTORvalContainer;
455  //else return &ZDCvalContainer;
456  else if(subDetString == "ZDC_EM" || subDetString == "ZDC" || subDetString == "ZDC_HAD" || subDetString == "ZDC_LUM") return &ZDCvalContainer;
457  else throw cms::Exception ("subDetString "+subDetString+" not found in Item");
458 
459  }
template<class Items , class Item >
DepthMap HcalObjRepresent::HcalDataContainer< Items, Item >::GetDepths ( )
inline
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 124 of file HcalObjRepresent.h.

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

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

References stringResolutionProvider_cfi::bin, ALCARECOTkAlBeamHalo_cff::etaMax, ALCARECOTkAlBeamHalo_cff::etaMin, mps_fire::i, AlignmentTrackSelector_cfi::phiMax, AlignmentTrackSelector_cfi::phiMin, anotherprimaryvertexanalyzer_cfi::xMax, and anotherprimaryvertexanalyzer_cfi::xMin.

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

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

Definition at line 193 of file HcalObjRepresent.h.

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

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

193  {
194 
195  if(PlotMode_ == "Ratio") {
196  float amp;
197  Double_t adjustMin = 1; Double_t tempMin;
198  int nBinsX = hist->GetXaxis()->GetNbins(); int nBinsY = hist->GetYaxis()->GetNbins();
199  for(int i = 0; i < nBinsX; i++) {
200  for(int j = 0; j < nBinsY; j++) {
201  tempMin = hist->GetBinContent(i,j);
202  if((tempMin != 0) && (tempMin < adjustMin)) adjustMin = tempMin;
203  }
204  }
205  amp = std::max((1 - adjustMin),(hist->GetMaximum() - 1) );
206  //amp = std::max((1 - hist->GetMinimum()),(hist->GetMaximum() - 1) );
207  return std::make_pair( 1 - amp, 1 + amp);
208  }
209  else if(PlotMode_ == "Diff") {
210  float amp;
211  amp = std::max((0 - hist->GetMinimum()),hist->GetMaximum() );
212  return std::make_pair( (-1 * amp), amp);
213  }
214  else {
215  Double_t adjustMin = 10000; Double_t tempMin;
216  int nBinsX = hist->GetXaxis()->GetNbins(); int nBinsY = hist->GetYaxis()->GetNbins();
217  for(int i = 0; i < nBinsX; i++) {
218  for(int j = 0; j < nBinsY; j++) {
219  tempMin = hist->GetBinContent(i,j);
220  if((tempMin != 0) && (tempMin < adjustMin)) adjustMin = tempMin;
221  }
222  }
223  return std::make_pair(((adjustMin==10000) ? hist->GetMinimum() : adjustMin), hist->GetMaximum());
224  }
225  }
template<class Items , class Item >
unsigned int HcalObjRepresent::HcalDataContainer< Items, Item >::GetRun ( )
inline
template<class Items , class Item >
std::map<std::string,int> HcalObjRepresent::HcalDataContainer< Items, Item >::GetSubDetDepths ( )
inline
template<class Items , class Item >
std::string HcalObjRepresent::HcalDataContainer< Items, Item >::GetTopoMode ( )
inline
template<class Items , class Item >
std::string HcalObjRepresent::HcalDataContainer< Items, Item >::GetUnit ( std::string  type)
inline
template<class Items , class Item >
virtual float HcalObjRepresent::HcalDataContainer< Items, Item >::getValue ( Item *  item)
inlinevirtual

Definition at line 118 of file HcalObjRepresent.h.

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

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

118 {throw cms::Exception ("Value definition not found") << "getValue definition not found for " << payload_->myname();};
std::shared_ptr< Items > payload_
template<class Items , class Item >
void HcalObjRepresent::HcalDataContainer< Items, Item >::initGraphics ( )
inline

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

228  {
229 
230  gStyle->SetOptStat(0);
231  gStyle->SetPalette(1);
232  gStyle->SetOptFit(0);
233  gStyle->SetLabelFont(42);
234  gStyle->SetLabelFont(42);
235  gStyle->SetTitleFont(42);
236  gStyle->SetTitleFont(42);
237  gStyle->SetMarkerSize(0);
238  gStyle->SetTitleOffset(1.3,"Y");
239  gStyle->SetTitleOffset(1.0,"X");
240  gStyle->SetNdivisions(510);
241  gStyle->SetStatH(0.11);
242  gStyle->SetStatW(0.33);
243  gStyle->SetTitleW(0.4);
244  gStyle->SetTitleX(0.13);
245  gStyle->SetPadTickX(1);
246  gStyle->SetPadTickY(1);
247  }
template<class Items , class Item >
void HcalObjRepresent::HcalDataContainer< Items, Item >::setTopoModeFromValConts ( bool  throwOnFail = false)
inlineprivate

Definition at line 461 of file HcalObjRepresent.h.

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

461  {
462 
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) TopoMode_ = "2017";
466  // Check endcap depth unique to 2018
467  else if(HEvalContainer.count(std::make_tuple(7,-26,63))!=0) TopoMode_ = "2018";
468  // if not 2017 or 2018, 2015 and 2016 are the same
469  else TopoMode_ = "2015/2016";
470  //NOTE: HO's one depth is labeled depth 4
471  if(TopoMode_ == "2018" || TopoMode_ == "2017") {
472  subDetDepths_.insert(std::pair<std::string,int>("HB",2));
473  subDetDepths_.insert(std::pair<std::string,int>("HE",7));
474  subDetDepths_.insert(std::pair<std::string,int>("HF",4));
475  subDetDepths_.insert(std::pair<std::string,int>("HO",1));
476  } else if(TopoMode_ == "2015/2016") {
477  subDetDepths_.insert(std::pair<std::string,int>("HB",2));
478  subDetDepths_.insert(std::pair<std::string,int>("HE",3));
479  subDetDepths_.insert(std::pair<std::string,int>("HF",2));
480  subDetDepths_.insert(std::pair<std::string,int>("HO",1));
481  }
482 
483  }
std::map< std::string, int > subDetDepths_
template<class Items , class Item >
void HcalObjRepresent::HcalDataContainer< Items, Item >::Subtract ( HcalDataContainer< Items, Item > *  dataCont2)
inline

Definition at line 175 of file HcalObjRepresent.h.

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

175  {
176  PlotMode_ = "Diff";
177  DepthMap::iterator depth1;
178  std::pair<std::string,int> key;
179  DepthMap myDepths = this->GetDepths();
180  DepthMap theirDepths = dataCont2->GetDepths();
181  for(depth1 = myDepths.begin(); depth1 != myDepths.end(); depth1++){
182  key = depth1->first;
183  if(theirDepths.count(key) != 0) {
184  myDepths.at(key)->Add(myDepths.at(key), theirDepths.at(key), 1, -1);
185  } else {
186  throw cms::Exception ("Unaligned Conditions") << "trying to plot conditions for " << payload_->myname() << "; found value for " << std::get<0>(key) << " depth " << std::to_string(std::get<1>(key)) << " in run " << GetRun() << " but not in run " << dataCont2->GetRun();
187  }
188  }
189  }
std::map< std::pair< std::string, int >, TH2F * > DepthMap
std::shared_ptr< Items > payload_

Member Data Documentation

template<class Items , class Item >
tHcalValCont HcalObjRepresent::HcalDataContainer< Items, Item >::CALIBvalContainer
private
template<class Items , class Item >
tHcalValCont HcalObjRepresent::HcalDataContainer< Items, Item >::CASTORvalContainer
private
template<class Items , class Item >
DepthMap HcalObjRepresent::HcalDataContainer< Items, Item >::depths_
private
template<class Items , class Item >
tHcalValCont HcalObjRepresent::HcalDataContainer< Items, Item >::HBvalContainer
private
template<class Items , class Item >
tHcalValCont HcalObjRepresent::HcalDataContainer< Items, Item >::HEvalContainer
private
template<class Items , class Item >
tHcalValCont HcalObjRepresent::HcalDataContainer< Items, Item >::HFvalContainer
private
template<class Items , class Item >
tHcalValCont HcalObjRepresent::HcalDataContainer< Items, Item >::HOvalContainer
private
template<class Items , class Item >
tHcalValCont HcalObjRepresent::HcalDataContainer< Items, Item >::HTvalContainer
private
template<class Items , class Item >
std::shared_ptr<Items> HcalObjRepresent::HcalDataContainer< Items, Item >::payload_
private
template<class Items , class Item >
std::string HcalObjRepresent::HcalDataContainer< Items, Item >::PlotMode_
private
template<class Items , class Item >
unsigned int HcalObjRepresent::HcalDataContainer< Items, Item >::run_
private
template<class Items , class Item >
std::map<std::string,int> HcalObjRepresent::HcalDataContainer< Items, Item >::subDetDepths_
private
template<class Items , class Item >
std::string HcalObjRepresent::HcalDataContainer< Items, Item >::TopoMode_
private
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 434 of file HcalObjRepresent.h.

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

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