00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #include "Plex/PlexHandle.h"
00013 #include "Plex/PlexLoanPool.h"
00014 #include "Plex/Plexus.h"
00015 #include "Plex/PlexVetoShieldHack.h"
00016
00017 #include "Validity/VldContext.h"
00018
00019
00020 #include "TString.h"
00021
00022 #include "MessageService/MsgService.h"
00023 CVSID("$Id: PlexHandle.cxx,v 1.26 2005/08/26 18:47:03 rhatcher Exp $");
00024
00025 #include <cassert>
00026
00027 ClassImp(PlexHandle)
00028
00029
00030 PlexHandle::PlexHandle()
00031 : fPlexus(0)
00032 {
00033
00034
00035 MSG("Plex",Msg::kFatal) <<
00036 "PlexHandle created by default ctor" << endl;
00037 assert(0);
00038 }
00039
00040
00041 PlexHandle::PlexHandle(const VldContext& vldc, Bool_t shared)
00042 {
00043
00044
00045
00046
00047
00048
00049 if (vldc.GetDetector() == Detector::kFar)
00050 PlexVetoShieldHack::SetDefaultContext(vldc);
00051
00052 fPlexus = PlexLoanPool::Instance()->GetPlexus(vldc,shared);
00053 fPlexus->IncrementRef();
00054 }
00055
00056
00057 PlexHandle::PlexHandle(const PlexHandle &ph) : PlexusABC()
00058 {
00059
00060
00061
00062
00063 ((PlexHandle&)ph).Copy(*this);
00064 fPlexus->IncrementRef();
00065 }
00066
00067
00068 PlexHandle::~PlexHandle()
00069 {
00070
00071 fPlexus->DecrementRef();
00072
00073 }
00074
00075
00076 PlexHandle& PlexHandle::operator=(const PlexHandle &ph)
00077 {
00078
00079
00080 fPlexus->DecrementRef();
00081 ((PlexHandle&)ph).Copy(*this);
00082 fPlexus->IncrementRef();
00083
00084 return *this;
00085 }
00086
00087
00088 void PlexHandle::Copy(PlexHandle &obj) const
00089 {
00090
00091
00092
00093
00094 TObject::Copy(obj);
00095 ((PlexHandle&)obj).fPlexus = fPlexus;
00096 }
00097
00098 void PlexHandle::Copy(TObject &obj) const
00099 {
00100
00101
00102
00103
00104 MSG("Plex",Msg::kFatal) <<
00105 "PlexHandle copied from generic TObject" << endl;
00106
00107 TObject::Copy(obj);
00108 ((PlexHandle&)obj).fPlexus = fPlexus;
00109 }
00110
00111
00112
00113 RawChannelId PlexHandle::GetTpmtFromLedPulserBox(Int_t ipb) const
00114 {
00115 return GetSpecialChannelContains(Form("PulserBox%02d",ipb));
00116 }
00117
00118 Int_t PlexHandle::GetLedPulserBoxFromTpmt(const RawChannelId& rcid) const
00119 {
00120 if ( GetReadoutType(rcid) != ReadoutType::kFlashTrigPMT ) return -1;
00121
00122 std::string descript = GetSpecialDescript(rcid);
00123 Int_t ipb = 999;
00124 sscanf(descript.c_str(),"FlashTrigPMT-PulserBox%02d",&ipb);
00125 return ipb;
00126 }
00127
00128
00129 #ifdef PLEX_EXPOSE_STRUCTURES
00130
00131
00132
00133
00134
00135 const std::multimap<RawChannelId,PlexPixelSpotId>&
00136 PlexHandle::GetRawChannelIdToPixelSpotId() const
00137 { return fPlexus->GetRawChannelIdToPixelSpotId(); }
00138
00139 const std::multimap<PlexPixelSpotId,PlexStripEndId>&
00140 PlexHandle::GetPixelSpotIdToStripEndId() const
00141 { return fPlexus->GetPixelSpotIdToStripEndId(); }
00142
00143 const std::map<PlexStripEndId,PlexPixelSpotId>&
00144 PlexHandle::GetStripEndIdToPixelSpotId() const
00145 { return fPlexus->GetStripEndIdToPixelSpotId(); }
00146
00147 const std::map<PlexPixelSpotId,RawChannelId>&
00148 PlexHandle::GetPixelSpotIdToRawChannelId() const
00149 { return fPlexus->GetPixelSpotIdToRawChannelId(); }
00150 #endif
00151
00152
00153