CMS 3D CMS Logo

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