Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:25:26

0001 #ifndef _RECOMET_METALGORITHMS_HCALHPDRBXMAP_H_
0002 #define _RECOMET_METALGORITHMS_HCALHPDRBXMAP_H_
0003 
0004 //

0005 // HcalHPDRBXMap.h

0006 //

0007 //   description: Algorithm which isomorphically maps HPD/RBX locations to

0008 //                integers ranging from 0 to NUM_HPDS-1/NUM_RBXS-1.  The HPDs/RBXs

0009 //                are ordered from lowest to highest: HB+, HB-, HE+, HE-.

0010 //                This is used extensively by the various HcalNoise container

0011 //                classes.  The constructor and destructor are hidden, since

0012 //                the only methods of interest are static.  All the methods

0013 //                here are O(1).

0014 //

0015 //   author: J.P. Chou, Brown

0016 //

0017 
0018 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0019 #include <vector>
0020 #include <array>
0021 
0022 class HcalHPDRBXMap {
0023 public:
0024   // "magic numbers"

0025   // total number of HPDs in the HB and HE

0026   const static int NUM_HPDS = 288;
0027   // total number of HPDs per subdetector (HB+, HB-, HE+, HE-)

0028   const static int NUM_HPDS_PER_SUBDET = 72;
0029   // number of HPDs per RBX

0030   const static int NUM_HPDS_PER_RBX = 4;
0031   // total number of RBXs in the HB and HE

0032   const static int NUM_RBXS = 72;
0033   // total number of RBXs per subdetector (e.g. HB+, HB-, HE+, HE-)

0034   const static int NUM_RBXS_PER_SUBDET = 18;
0035 
0036   // access magic numbers by inline function

0037   inline int static numHPDs(void) { return NUM_HPDS; }
0038   inline int static numHPDsPerSubdet(void) { return NUM_HPDS_PER_SUBDET; }
0039   inline int static numHPDsPerRBX(void) { return NUM_HPDS_PER_RBX; }
0040   inline int static numRBXs(void) { return NUM_RBXS; }
0041   inline int static numRBXsPerSubdet(void) { return NUM_RBXS_PER_SUBDET; }
0042 
0043   // determines whether an HPD or RBX index is valid

0044   // HPDs run from [0,NUM_HPDS-1], and RBXs run from [0,NUM_RBXS-1]

0045   bool static isValidHPD(int index);
0046   bool static isValidRBX(int index);
0047 
0048   // determines whether a HcalDetId corresponds to a valid HPD/RBX

0049   // this requires that the HcalDetId be in the HB or HE, does not check depth

0050   bool static isValid(const HcalDetId&);
0051 
0052   // determines whether the ieta, iphi coordinate corresponds to a valid HPD/RBX

0053   bool static isValid(int ieta, int iphi);
0054 
0055   // location of the HPD/RBX in the detector based on the HPD/RBX index

0056   // exception is thrown if index is invalid

0057   HcalSubdetector static subdetHPD(int index);
0058   HcalSubdetector static subdetRBX(int index);
0059   int static zsideHPD(int index);
0060   int static zsideRBX(int index);
0061   int static iphiloHPD(int index);
0062   int static iphiloRBX(int index);
0063   int static iphihiHPD(int index);
0064   int static iphihiRBX(int index);
0065 
0066   // returns a list of HPD indices found in a given RBX

0067   // exception is thrown if rbxindex is invalid

0068   // HPD indices are ordered in phi-space

0069   void static indicesHPDfromRBX(int rbxindex, std::array<int, NUM_HPDS_PER_RBX>& hpdindices);
0070 
0071   // returns the RBX index given an HPD index

0072   // exception is thrown if hpdindex is invalid

0073   int static indexRBXfromHPD(int hpdindex);
0074 
0075   // get the HPD/RBX index from an HcalDetector id

0076   // throws an exception if the HcalDetID does not correspond to a valid HPD/RBX

0077   int static indexHPD(const HcalDetId&);
0078   int static indexRBX(const HcalDetId&);
0079 
0080   // get the HPD/RBX indices corresponding to an ieta, iphi coordinate

0081   // throws an exception if the ieta and iphi do not correspond to a valid HPD/RBX

0082   void static indexHPDfromEtaPhi(int ieta, int iphi, std::vector<int>& hpdindices);
0083   void static indexRBXfromEtaPhi(int ieta, int iphi, std::vector<int>& rbxindices);
0084 
0085 private:
0086   HcalHPDRBXMap();
0087   ~HcalHPDRBXMap();
0088 };
0089 
0090 #endif