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.

15  {
16  pedHistDir = parent->mkdir("PEDESTAL");
17  ledHistDir = parent->mkdir("LED");
18  laserHistDir = parent->mkdir("LASER");
19  beamHistDir = parent->mkdir("BEAM");
20  otherHistDir = parent->mkdir("OTHER");
21  histoParams_ = histoParams;
22 }
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 64 of file HcalQLPlotHistoMgr.cc.

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

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

64  {
65  std::string flavor = nameForFlavor(ht);
66 
67  char name[120];
68 
69  std::string subdetStr;
70  switch (id.subdet()) {
71  case (HcalBarrel):
72  subdetStr = "HB";
73  break;
74  case (HcalEndcap):
75  subdetStr = "HE";
76  break;
77  case (HcalOuter):
78  subdetStr = "HO";
79  break;
80  case (HcalForward):
81  subdetStr = "HF";
82  break;
83  default:
84  subdetStr = "Other";
85  break;
86  }
87 
88  sprintf(name,
89  "%s_%s_%d_%d_%d_eid=%d_%d_%d_%d_HTR_%d:%d%c",
90  flavor.c_str(),
91  subdetStr.c_str(),
92  id.ieta(),
93  id.iphi(),
94  id.depth(),
95  eid.dccid(),
96  eid.spigot(),
97  eid.fiberIndex(),
98  eid.fiberChanId(),
99  eid.readoutVMECrateId(),
100  eid.htrSlot(),
101  (eid.htrTopBottom() == 1) ? ('t') : ('b'));
102 
103  return GetAHistogramImpl(name, ht, et);
104 }
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)
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 106 of file HcalQLPlotHistoMgr.cc.

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

109  {
110  std::string flavor = nameForFlavor(ht);
111 
112  char name[120];
113 
114  std::string subdetStr;
115  switch (id.hcalSubdet()) {
116  case (HcalBarrel):
117  subdetStr = "HB";
118  break;
119  case (HcalEndcap):
120  subdetStr = "HE";
121  break;
122  case (HcalOuter):
123  subdetStr = "HO";
124  break;
125  case (HcalForward):
126  subdetStr = "HF";
127  break;
128  default:
129  subdetStr = "Other";
130  break;
131  }
132 
133  std::string chanstring = id.cboxChannelString();
134  if (chanstring.empty()) {
135  chanstring = "Unknown";
136  edm::LogInfo("HcalQLPlotHistoMgr::GetAHistogram") << "Unknown calibration channel " << id.cboxChannel();
137  }
138 
139  sprintf(name,
140  "%s_CALIB_%s_%d_%d_chan=%s_eid=%d_%d_%d_%d_HTR_%d:%d%c",
141  flavor.c_str(),
142  subdetStr.c_str(),
143  id.ieta(),
144  id.iphi(),
145  chanstring.c_str(),
146  eid.dccid(),
147  eid.spigot(),
148  eid.fiberIndex(),
149  eid.fiberChanId(),
150  eid.readoutVMECrateId(),
151  eid.htrSlot(),
152  (eid.htrTopBottom() == 1) ? ('t') : ('b'));
153 
154  return GetAHistogramImpl(name, ht, et);
155 }
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)
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 157 of file HcalQLPlotHistoMgr.cc.

References BEAM, BEAM_BINS, beamHistDir, trigObjTnPSource_cfi::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().

