StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
L2DbTime.cxx
1 
2 
3 #include <string>
4 #include <iostream>
5 #include <fstream>
6 
7 #include "L2DbTime.h"
8 
9 //
10 // specification of L2DbTime
11 //
12 
13 
14 
15 // ---------------------------------------------------------------------------
16 L2DbTime::L2DbTime()
17 {
18 
19  Int_t mydate=-1111;
20  Int_t mytime=-1111;
21 
22  mTag=mPedFile=mMaskFile="EMPTY";
23  mDateStart=mydate;
24  mDateFinish=mydate;
25  mTimeStart=mytime;
26  mTimeFinish=mytime;
27 }
28 
29 Bool_t L2DbTime::valid( Int_t mydate, Int_t mytime )
30 {
31 
32  Bool_t inRange = mydate >= mDateStart && mydate <= mDateFinish;
33  if ( mydate==mDateStart ) inRange &= mytime >= mTimeStart;
34  if ( mydate==mDateFinish ) inRange &= mytime < mTimeFinish;
35  return inRange;
36 
37 }
38 
39 Bool_t L2DbTime::eof()
40 {
41  return mTag.Contains("EndOfFile") || mTag.Contains("EOF");
42 }
43 
44 Bool_t L2DbTime::comment()
45 {
46  return mTag.Contains("#");
47 }
48 
49 std::ifstream &L2DbTime::read( std::ifstream &in )
50 {
51  Char_t buf1[128], buf2[128], buf3[128];
52  READ:
53  if ( in.eof() ) return in;
54 
55  in >> buf1; mTag=buf1;
56  if ( !TString(mTag).Contains(":") ) goto READ;
57  in >> mDateStart;
58  in >> mTimeStart;
59  in >> mDateFinish;
60  in >> mTimeFinish;
61  in >> buf2; mPedFile=buf2;
62  in >> buf3; mMaskFile=buf3;
63 
64  return in;
65 }
66 
67 void L2DbTime::print()
68 {
69  std::cout << Form(" L2DbTime::=%s=\t%7i.%i\t%7i.%i\t%s\t%s",mTag.Data(),mDateStart,mTimeStart,mDateFinish,mTimeFinish,mPedFile.Data(),mMaskFile.Data()) << std::endl;
70 }
71