test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ElectronicsQuantity.h
Go to the documentation of this file.
1 #ifndef ElectronicsQuantity_h
2 #define ElectronicsQauntity_h
3 
10 #include "boost/unordered_map.hpp"
11 #include "boost/foreach.hpp"
12 
13 namespace hcaldqm
14 {
15  using namespace constants;
16  namespace quantity
17  {
19  {
20  fFED = 0,
21  fFEDuTCA = 1,
22  fFEDVME = 2,
23  fCrate = 3,
25  fCrateVME = 5,
26  fSlotuTCA = 6,
27  fSlotVME = 7,
28  fSpigot = 8,
30  fFiberVME = 10,
31  fFiberCh = 11,
32 
33  // Complex Quantities
38 
39  // Adding Trigger Quantities for VME
40  fSLB = 16,
41  fSLBCh = 17,
42  fSLBSLBCh = 18,
43 
44  // Adding Trigger Quantities for uTCA
48 
50  };
51 
52  int getValue_FED(HcalElectronicsId const&);
68  int getValue_SLB(HcalElectronicsId const&);
74  uint32_t getBin_FED(HcalElectronicsId const&);
75  uint32_t getBin_FEDuTCA(HcalElectronicsId const&);
76  uint32_t getBin_FEDVME(HcalElectronicsId const&);
77  uint32_t getBin_Crate(HcalElectronicsId const&);
78  uint32_t getBin_CrateuTCA(HcalElectronicsId const&);
79  uint32_t getBin_CrateVME(HcalElectronicsId const&);
80  uint32_t getBin_SlotuTCA(HcalElectronicsId const&);
81  uint32_t getBin_SlotVME(HcalElectronicsId const&);
82  uint32_t getBin_Spigot(HcalElectronicsId const&);
83  uint32_t getBin_FiberuTCA(HcalElectronicsId const&);
84  uint32_t getBin_FiberVME(HcalElectronicsId const&);
85  uint32_t getBin_FiberCh(HcalElectronicsId const&);
86  uint32_t getBin_FEDuTCASlot(HcalElectronicsId const&);
87  uint32_t getBin_FEDVMESpigot(HcalElectronicsId const&);
90  uint32_t getBin_SLB(HcalElectronicsId const&);
91  uint32_t getBin_SLBCh(HcalElectronicsId const&);
92  uint32_t getBin_SLBSLBCh(HcalElectronicsId const&);
93  uint32_t getBin_FiberuTCATP(HcalElectronicsId const&);
94  uint32_t getBin_FiberChuTCATP(HcalElectronicsId const&);
118  std::vector<std::string> getLabels_FED();
119  std::vector<std::string> getLabels_FEDuTCA();
120  std::vector<std::string> getLabels_FEDVME();
121  std::vector<std::string> getLabels_Crate();
122  std::vector<std::string> getLabels_CrateuTCA();
123  std::vector<std::string> getLabels_CrateVME();
124  std::vector<std::string> getLabels_SlotuTCA();
125  std::vector<std::string> getLabels_SlotVME();
126  std::vector<std::string> getLabels_Spigot();
127  std::vector<std::string> getLabels_FiberuTCA();
128  std::vector<std::string> getLabels_FiberVME();
129  std::vector<std::string> getLabels_FiberCh();
130  std::vector<std::string> getLabels_FEDuTCASlot();
131  std::vector<std::string> getLabels_FEDVMESpigot();
132  std::vector<std::string> getLabels_FiberuTCAFiberCh();
133  std::vector<std::string> getLabels_FiberVMEFiberCh();
134  std::vector<std::string> getLabels_SLB();
135  std::vector<std::string> getLabels_SLBCh();
136  std::vector<std::string> getLabels_SLBSLBCh();
137  std::vector<std::string> getLabels_FiberuTCATP();
138  std::vector<std::string> getLabels_FiberChuTCATP();
139  std::vector<std::string> getLabels_FiberuTCATPFiberChuTCATP();
140 
141  typedef int(*getValueType_eid)(HcalElectronicsId const&);
142  typedef uint32_t (*getBinType_eid)(HcalElectronicsId const&);
143  typedef HcalElectronicsId (*getEid_eid)(int);
144  typedef std::vector<std::string> (*getLabels_eid)();
146  = {
157  };
169  };
181  };
183  {
194  };
196  "FED", "FEDuTCA", "FEDVME",
197  "Crate", "CrateuTCA", "CrateVME",
198  "SlotuTCA", "SlotVME",
199  "Spigot",
200  "FiberuTCA", "FiberVME",
201  "FiberCh",
202  "FEDuTCASlot", "FEDVMESpigot",
203  "FiberuTCAFiberCh", "FiberVMEFiberCh",
204  "SLB", "SLBCh", "SLB-SLBCh",
205  "TPFiber", "TPFiberCh",
206  "TPF-TPFCh"
207  };
209  0, 0, 0,
210  0, 0, 0,
211  0, 0,
212  0,
213  0, 0,
214  0,
215  0, 0,
216  0, 0,
217  0, 0, 0,
218  0, 0,
219  0
220  };
225  SPIGOT_NUM,
227  FIBERCH_NUM,
228  FED_uTCA_NUM*SLOT_uTCA_NUM, FED_VME_NUM*SPIGOT_NUM,
229  FIBER_uTCA_NUM*FIBERCH_NUM, FIBER_VME_NUM*FIBERCH_NUM,
230  SLB_NUM, SLBCH_NUM, SLB_NUM*SLBCH_NUM,
232  TPFIBER_NUM*TPFIBERCH_NUM
233  };
238  SPIGOT_NUM,
240  FIBERCH_NUM,
241  FED_uTCA_NUM*SLOT_uTCA_NUM, FED_VME_NUM*SPIGOT_NUM,
242  FIBER_uTCA_NUM*FIBERCH_NUM, FIBER_VME_NUM*FIBERCH_NUM,
243  SLB_NUM, SLBCH_NUM, SLB_NUM*SLBCH_NUM,
245  TPFIBER_NUM*TPFIBERCH_NUM
246  };
247 
249  {
250  public:
253  bool isLog=false) :
254  Quantity(name_eid[type], isLog), _type(type)
255  {}
256  virtual ~ElectronicsQuantity() {}
258  {return new ElectronicsQuantity(_type, _isLog);}
259 
260  virtual int getValue(HcalElectronicsId const& eid)
261  {return getValue_functions_eid[_type](eid);}
262  virtual uint32_t getBin(HcalElectronicsId const& eid)
263  {return getBin_functions_eid[_type](eid);}
264 
266  virtual int nbins() {return nbins_eid[_type];}
267  virtual double min() {return min_eid[_type];}
268  virtual double max() {return max_eid[_type];}
269  virtual bool isCoordinate() {return true;}
270  virtual std::vector<std::string> getLabels()
271  {return getLabels_functions_eid[_type]();}
272 
273  protected:
275  };
276 
277  // sorted list of FEDs you want to have on the axis
279  {
280  public:
282  FEDQuantity(std::vector<int> const& vFEDs) :
284  {this->setup(vFEDs);}
285  virtual ~FEDQuantity() {}
286 
287  virtual void setup(std::vector<int> const& vFEDs);
288  virtual int getValue(HcalElectronicsId const&);
289  virtual uint32_t getBin(HcalElectronicsId const&);
290 
291  virtual int nbins() {return _feds.size();}
292  virtual double min() {return 0;}
293  virtual double max() {return _feds.size();}
294  virtual std::vector<std::string> getLabels();
295 
296  protected:
297  typedef boost::unordered_map<int, uint32_t> FEDMap;
299 
300  public:
302  {
303  std::vector<int> vfeds;
304  BOOST_FOREACH(FEDMap::value_type &p, _feds)
305  {
306  vfeds.push_back(p.first);
307  }
308 
309  // MUST SORT BEFORE EXITING!
310  std::sort(vfeds.begin(), vfeds.end());
311  return new FEDQuantity(vfeds);
312  }
313  };
314  }
315 }
316 
317 #endif
getBinType_eid const getBin_functions_eid[nElectronicsQuantityType]
std::vector< std::string > getLabels_Crate()
std::vector< std::string > getLabels_Spigot()
type
Definition: HCALResponse.h:21
HcalElectronicsId getEid_FEDuTCASlot(int)
double const max_eid[nElectronicsQuantityType]
uint32_t getBin_SlotuTCA(HcalElectronicsId const &)
HcalElectronicsId getEid_SLB(int)
uint32_t getBin_SLBSLBCh(HcalElectronicsId const &)
HcalElectronicsId getEid_FiberuTCAFiberCh(int)
int const TPFIBER_NUM
Definition: Constants.h:111
std::vector< std::string > getLabels_FED()
int const FIBERCH_NUM
Definition: Constants.h:102
std::vector< std::string >(* getLabels_eid)()
virtual uint32_t getBin(HcalElectronicsId const &eid)
int getValue_FiberChuTCATP(HcalElectronicsId const &)
virtual std::vector< std::string > getLabels()
int getValue_FED(HcalElectronicsId const &)
uint32_t(* getBinType_eid)(HcalElectronicsId const &)
uint32_t getBin_CrateuTCA(HcalElectronicsId const &)
int getValue_SLBSLBCh(HcalElectronicsId const &)
int getValue_SlotVME(HcalElectronicsId const &)
int getValue_Spigot(HcalElectronicsId const &)
HcalElectronicsId getEid_FiberuTCA(int)
std::vector< std::string > getLabels_SlotVME()
uint32_t getBin_FiberuTCAFiberCh(HcalElectronicsId const &)
virtual int getValue(HcalElectronicsId const &eid)
int const CRATE_uTCA_NUM
Definition: Constants.h:68
std::vector< std::string > getLabels_FiberChuTCATP()
uint32_t getBin_FiberVMEFiberCh(HcalElectronicsId const &)
int getValue_FiberuTCATP(HcalElectronicsId const &)
HcalElectronicsId getEid_SlotVME(int)
uint32_t getBin_FEDVME(HcalElectronicsId const &)
uint32_t getBin_FiberuTCATP(HcalElectronicsId const &)
uint32_t getBin_FiberChuTCATP(HcalElectronicsId const &)
std::vector< std::string > getLabels_FiberVMEFiberCh()
int getValue_FiberVME(HcalElectronicsId const &)
uint32_t getBin_FEDuTCASlot(HcalElectronicsId const &)
getValueType_eid const getValue_functions_eid[nElectronicsQuantityType]
double const min_eid[nElectronicsQuantityType]
HcalElectronicsId getEid_CrateVME(int)
std::vector< std::string > getLabels_FiberuTCATPFiberChuTCATP()
std::vector< std::string > getLabels_SLB()
int const SLOT_VME_NUM
Definition: Constants.h:83
int const nbins_eid[nElectronicsQuantityType]
std::vector< std::string > getLabels_FEDuTCA()
HcalElectronicsId getEid_SLBCh(int)
HcalElectronicsId getEid_SlotuTCA(int)
FEDQuantity(std::vector< int > const &vFEDs)
HcalElectronicsId getEid_Spigot(int)
int getValue_SLBCh(HcalElectronicsId const &)
std::vector< std::string > getLabels_FEDVME()
HcalElectronicsId getEid_FiberVME(int)
virtual ElectronicsQuantity * makeCopy()
int getValue_FiberCh(HcalElectronicsId const &)
ElectronicsQuantity(ElectronicsQuantityType type, bool isLog=false)
uint32_t getBin_SLB(HcalElectronicsId const &)
HcalElectronicsId getEid_FiberuTCATPFiberChuTCATP(int)
HcalElectronicsId getEid_FEDuTCA(int)
std::vector< std::string > getLabels_CrateuTCA()
uint32_t getBin_FiberVME(HcalElectronicsId const &)
int getValue_Crate(HcalElectronicsId const &)
int const CRATE_TOTAL_NUM
Definition: Constants.h:69
std::vector< std::string > getLabels_SlotuTCA()
int getValue_CrateuTCA(HcalElectronicsId const &)
int getValue_FEDVME(HcalElectronicsId const &)
std::vector< std::string > getLabels_FiberuTCATP()
HcalElectronicsId getEid_FEDVMESpigot(int)
uint32_t getBin_FED(HcalElectronicsId const &)
int const SLB_NUM
Definition: Constants.h:107
HcalElectronicsId getEid_FiberVMEFiberCh(int)
uint32_t getBin_SlotVME(HcalElectronicsId const &)
int const SLBCH_NUM
Definition: Constants.h:115
int getBin(double x, std::vector< double > boundaries)
Definition: Utilities.h:512
HcalElectronicsId(* getEid_eid)(int)
int const FIBER_VME_NUM
Definition: Constants.h:92
uint32_t getBin_FEDuTCA(HcalElectronicsId const &)
int const FIBER_uTCA_NUM
Definition: Constants.h:97
uint32_t getBin_CrateVME(HcalElectronicsId const &)
int getValue_FiberuTCAFiberCh(HcalElectronicsId const &)
std::vector< std::string > getLabels_FiberVME()
std::vector< std::string > getLabels_FiberCh()
getLabels_eid const getLabels_functions_eid[nElectronicsQuantityType]
int const SPIGOT_NUM
Definition: Constants.h:87
int getValue_CrateVME(HcalElectronicsId const &)
int const FED_uTCA_NUM
Definition: Constants.h:55
std::vector< std::string > getLabels_FEDVMESpigot()
int getValue_SlotuTCA(HcalElectronicsId const &)
virtual FEDQuantity * makeCopy()
int const FED_VME_NUM
Definition: Constants.h:50
std::vector< std::string > getLabels_FEDuTCASlot()
int const CRATE_VME_NUM
Definition: Constants.h:63
int getValue_FiberVMEFiberCh(HcalElectronicsId const &)
uint32_t getBin_SLBCh(HcalElectronicsId const &)
uint32_t getBin_Spigot(HcalElectronicsId const &)
int getValue_FEDVMESpigot(HcalElectronicsId const &)
std::vector< std::string > getLabels_SLBCh()
int getValue_FEDuTCA(HcalElectronicsId const &)
HcalElectronicsId getEid_FiberCh(int)
int const SLOT_uTCA_NUM
Definition: Constants.h:75
HcalElectronicsId getEid_FiberChuTCATP(int)
HcalElectronicsId getEid_FED(int)
int getValue_FiberuTCATPFiberChuTCATP(HcalElectronicsId const &)
std::string const name_eid[nElectronicsQuantityType]
std::vector< std::string > getLabels_FiberuTCA()
std::vector< std::string > getLabels_CrateVME()
int const FED_TOTAL_NUM
Definition: Constants.h:57
uint32_t getBin_FiberCh(HcalElectronicsId const &)
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
uint32_t getBin_Crate(HcalElectronicsId const &)
uint32_t getBin_FEDVMESpigot(HcalElectronicsId const &)
int getValue_FEDuTCASlot(HcalElectronicsId const &)
uint32_t getBin_FiberuTCA(HcalElectronicsId const &)
HcalElectronicsId getEid_CrateuTCA(int)
volatile std::atomic< bool > shutdown_flag false
uint32_t getBin_FiberuTCATPFiberChuTCATP(HcalElectronicsId const &)
int getValue_SLB(HcalElectronicsId const &)
int const TPFIBERCH_NUM
Definition: Constants.h:119
int(* getValueType_eid)(HcalElectronicsId const &)
HcalElectronicsId getEid_Crate(int)
HcalElectronicsId getEid_FiberuTCATP(int)
Readout chain identification for Hcal.
boost::unordered_map< int, uint32_t > FEDMap
HcalElectronicsId getEid_SLBSLBCh(int)
int getValue_FiberuTCA(HcalElectronicsId const &)
HcalElectronicsId getEid_FEDVME(int)
getEid_eid const getEid_functions_eid[nElectronicsQuantityType]
std::vector< std::string > getLabels_SLBSLBCh()
std::vector< std::string > getLabels_FiberuTCAFiberCh()