157  {
158  TDirectory* td;
159 
160  switch (et) {
161  case (PEDESTAL):
162  td = pedHistDir;
163  break;
164  case (LED):
165  td = ledHistDir;
166  break;
167  case (LASER):
168  td = laserHistDir;
169  break;
170  case (BEAM):
171  td = beamHistDir;
172  break;
173  case (UNKNOWN):
174  td = otherHistDir;
175  break;
176  default:
177  td = nullptr;
178  break;
179  }
180 
181  if (td == nullptr) {
182  printf("Unknown %d !\n", et);
183  return nullptr;
184  }
185 
186  TH1* retval = nullptr;
187 
188  retval = (TH1*)td->Get(name);
189  int bins = 0;
190  double lo = 0, hi = 0;
191 
192  // If the histogram doesn't exist and we are authorized,
193  // create it!
194  //
195  if (retval == nullptr) {
196  td->cd();
197  switch (ht) {
198  case (ENERGY): {
199  switch (et) {
200  case (PEDESTAL):
201  bins = PED_BINS;
202  try {
203  lo = histoParams_.getParameter<double>("pedGeVlo");
204  hi = histoParams_.getParameter<double>("pedGeVhi");
205  } catch (std::exception& e) { // can't find it!
206  edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) pedGeVlo/hi not found.";
207  throw e;
208  }
209  break;
210  case (LED):
211  bins = LED_BINS;
212  try {
213  lo = histoParams_.getParameter<double>("ledGeVlo");
214  hi = histoParams_.getParameter<double>("ledGeVhi");
215  } catch (std::exception& e) { // can't find it!
216  edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) ledGeVlo/hi not found.";
217  throw e;
218  }
219  break;
220  case (LASER):
221  bins = LASER_BINS;
222  try {
223  lo = histoParams_.getParameter<double>("laserGeVlo");
224  hi = histoParams_.getParameter<double>("laserGeVhi");
225  } catch (std::exception& e) { // can't find it!
226  edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) laserGeVlo/hi not found.";
227  throw e;
228  }
229  break;
230  case (BEAM):
231  bins = BEAM_BINS;
232  try {
233  lo = histoParams_.getParameter<double>("beamGeVlo");
234  hi = histoParams_.getParameter<double>("beamGeVhi");
235  } catch (std::exception& e) { // can't find it!
236  edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) beamGeVlo/hi not found.";
237  throw e;
238  }
239  break;
240  case (UNKNOWN):
241  bins = OTHER_BINS;
242  try {
243  lo = histoParams_.getParameter<double>("otherGeVlo");
244  hi = histoParams_.getParameter<double>("otherGeVhi");
245  } catch (std::exception& e) { // can't find it!
246  edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) otherGeVlo/hi not found.";
247  throw e;
248  }
249  break;
250  default:
251  break;
252  };
253  } break;
254  case (TIME):
255  bins = TIME_BINS;
256  try {
257  lo = histoParams_.getParameter<double>("timeNSlo");
258  hi = histoParams_.getParameter<double>("timeNShi");
259  } catch (std::exception& e) { // can't find it!
260  edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) timeNSlo/hi not found.";
261  throw e;
262  }
263  break;
264  case (PULSE):
265  bins = PULSE_BINS;
266  lo = -0.5;
267  hi = PULSE_BINS - 0.5;
268  break;
269  case (ADC):
270  bins = PED_BINS;
271  try {
272  lo = histoParams_.getParameter<double>("pedADClo");
273  hi = histoParams_.getParameter<double>("pedADChi");
274  } catch (std::exception& e) { // can't find it!
275  edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) pedADClo/hi not found.";
276  throw e;
277  }
278  break;
279  }
280 
281  if (bins > 0) {
282  if (ht == PULSE) {
283  retval = new TProfile(name, name, bins, lo, hi);
284  retval->GetXaxis()->SetTitle("TimeSlice(25ns)");
285  retval->GetYaxis()->SetTitle("fC");
286  } else if (ht == TIME) {
287  retval = new TH1F(name, name, bins, lo, hi);
288  retval->GetXaxis()->SetTitle("Timing(ns)");
289  } else if (ht == ENERGY) {
290  retval = new TH1F(name, name, bins, lo, hi);
291  retval->GetXaxis()->SetTitle("Energy(GeV)");
292  } else if (ht == ADC) {
293  retval = new TH1F(name, name, bins, lo, hi);
294  retval->GetXaxis()->SetTitle("ADC Counts");
295  }
296  }
297  }
298 
299  return retval;
300 }
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
static const int PED_BINS
TDirectory * otherHistDir
std::string HcalQLPlotHistoMgr::nameForEvent ( EventType  et)
static

Definition at line 44 of file HcalQLPlotHistoMgr.cc.

References BEAM, LASER, LED, and PEDESTAL.

44  {
45  switch (et) {
46  case (PEDESTAL):
47  return "Pedestal";
48  break;
49  case (LED):
50  return "LED";
51  break;
52  case (LASER):
53  return "Laser";
54  break;
55  case (BEAM):
56  return "Beam";
57  break;
58  default:
59  return "Other";
60  break;
61  }
62 }
std::string HcalQLPlotHistoMgr::nameForFlavor ( HistType  ht)
static

Definition at line 24 of file HcalQLPlotHistoMgr.cc.

References ENERGY, PULSE, and TIME.

Referenced by GetAHistogram().

24  {
25  switch (ht) {
26  case (ENERGY):
27  return "Energy";
28  break;
29  case (TIME):
30  return "Time";
31  break;
32  case (PULSE):
33  return "Pulse";
34  break;
35  case (ADC):
36  return "ADC";
37  break;
38  default:
39  return "";
40  break;
41  }
42 }

Member Data Documentation

TDirectory* HcalQLPlotHistoMgr::beamHistDir
private

Definition at line 31 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().

TDirectory* HcalQLPlotHistoMgr::ctrHistDir
private

Definition at line 32 of file HcalQLPlotHistoMgr.h.

edm::ParameterSet HcalQLPlotHistoMgr::histoParams_
private

Definition at line 34 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().

TDirectory* HcalQLPlotHistoMgr::laserHistDir
private

Definition at line 30 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().

TDirectory* HcalQLPlotHistoMgr::ledHistDir
private

Definition at line 29 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().

TDirectory* HcalQLPlotHistoMgr::otherHistDir
private

Definition at line 33 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().

TDirectory* HcalQLPlotHistoMgr::pedHistDir
private

Definition at line 28 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().