VldRange Class Reference
[Validity]

Delimits and identifies the allowed "context" values associated with the associated DBI returned information. More...

#include <VldRange.h>

List of all members.

Public Member Functions

 VldRange ()
 VldRange (const Int_t detMask, const Int_t simMask, const VldTimeStamp &tstart, const VldTimeStamp &tend, const TString &source)
virtual ~VldRange ()
const char * AsString (Option_t *option="") const
Bool_t IsCompatible (const VldContext &vldc) const
Bool_t IsCompatible (const VldContext *vldc) const
Int_t GetDetectorMask () const
Int_t GetSimMask () const
VldTimeStamp GetTimeStart () const
VldTimeStamp GetTimeEnd () const
TString GetDataSource () const
void Print (Option_t *option="") const
 Print to stdout. See AsString() for options.
void TrimTo (const VldRange &vldr)
void SetTimeStart (const VldTimeStamp &tstart)
void SetTimeEnd (const VldTimeStamp &tend)

Protected Attributes

Int_t fDetectorMask
Int_t fSimMask
 or's of Detector::Detector_t
VldTimeStamp fTimeStart
 or's of data/mc conditions
VldTimeStamp fTimeEnd
TString fDataSource

Detailed Description

Delimits and identifies the allowed "context" values associated with the associated DBI returned information.

Author:
(last to touch it)
Author
rhatcher
Version:
Revision
1.14
Date:
Date
2005/08/26 17:25:58

Contact: R. Hatcher

Created on: 2000.05.03

Definition at line 37 of file VldRange.h.


Constructor & Destructor Documentation

VldRange::VldRange (  ) 

Definition at line 28 of file VldRange.cxx.

00029    : fDetectorMask(0), fSimMask(0), 
00030      fTimeStart(), fTimeEnd(), fDataSource("unknown")
00031 {
00032    // Default constructor
00033 }

VldRange::VldRange ( const Int_t  detMask,
const Int_t  simMask,
const VldTimeStamp tstart,
const VldTimeStamp tend,
const TString &  source 
)

Definition at line 35 of file VldRange.cxx.

00039    : fDetectorMask(detMask), fSimMask(simMask), 
00040      fTimeStart(tstart), fTimeEnd(tend), fDataSource(source)
00041 {
00042    // normal constructor
00043 }

VldRange::~VldRange (  )  [virtual]

Definition at line 46 of file VldRange.cxx.

00047 {
00048    // delete all the owned sub-objects
00049 
00050 }


Member Function Documentation

const char * VldRange::AsString ( Option_t *  option = ""  )  const

Return the VldRange as a string

Result is a pointer to a statically allocated string. User should copy this into their own buffer before calling this method again.

option "a": give detector/simflag masks as alpha chars option "c": compact (single line) option "s": drop nsec part of times option "1": include only "start time" option "-": don't include "source" info

Definition at line 53 of file VldRange.cxx.

References VldTimeStamp::AsString(), fDataSource, fDetectorMask, fSimMask, fTimeEnd, fTimeStart, and Detector::MaskToString().

Referenced by UgliGeometry::BuildAll(), CoilTools::CoilCurrentLimits(), DbiValidityRec::Fill(), Fill_MBSpill(), UgliGeometry::GetZExtent(), DbiValidityRec::IsCompatible(), CoilTools::LocalQuery(), lootSpillFile(), LIPlexMaps::MakeCalMIPCalibration(), LIPlexMaps::MakeCalStripAtten(), LIPlexMaps::MakeCalStripToStrip(), Print(), UgliGeometry::Print(), Plexus::Print(), GeoGeometry::PrintHeader(), UgliGeometry::SetFrozen(), and NDSgateTimeLooter::Write().

