00001
00002
00003
00004
00005
00006
00007
00008
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;
00024
00025 public:
00026
00027
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
00085 virtual void ValidateConsistency() const;
00086
00087 #ifdef PLEX_EXPOSE_STRUCTURES
00088
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
00098 Plexus();
00099
00100
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
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
00131 virtual const std::vector<PlexPixelSpotId>&
00132 GetAllPixelSpotIds(ETrimSpots trim) const;
00133
00134
00135 mutable Int_t fRef;
00136 mutable VldRange fVldRange;
00137 mutable UInt_t fBuiltMaps;
00138
00139
00140
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
00149
00150
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
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
00189 static Bool_t fgAltLHasBrokenFibers;
00190 static Bool_t fgAltLInitiallySortedBySEId;
00191 private:
00192
00193 ClassDef(Plexus,3)
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