CMS 3D CMS Logo

HcalHPDRBXMap.h
Go to the documentation of this file.
1 #ifndef _RECOMET_METALGORITHMS_HCALHPDRBXMAP_H_
2 #define _RECOMET_METALGORITHMS_HCALHPDRBXMAP_H_
3 
4 //
5 // HcalHPDRBXMap.h
6 //
7 // description: Algorithm which isomorphically maps HPD/RBX locations to
8 // integers ranging from 0 to NUM_HPDS-1/NUM_RBXS-1. The HPDs/RBXs
9 // are ordered from lowest to highest: HB+, HB-, HE+, HE-.
10 // This is used extensively by the various HcalNoise container
11 // classes. The constructor and destructor are hidden, since
12 // the only methods of interest are static. All the methods
13 // here are O(1).
14 //
15 // author: J.P. Chou, Brown
16 //
17 
19 #include <vector>
20 #include <array>
21 
23 public:
24  // "magic numbers"
25  // total number of HPDs in the HB and HE
26  const static int NUM_HPDS = 288;
27  // total number of HPDs per subdetector (HB+, HB-, HE+, HE-)
28  const static int NUM_HPDS_PER_SUBDET = 72;
29  // number of HPDs per RBX
30  const static int NUM_HPDS_PER_RBX = 4;
31  // total number of RBXs in the HB and HE
32  const static int NUM_RBXS = 72;
33  // total number of RBXs per subdetector (e.g. HB+, HB-, HE+, HE-)
34  const static int NUM_RBXS_PER_SUBDET = 18;
35 
36  // access magic numbers by inline function
37  inline int static numHPDs(void) { return NUM_HPDS; }
38  inline int static numHPDsPerSubdet(void) { return NUM_HPDS_PER_SUBDET; }
39  inline int static numHPDsPerRBX(void) { return NUM_HPDS_PER_RBX; }
40  inline int static numRBXs(void) { return NUM_RBXS; }
41  inline int static numRBXsPerSubdet(void) { return NUM_RBXS_PER_SUBDET; }
42 
43  // determines whether an HPD or RBX index is valid
44  // HPDs run from [0,NUM_HPDS-1], and RBXs run from [0,NUM_RBXS-1]
45  bool static isValidHPD(int index);
46  bool static isValidRBX(int index);
47 
48  // determines whether a HcalDetId corresponds to a valid HPD/RBX
49  // this requires that the HcalDetId be in the HB or HE, does not check depth
50  bool static isValid(const HcalDetId&);
51 
52  // determines whether the ieta, iphi coordinate corresponds to a valid HPD/RBX
53  bool static isValid(int ieta, int iphi);
54 
55  // location of the HPD/RBX in the detector based on the HPD/RBX index
56  // exception is thrown if index is invalid
57  HcalSubdetector static subdetHPD(int index);
58  HcalSubdetector static subdetRBX(int index);
59  int static zsideHPD(int index);
60  int static zsideRBX(int index);
61  int static iphiloHPD(int index);
62  int static iphiloRBX(int index);
63  int static iphihiHPD(int index);
64  int static iphihiRBX(int index);
65 
66  // returns a list of HPD indices found in a given RBX
67  // exception is thrown if rbxindex is invalid
68  // HPD indices are ordered in phi-space
69  void static indicesHPDfromRBX(int rbxindex, std::array<int, NUM_HPDS_PER_RBX>& hpdindices);
70 
71  // returns the RBX index given an HPD index
72  // exception is thrown if hpdindex is invalid
73  int static indexRBXfromHPD(int hpdindex);
74 
75  // get the HPD/RBX index from an HcalDetector id
76  // throws an exception if the HcalDetID does not correspond to a valid HPD/RBX
77  int static indexHPD(const HcalDetId&);
78  int static indexRBX(const HcalDetId&);
79 
80  // get the HPD/RBX indices corresponding to an ieta, iphi coordinate
81  // throws an exception if the ieta and iphi do not correspond to a valid HPD/RBX
82  void static indexHPDfromEtaPhi(int ieta, int iphi, std::vector<int>& hpdindices);
83  void static indexRBXfromEtaPhi(int ieta, int iphi, std::vector<int>& rbxindices);
84 
85 private:
86  HcalHPDRBXMap();
88 };
89 
90 #endif
static const int NUM_HPDS_PER_RBX
Definition: HcalHPDRBXMap.h:30
static int indexRBXfromHPD(int hpdindex)
static int numRBXsPerSubdet(void)
Definition: HcalHPDRBXMap.h:41
static int numHPDsPerRBX(void)
Definition: HcalHPDRBXMap.h:39
static void indicesHPDfromRBX(int rbxindex, std::array< int, NUM_HPDS_PER_RBX > &hpdindices)
static int indexRBX(const HcalDetId &)
static HcalSubdetector subdetHPD(int index)
static void indexHPDfromEtaPhi(int ieta, int iphi, std::vector< int > &hpdindices)
static int numHPDsPerSubdet(void)
Definition: HcalHPDRBXMap.h:38
static const int NUM_HPDS_PER_SUBDET
Definition: HcalHPDRBXMap.h:28
static int iphiloRBX(int index)
static const int NUM_RBXS
Definition: HcalHPDRBXMap.h:32
static const int NUM_HPDS
Definition: HcalHPDRBXMap.h:26
static int iphiloHPD(int index)
static bool isValidRBX(int index)
static int numRBXs(void)
Definition: HcalHPDRBXMap.h:40
static const int NUM_RBXS_PER_SUBDET
Definition: HcalHPDRBXMap.h:34
static void indexRBXfromEtaPhi(int ieta, int iphi, std::vector< int > &rbxindices)
static bool isValidHPD(int index)
static int numHPDs(void)
Definition: HcalHPDRBXMap.h:37
static int zsideHPD(int index)
HcalSubdetector
Definition: HcalAssistant.h:31
static bool isValid(const HcalDetId &)
static int iphihiRBX(int index)
static HcalSubdetector subdetRBX(int index)
static int indexHPD(const HcalDetId &)
static int iphihiHPD(int index)
static int zsideRBX(int index)