00054 {
00055    // Return the VldRange as a string
00056    //
00057    // Result is a pointer to a statically allocated string.
00058    // User should copy this into their own buffer before calling
00059    // this method again.
00060    //
00061    // option "a": give detector/simflag masks as alpha chars
00062    // option "c": compact (single line)
00063    // option "s": drop nsec part of times
00064    // option "1": include only "start time"
00065    // option "-": don't include "source" info 
00066 
00067    static char newstring[255] = " ";
00068 
00069    TString opt = option;
00070    opt.ToLower();
00071 
00072    Bool_t opt_a = opt.Contains("a");
00073    Bool_t opt_c = opt.Contains("c");
00074 
00075    TString detbits;
00076    if (opt_a) {
00077      detbits = Detector::MaskToString(fDetectorMask);
00078    }
00079    else {
00080       sprintf(newstring,"det %#4.4x",fDetectorMask);
00081       detbits = newstring;
00082    }
00083 
00084    TString simbits;
00085    if (opt_a) {
00086      simbits = SimFlag::MaskToString(fSimMask);
00087    }
00088    else {
00089       sprintf(newstring,"sim %#4.4x",fSimMask);
00090       simbits = newstring;
00091    }
00092 
00093    // VldTimeStamp::AsString returns pointer to statically allocated string
00094    // one needs to copy this before calling it again in same function call
00095    static char timeopt[4] = "c  ";
00096    timeopt[0] = (opt.Contains("s")?'s':'c');
00097    TString start_str = fTimeStart.AsString(timeopt);
00098    TString end_str;
00099    if ( ! opt.Contains("1")) {
00100       end_str = fTimeEnd.AsString(timeopt);
00101       if ( !opt_c ) end_str.Prepend("\n\t ");
00102       else          end_str.Prepend(" ");
00103    }
00104    if ( ! opt_c ) start_str.Prepend("\n\t ");
00105 
00106    TString source;
00107    if ( ! opt.Contains("-")) {
00108       source +=  (opt_c) ? " '" : "\n\t from source: ";
00109       source += fDataSource;
00110       source +=  (opt_c) ? "'" : "";
00111    }
00112 
00113    sprintf(newstring,
00114               "|%s|%s|%s%s%s",
00115               (const char*)detbits,
00116               (const char*)simbits,
00117               (const char*)start_str,
00118               (const char*)end_str,
00119               (const char*)source);
00120 
00121    return newstring;
00122 }

TString VldRange::GetDataSource (  )  const [inline]

Definition at line 72 of file VldRange.h.

References fDataSource.

Referenced by DbiBinaryFile::operator<<(), and DbiValidityRec::SetTimeWindow().

00072 { return fDataSource; }

Int_t VldRange::GetDetectorMask (  )  const [inline]

Definition at line 68 of file VldRange.h.

References fDetectorMask.

Referenced by UgliStripNode::BackConstructVldContext(), UgliGeometryReroot::BuildShapes(), DbiWriter< T >::CompleteOpen(), PlexVetoShieldHack::ConvertRangeToContext(), PulserTimePlotter::CreateGraph(), LIPlexMaps::DriftWithTime(), DbiLogEntry::Fill(), FabSteelPlate::Fill(), PulserRefDriftPin::Fill(), DbuVaChipSpars::Fill(), FabPlnInstall::Fill(), PlexPixelSpotToStripEnd::Fill(), PulserRawGainPin::Fill(), UgliDbiStripStruct::Fill(), PlexPinDiodeToLed::Fill(), PlexVetoShieldMuxToMdl::Fill(), BfldDbiPlaneMap::Fill(), UgliDbiSteelPln::Fill(), PlexStripEndToLed::Fill(), PlexRawChannelReadoutType::Fill(), PlexRawChannelToPinDiode::Fill(), UgliDbiScintPln::Fill(), DbuRunSummary::Fill(), UgliDbiScintMdlStruct::Fill(), UgliDbiStrip::Fill(), DbuDaqFileSummary::Fill(), PulserDriftPin::Fill(), PulserGainPin::Fill(), UgliDbiScintMdl::Fill(), DbuVaChipPeds::Fill(), PlexPixelToRawChannel::Fill(), UgliDbiScintPlnStruct::Fill(), DbuSubRunSummary::Fill(), PulserRawDriftPin::Fill(), BfieldCoilCurrent::Fill(), UgliGeomHandle::GetDetector(), DataUtil::GetDetectorBinsUV(), DataUtil::GetDetectorBinsZ(), UgliGeometry::GetTransverseExtent(), GeoGeometry::GetTransverseExtent(), UgliGeometry::GetZExtent(), DbiValidityRec::HasExpired(), DbmModule::LogEntry(), UgliGeometryReroot::MakeTempDbiGeometry(), DbiBinaryFile::operator<<(), SimPmtM64CrosstalkTable::Reset(), PhotonLookupTable::Reset(), RangeLookupTable::Reset(), DbiResultPtr< T >::SetContext(), DbiValidityRec::SetTimeWindow(), DbiValidityRec::Store(), and WriteTableToCSVFile().

00068 { return fDetectorMask; }

Int_t VldRange::GetSimMask (  )  const [inline]
VldTimeStamp VldRange::GetTimeEnd (  )  const [inline]
VldTimeStamp VldRange::GetTimeStart (  )  const [inline]
Bool_t VldRange::IsCompatible ( const VldContext vldc  )  const

Compare VldContext with this VldRange to see if the the tagged set is compatible.

Definition at line 151 of file VldRange.cxx.

References IsCompatible().

00152 {
00153    // compare VldContext with this VldRange to see if the
00154    // the tagged set is compatible
00155 
00156    return IsCompatible(*vldc);
00157 }

Bool_t VldRange::IsCompatible ( const VldContext vldc  )  const

Compare VldContext with this VldRange to see if the the tagged set is compatible.

Definition at line 125 of file VldRange.cxx.

