Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:46:58

0001 #ifndef MERunManager_hh
0002 #define MERunManager_hh
0003 
0004 #include "MusEcal.hh"
0005 class MERun;
0006 class MEChannel;
0007 class MEVarVector;
0008 
0009 class MERunManager 
0010 {
0011 public:
0012 
0013   // a run manager for a given monitoring region, run type, color
0014   MERunManager( unsigned int lmr, 
0015         unsigned int type, // e.g. ME::iLaser, iTestPulse, iPedestal 
0016         unsigned int color=ME::iSizeC ); // when type=iLaser
0017 
0018   virtual ~MERunManager();
0019 
0020   void updateRunList();
0021 
0022   // iterators
0023   MusEcal::RunIterator it();
0024   MusEcal::RunIterator it(   ME::Time );
0025   MusEcal::RunIterator from( ME::Time );
0026   MusEcal::RunIterator to(   ME::Time );
0027   MusEcal::RunIterator begin();
0028   MusEcal::RunIterator end();
0029   MusEcal::RunIterator first();
0030   MusEcal::RunIterator last();
0031   MusEcal::RunIterator cur();
0032 
0033   // keys
0034   ME::Time beginKey()     const;
0035   ME::Time endKey()       const;
0036   ME::Time firstKey()     const { return _first; }
0037   ME::Time lastKey()      const { return _last; }
0038   ME::Time normFirstKey() const { return _normFirst; }
0039   ME::Time normLastKey()  const { return _normLast; }
0040   ME::Time curKey()       const { return _current; }
0041   ME::Time closestKey( ME::Time key );
0042   ME::Time closestKeyInFuture( ME::Time key );
0043 
0044   // runs
0045   unsigned size() const { return _runs.size(); }
0046   MERun* beginRun();
0047   MERun*   endRun();
0048   MERun* firstRun();
0049   MERun*  lastRun();
0050   MERun*   curRun();
0051   MERun*  run( ME::Time );
0052 
0053   bool setCurrentRun( ME::Time key );
0054   void setNoCurrent();
0055 
0056   bool setPlotRange(  ME::Time first, ME::Time last, bool verbose=true );
0057   bool setNormRange(  ME::Time first, ME::Time last, bool verbose=true );
0058 
0059   // set the current run to bad
0060   void setBadRun();
0061 
0062   // set the range to bad
0063   void setBadRange( ME::Time firstBad, ME::Time lastBad, bool verbose=true  );
0064 
0065   // refresh bad runs
0066   void refreshBadRuns();
0067 
0068   // is a run good
0069   bool isGood( ME::Time );
0070 
0071   // tree of channels
0072   MEChannel* tree();
0073   
0074   void print();
0075 
0076   int LMRegion() const { return _lmr; }
0077 
0078   // fill the maps (should be private)
0079   void fillMaps();
0080 
0081   // set good/bad flags
0082   void setFlags();
0083   void setLaserFlags();
0084   void setTestPulseFlags();
0085 
0086   // get the vectors
0087   MEVarVector* apdVector( MEChannel* );
0088   MEVarVector* pnVector( MEChannel*, int ipn );
0089   MEVarVector* mtqVector( MEChannel* );
0090 
0091   // recursive flag setting 
0092   void setFlag( MEChannel* leaf, ME::Time time, int var, bool flag ); 
0093 
0094   void refresh();
0095 
0096 private :
0097   
0098   int   _lmr;
0099   int   _reg;
0100   int    _sm;
0101   int   _dcc;
0102   int  _side;
0103   int  _type;
0104   int _color;
0105 
0106   // absolute paths to the LM data and to the primitives
0107   TString _lmdataPath;
0108   TString _primPath;
0109 
0110   MusEcal::RunMap _runs;
0111 
0112   ME::Time _first;
0113   ME::Time _last;
0114   ME::Time _current;
0115   ME::Time _normFirst;
0116   ME::Time _normLast;
0117   
0118   // map of bad runs
0119   MusEcal::BoolTimeMap _badRuns;
0120 
0121   // access to the data for each channel
0122   std::map< MEChannel*, MEVarVector* >  _apdMap;
0123   std::map< MEChannel*, MEVarVector* >  _pnMap[2];
0124   std::map< MEChannel*, MEVarVector* >  _mtqMap;
0125 
0126   MEChannel* _tree;  // the tree of channels
0127 
0128   ClassDef( MERunManager, 0 ) // MERunManager  -- manages laser monitoring runs
0129 };
0130 
0131 #endif