QwAnalysis
VQwClock.h
Go to the documentation of this file.
1 /********************************************************\
2 * File: VQwClock.h *
3 * *
4 * Author: Juan Carlos Cornejo <cornejo@jlab.org> *
5 * Time-stamp: <2011-06-16> *
6 \********************************************************/
7 
8 #ifndef __VQWCLOCK__
9 #define __VQWCLOCK__
10 
11 // System headers
12 #include <vector>
13 #include <boost/shared_ptr.hpp>
14 
15 // ROOT headers
16 #include <TTree.h>
17 
18 #include "QwParameterFile.h"
19 #include "VQwDataElement.h"
20 #include "VQwHardwareChannel.h"
21 
22 // Forward declarations
23 class QwDBInterface;
24 
25 template<typename T> class QwClock;
26 
27 /**
28  * \ingroup QwAnalysis_BeamLine
29  */
30 class VQwClock : public VQwDataElement {
31  /***************************************************************
32  * Class: VQwClock
33  * Pure Virtual base class for the clocks in the datastream
34  * Through use of the Create factory function, one can
35  * get a concrete instance of a templated QwClock.
36  *
37  ***************************************************************/
38 public:
39  VQwClock() { }; // Do not use this function!!
40  VQwClock(const VQwClock& source)
41  : VQwDataElement(source)
42  { }
43  virtual ~VQwClock() {};
44 
45  // VQwDataElement virtual functions
46  virtual Int_t ProcessEvBuffer(UInt_t* buffer, UInt_t word_position_in_buffer, UInt_t subelement=0) = 0;
47  virtual void ConstructHistograms(TDirectory *folder, TString &prefix) = 0;
48  virtual void FillHistograms() = 0;
49  /*! \brief Inherited from VQwDataElement to set the upper and lower limits (fULimit and fLLimit), stability % and the error flag on this channel */
50  virtual void SetSingleEventCuts(UInt_t errorflag,Double_t min, Double_t max, Double_t stability) = 0;
51  virtual void Ratio( const VQwClock &numer, const VQwClock &denom)
52  { std::cerr << "Ratio not defined! (VQwClock)" << std::endl; }
53  virtual void ClearEventData() = 0;
54 
55  // Virtual functions delegated to sub classes
56  virtual void InitializeChannel(TString subsystem, TString name, TString datatosave, TString type = "") = 0;
57 
58  virtual void LoadChannelParameters(QwParameterFile &paramfile) = 0;
59 
60  virtual void SetEventCutMode(Int_t bcuts) = 0;
61  virtual void SetPedestal(Double_t ped) = 0;
62  virtual void SetCalibrationFactor(Double_t calib) = 0;
63  virtual Bool_t ApplySingleEventCuts() = 0;//Check for good events by stting limits on the devices readings
64  virtual void IncrementErrorCounters() = 0;
65  virtual void ProcessEvent() = 0;
66  virtual void Scale(Double_t factor) = 0;
67  virtual void CalculateRunningAverage() = 0;
68  virtual void AccumulateRunningSum(const VQwClock& value) = 0;
69  virtual void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector<Double_t> &values) = 0;
70  virtual void ConstructBranch(TTree *tree, TString &prefix) = 0;
71  virtual void ConstructBranch(TTree *tree, TString &prefix, QwParameterFile& modulelist) = 0;
72  virtual void FillTreeVector(std::vector<Double_t> &values) const = 0;
73 
74  virtual std::vector<QwDBInterface> GetDBEntry() = 0;
75 
76  // Operators
77  virtual VQwClock& operator= (const VQwClock &value) =0;
78  virtual VQwClock& operator+= (const VQwClock &value) =0;
79  virtual VQwClock& operator-= (const VQwClock &value) =0;
80 
81  // Factory function to produce appropriate Clock
82  static VQwClock* Create(TString subsystemname, TString type, TString name);
83  static VQwClock* Create(const VQwClock& source);
84 
85  // These are related to those hardware channels that need to normalize
86  // to an external clock
87  virtual Double_t GetNormClockValue() = 0;
88  virtual Double_t GetStandardClockValue() = 0;
89 
90  virtual const VQwHardwareChannel* GetTime() const = 0;
91 
92 };
93 
94 typedef boost::shared_ptr<VQwClock> VQwClock_ptr;
95 
96 #endif // __VQWCLOCK__
virtual VQwClock & operator=(const VQwClock &value)=0
virtual VQwClock & operator+=(const VQwClock &value)=0
virtual void CalculateRunningAverage()=0
virtual void SetCalibrationFactor(Double_t calib)=0
virtual void Scale(Double_t factor)=0
virtual void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)=0
virtual void ProcessEvent()=0
static VQwClock * Create(TString subsystemname, TString type, TString name)
A fast way of creating a Clock of specified type.
Definition: VQwClock.cc:26
boost::shared_ptr< VQwClock > VQwClock_ptr
Definition: VQwClock.h:94
virtual void SetSingleEventCuts(UInt_t errorflag, Double_t min, Double_t max, Double_t stability)=0
Inherited from VQwDataElement to set the upper and lower limits (fULimit and fLLimit), stability % and the error flag on this channel.
virtual void FillHistograms()=0
Fill the histograms for this data element.
virtual void InitializeChannel(TString subsystem, TString name, TString datatosave, TString type="")=0
virtual void FillTreeVector(std::vector< Double_t > &values) const =0
Definition of the pure virtual base class of all data elements.
The pure virtual base class of all data elements.
virtual void ConstructBranch(TTree *tree, TString &prefix)=0
virtual Double_t GetNormClockValue()=0
virtual void SetEventCutMode(Int_t bcuts)=0
virtual void ClearEventData()=0
Clear the event data in this element.
VQwClock(const VQwClock &source)
Definition: VQwClock.h:40
static const double min
Definition: QwUnits.h:76
virtual std::vector< QwDBInterface > GetDBEntry()=0
virtual const VQwHardwareChannel * GetTime() const =0
virtual void IncrementErrorCounters()=0
virtual void ConstructHistograms(TDirectory *folder, TString &prefix)=0
Construct the histograms for this data element.
virtual Bool_t ApplySingleEventCuts()=0
virtual Int_t ProcessEvBuffer(UInt_t *buffer, UInt_t word_position_in_buffer, UInt_t subelement=0)=0
Process the CODA event buffer for this element.
virtual ~VQwClock()
Definition: VQwClock.h:43
VQwClock()
Definition: VQwClock.h:39
virtual VQwClock & operator-=(const VQwClock &value)=0
virtual void LoadChannelParameters(QwParameterFile &paramfile)=0
virtual Double_t GetStandardClockValue()=0
virtual void Ratio(const VQwClock &numer, const VQwClock &denom)
Definition: VQwClock.h:51
virtual void SetPedestal(Double_t ped)=0
virtual void AccumulateRunningSum(const VQwClock &value)=0