CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HcalQLPlotHistoMgr Class Reference

#include <HcalQLPlotHistoMgr.h>

Public Types

enum  EventType {
  UNKNOWN =0, PEDESTAL =1, LED =2, LASER =3,
  BEAM =4
}
 
enum  HistType { ENERGY =0, TIME =1, PULSE =2, ADC =3 }
 

Public Member Functions

TH1 * GetAHistogram (const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
 
TH1 * GetAHistogram (const HcalCalibDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
 
 HcalQLPlotHistoMgr (TDirectory *parent, const edm::ParameterSet &histoParams)
 

Static Public Member Functions

static std::string nameForEvent (EventType et)
 
static std::string nameForFlavor (HistType ht)
 

Private Member Functions

TH1 * GetAHistogramImpl (const char *name, HistType ht, EventType et)
 

Private Attributes

TDirectory * beamHistDir
 
TDirectory * ctrHistDir
 
edm::ParameterSet histoParams_
 
TDirectory * laserHistDir
 
TDirectory * ledHistDir
 
TDirectory * otherHistDir
 
TDirectory * pedHistDir
 

Detailed Description

Definition at line 12 of file HcalQLPlotHistoMgr.h.

Member Enumeration Documentation

Enumerator
ENERGY 
TIME 
PULSE 
ADC 

Definition at line 14 of file HcalQLPlotHistoMgr.h.

Constructor & Destructor Documentation

HcalQLPlotHistoMgr::HcalQLPlotHistoMgr ( TDirectory *  parent,
const edm::ParameterSet histoParams 
)

Definition at line 15 of file HcalQLPlotHistoMgr.cc.

References beamHistDir, histoParams_, laserHistDir, ledHistDir, otherHistDir, and pedHistDir.

16  {
17  pedHistDir=parent->mkdir("PEDESTAL");
18  ledHistDir=parent->mkdir("LED");
19  laserHistDir=parent->mkdir("LASER");
20  beamHistDir=parent->mkdir("BEAM");
21  otherHistDir=parent->mkdir("OTHER");
22  histoParams_ = histoParams;
23 }
edm::ParameterSet histoParams_
TDirectory * beamHistDir
TDirectory * laserHistDir
TDirectory * otherHistDir

Member Function Documentation

TH1 * HcalQLPlotHistoMgr::GetAHistogram ( const HcalDetId id,
const HcalElectronicsId eid,
HistType  ht,
EventType  et 
)

Definition at line 45 of file HcalQLPlotHistoMgr.cc.

References HcalElectronicsId::dccid(), HcalElectronicsId::fiberChanId(), HcalElectronicsId::fiberIndex(), GetAHistogramImpl(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalElectronicsId::htrSlot(), HcalElectronicsId::htrTopBottom(), dataset::name, nameForFlavor(), HcalElectronicsId::readoutVMECrateId(), HcalElectronicsId::spigot(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by HcalQLPlotAnalAlgos::processDigi(), and HcalQLPlotAnalAlgos::processRH().

48 {
49  std::string flavor=nameForFlavor(ht);
50 
51  char name[120];
52 
53  std::string subdetStr;
54  switch (id.subdet()) {
55  case (HcalBarrel) : subdetStr="HB"; break;
56  case (HcalEndcap) : subdetStr="HE"; break;
57  case (HcalOuter) : subdetStr="HO"; break;
58  case (HcalForward) : subdetStr="HF"; break;
59  default: subdetStr="Other"; break;
60  }
61 
62  sprintf(name,"%s_%s_%d_%d_%d_eid=%d_%d_%d_%d_HTR_%d:%d%c",
63  flavor.c_str(),subdetStr.c_str(),id.ieta(),id.iphi(),id.depth(),
64  eid.dccid(),eid.spigot(), eid.fiberIndex(), eid.fiberChanId(),
65  eid.readoutVMECrateId(), eid.htrSlot(),(eid.htrTopBottom()==1)?('t'):('b') );
66 
67  return GetAHistogramImpl(name,ht,et);
68 }
constexpr int dccid() const
get the (Hcal local) DCC id for VME, crate number for uTCA
static std::string nameForFlavor(HistType ht)
constexpr int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom), valid for VME
constexpr int htrSlot() const
get the htr slot
constexpr int readoutVMECrateId() const
get the readout VME crate number
constexpr int spigot() const
get the spigot (input number on DCC, AMC card number for uTCA)
constexpr int fiberIndex() const
get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zer...
TH1 * GetAHistogramImpl(const char *name, HistType ht, EventType et)
et
define resolution functions of each parameter
constexpr int fiberChanId() const
get the fiber channel id (which of channels on a fiber)
TH1 * HcalQLPlotHistoMgr::GetAHistogram ( const HcalCalibDetId id,
const HcalElectronicsId eid,
HistType  ht,
EventType  et 
)

Definition at line 70 of file HcalQLPlotHistoMgr.cc.

References HcalElectronicsId::dccid(), HcalElectronicsId::fiberChanId(), HcalElectronicsId::fiberIndex(), GetAHistogramImpl(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalElectronicsId::htrSlot(), HcalElectronicsId::htrTopBottom(), dataset::name, nameForFlavor(), HcalElectronicsId::readoutVMECrateId(), HcalElectronicsId::spigot(), and AlCaHLTBitMon_QueryRunRegistry::string.

73 {
74  std::string flavor=nameForFlavor(ht);
75 
76  char name[120];
77 
78  std::string subdetStr;
79  switch (id.hcalSubdet()) {
80  case (HcalBarrel) : subdetStr="HB"; break;
81  case (HcalEndcap) : subdetStr="HE"; break;
82  case (HcalOuter) : subdetStr="HO"; break;
83  case (HcalForward) : subdetStr="HF"; break;
84  default: subdetStr="Other"; break;
85  }
86 
87  std::string chanstring = id.cboxChannelString();
88  if (chanstring.empty()) {
89  chanstring = "Unknown";
90  edm::LogInfo("HcalQLPlotHistoMgr::GetAHistogram") << "Unknown calibration channel " << id.cboxChannel();
91  }
92 
93  sprintf(name,"%s_CALIB_%s_%d_%d_chan=%s_eid=%d_%d_%d_%d_HTR_%d:%d%c",
94  flavor.c_str(),subdetStr.c_str(),id.ieta(),id.iphi(),chanstring.c_str(),
95  eid.dccid(),eid.spigot(), eid.fiberIndex(), eid.fiberChanId(),
96  eid.readoutVMECrateId(), eid.htrSlot(),(eid.htrTopBottom()==1)?('t'):('b') );
97 
98  return GetAHistogramImpl(name,ht,et);
99 }
constexpr int dccid() const
get the (Hcal local) DCC id for VME, crate number for uTCA
static std::string nameForFlavor(HistType ht)
constexpr int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom), valid for VME
constexpr int htrSlot() const
get the htr slot
constexpr int readoutVMECrateId() const
get the readout VME crate number
constexpr int spigot() const
get the spigot (input number on DCC, AMC card number for uTCA)
constexpr int fiberIndex() const
get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zer...
TH1 * GetAHistogramImpl(const char *name, HistType ht, EventType et)
et
define resolution functions of each parameter
constexpr int fiberChanId() const
get the fiber channel id (which of channels on a fiber)
TH1 * HcalQLPlotHistoMgr::GetAHistogramImpl ( const char *  name,
HistType  ht,
EventType  et 
)
private

Definition at line 101 of file HcalQLPlotHistoMgr.cc.

References BEAM, BEAM_BINS, beamHistDir, create_public_pileup_plots::bins, MillePedeFileConverter_cfg::e, ENERGY, cppFunctionSkipper::exception, edm::ParameterSet::getParameter(), histoParams_, LASER, LASER_BINS, laserHistDir, LED, LED_BINS, ledHistDir, OTHER_BINS, otherHistDir, PED_BINS, PEDESTAL, pedHistDir, PULSE, PULSE_BINS, TIME, TIME_BINS, and UNKNOWN.

Referenced by GetAHistogram().

103 {
104  TDirectory* td;
105 
106  switch (et) {
107  case(PEDESTAL): td=pedHistDir; break;
108  case(LED): td=ledHistDir; break;
109  case(LASER): td=laserHistDir; break;
110  case(BEAM): td=beamHistDir; break;
111  case(UNKNOWN): td=otherHistDir; break;
112  default: td=nullptr; break;
113  }
114 
115  if (td==nullptr) {
116  printf("Unknown %d !\n", et);
117  return nullptr;
118  }
119 
120  TH1* retval=nullptr;
121 
122  retval=(TH1*)td->Get(name);
123  int bins=0; double lo=0, hi=0;
124 
125  // If the histogram doesn't exist and we are authorized,
126  // create it!
127  //
128  if (retval==nullptr) {
129  td->cd();
130  switch (ht) {
131  case(ENERGY): {
132  switch (et) {
133  case(PEDESTAL):
134  bins=PED_BINS;
135  try {
136  lo=histoParams_.getParameter<double>("pedGeVlo");
137  hi=histoParams_.getParameter<double>("pedGeVhi");
138  } catch (std::exception& e) { // can't find it!
139  edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) pedGeVlo/hi not found.";
140  throw e;
141  }
142  break;
143  case(LED):
144  bins=LED_BINS;
145  try {
146  lo=histoParams_.getParameter<double>("ledGeVlo");
147  hi=histoParams_.getParameter<double>("ledGeVhi");
148  } catch (std::exception& e) { // can't find it!
149  edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) ledGeVlo/hi not found.";
150  throw e;
151  }
152  break;
153  case(LASER):
154  bins=LASER_BINS;
155  try {
156  lo=histoParams_.getParameter<double>("laserGeVlo");
157  hi=histoParams_.getParameter<double>("laserGeVhi");
158  } catch (std::exception& e) { // can't find it!
159  edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) laserGeVlo/hi not found.";
160  throw e;
161  }
162  break;
163  case(BEAM):
164  bins=BEAM_BINS;
165  try {
166  lo=histoParams_.getParameter<double>("beamGeVlo");
167  hi=histoParams_.getParameter<double>("beamGeVhi");
168  } catch (std::exception& e) { // can't find it!
169  edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) beamGeVlo/hi not found.";
170  throw e;
171  }
172  break;
173  case(UNKNOWN):
174  bins=OTHER_BINS;
175  try {
176  lo=histoParams_.getParameter<double>("otherGeVlo");
177  hi=histoParams_.getParameter<double>("otherGeVhi");
178  } catch (std::exception& e) { // can't find it!
179  edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) otherGeVlo/hi not found.";
180  throw e;
181  }
182  break;
183  default: break;
184  };
185  }
186  break;
187  case(TIME):
188  bins=TIME_BINS;
189  try {
190  lo=histoParams_.getParameter<double>("timeNSlo");
191  hi=histoParams_.getParameter<double>("timeNShi");
192  } catch (std::exception& e) { // can't find it!
193  edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) timeNSlo/hi not found.";
194  throw e;
195  }
196  break;
197  case(PULSE):
198  bins=PULSE_BINS;
199  lo=-0.5;
200  hi=PULSE_BINS-0.5;
201  break;
202  case(ADC):
203  bins=PED_BINS;
204  try {
205  lo=histoParams_.getParameter<double>("pedADClo");
206  hi=histoParams_.getParameter<double>("pedADChi");
207  } catch (std::exception& e) { // can't find it!
208  edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) pedADClo/hi not found.";
209  throw e;
210  }
211  break;
212  }
213 
214  if (bins>0){
215  if (ht==PULSE){
216  retval=new TProfile(name,name,bins,lo,hi);
217  retval->GetXaxis()->SetTitle("TimeSlice(25ns)");
218  retval->GetYaxis()->SetTitle("fC");
219  }
220  else if (ht==TIME){
221  retval=new TH1F(name,name,bins,lo,hi);
222  retval->GetXaxis()->SetTitle("Timing(ns)");
223  }
224  else if (ht==ENERGY){
225  retval=new TH1F(name,name,bins,lo,hi);
226  retval->GetXaxis()->SetTitle("Energy(GeV)");
227  }
228  else if (ht==ADC){
229  retval=new TH1F(name,name,bins,lo,hi);
230  retval->GetXaxis()->SetTitle("ADC Counts");
231  }
232  }
233  }
234 
235  return retval;
236 }
T getParameter(std::string const &) const
static const int TIME_BINS
static const int BEAM_BINS
static const int OTHER_BINS
edm::ParameterSet histoParams_
static const int LED_BINS
TDirectory * beamHistDir
TDirectory * laserHistDir
static const int PULSE_BINS
static const int LASER_BINS
et
define resolution functions of each parameter
static const int PED_BINS
TDirectory * otherHistDir
std::string HcalQLPlotHistoMgr::nameForEvent ( EventType  et)
static

