CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/RecoMuon/MuonIdentification/interface/MuonHOAcceptance.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include <vector>
00003 #include <list>
00004 #include <stdint.h>
00005 #include "FWCore/Framework/interface/EventSetup.h"
00006 
00007 class TMultiGraph;
00008 
00009 class MuonHOAcceptance {
00010  public:
00011   static bool isChannelDead(uint32_t id);
00012   static bool isChannelSiPM(uint32_t id);
00013   static bool inGeomAccept(double eta, double phi, double delta_eta = 0.,
00014                            double delta_phi = 0.);
00015   static bool inNotDeadGeom(double eta, double phi, double delta_eta = 0.,
00016                             double delta_phi = 0.);
00017   static bool inSiPMGeom(double eta, double phi, double delta_eta = 0.,
00018                          double delta_phi = 0.);
00019   static void initIds(edm::EventSetup const& eSetup);
00020   static bool Inited() { return inited; }
00021   static TMultiGraph * graphDeadRegions() { return graphRegions(deadRegions); }
00022   static TMultiGraph * graphSiPMRegions() { return graphRegions(SiPMRegions); }
00023 
00024  private:
00025 
00026   struct deadRegion {
00027     deadRegion( double eMin = 0., double eMax = 0., 
00028                 double pMin = 0., double pMax = 0. ) :
00029       etaMin(eMin), etaMax(eMax), phiMin(pMin), phiMax(pMax) { }
00030     deadRegion( deadRegion const& other ) :
00031       etaMin(other.etaMin), etaMax(other.etaMax), 
00032       phiMin(other.phiMin), phiMax(other.phiMax) { }
00033     double etaMin;
00034     double etaMax;
00035     double phiMin;
00036     double phiMax;
00037     bool operator== ( deadRegion const& other) {
00038       return ((other.etaMin==etaMin) && (other.etaMax==etaMax) &&
00039               (other.phiMin==phiMin) && (other.phiMax==phiMax));
00040     }
00041   };
00042 
00043   struct deadIdRegion {
00044     deadIdRegion( int eMin = 0, int eMax = 0, int pMin = 0, int pMax = 0 ) :
00045       etaMin(eMin), etaMax(eMax), phiMin(pMin), phiMax(pMax) { }
00046     deadIdRegion( deadIdRegion const& other ) :
00047       etaMin(other.etaMin), etaMax(other.etaMax), 
00048       phiMin(other.phiMin), phiMax(other.phiMax) { }
00049     int etaMin;
00050     int etaMax;
00051     int phiMin;
00052     int phiMax;
00053     bool operator== ( deadIdRegion const& other ) { 
00054       return ((other.etaMin==etaMin) && (other.etaMax==etaMax) &&
00055               (other.phiMin==phiMin) && (other.phiMax==phiMax));
00056     }
00057     bool sameEta (deadIdRegion const& other) {
00058       return ((other.etaMin==etaMin) && (other.etaMax==etaMax));
00059     }
00060     bool samePhi (deadIdRegion const& other) {
00061       return ((other.phiMax==phiMax) && (other.phiMin==phiMin));
00062     }
00063     bool adjacentEta (deadIdRegion const& other) {
00064       return ( (other.etaMin-1 == etaMax) || 
00065                (etaMin-1 == other.etaMax ) );
00066     }
00067     bool adjacentPhi (deadIdRegion const& other) {
00068       return ( (other.phiMin-1 == phiMax) ||
00069                (phiMin-1 == other.phiMax) );
00070     }
00071     void merge (deadIdRegion const& other);
00072   };
00073 
00074   static void buildDeadAreas();
00075   static void buildSiPMAreas();
00076   static void mergeRegionLists(std::list<deadIdRegion>& didregions);
00077   static void convertRegions(std::list<deadIdRegion> const& idregions,
00078                              std::vector<deadRegion>& regions);
00079   static TMultiGraph * graphRegions(std::vector<deadRegion> const& regions);
00080 
00081   static std::vector<uint32_t> deadIds;
00082   static std::vector<deadRegion> deadRegions;
00083   static std::vector<uint32_t> SiPMIds;
00084   static std::vector<deadRegion> SiPMRegions;
00085   static bool inited;
00086   static int const etaBounds;
00087   static double const etaMin[];
00088   static double const etaMax[];
00089   static double const twopi;
00090   static int const phiSectors;
00091   static double const phiMinR0[];
00092   static double const phiMaxR0[];
00093   static double const phiMinR12[];
00094   static double const phiMaxR12[];
00095 };