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

CandDigitHandle.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CandDigitHandle.cxx,v 1.23 2005/01/19 13:33:37 kordosky Exp $
00003 //
00004 // CandDigitHandle.cxx
00005 //
00006 // CandDigitHandle is the specialized access handle to CandDigit.
00007 //
00008 // Each concrete CandHandle must define a DupHandle function.
00009 //
00010 // Author:  G. Irwin 5/2000
00012 
00013 #include <cassert>
00014 #include <iostream>
00015 
00016 #include "CandDigit/CandDigit.h"
00017 #include "CandDigit/CandDigitHandle.h"
00018 #include "CandDigit/CandDigitListHandle.h"
00019 #include "MessageService/MsgService.h"
00020 #include "Plex/PlexSEIdAltL.h"
00021 #include "Plex/PlexSEIdAltLItem.h"
00022 
00023 ClassImp(CandDigitHandle)
00024 
00025 //______________________________________________________________________
00026 CVSID("$Id: CandDigitHandle.cxx,v 1.23 2005/01/19 13:33:37 kordosky Exp $");
00027 
00028 //______________________________________________________________________
00029 CandDigitHandle::CandDigitHandle()
00030 {
00031 }
00032 
00033 //______________________________________________________________________
00034 CandDigitHandle::CandDigitHandle(const CandDigitHandle &cdh) :
00035   CandHandle(cdh)
00036 {
00037 }
00038 
00039 //______________________________________________________________________
00040 CandDigitHandle::CandDigitHandle(CandDigit *cd) :
00041   CandHandle(cd)
00042 {
00043 }
00044 
00045 //______________________________________________________________________
00046 CandDigitHandle::~CandDigitHandle()
00047 {
00048 }
00049 
00050 //______________________________________________________________________
00051 CandDigitHandle *CandDigitHandle::DupHandle() const
00052 {
00053    return (new CandDigitHandle(*this));
00054 }
00055 
00056 //______________________________________________________________________
00057 RawChannelId CandDigitHandle::GetChannelId() const
00058 {
00059    return ((CandDigit *) GetCandBase())->fChannelId;
00060 }
00061 
00062 //______________________________________________________________________
00063 Float_t CandDigitHandle::GetCharge(CalDigitType::CalDigitType_t
00064                                                         caltype_t) const
00065 {
00066 
00067 // Return uncalibrated charge straight away, if desired.
00068    if (caltype_t == CalDigitType::kNone) {
00069      return ((CandDigit *) GetCandBase())->fCharge;
00070    }
00071 
00072 // Check against Demux veto before returning a calibrated charge.
00073    const PlexSEIdAltL &seidl = GetPlexSEIdAltL();
00074    if (seidl.GetDemuxVetoFlag() != 0) {
00075      MSG("Cand", Msg::kWarning)
00076             << " *** Invalid PlexSEIdAltL.  DeMuxVetoFlag = "
00077             << seidl.GetDemuxVetoFlag() << endl
00078             << "Return uncalibrated charge." << endl;
00079      return ((CandDigit *) GetCandBase())->fCharge;
00080    }
00081 
00082    switch (caltype_t) {
00083      // M. Kordosky, Jan 19, 2005 ... noticed while browsing
00084      // We check for caltype_t==kNone and deal with it 
00085      // in the first line of the present function.
00086      // Why do it again?
00087      //     case (CalDigitType::kNone):
00088      //       return ((CandDigit *) GetCandBase())->fCharge;
00089      //       break;
00090      case (CalDigitType::kSigLin):
00091        return seidl.GetBestItem().GetSigLin();
00092        break;
00093      case (CalDigitType::kSigCorr):
00094        return seidl.GetBestItem().GetSigCorr();
00095        break;
00096      case (CalDigitType::kPE):
00097        return seidl.GetBestItem().GetPE();
00098        break;
00099      default:
00100        MSG("Cand", Msg::kError)
00101            << " *** Unknown Digit charge type = "
00102            << caltype_t << endl
00103            << "Return uncalibrated charge."
00104            << endl;
00105        return ((CandDigit *) GetCandBase())->fCharge;
00106        break;
00107    }
00108 }
00109 
00110 //______________________________________________________________________
00111 const PlexSEIdAltL &CandDigitHandle::GetPlexSEIdAltL() const
00112 {
00113    return ((CandDigit *) GetCandBase())->fPlexSEIdAltL;
00114 }
00115 
00116 //______________________________________________________________________
00117 PlexSEIdAltL &CandDigitHandle::GetPlexSEIdAltLWritable()
00118 {
00119    return ((CandDigit *) GetOwnedCandBase())->fPlexSEIdAltL;
00120 }
00121 
00122 //______________________________________________________________________
00123 Int_t CandDigitHandle::GetRawDigitIndex() const
00124 {
00125    return ((CandDigit *) GetCandBase())->fRawDigitIndex;
00126 }
00127 
00128 //______________________________________________________________________
00129 Double_t CandDigitHandle::GetSubtractedTime(CalTimeType::CalTimeType_t
00130                                                         caltype_t) const
00131 {
00132 
00133 // Return GetTime() value minus mother CandDigitList GetAbsTime() offset
00134 // No offset subtraction is done if no CandDigitList mother exists.
00135    const CandDigitListHandle *mother =
00136                  dynamic_cast<const CandDigitListHandle *>(GetMother());
00137    if (mother) return GetTime(caltype_t) - mother->GetAbsTime();
00138    else return GetTime(caltype_t);
00139 }
00140 
00141 //______________________________________________________________________
00142 Double_t CandDigitHandle::GetTime(CalTimeType::CalTimeType_t caltype_t)
00143                                                                    const
00144 {
00145 
00146 // Return digit time without CandDigitList GetAbsTime offset subtraction
00147 
00148 // Return uncalibrated time straight away, if desired.
00149    if (caltype_t == CalTimeType::kNone) {
00150      return ((CandDigit *) GetCandBase())->fTime;
00151    }
00152 
00153 // Check against Demux veto before returning a calibrated time.
00154    const PlexSEIdAltL &seidl = GetPlexSEIdAltL();
00155    if (seidl.GetDemuxVetoFlag() != 0) {
00156      MSG("Cand", Msg::kWarning)
00157             << " *** Invalid PlexSEIdAltL.  DeMuxVetoFlag = "
00158             << seidl.GetDemuxVetoFlag() << endl
00159             << "Return uncalibrated time." << endl;
00160      return ((CandDigit *) GetCandBase())->fTime;
00161    }
00162 
00163    switch (caltype_t) {
00164      // M. Kordosky, Jan 19, 2005 ... noticed while browsing
00165      // We check for caltype_t==kNone and deal with it 
00166      // in the first line of the present function.
00167      // Why do it again?
00168      //     case (CalTimeType::kNone):
00169      //       return ((CandDigit *) GetCandBase())->fTime;
00170      //       break;
00171      case (CalTimeType::kT0):
00172        return seidl.GetBestItem().GetTime();
00173        break;
00174      default:
00175        MSG("Cand", Msg::kError)
00176            << " *** Unknown Digit time type = "
00177            << caltype_t << endl
00178            << "Return uncalibrated time."
00179            << endl;
00180        return ((CandDigit *) GetCandBase())->fTime;
00181        break;
00182    }
00183 }
00184 
00185 //______________________________________________________________________
00186 Char_t CandDigitHandle::GetVaErrorBits() const
00187 {
00188    return ((CandDigit *) GetCandBase())->fVaErrorBits;
00189 }
00190 
00191 //______________________________________________________________________
00192 Char_t CandDigitHandle::GetQieErrorBits() const
00193 {
00194    return ((CandDigit *) GetCandBase())->fQieErrorBits;
00195 }
00196 
00197 //______________________________________________________________________
00198 void CandDigitHandle::SetChannelId(RawChannelId chid)
00199 {
00200    ((CandDigit *) GetOwnedCandBase())->fChannelId = chid;
00201 }
00202 
00203 //______________________________________________________________________
00204 void CandDigitHandle::SetCharge(Float_t chg)
00205 {
00206    ((CandDigit *) GetOwnedCandBase())->fCharge = chg;
00207 }
00208 
00209 //______________________________________________________________________
00210 void CandDigitHandle::SetPlexSEIdAltL(PlexSEIdAltL &altlist)
00211 {
00212    ((CandDigit *) GetOwnedCandBase())->fPlexSEIdAltL = altlist;
00213 }
00214 
00215 //______________________________________________________________________
00216 void CandDigitHandle::SetRawDigitIndex(Int_t rawdigitindex)
00217 {
00218    ((CandDigit *) GetOwnedCandBase())->fRawDigitIndex = rawdigitindex;
00219 }
00220 
00221 //______________________________________________________________________
00222 void CandDigitHandle::SetTime(Double_t time)
00223 {
00224    ((CandDigit *) GetOwnedCandBase())->fTime = time;
00225 }
00226 
00227 //______________________________________________________________________
00228 void CandDigitHandle::SetVaErrorBits(Char_t vaerrbits)
00229 {
00230    ((CandDigit *) GetOwnedCandBase())->fVaErrorBits = vaerrbits;
00231 }
00232 
00233 //______________________________________________________________________
00234 void CandDigitHandle::SetQieErrorBits(Char_t qieerrbits)
00235 {
00236    ((CandDigit *) GetOwnedCandBase())->fQieErrorBits = qieerrbits;
00237 }
00238 
00239 //______________________________________________________________________
00240 void CandDigitHandle::Trace(const char *c) const
00241 {
00242   MSG("Cand", Msg::kDebug)
00243     << "**********Begin CandDigitHandle::Trace(\"" << c << "\")" << endl
00244            << "Information from CandDigitHandle's CandHandle: " << endl;
00245   CandHandle::Trace(c);
00246   MSG("Cand", Msg::kDebug)
00247      << "**********End CandDigitHandle::Trace(\"" << c << "\")" << endl;
00248 }
00249 
00250 XXXITRIMP(CandDigitHandle)

Generated on Mon Feb 15 11:06:28 2010 for loon by  doxygen 1.3.9.1