00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00012
00013 #include "Validity/VldContext.h"
00014
00015 #include "MessageService/MsgService.h"
00016
00017
00018 ClassImp(VldContext)
00019
00020
00021 std::ostream& operator<<(std::ostream& os, const VldContext& vldc)
00022 {
00023 if (os.good()) {
00024 if (os.tie()) os.tie()->flush();
00025 os << vldc.AsString();
00026 }
00027
00028 if (os.flags() & std::ios::unitbuf) os.flush();
00029 return os;
00030 }
00031
00032
00033 VldContext::VldContext(const Detector::Detector_t &detector,
00034 const SimFlag::SimFlag_t mcFlag,
00035 const VldTimeStamp &tstamp)
00036 : fDetector(detector), fSimFlag(mcFlag), fTimeStamp(tstamp)
00037 {
00038
00039 }
00040
00041
00042 const char* VldContext::AsString(Option_t *option) const
00043 {
00044
00045
00046
00047
00048 static char newstring[80] = " ";
00049
00050 switch (option[0]) {
00051 case 'c':
00052 case 'C':
00053 sprintf(newstring,"{%c%c %s}",
00054 Detector::AsString(GetDetector())[0],
00055 SimFlag::AsString(GetSimFlag())[0],
00056 fTimeStamp.AsString("c"));
00057 break;
00058 default:
00059 sprintf(newstring,"{%6.6s|%6.6s|%s}",
00060 Detector::AsString(GetDetector()),
00061 SimFlag::AsString(GetSimFlag()),
00062 fTimeStamp.AsString("c"));
00063 }
00064
00065 return newstring;
00066 }
00067
00068
00069 void VldContext::Print(Option_t *option) const
00070 {
00071
00072
00073 printf("%s\n",AsString(option));
00074
00075 }
00076
00077
00078 Bool_t VldContext::IsNull() const
00079 {
00080
00081
00082 return fDetector==Detector::kUnknown && fSimFlag == SimFlag::kUnknown;
00083
00084 }
00085
00086
00087