Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:55

0001 #ifndef METimeInterval_hh
0002 #define METimeInterval_hh
0003 
0004 #include <list>
0005 #include <TString.h>
0006 
0007 #include "../../interface/ME.h"
0008 
0009 class METimeInterval 
0010 {
0011 public:
0012 
0013   static int instances;
0014 
0015   // public constructor
0016   METimeInterval( ME::Time firstTime, ME::Time lastTime );
0017 
0018   // public splitting
0019   void split( const std::list<ME::Time>& times );
0020 
0021   // recursive destructor
0022   virtual ~METimeInterval();
0023   
0024   // find an interval at a given level
0025   METimeInterval* get( ME::Time time, unsigned level=1000 );
0026 
0027   // first and last intervals at required level connected to this 
0028   METimeInterval* first( unsigned level );
0029   METimeInterval* last( unsigned level );
0030 
0031   // accessors
0032   unsigned level() { return _level; }
0033   ME::Time firstTime() const { return _firstTime; }
0034   ME::Time lastTime()  const { return _lastTime; }
0035   bool isGood() const { return _good; }
0036 
0037   // interval navigation at same level
0038   METimeInterval* above() { return _above; }
0039   METimeInterval* next();
0040   METimeInterval* previous();
0041   METimeInterval* firstIn();
0042   METimeInterval* lastIn();
0043 
0044   // recursive printing
0045   void print( unsigned level );
0046 
0047   // one-line printing
0048   void oneLine();
0049 
0050   // convenient printing [time0;time1[
0051   TString inBrackets();
0052 
0053 private :
0054 
0055   // private constructor
0056   METimeInterval( ME::Time firstTime, ME::Time lastTime, METimeInterval* previous, METimeInterval* above, bool OK=true ); 
0057 
0058   // private splitting
0059   METimeInterval* cut( ME::Time time );
0060 
0061   // time interval
0062   ME::Time _firstTime;
0063   ME::Time _lastTime;
0064 
0065   // navigation pointers
0066   METimeInterval* _previous;
0067   METimeInterval* _next;
0068   METimeInterval* _above;
0069   METimeInterval* _below;
0070 
0071   // level of the interval, 0 being the top interval
0072   unsigned _level;
0073 
0074   bool _good;
0075 
0076   ClassDef(METimeInterval,0) // MusEcal: a time interval
0077 };
0078 
0079 #endif