Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Plexus.h

Go to the documentation of this file.
00001 
00002 // $Id: Plexus.h,v 1.36 2007/04/26 14:22:46 west Exp $
00003 //
00004 // Plexus
00005 //
00006 // Plexus is an actual connection map
00007 //
00008 // Author:  R. Hatcher 2000.05.03
00009 //
00011 
00012 #ifndef PLEXUS_H
00013 #define PLEXUS_H
00014 
00015 #include "Plex/PlexusABC.h"
00016 
00017 #include <map>
00018 
00019 class DbiValidityRec;
00020 
00021 class Plexus : public PlexusABC {
00022 
00023    friend class PlexLoanPool;  // only the loan pool can create/delete one
00024 
00025  public:
00026 
00027    // these are the normal methods
00028    virtual RawChannelId     GetRawChannelId(const PlexStripEndId& seid) const;
00029    virtual RawChannelId     GetRawChannelId(const PlexPixelSpotId& psid) const;
00030    virtual RawChannelId     GetRawChannelId(const PlexPinDiodeId& diodeid) const;
00031 
00032    virtual PlexSEIdAltL     GetSEIdAltL(const RawChannelId& rcid,
00033                                         const PlexCalib* calib=0,
00034                                         Int_t adc=0, Double_t time=0) const;
00035    virtual PlexStripEndId   GetStripEndId(const PlexPixelSpotId& psid) const;
00036 
00037    virtual std::vector<PlexPixelSpotId>
00038                             GetPixelSpotIdVector(const RawChannelId& rcid,
00039                                                  bool uniquePixels=false) const; 
00040    virtual PlexPixelSpotId  GetPixelSpotId(const PlexStripEndId& seid) const;
00041 
00042    virtual PlexPinDiodeId   GetPinDiodeId(const RawChannelId& rcid) const;
00043 
00044    virtual ReadoutType::Readout_t 
00045                             GetReadoutType(const RawChannelId& rcid) const;
00046    virtual std::string      GetSpecialDescript(const RawChannelId& rcid) const;
00047    virtual RawChannelId     GetSpecialChannelContains(const std::string& key) const;
00048    virtual const std::map<RawChannelId,std::string>&
00049                             GetSpecialDescriptMap() const 
00050                                { return fSpecialDescript; }
00051 
00052    virtual std::vector<PlexStripEndId>   
00053                             GetStripEndIdVector(const PlexLedId& ledid) const;
00054    virtual std::pair<PlexPinDiodeId,PlexPinDiodeId> 
00055                             GetPinDiodeIds(const PlexLedId& ledid) const;
00056    virtual PlexLedId        GetLedId(const PlexStripEndId& seid) const;
00057    virtual PlexLedId        GetLedId(const PlexPinDiodeId& diodeid) const;
00058 
00059 
00060    virtual const std::vector<PlexStripEndId>&
00061       GetAllStripEnds(StripEnd::StripEnd_t restrictEnd =
00062                                 StripEnd::kUnknown) const;
00063 
00064    virtual const std::vector<PlexPixelSpotId>& GetAllPixelSpots() const;
00065    virtual const std::vector<PlexPixelSpotId>& GetAllPixels() const;
00066    virtual const std::vector<PlexPixelSpotId>& GetAllTubes() const;
00067 
00068    virtual const std::vector<RawChannelId>& GetAllRawChannelIds() const;
00069 
00070    virtual const std::vector<PlexPinDiodeId>& GetAllPinDiodes() const;
00071    virtual const std::vector<PlexLedId>& GetAllLeds() const;
00072 
00073    virtual const VldRange&  GetVldRange() const { return fVldRange; }
00074 
00075    void           IncrementRef() { fRef++; }
00076    void           DecrementRef() { fRef--; }
00077    Int_t          CountRef() const { return fRef; }
00078 
00079    void           Print(Option_t *option) const;
00080 
00081    Bool_t         IsCompatible(const VldContext& vldc);
00082    Bool_t         IsCompatible(const VldContext* vldc);
00083 
00084    // test maps for consistency
00085    virtual void ValidateConsistency() const;
00086 
00087 #ifdef PLEX_EXPOSE_STRUCTURES
00088    // const access to maps ... should not be needed by average users
00089    const std::multimap<RawChannelId,PlexPixelSpotId>& GetRawChannelIdToPixelSpotId() const { return fChannelToPixel; }
00090    const std::multimap<PlexPixelSpotId,PlexStripEndId>& GetPixelSpotIdToStripEndId() const { return fPixelToStripEnd; }
00091    const std::map<PlexStripEndId,PlexPixelSpotId>& GetStripEndIdToPixelSpotId() const { return fStripEndToSpot; }
00092    const std::map<PlexPixelSpotId,RawChannelId>& GetPixelSpotIdToRawChannelId() const { return fPixelToChannel; }
00093 #endif
00094 
00095  public:
00096 
00097    // to make this i/o-able we need a public default ctor
00098    Plexus();
00099 
00100    // make these public so that one can selectively purge before saving
00101    typedef enum EMapSets {
00102      kPixelMaps      = 0x0001,
00103      kReadoutMap     = 0x0002,
00104      kPinDiodeMap    = 0x0004,
00105      kLedMaps        = 0x0008,
00106      kAllVectors     = 0x0010
00107    } MapSets_t;
00108 
00109  protected:
00110 
00111    Plexus(const VldContext& vldc);
00112    virtual ~Plexus();
00113 
00114    // logically const functions
00115    virtual void BuildPixelMaps(const VldContext& vldc) const;
00116    virtual void BuildReadoutMap(const VldContext& vldc) const;
00117    virtual void BuildPinDiodeMap(const VldContext& vldc) const;
00118    virtual void BuildLedMaps(const VldContext& vldc) const;
00119 
00120    virtual void PurgeComponents(UInt_t purgeMask);
00121 
00122    void TrimVldRange(const char* tblName="", const DbiValidityRec* dbivrec=0) const;
00123 
00124    typedef enum ETrimSpots {
00125      kIncludeSpot, 
00126      kIncludePixel, 
00127      kIncludeTube 
00128    } TrimSpots_t;
00129    
00130    // one workhorse routine for GetAllPixelSpots,GetAllPixels,GetAllTubes
00131    virtual const std::vector<PlexPixelSpotId>& 
00132      GetAllPixelSpotIds(ETrimSpots trim) const;
00133 
00134 
00135    mutable Int_t       fRef;           
00136    mutable VldRange    fVldRange;      // tagging parameter set
00137    mutable UInt_t      fBuiltMaps;     // components that have been initialized
00138 
00139    // mappings that go through PlexPixelSpotId
00140    // "mutable" so that methods can be const
00141 
00142    mutable std::multimap<RawChannelId,PlexPixelSpotId>    fChannelToPixel;
00143    mutable std::multimap<PlexPixelSpotId,PlexStripEndId>  fPixelToStripEnd;
00144 
00145    mutable std::map<PlexStripEndId,PlexPixelSpotId>       fStripEndToSpot;
00146    mutable std::map<PlexPixelSpotId,RawChannelId>         fPixelToChannel;
00147 
00148    // ideally this mapping would be to ReadoutType::Readout_t
00149    // but cint can't correctly i/o enum as as second type of map 
00150    // so use UShort_t (must be > 8 bits to correctly hold all Readout_t values)
00151    mutable std::map<RawChannelId,UShort_t>                fChannelToReadout;
00152 
00153    mutable std::map<RawChannelId,std::string>             fSpecialDescript;
00154 
00155    mutable std::map<RawChannelId,PlexPinDiodeId>          fChannelToPinDiode;
00156 
00157    mutable std::map<PlexStripEndId,PlexLedId>             fStripEndToLed;
00158    mutable std::map<PlexPinDiodeId,PlexLedId>             fPinDiodeToLed;
00159 
00160    // the following vectors get filled as necessary from the above maps
00161 
00162    mutable std::vector<PlexStripEndId>                    fAllStripEnds; 
00163    mutable std::vector<PlexStripEndId>                    fAllEastEnds;  
00164    mutable std::vector<PlexStripEndId>                    fAllWestEnds;  
00165    mutable std::vector<PlexStripEndId>                    fAllStrips;    
00166 
00167    mutable std::vector<PlexPixelSpotId>                   fAllTubes;     
00168    mutable std::vector<PlexPixelSpotId>                   fAllPixels;    
00169    mutable std::vector<PlexPixelSpotId>                   fAllSpots;     
00170 
00171    mutable std::vector<RawChannelId>                      fAllChannels;  
00172 
00173    mutable std::vector<PlexPinDiodeId>                    fAllPinDiodes; 
00174    mutable std::vector<PlexLedId>                         fAllLeds;      
00175 
00176  public:
00177 
00178    static void   SetAltLHasBrokenFibers(Bool_t tf) 
00179      { fgAltLHasBrokenFibers = tf; }
00180    static Bool_t GetAltLHasBrokenFibers() 
00181      { return fgAltLHasBrokenFibers; }
00182    static void   SetAltLInitiallySortedBySEId(Bool_t tf)
00183      { fgAltLInitiallySortedBySEId = tf; }
00184    static Bool_t GetAltLInitiallySortedBySEId() 
00185      { return fgAltLInitiallySortedBySEId; }
00186 
00187  protected:
00188    // compatibility mode
00189    static Bool_t fgAltLHasBrokenFibers; // SEIdAltLs will include broken fibers
00190    static Bool_t fgAltLInitiallySortedBySEId; // sort SEIdAltLs before they have weights
00191  private:
00192 
00193    ClassDef(Plexus,3) // map between logical components
00194 
00195 };
00196 
00197 inline const std::vector<PlexPixelSpotId>&
00198 Plexus::GetAllPixelSpots() const
00199 { return this->GetAllPixelSpotIds(Plexus::kIncludeSpot); }
00200 
00201 inline const std::vector<PlexPixelSpotId>&
00202 Plexus::GetAllPixels() const
00203 { return this->GetAllPixelSpotIds(Plexus::kIncludePixel); }
00204 
00205 inline const std::vector<PlexPixelSpotId>&
00206 Plexus::GetAllTubes() const
00207 { return this->GetAllPixelSpotIds(Plexus::kIncludeTube); }
00208 
00209 #endif // PLEXUS_H

Generated on Mon Nov 23 05:28:02 2009 for loon by  doxygen 1.3.9.1