CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/RecoMET/METAlgorithms/interface/HcalHPDRBXMap.h

Go to the documentation of this file.
00001 #ifndef _RECOMET_METALGORITHMS_HCALHPDRBXMAP_H_
00002 #define _RECOMET_METALGORITHMS_HCALHPDRBXMAP_H_
00003 
00004 
00005 //
00006 // HcalHPDRBXMap.h
00007 //
00008 //   description: Algorithm which isomorphically maps HPD/RBX locations to
00009 //                integers ranging from 0 to NUM_HPDS-1/NUM_RBXS-1.  The HPDs/RBXs
00010 //                are ordered from lowest to highest: HB+, HB-, HE+, HE-.
00011 //                This is used extensively by the various HcalNoise container
00012 //                classes.  The constructor and destructor are hidden, since
00013 //                the only methods of interest are static.  All the methods
00014 //                here are O(1).
00015 //
00016 //   author: J.P. Chou, Brown
00017 //
00018 
00019 #include "boost/array.hpp"
00020 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00021 #include <vector>
00022 
00023 class HcalHPDRBXMap {
00024  public:
00025   
00026   // "magic numbers"
00027   // total number of HPDs in the HB and HE
00028   const static int NUM_HPDS=288;
00029   // total number of HPDs per subdetector (HB+, HB-, HE+, HE-)
00030   const static int NUM_HPDS_PER_SUBDET=72;
00031   // number of HPDs per RBX
00032   const static int NUM_HPDS_PER_RBX = 4;
00033   // total number of RBXs in the HB and HE
00034   const static int NUM_RBXS=72;
00035   // total number of RBXs per subdetector (e.g. HB+, HB-, HE+, HE-)
00036   const static int NUM_RBXS_PER_SUBDET=18;
00037 
00038   // access magic numbers by inline function
00039   inline int static numHPDs(void) { return NUM_HPDS; }
00040   inline int static numHPDsPerSubdet(void) { return NUM_HPDS_PER_SUBDET; }
00041   inline int static numHPDsPerRBX(void) { return NUM_HPDS_PER_RBX; }
00042   inline int static numRBXs(void) { return NUM_RBXS; }
00043   inline int static numRBXsPerSubdet(void) { return NUM_RBXS_PER_SUBDET; }
00044 
00045   // determines whether an HPD or RBX index is valid
00046   // HPDs run from [0,NUM_HPDS-1], and RBXs run from [0,NUM_RBXS-1]
00047   bool static isValidHPD(int index);
00048   bool static isValidRBX(int index);
00049   
00050   // determines whether a HcalDetId corresponds to a valid HPD/RBX
00051   // this requires that the HcalDetId be in the HB or HE, does not check depth
00052   bool static isValid(const HcalDetId&);
00053 
00054   // determines whether the ieta, iphi coordinate corresponds to a valid HPD/RBX
00055   bool static isValid(int ieta, int iphi);
00056 
00057   // location of the HPD/RBX in the detector based on the HPD/RBX index
00058   // exception is thrown if index is invalid
00059   HcalSubdetector static subdetHPD(int index);
00060   HcalSubdetector static subdetRBX(int index);
00061   int static zsideHPD(int index);
00062   int static zsideRBX(int index);
00063   int static iphiloHPD(int index);
00064   int static iphiloRBX(int index);
00065   int static iphihiHPD(int index);
00066   int static iphihiRBX(int index);
00067 
00068   // returns a list of HPD indices found in a given RBX
00069   // exception is thrown if rbxindex is invalid
00070   // HPD indices are ordered in phi-space
00071   void static indicesHPDfromRBX(int rbxindex, boost::array<int, NUM_HPDS_PER_RBX>& hpdindices);
00072 
00073   // returns the RBX index given an HPD index
00074   // exception is thrown if hpdindex is invalid
00075   int static indexRBXfromHPD(int hpdindex);
00076 
00077   // get the HPD/RBX index from an HcalDetector id
00078   // throws an exception if the HcalDetID does not correspond to a valid HPD/RBX
00079   int static indexHPD(const HcalDetId&);
00080   int static indexRBX(const HcalDetId&);
00081 
00082   // get the HPD/RBX indices corresponding to an ieta, iphi coordinate
00083   // throws an exception if the ieta and iphi do not correspond to a valid HPD/RBX
00084   void static indexHPDfromEtaPhi(int ieta, int iphi, std::vector<int>& hpdindices);
00085   void static indexRBXfromEtaPhi(int ieta, int iphi, std::vector<int>& rbxindices);
00086 
00087  private:
00088   HcalHPDRBXMap();
00089   ~HcalHPDRBXMap();
00090 
00091 };
00092 
00093 #endif