00001 /** 00002 * \class TVldRange 00003 * 00004 * \ingroup Validity 00005 * 00006 * \brief Delimits and identifies the allowed "context" values 00007 * associated with the associated DBI returned information 00008 * 00009 * 00010 * 00011 * \author (last to touch it) $Author: finch $ 00012 * 00013 * \version $Revision: 1.1 $ 00014 * 00015 * \date $Date: 2011/01/18 05:49:20 $ 00016 * 00017 * Contact: R. Hatcher 00018 * 00019 * Created on: 2000.05.03 00020 * 00021 */ 00022 00023 #ifndef VLDRANGE_H 00024 #define VLDRANGE_H 00025 00026 #include "TObject.h" 00027 #include "TString.h" 00028 #include "DbiDetector.hxx" 00029 #include "TVldTimeStamp.hxx" 00030 #include <iosfwd> 00031 00032 00033 class TVldContext; 00034 00035 class TVldRange; 00036 00037 class TVldRange : public TObject { 00038 00039 public: 00040 00041 TVldRange(); // necessary for streamer io 00042 TVldRange(const Int_t detMask, const Int_t simMask, 00043 const TVldTimeStamp &tstart, const TVldTimeStamp &tend, 00044 const TString &source); 00045 virtual ~TVldRange(); 00046 00047 /** Return the TVldRange as a string 00048 * 00049 * Result is a pointer to a statically allocated string. 00050 * User should copy this into their own buffer before calling 00051 * this method again. 00052 * 00053 * option "a": give detector/simflag masks as alpha chars 00054 * option "c": compact (single line) 00055 * option "s": drop nsec part of times 00056 * option "1": include only "start time" 00057 * option "-": don't include "source" info 00058 */ 00059 const char* AsString(Option_t *option = "") const; 00060 00061 /** Compare TVldContext with this TVldRange to see if the 00062 * the tagged set is compatible.*/ 00063 Bool_t IsCompatible(const TVldContext &vldc) const; 00064 /** Compare TVldContext with this TVldRange to see if the 00065 * the tagged set is compatible.*/ 00066 Bool_t IsCompatible(const TVldContext *vldc) const; 00067 00068 Int_t GetDetectorMask() const { return fDetectorMask; } 00069 Int_t GetSimMask() const { return fSimMask; } 00070 TVldTimeStamp GetTimeStart() const { return fTimeStart; } 00071 TVldTimeStamp GetTimeEnd() const { return fTimeEnd; } 00072 TString GetDataSource() const { return fDataSource; } 00073 00074 /// Print to stdout. See AsString() for options. 00075 void Print(Option_t *option = "") const; 00076 00077 /// Trim this range to the intersection (ie. more restricted) 00078 /// limits of it's initial value and that of the argument 00079 void TrimTo(const TVldRange& vldr); 00080 void SetTimeStart(const TVldTimeStamp& tstart) { fTimeStart = tstart; } 00081 void SetTimeEnd(const TVldTimeStamp& tend) { fTimeEnd = tend; } 00082 00083 protected: 00084 00085 Int_t fDetectorMask; /// or's of DbiDetector::Detector_t 00086 Int_t fSimMask; /// or's of data/mc conditions 00087 TVldTimeStamp fTimeStart; 00088 TVldTimeStamp fTimeEnd; 00089 TString fDataSource; 00090 00091 private: 00092 00093 ClassDef(TVldRange,1) // TVldRange version 1 00094 }; 00095 std::ostream& operator<<(std::ostream& os, const TVldRange& vldts); 00096 00097 #endif // VLDRANGE_H