Definition at line 35 of file HcalQLPlotHistoMgr.cc.

References BEAM, LASER, LED, and PEDESTAL.

35  {
36  switch(et) {
37  case(PEDESTAL): return "Pedestal"; break;
38  case(LED): return "LED"; break;
39  case(LASER): return "Laser"; break;
40  case(BEAM): return "Beam"; break;
41  default: return "Other"; break;
42  }
43 }
et
define resolution functions of each parameter
std::string HcalQLPlotHistoMgr::nameForFlavor ( HistType  ht)
static

Definition at line 25 of file HcalQLPlotHistoMgr.cc.

References ENERGY, PULSE, and TIME.

Referenced by GetAHistogram().

25  {
26  switch (ht) {
27  case(ENERGY): return "Energy"; break;
28  case(TIME): return "Time"; break;
29  case(PULSE): return "Pulse"; break;
30  case(ADC): return "ADC"; break;
31  default: return ""; break;
32  }
33 }

Member Data Documentation

TDirectory* HcalQLPlotHistoMgr::beamHistDir
private

Definition at line 34 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().

TDirectory* HcalQLPlotHistoMgr::ctrHistDir
private

Definition at line 35 of file HcalQLPlotHistoMgr.h.

edm::ParameterSet HcalQLPlotHistoMgr::histoParams_
private

Definition at line 37 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().

TDirectory* HcalQLPlotHistoMgr::laserHistDir
private

Definition at line 33 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().

TDirectory* HcalQLPlotHistoMgr::ledHistDir
private

Definition at line 32 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().

TDirectory* HcalQLPlotHistoMgr::otherHistDir
private

Definition at line 36 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().

TDirectory* HcalQLPlotHistoMgr::pedHistDir
private

Definition at line 31 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().