fmssim
Geometry.h
Go to the documentation of this file.
00001 #ifndef _FMS_GEOMETRY_H_
00002 #define _FMS_GEOMETRY_H_
00003 
00004 //
00005 // Geometry.h
00006 // fmssim
00007 //
00008 // Created by TB on 9/16/11.
00009 // Copyright 2011 BNL. All rights reserved.
00010 //
00011 
00012 #include <map>
00013 
00014 #include <Rtypes.h>
00015 
00016 #include <TVector3.h>
00017 
00021 namespace fms {
00022    
00027    namespace geometry {
00028    }
00029    
00033    namespace trigger {
00034    }
00035    
00036 }
00037 
00038 
00039 
00040 namespace fms {
00041    
00042    namespace geometry {
00043       
00050       enum EDirection {
00051          EAST = 1,
00052          WEST = 2,
00053          NORTH = 10,
00054          SOUTH = 20,
00055          TOP = 100,
00056          BOTTOM = 200
00057       };
00058       
00059       enum ECellType {
00060          LARGE,
00061          SMALL,
00062          INVALID_CELL_TYPE
00063       };
00064       
00065       enum ESubDetector {
00066          LARGE_NORTH,
00067          LARGE_SOUTH,
00068          SMALL_NORTH,
00069          SMALL_SOUTH
00070       };
00071       
00072       
00076       class Quadrant {
00077          
00078       public:
00079          
00080          enum EQuadrant {
00081             NORTH_TOP,
00082             NORTH_BOTTOM,
00083             SOUTH_TOP,
00084             SOUTH_BOTTOM,
00085             INVALID_QUADRANT
00086          };
00087          
00088          static EQuadrant Get(const TVector3& v) {
00089             
00090             const double x = v.X();
00091             const double y = v.Y();
00092             
00093             EQuadrant q(INVALID_QUADRANT);
00094             
00095             // x defines south/north. y defines top/bottom.
00096             if(x > 0.) {
00097                if(y > 0.) {
00098                   q = NORTH_TOP;
00099                } // if
00100                else if(y < 0.) {
00101                   q = NORTH_BOTTOM;
00102                } // else
00103             } // if
00104             else if(x < 0.) {
00105                if(y > 0.) {
00106                   q = SOUTH_TOP;
00107                }
00108                else if(y < 0.) {
00109                   q = SOUTH_BOTTOM;
00110                }
00111             } // else
00112             
00113             return q;
00114          }
00115          
00116          ClassDef(fms::geometry::Quadrant, 1)
00117       };
00118       
00122       class Qt {
00123          
00124       public:
00125          
00126          
00127          /*
00128           
00129           |^^^^^^^^^^^^^^^^^^^^^^^^^^|
00130           |               E F G         |
00131           |                      H    |
00132           |               A B C   I      |
00133           |                          |
00134           |         |^^^^^^|  D   J    |
00135           |         |      |         |
00136           |         |      |         |
00137           |         |______|         |
00138           |                          |
00139           |                          |
00140           |                          |
00141           |                          |
00142           |__________________________|
00143           
00144           */
00145          
00146          
00147          
00148          
00149 //         static EQuadrant FindQuadrant(const TVector3& v) {
00150 //            
00151 //         }
00152          
00153          enum EBoard {
00154             A = 65, 
00155             B, 
00156             C, 
00157             D, 
00158             E, 
00159             F, 
00160             G, 
00161             H, 
00162             I, 
00163             J, 
00164             INVALID_BOARD 
00165          };
00166          
00171          static Char_t GetName(EBoard board) {
00172 #if 0
00173             char name('\0');
00174             static std::map<EBoard, char> names;
00175             if(names.empty()) {
00176                using std::make_pair;
00177                names.insert(make_pair(A, 'A'));
00178                names.insert(make_pair(B, 'B'));
00179                names.insert(make_pair(C, 'C'));
00180                names.insert(make_pair(D, 'D'));
00181                names.insert(make_pair(E, 'E'));
00182                names.insert(make_pair(F, 'F'));
00183                names.insert(make_pair(G, 'G'));
00184                names.insert(make_pair(H, 'H'));
00185                names.insert(make_pair(I, 'I'));
00186                names.insert(make_pair(J, 'J'));
00187             } // if
00188             std::map<EBoard, char>::const_iterator i = names.find(board);
00189             if(i not_eq names.end()) {
00190                name = i->second;
00191             } // if
00192             return name;
00193 #endif
00194             return static_cast<char>(board);
00195 #if 0            
00196             switch(board) {
00197                case A:
00198                   name = 'A'
00199                   break;
00200                case A:
00201                   name = 'A'
00202                   break;
00203                case A:
00204                   name = 'A'
00205                   break;
00206                case A:
00207                   name = 'A'
00208                   break;
00209                case A:
00210                   name = 'A'
00211                   break;
00212                case A:
00213                   name = 'A'
00214                   break;
00215                default:
00216                   break;
00217             }
00218 #endif
00219          }
00220          
00221          
00222          ClassDef(fms::geometry::Qt, 1)
00223       };
00224       
00225       
00226    } // namespace geometry
00227    
00228 } // namespace fms
00229 
00230 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines