00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef PLEXSTRIPENDID_H
00013 #define PLEXSTRIPENDID_H
00014
00015 #include <iosfwd>
00016
00017 #include "Plex/PlexPlaneId.h"
00018 #include "Plex/PlexScintMdlId.h"
00019 #include "Conventions/StripEnd.h"
00020
00021 class PlexStripEndId;
00022 std::ostream& operator<<(std::ostream& os, const PlexStripEndId& p);
00023
00024 class PlexStripEndId : public PlexPlaneId {
00025
00026 public:
00027
00028 PlexStripEndId();
00029 PlexStripEndId(PlexPlaneId plnid,
00030 UInt_t strip,
00031 StripEnd::StripEnd_t end=StripEnd::kUnknown,
00032 StripEnd::StripEnd_t subpart=StripEnd::kWhole);
00033 PlexStripEndId(Detector::Detector_t detector,
00034 UInt_t plane, UInt_t strip,
00035 StripEnd::StripEnd_t end=StripEnd::kUnknown,
00036 StripEnd::StripEnd_t subpart=StripEnd::kWhole,
00037 PlaneView::PlaneView_t view=PlaneView::kUnknown,
00038 PlaneCoverage::PlaneCoverage_t cover=PlaneCoverage::kUnknown);
00039
00040 virtual ~PlexStripEndId() { ; }
00041
00042
00043 explicit PlexStripEndId(const UInt_t encoded);
00044 inline UInt_t GetEncoded() const { return fEncoded; }
00045
00046 const char *AsString(Option_t *option="") const;
00047
00048 StripEnd::StripEnd_t GetEnd() const;
00049 UShort_t GetStrip() const;
00050 StripEnd::StripEnd_t GetSubPart() const;
00051
00052 PlexStripEndId GetOppositeSEId() const;
00053 PlexScintMdlId GetScintMdlId() const;
00054 UShort_t GetStripInMdl() const;
00055
00056
00057
00058
00059 UShort_t GetMapperStripInMdl() const;
00060
00061
00062 StripEnd::StripEnd_t GetManifoldF1() const;
00063
00064
00065
00066 Int_t Build18BitPlnStripKey() const;
00067 static PlexStripEndId Unbuild18BitPlnStripKey(Detector::Detector_t det, Int_t key);
00068
00069
00070
00071
00072 Int_t BuildPlnStripEndKey() const;
00073 static PlexStripEndId UnbuildPlnStripEndKey(Detector::Detector_t det, Int_t key);
00074
00075
00076
00077 UInt_t GetUniqueStripEncodedValue() const;
00078
00079 Bool_t IsSameStrip(const PlexStripEndId &other) const;
00080 Bool_t IsSameStripEnd(const PlexStripEndId &other) const;
00081 Bool_t IsOppositeStripEnd(const PlexStripEndId &other) const;
00082
00083 virtual Bool_t IsValid() const;
00084
00085 void Print(Option_t *option="") const;
00086
00087 void SetEnd(StripEnd::StripEnd_t end);
00088 void SetStrip(UInt_t strip);
00089 void SetSubPart(StripEnd::StripEnd_t subpart);
00090
00091 friend Bool_t operator< (const PlexStripEndId &lhs, const PlexStripEndId &rhs);
00092 friend Bool_t operator<=(const PlexStripEndId &lhs, const PlexStripEndId &rhs);
00093 friend Bool_t operator==(const PlexStripEndId &lhs, const PlexStripEndId &rhs);
00094 friend Bool_t operator!=(const PlexStripEndId &lhs, const PlexStripEndId &rhs);
00095 friend Bool_t operator> (const PlexStripEndId &lhs, const PlexStripEndId &rhs);
00096 friend Bool_t operator>=(const PlexStripEndId &lhs, const PlexStripEndId &rhs);
00097
00098 protected:
00099
00100 private:
00101
00102
00103
00104 void SetIsSteel(Bool_t ) {;}
00105
00106 ClassDef(PlexStripEndId,3)
00107 };
00108
00109 #ifndef __CINT__
00110
00111
00112
00113
00114 inline Bool_t operator< (const PlexStripEndId &lhs, const PlexStripEndId &rhs)
00115 { return lhs.fEncoded < rhs.fEncoded; }
00116
00117 inline Bool_t operator<=(const PlexStripEndId &lhs, const PlexStripEndId &rhs)
00118 { return lhs.fEncoded <= rhs.fEncoded; }
00119
00120 inline Bool_t operator==(const PlexStripEndId &lhs, const PlexStripEndId &rhs)
00121 { return lhs.fEncoded == rhs.fEncoded; }
00122
00123 inline Bool_t operator!=(const PlexStripEndId &lhs, const PlexStripEndId &rhs)
00124 { return lhs.fEncoded != rhs.fEncoded; }
00125
00126 inline Bool_t operator> (const PlexStripEndId &lhs, const PlexStripEndId &rhs)
00127 { return lhs.fEncoded > rhs.fEncoded; }
00128
00129 inline Bool_t operator>=(const PlexStripEndId &lhs, const PlexStripEndId &rhs)
00130 { return lhs.fEncoded >= rhs.fEncoded; }
00131
00132 inline PlexStripEndId::PlexStripEndId() { fEncoded = defaultPlexStripEndId; }
00133 inline PlexStripEndId::PlexStripEndId(const UInt_t encoded)
00134 { fEncoded = encoded; }
00135
00136 inline StripEnd::StripEnd_t PlexStripEndId::GetEnd() const
00137 {
00138 Int_t bitField = ( fEncoded & maskPlexIdEnd ) >> shftPlexIdEnd;
00139 return (StripEnd::StripEnd_t) bitField;
00140 }
00141
00142 inline UShort_t PlexStripEndId::GetStrip() const
00143 {
00144 return ( fEncoded & maskPlexIdStrip ) >> shftPlexIdStrip;
00145 }
00146
00147 inline StripEnd::StripEnd_t PlexStripEndId::GetSubPart() const
00148 {
00149 Int_t bitField = ( fEncoded & maskPlexIdSubPart ) >> shftPlexIdSubPart;
00150 return (StripEnd::StripEnd_t) bitField;
00151 }
00152
00153 inline UInt_t PlexStripEndId::GetUniqueStripEncodedValue() const
00154 {
00155
00156
00157
00158 return
00159 ( fEncoded & ~(maskPlexIdEnd|maskPlexIdSubPart) ) |
00160 ( ( StripEnd::kWhole << shftPlexIdSubPart ) & maskPlexIdSubPart ) |
00161 ( ( StripEnd::kWhole << shftPlexIdEnd ) & maskPlexIdEnd ) ;
00162
00163 }
00164
00165 inline void PlexStripEndId::SetEnd(StripEnd::StripEnd_t end)
00166 {
00167 fEncoded = ( fEncoded & ~maskPlexIdEnd ) |
00168 ( ( end << shftPlexIdEnd ) & maskPlexIdEnd );
00169 }
00170
00171 inline void PlexStripEndId::SetStrip(UInt_t strip)
00172 {
00173 fEncoded = ( fEncoded & ~maskPlexIdStrip ) |
00174 ( ( strip << shftPlexIdStrip ) & maskPlexIdStrip );
00175 }
00176
00177 inline void PlexStripEndId::SetSubPart(StripEnd::StripEnd_t subpart)
00178 {
00179 fEncoded = ( fEncoded & ~maskPlexIdSubPart ) |
00180 ( ( subpart << shftPlexIdSubPart ) & maskPlexIdSubPart );
00181 }
00182
00183 #endif
00184 #endif // PLEXSTRIPENDID_H