• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

onlinemonitor/rocmonitor/TPedestalExtractor.h (r4864/r3075)

Go to the documentation of this file.
00001 #ifndef TPEDESTALEXTRACTOR_H_
00002 #define TPEDESTALEXTRACTOR_H_
00003 
00004 #include "TH1.h"
00005 #include "TH2.h"
00006 #include "roc/Iterator.h"
00007 #include <vector>
00008 
00009 /*
00010  * Baseline - set of externally-triggered data with zero input signal.
00011  * Pedestal - position of the baseline
00012  */
00013 
00014 class TPedestalExtractor {
00015         private:
00016                 static const Int_t              kEntriesMin = 100;
00017                 static const Float_t    kInvalidPedestalValue = -1000.0;
00018                 static const Float_t    kInvalidWidthValue = -1000.0;
00019                 static const Char_t *   kPedFileFormat;
00020                 Int_t                   fVerbose;
00021                 Int_t                   fRocArrSize;
00022                 Int_t                   fNxArrSize;
00023                 Int_t                   fNChannels;
00024                 Int_t           fNAdcBins;
00025                 Float_t                 fAdcMin;
00026                 Float_t                 fAdcMax;
00027                 TH1F ****               fBaselines;
00028                 Float_t ***             fPedestals;
00029                 Float_t ***             fWidths;
00030                 Bool_t *                fIsExtracted;
00031                 uint64_t                fExttrigCalibrPeriod;           // See TPedestalExtractor::ExtractExttrigStream. In nanoseconds.
00032                 Bool_t          fPrintedDataNotTimeSorted;
00033                 roc::SysMessageUserTypes * fState;
00034                 roc::SysMessageUserTypes * fPrevState;
00035                 std::vector< uint64_t > fLastCalibrTime;        // Full time stamp of the last calibration hit used for the actual calibration. For every ROC.
00036                 std::vector< uint64_t > fLastHitTime;           // Full time stamp of the last calibration hit. For every ROC.
00037 
00038                 void                    AddHit( Int_t iRoc, Int_t iNx, Int_t iChannel, Int_t adc );
00039                 void                    ChangeState( roc::SysMessageUserTypes const & newState );
00040                 void                    ChangeState( Int_t rocId, roc::SysMessageUserTypes const & newState );
00041                 Int_t                   GetVerbose() const;
00042                 Bool_t          IsChannelValid( Int_t channel ) const { return channel >= 0 && channel < fNChannels; }
00043                 Bool_t          IsRocValid( uint16_t roc ) const { return roc < fRocArrSize; }
00044                 Bool_t          IsNxValid( Int_t nx ) const { return nx >= 0 && nx < fNxArrSize; }
00045       Bool_t      IsLooksLikeNewPedestalFileFormat(const char* pedFileName ) const;
00046       Bool_t      IsValid( Int_t roc, Int_t nx, Int_t channel ) const { return IsRocValid( roc ) && IsNxValid( nx ) && IsChannelValid( channel ); }
00047                 void                    PrintLog(const char* message, Int_t minVerbose = 0 ) const;
00048 
00049 
00050         public:
00051                 TPedestalExtractor(Int_t nRocs, Int_t nNxs, roc::SysMessageUserTypes initialState = roc::SYSMSG_USER_RECONFIGURE, Int_t nChannels = 128, Int_t nAdcBins = 4096, Double_t adcMin = 0.0, Double_t adcMax = 4096.0);
00052                 virtual ~TPedestalExtractor();
00053                 void                            ResetCalibrData();
00054                 void                            ResetCalibrData( Int_t rocId );
00055                 void                            ResetCalibrResults();
00056                 void                            ResetCalibrResults( Int_t rocId );
00057                 void                            ResetLastCalibrTime();
00058                 void                            ResetLastCalibrTime( Int_t rocId );
00059                 void                            Extract();
00060                 void                            Extract( Int_t idRoc );
00061                 static void                     Extract( TH1 * hist, Float_t & pedestal, Float_t & width );
00062                 Int_t                           ExtractAutocalibrStream( roc::Message const & msg, uint64_t fullTime );
00063                 Int_t                           ExtractAutocalibrLmd( std::string lmdFileName, roc::SysMessageUserTypes initialState = roc::SYSMSG_USER_RECONFIGURE, Int_t skipCalibrIterations = 0 );
00064                 // Int_t                                ExtractAutocalibrRoot( std::string rootFileName, Int_t calibrIteration ); // Not implemented
00065                 Int_t                           ExtractExttrigStream( roc::Message const & msg, uint64_t fullTime );
00066                 // Int_t                                ExtractExttrigLmd( std::string lmdFileName, Float_t startTime, Float_t finishTime ); // Not implemented
00067                 // Int_t                                ExtractExttrigRoot( std::string rootFileName, Float_t startTime, Float_t finishTime ); // Not implemented
00068                 Float_t                         GetPedestal( Int_t roc, Int_t nx, Int_t channel ) const;
00069                 uint64_t                        GetLastCalibrTime( Int_t rocId ) const;
00070                 Float_t                         GetWidth( Int_t iRoc, Int_t iNx, Int_t iChannel ) const;
00071                 TH1F *                          GetHistogram( Int_t roc, Int_t nx, Int_t channel );
00072                 TH2F *                  GetHist2DCopy( Int_t roc, Int_t nx );
00073                 uint64_t                        GetSelftrigCalibrPeriod() const;
00074                 Int_t                           GetNxArrSize() const { return fNxArrSize; };
00075                 Int_t               GetNChannels() const { return fNChannels; };
00076                 Int_t                           GetRocArrSize() const { return fRocArrSize; };
00077                 roc::SysMessageUserTypes        GetState( Int_t roc ) const;
00078                 Bool_t                          IsExtracted( Int_t roc ) const;
00079                 Bool_t                          IsOneExtracted() const;
00080                 Bool_t                          IsAllExtracted() const;
00081                 void                LoadFromFile( Char_t const * fileName);
00082                 void                            Print() const;
00083                 void                            Print( Int_t roc ) const;
00084                 void                SaveToFile( Char_t const * fileName) const;
00085                 void                            SetVerbose( Int_t verbose );
00086                 void                            SetExttrigCalibrPeriod( uint64_t period );
00087                 Int_t                           WatchState( roc::Message const & msg );
00088                 void                            WatchPedestalMessages( roc::Message const & msg, Long64_t const fullTime = 0 );
00089 
00090                 ClassDef(TPedestalExtractor, 1)
00091 
00092 };
00093 
00094 #endif // #ifndef TPEDESTALEXTRACTOR_H_
00095 

Generated on Tue Dec 10 2013 04:52:22 for ROCsoft by  doxygen 1.7.1