StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcGeoId.h
1 
17 #ifndef _ST_EEMC_GEO_ID_
18 #define _ST_EEMC_GEO_ID_
19 
20 #include <set>
21 #include <Rtypes.h>
22 
23 #include "StEEmcUtil/EEmcGeom/EEmcGeomDefs.h"
24 
25 // The class
27  public:
28  // deconstructor
29  ~StEEmcGeoId_t() { /* */ };
30 
31  // static member functions
32  static Short_t encodeSmd( Short_t sector, Bool_t layerIsV, Short_t strip );
33  static void decodeSmd( Short_t geoId, Short_t& sector, Bool_t& layerIsV, Short_t& strip );
34  static Int_t getMaxSmdGeoId();
35 
36  static Short_t encodeTow( Short_t sector, Short_t subsector, Short_t etaBin );
37  static void decodeTow( Short_t geoId, Short_t& sector, Short_t& subsector, Short_t& etaBin );
38 
39  static Short_t encodeTow( Short_t phiBin, Short_t etaBin );
40  static void decodeTow( Short_t geoId, Short_t& phiBin, Short_t& etaBin );
41 
42  protected:
43  enum { kMaxSmdGeoId = kEEmcNumStrips*kEEmcNumSmdUVs*kEEmcNumSectors };
44 
45  private:
46  // constructor is private, so that it cannot be constructed
47  StEEmcGeoId_t(){ /* */ };
48 
49 };
50 
51 // inline functions
52 
53 inline Short_t StEEmcGeoId_t::encodeSmd( Short_t sector, Bool_t layerIsV, Short_t strip ){
54  return kEEmcNumStrips*( 2*sector + layerIsV ) + strip;
55 };
56 
57 inline void StEEmcGeoId_t::decodeSmd( Short_t geoId, Short_t& sector, Bool_t& layerIsV, Short_t& strip ){
58  strip = geoId % kEEmcNumStrips;
59  geoId /= kEEmcNumStrips;
60  layerIsV = geoId % 2;
61  sector = geoId / 2;
62 };
63 
64 inline Int_t StEEmcGeoId_t::getMaxSmdGeoId(){
65  return kMaxSmdGeoId;
66 };
67 
68 inline Short_t StEEmcGeoId_t::encodeTow( Short_t sector, Short_t subsector, Short_t etaBin ){
69  return kEEmcNumEtas*( kEEmcNumSubSectors*sector + subsector ) + etaBin;
70 };
71 
72 inline void StEEmcGeoId_t::decodeTow( Short_t geoId, Short_t& sector, Short_t& subsector, Short_t& etaBin ){
73  etaBin = geoId % kEEmcNumEtas;
74  geoId /= kEEmcNumEtas;
75  subsector = geoId % kEEmcNumSubSectors;
76  sector = geoId / kEEmcNumSubSectors;
77 };
78 
79 inline Short_t StEEmcGeoId_t::encodeTow( Short_t phiBin, Short_t etaBin ){
80  return kEEmcNumEtas*phiBin + etaBin;
81 };
82 
83 inline void StEEmcGeoId_t::decodeTow( Short_t geoId, Short_t& phiBin, Short_t& etaBin ){
84  etaBin = geoId % kEEmcNumEtas;
85  phiBin = geoId / kEEmcNumEtas;
86 };
87 
88 #endif
89 
90 /*
91  * $Id: StEEmcGeoId.h,v 1.1 2012/08/29 15:44:17 sgliske Exp $
92  * $Log: StEEmcGeoId.h,v $
93  * Revision 1.1 2012/08/29 15:44:17 sgliske
94  * Moved from offline/users/sgliske/StRoot/StEEmcPool
95  *
96  *
97  */