#ifndef SICHANNELGEOMETER_HPP #define SICHANNELGEOMETER_HPP // // $Id: SiChannelGeometer.hpp,v 1.17 2005/04/03 15:36:37 shfu Exp $ // // File: SiChannelGeometer.hpp // Purpose: Create instances of SiStrips for converting cluster positions to // global DZero coordinate space. // Created: 15-DEC-1997 John Hobbs // // Jan 30, 2005 by Shaohua Fu // added Layer0 // SFL0_Jan_2005 // function overloaded to be backward compatible // // $Revision: 1.17 $ // // // Include files #include #include #include "geometry_system/management/absRcpGeometer.hpp" #include #include #include "rcp/RCP.hpp" class SiLadderStrips; class SiWedgeStrips; namespace silicon_geom { class Map; } // Global definitions /** The Channel geometer singleton. It creates instances of SiStrips for converting cluster positions to global DZero coordinate space. */ class SiChannelGeometer: public dgs::absRcpGeometer { public: /// Return a pointer to the (sole) instance of the geometer. static SiChannelGeometer* get_instance(); /// Check if a channel geometer already exists. bool check_channelgeom(); /// Return the number of views in a given ladder. int get_view_count(int barrel, int layer, int ladder); // cmt.out SFL0_Jan_2005 int get_view_count(int bartype, int barrel, int layer, int ladder); // added SFL0_Jan_2005 /// Return the strips corresponding to the given ladder. This will move to private const SiLadderStrips* get_ladder_strips(int barrel, int layer, int ladder, int view) const; // cmt.out SFL0_Jan_2005 const SiLadderStrips* get_ladder_strips(int bartype, int barrel, int layer, int ladder, int view) const; // added SFL0_Jan_2005 /// Return the strips corresponding to the given wedge. This will move to private const SiWedgeStrips* get_wedge_strips(int disktype, int disk, int wedge, int view) const; /// Return the strips corresponding to the given wedge. This will move to private const SiWedgeStrips* get_wedge_strips(int disktype, int disk, int subdisk, int wedge, int view) const; // This will be moved to private soon. /// Update the silicon channel geometer using an RCP file. Virtual in absRcpGeometer bool refresh(const edm::RCP* channel_map); typedef int (*versFuncPtr)(const edm::Event &anEvt); /** This establishes a pointer to the function needed to get the Smt data chunk version number. Doing it in this manner introduces no circular dependence between the */ versFuncPtr smt_data_version_function(versFuncPtr); // return current geometry version int get_version() const; // first bit 1 if rel <= p10 // second bit 1 if rel < p12 or < 227 int get_subversion() const; // checks if two strips intersect within borders // important no floating point operations are performed to determine // the outcome. It assures that result will be platform independent // and also run to run independent // 0 map_timestamp means using the current map file // No need for layer0 since it's single-sided // SFL0_Jan_2005 bool check_ladder_boundaries(int bar,int lyr,int lad,int p_strip,int n_strip,unsigned int map_timestamp=0) const; bool check_wedge_boundaries(int disktype,int disk,int wedge,int p_strip,int n_strip,unsigned int map_timestamp=0) const; unsigned int get_map_timestamp() const; public: /// don't use it unless you have to ( if you work in a standalone environment) /// Implement the version control virtual interface in absRcpGeometer. edm::RCP* check_version(const bool isMC, const int runNumber, const std::vector& versions, const edm::Event *anEvt=0); private: /// Default constructor SiChannelGeometer(); /// Defualt destructor ~SiChannelGeometer(); /** Create the internal information needed to map ladder/wedge and view ID's onto a given layout. */ void build_default(const edm::RCP* channel_map=0); // The constructor... /// Control access to myself static SiChannelGeometer* _instance; // myself. Initially zero. static bool _existence; std::vector _views_b; std::vector _views_l0b; // added SFL0_Jan_2005 int _views_F; int _views_H; /// Vector to hold the barrel strips. std::vector _barrel_strips; /// Vector to hold the layer0 barrel strips. // added SFL0_Jan_2005 std::vector _l0barrel_strips; // added SFL0_Jan_2005 /// Vector to hold the F disk strips (according to the coarse indexing). std::vector _Fdisk_coarse_strips; /// Vector to hold the F disk strips (according to the fine indexing). std::vector _Fdisk_fine_strips; /// Vector to hold the H disk strips (according to the coarse indexing). std::vector _Hdisk_coarse_strips; /// Vector to hold the H disk strips (according to the fine indexing). std::vector _Hdisk_fine_strips; /// Holds the version control information needed by check_version above std::map _versRCPs; /// Hold the default version RCPID to use if no smt data chunk exists. edm::RCPID _defaultRCPID; /// Hold the version number of the default to use if no smt data chunk exists. int _defaultVID; /// Holds a pointer to a standalone function which returns the data version versFuncPtr _dataVersionGrabber; mutable std::map _maps; std::map _timestamps; static bool _load_maps; public: static void load_map(bool flag) {_load_maps=flag;} }; #endif //SICHANNELGEOMETER_HPP