References fDetectorMask, fSimMask, fTimeEnd, fTimeStart, VldContext::GetDetector(), VldContext::GetSimFlag(), VldContext::GetTimeStamp(), SimFlag::kUnknown, and Detector::kUnknown.

Referenced by BfldLoanPool::GetCache(), CoilTools::GetCoilState(), FarTimingFidFinder::GetFarTimingFid(), CoilTools::GetMagNear(), MCApplication::InitSnarl(), GeoGeometry::IsCompatible(), Plexus::IsCompatible(), UgliGeometry::IsCompatible(), DbiValidityRec::IsCompatible(), IsCompatible(), CoilTools::LocalQuery(), main(), ShieldGeom::Reinitialize(), and LISummarySorter::SetPlexHandle().

00126 {
00127    // compare VldContext with this VldRange to see if the
00128    // the tagged set is compatible
00129 
00130    Int_t detector = (Int_t)vldc.GetDetector();
00131    Int_t simflag  = (Int_t)vldc.GetSimFlag();
00132 
00133    // account for case where both VldContext and VldRange
00134    // are using "kUnknown" which has no bits set
00135    if ( ! (detector & fDetectorMask) &&
00136         (detector      != Detector::kUnknown || 
00137          fDetectorMask != Detector::kUnknown    ) ) return kFALSE;
00138    if ( ! (simflag  & fSimMask) &&
00139         (simflag  != SimFlag::kUnknown || 
00140          fSimMask != SimFlag::kUnknown   ) ) return kFALSE;
00141 
00142    // the start time is taken as inclusive, but the end time is exclusive
00143 
00144    if ( vldc.GetTimeStamp() <  fTimeStart ) return kFALSE;
00145    if ( vldc.GetTimeStamp() >= fTimeEnd   ) return kFALSE;
00146 
00147    return kTRUE;
00148 }

void VldRange::Print ( Option_t *  option = ""  )  const

Print to stdout. See AsString() for options.

Definition at line 160 of file VldRange.cxx.

References AsString().

Referenced by PlexusReroot::BuildPinDiodeMap(), PlexusReroot::BuildPixelMaps(), PlexusReroot::BuildReadoutMap(), LIPlexMaps::MakePlexStripEndToLed(), and VldValidate::TestRange().

00161 {
00162    // Print this object
00163 
00164    printf("%s\n",AsString(option));
00165 }

void VldRange::SetTimeEnd ( const VldTimeStamp tend  )  [inline]
void VldRange::SetTimeStart ( const VldTimeStamp tstart  )  [inline]

Definition at line 80 of file VldRange.h.

References fTimeStart.

Referenced by PulserGainFit::RunNearFarFits(), PulserGainFit::RunPinFits(), and BDSwicPedAccessor::SetSpillTime().

00080 { fTimeStart = tstart; }

void VldRange::TrimTo ( const VldRange vldr  ) 

Trim this range to the intersection (ie. more restricted) limits of it's initial value and that of the argument

Definition at line 168 of file VldRange.cxx.

References fDataSource, fDetectorMask, fSimMask, fTimeEnd, and fTimeStart.

Referenced by BfldCache::BfldCache(), CoilTools::LocalQuery(), BField::ResetVldContext(), GeoGeometry::TrimVldRange(), Plexus::TrimVldRange(), and UgliGeometry::TrimVldRange().

00169 {
00170    // Trim this range to the intersection (ie. more restricted)
00171    // limits of it's initial value and that of the argument
00172 
00173    fDetectorMask &= vldr.fDetectorMask;
00174    fSimMask      &= vldr.fSimMask;
00175    if (fTimeStart < vldr.fTimeStart) fTimeStart = vldr.fTimeStart;
00176    if (fTimeEnd   > vldr.fTimeEnd  ) fTimeEnd   = vldr.fTimeEnd;
00177    if (!fDataSource.Contains(vldr.fDataSource)) {
00178       fDataSource   += ", ";
00179       fDataSource   += vldr.fDataSource;
00180    }
00181 }


Member Data Documentation

TString VldRange::fDataSource [protected]

Definition at line 89 of file VldRange.h.

Referenced by AsString(), GetDataSource(), and TrimTo().

Int_t VldRange::fDetectorMask [protected]

Definition at line 85 of file VldRange.h.

Referenced by AsString(), GetDetectorMask(), IsCompatible(), and TrimTo().

Int_t VldRange::fSimMask [protected]

or's of Detector::Detector_t

Definition at line 86 of file VldRange.h.

Referenced by AsString(), GetSimMask(), IsCompatible(), and TrimTo().

Definition at line 88 of file VldRange.h.

Referenced by AsString(), GetTimeEnd(), IsCompatible(), SetTimeEnd(), and TrimTo().

or's of data/mc conditions

Definition at line 87 of file VldRange.h.

Referenced by AsString(), GetTimeStart(), IsCompatible(), SetTimeStart(), and TrimTo().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1