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

PlexHandle.cxx

Go to the documentation of this file.
00001 
00002 // $Id: PlexHandle.cxx,v 1.26 2005/08/26 18:47:03 rhatcher Exp $
00003 //
00004 // PlexHandle
00005 //
00006 // PlexHandle is a handle for a Plexus
00007 //
00008 // Author:  R. Hatcher 2000.05.03
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 // include TString for Form()
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    // Default constructor
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    // Build a handle to a plexus
00044    // Get plexus from the loan pool (which will build it if necessary)
00045 
00046    // complete hack to keep a "global" context so that decisions about 
00047    // veto shield configuration can be made in a pseudo-vacuum.
00048    // set this *before* going to the loan pool
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    // Copy constructor keeps reference count up-to-date
00060 
00061    // patterned after other ROOT objects
00062 
00063    ((PlexHandle&)ph).Copy(*this);
00064    fPlexus->IncrementRef();
00065 }
00066 
00067 //_____________________________________________________________________________
00068 PlexHandle::~PlexHandle()
00069 {
00070    // handle deletion updates reference count
00071    fPlexus->DecrementRef();
00072 
00073 }
00074 
00075 //_____________________________________________________________________________
00076 PlexHandle& PlexHandle::operator=(const PlexHandle &ph)
00077 {
00078    // assignment keeps reference counts up-to-date
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    // Copy method 
00091 
00092    // patterned after other ROOT objects
00093 
00094    TObject::Copy(obj);
00095    ((PlexHandle&)obj).fPlexus = fPlexus;
00096 }
00097 //_____________________________________________________________________________
00098 void PlexHandle::Copy(TObject &obj) const
00099 {
00100    // Copy method 
00101 
00102    // patterned after other ROOT objects
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   // hopefully the DB has the PB info in it.
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 // const access to maps ... should not be needed by average users
00131 // actual format of the data (ie. that these are multimaps, etc)
00132 // is subject to change and thus users should not rely on these 
00133 // access methods!!!
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 

Generated on Fri Mar 28 15:37:35 2008 for loon by  doxygen 1.3.9.1