QwAnalysis
QwScaler_Channel< data_mask, data_shift > Class Template Reference

#include <QwScaler_Channel.h>

+ Inheritance diagram for QwScaler_Channel< data_mask, data_shift >:
+ Collaboration diagram for QwScaler_Channel< data_mask, data_shift >:

Public Member Functions

 QwScaler_Channel ()
 
 QwScaler_Channel (const QwScaler_Channel &source)
 
 QwScaler_Channel (TString name, TString datatosave="raw")
 
void EncodeEventData (std::vector< UInt_t > &buffer)
 Encode the event data into a CODA buffer. More...
 
Int_t ProcessEvBuffer (UInt_t *buffer, UInt_t num_words_left, UInt_t index=0)
 Process the CODA event buffer for this element. More...
 
- Public Member Functions inherited from VQwScaler_Channel
 VQwScaler_Channel ()
 
 VQwScaler_Channel (TString name, TString datatosave="raw")
 
 VQwScaler_Channel (const VQwScaler_Channel &source)
 
virtual ~VQwScaler_Channel ()
 
void InitializeChannel (TString name, TString datatosave="raw")
 Initialize the fields in this object. More...
 
void InitializeChannel (TString subsystem, TString instrumenttype, TString name, TString datatosave)
 Initialize the fields in this object. More...
 
void SetDefaultSampleSize (size_t NumberOfSamples_map)
 
void LoadChannelParameters (QwParameterFile &paramfile)
 
void ClearEventData ()
 Clear the event data in this element. More...
 
void RandomizeEventData (int helicity=0, double time=0.0)
 Internally generate random event data. More...
 
void SetEventData (Double_t value)
 
void ProcessEvent ()
 
Int_t GetRawValue (size_t element) const
 
Double_t GetValue (size_t element) const
 
Double_t GetValueM2 (size_t element) const
 
Double_t GetValueError (size_t element) const
 
VQwScaler_Channeloperator= (const VQwScaler_Channel &value)
 
void AssignScaledValue (const VQwScaler_Channel &value, Double_t scale)
 
void AssignValueFrom (const VQwDataElement *valueptr)
 
void AddValueFrom (const VQwHardwareChannel *valueptr)
 
void SubtractValueFrom (const VQwHardwareChannel *valueptr)
 
void MultiplyBy (const VQwHardwareChannel *valueptr)
 
void DivideBy (const VQwHardwareChannel *valueptr)
 
VQwScaler_Channeloperator+= (const VQwScaler_Channel &value)
 
VQwScaler_Channeloperator-= (const VQwScaler_Channel &value)
 
VQwScaler_Channeloperator*= (const VQwScaler_Channel &value)
 
VQwHardwareChanneloperator+= (const VQwHardwareChannel *input)
 
VQwHardwareChanneloperator-= (const VQwHardwareChannel *input)
 
VQwHardwareChanneloperator*= (const VQwHardwareChannel *input)
 
VQwHardwareChanneloperator/= (const VQwHardwareChannel *input)
 
void Sum (VQwScaler_Channel &value1, VQwScaler_Channel &value2)
 
void Difference (VQwScaler_Channel &value1, VQwScaler_Channel &value2)
 
void Ratio (const VQwScaler_Channel &numer, const VQwScaler_Channel &denom)
 
void Product (VQwScaler_Channel &numer, VQwScaler_Channel &denom)
 
void AddChannelOffset (Double_t Offset)
 
void Scale (Double_t Offset)
 
void DivideBy (const VQwScaler_Channel &denom)
 
Int_t ApplyHWChecks ()
 
Bool_t ApplySingleEventCuts ()
 
void IncrementErrorCounters ()
 
void PrintErrorCounters () const
 report number of events failed due to HW and event cut failure More...
 
void ConstructHistograms (TDirectory *folder, TString &prefix)
 Construct the histograms for this data element. More...
 
void FillHistograms ()
 Fill the histograms for this data element. More...
 
void ConstructBranchAndVector (TTree *tree, TString &prefix, std::vector< Double_t > &values)
 
void ConstructBranch (TTree *tree, TString &prefix)
 
void FillTreeVector (std::vector< Double_t > &values) const
 
void AccumulateRunningSum (const VQwScaler_Channel &value)
 
void AccumulateRunningSum (const VQwScaler_Channel &value, Int_t count)
 
void AccumulateRunningSum (const VQwHardwareChannel *value, Int_t count)
 
void DeaccumulateRunningSum (const VQwScaler_Channel &value)
 
void PrintValue () const
 Print single line of value and error of this data element. More...
 
void PrintInfo () const
 Print multiple lines of information about this data element. More...
 
void CalculateRunningAverage ()
 
virtual Bool_t NeedsExternalClock ()
 
virtual void SetNeedsExternalClock (Bool_t needed)
 
virtual std::string GetExternalClockName ()
 
virtual void SetExternalClockPtr (const VQwHardwareChannel *clock)
 
virtual void SetExternalClockName (const std::string name)
 
virtual Bool_t IsDifferentialScaler ()
 
virtual void SetDifferentialScaler (Bool_t diff)
 
void ScaledAdd (Double_t scale, const VQwHardwareChannel *value)
 
- Public Member Functions inherited from VQwHardwareChannel
 VQwHardwareChannel ()
 
 VQwHardwareChannel (const VQwHardwareChannel &value)
 
 VQwHardwareChannel (const VQwHardwareChannel &value, VQwDataElement::EDataToSave datatosave)
 
virtual ~VQwHardwareChannel ()
 
size_t GetNumberOfDataWords ()
 Get the number of data words in this data element. More...
 
size_t GetNumberOfSubelements ()
 Get the number of subelements in this data element. More...
 
Int_t GetRawValue () const
 
Double_t GetValue () const
 
Double_t GetValueM2 () const
 
Double_t GetValueError () const
 
Double_t GetValueWidth () const
 
Double_t GetValueWidth (size_t element) const
 
void InitializeChannel (TString name)
 Initialize the fields in this object. More...
 
void SetEventCutMode (Int_t bcuts)
 
void SetSingleEventCuts (Double_t min, Double_t max)
 Set the upper and lower limits (fULimit and fLLimit) for this channel. More...
 
void SetSingleEventCuts (UInt_t errorflag, Double_t min, Double_t max, Double_t stability)
 Inherited from VQwDataElement to set the upper and lower limits (fULimit and fLLimit), stability % and the error flag on this channel. More...
 
Double_t GetEventCutUpperLimit () const
 
Double_t GetEventCutLowerLimit () const
 
Double_t GetStabilityLimit () const
 
UInt_t UpdateErrorFlag ()
 Update the error flag based on the error flags of internally contained objects Return paramter is the "Eventcut Error Flag". More...
 
void UpdateErrorFlag (const VQwHardwareChannel &elem)
 
virtual UInt_t GetErrorCode () const
 
virtual VQwHardwareChanneloperator= (const VQwHardwareChannel &value)
 Arithmetic assignment operator: Should only copy event-based data. More...
 
void SetPedestal (Double_t ped)
 
Double_t GetPedestal () const
 
void SetCalibrationFactor (Double_t factor)
 
Double_t GetCalibrationFactor () const
 
void AddEntriesToList (std::vector< QwDBInterface > &row_list)
 
virtual void AddErrEntriesToList (std::vector< QwErrDBInterface > &row_list)
 
virtual void AccumulateRunningSum (const VQwHardwareChannel *value)
 
virtual void DeaccumulateRunningSum (const VQwHardwareChannel *value)
 
void ConstructBranch (TTree *tree, TString &prefix, QwParameterFile &modulelist)
 
- Public Member Functions inherited from VQwDataElement
 VQwDataElement ()
 Default constructor. More...
 
 VQwDataElement (const VQwDataElement &value)
 Copy constructor. More...
 
virtual ~VQwDataElement ()
 Virtual destructor. More...
 
Bool_t IsNameEmpty () const
 Is the name of this element empty? More...
 
void SetElementName (const TString &name)
 Set the name of this element. More...
 
virtual const TString & GetElementName () const
 Get the name of this element. More...
 
size_t GetNumberOfDataWords ()
 Get the number of data words in this data element. More...
 
UInt_t GetGoodEventCount () const
 
virtual VQwDataElementoperator+= (const VQwDataElement &value)
 Addition-assignment operator. More...
 
virtual VQwDataElementoperator-= (const VQwDataElement &value)
 Subtraction-assignment operator. More...
 
virtual void Sum (const VQwDataElement &value1, const VQwDataElement &value2)
 Sum operator. More...
 
virtual void Difference (const VQwDataElement &value1, const VQwDataElement &value2)
 Difference operator. More...
 
virtual void Ratio (const VQwDataElement &numer, const VQwDataElement &denom)
 Ratio operator. More...
 
virtual UInt_t GetEventcutErrorFlag ()
 return the error flag on this channel/device More...
 
virtual Double_t GetNormClockValue ()
 
TString GetSubsystemName () const
 Return the name of the inheriting subsystem name. More...
 
void SetSubsystemName (TString sysname)
 Set the name of the inheriting subsystem name. More...
 
TString GetModuleType () const
 Return the type of the beam instrument. More...
 
void SetModuleType (TString ModuleType)
 set the type of the beam instrument More...
 
- Public Member Functions inherited from MQwHistograms
void ShareHistograms (const MQwHistograms *source)
 Share histogram pointers between objects. More...
 
- Public Member Functions inherited from MQwMockable
 MQwMockable ()
 
virtual ~MQwMockable ()
 
void SetRandomEventDriftParameters (Double_t amplitude, Double_t phase, Double_t frequency)
 Set a single set of harmonic drift parameters. More...
 
void AddRandomEventDriftParameters (Double_t amplitude, Double_t phase, Double_t frequency)
 Add drift parameters to the internal set. More...
 
void SetRandomEventParameters (Double_t mean, Double_t sigma)
 Set the normal random event parameters. More...
 
void SetRandomEventAsymmetry (Double_t asymmetry)
 Set the helicity asymmetry. More...
 
Double_t GetRandomValue ()
 
void UseExternalRandomVariable ()
 Set the flag to use an externally provided random variable. More...
 
void SetExternalRandomVariable (Double_t random_variable)
 Set the externally provided random variable. More...
 

Additional Inherited Members

- Public Types inherited from VQwDataElement
enum  EDataToSave { kRaw = 0, kDerived }
 
- Static Public Member Functions inherited from VQwScaler_Channel
static Int_t GetBufferOffset (Int_t scalerindex, Int_t wordindex, UInt_t header=1)
 
static void PrintErrorCounterHead ()
 
static void PrintErrorCounterTail ()
 
- Protected Member Functions inherited from VQwScaler_Channel
VQwScaler_Channeloperator/= (const VQwScaler_Channel &)
 
- Protected Member Functions inherited from VQwHardwareChannel
void SetNumberOfDataWords (const UInt_t &numwords)
 Set the number of data words in this data element. More...
 
void SetNumberOfSubElements (const size_t elements)
 Set the number of data words in this data element. More...
 
void SetDataToSave (TString datatosave)
 Set the flag indicating if raw or derived values are in this data element. More...
 
void SetDataToSave (VQwDataElement::EDataToSave datatosave)
 Set the flag indicating if raw or derived values are in this data element. More...
 
void RangeCheck (size_t element) const
 Checks that the requested element is in range, to be used in accesses to subelements similar to std::vector::at(). More...
 
- Protected Member Functions inherited from VQwDataElement
void SetNumberOfDataWords (const UInt_t &numwords)
 Set the number of data words in this data element. More...
 
virtual VQwDataElementoperator= (const VQwDataElement &value)
 Arithmetic assignment operator: Should only copy event-based data. More...
 
virtual void UpdateErrorFlag (const UInt_t &error)
 
- Protected Member Functions inherited from MQwHistograms
 MQwHistograms ()
 Default constructor. More...
 
 MQwHistograms (const MQwHistograms &source)
 Copy constructor. More...
 
virtual ~MQwHistograms ()
 Virtual destructor. More...
 
virtual MQwHistogramsoperator= (const MQwHistograms &value)
 
void Fill_Pointer (TH1_ptr hist_ptr, Double_t value)
 
void AddHistogram (TH1 *h)
 Register a histogram. More...
 
- Protected Attributes inherited from VQwScaler_Channel
UInt_t fValue_Raw_Old
 
UInt_t fValue_Raw
 
Double_t fValue
 
Double_t fValueM2
 
Double_t fValueError
 
const VQwHardwareChannelfNormChannelPtr
 
Double_t fClockNormalization
 
std::string fNormChannelName
 
Bool_t fNeedsExternalClock
 
Bool_t fIsDifferentialScaler
 
Int_t fNumEvtsWithHWErrors
 
Int_t fNumEvtsWithEventCutsRejected
 
- Protected Attributes inherited from VQwHardwareChannel
UInt_t fNumberOfDataWords
 Number of raw data words in this data element. More...
 
UInt_t fNumberOfSubElements
 Number of subelements in this data element. More...
 
EDataToSave fDataToSave
 
size_t fTreeArrayIndex
 
size_t fTreeArrayNumEntries
 
Double_t fPedestal
 
Double_t fCalibrationFactor
 
Bool_t kFoundPedestal
 
Bool_t kFoundGain
 
Int_t bEVENTCUTMODE
 
Double_t fULimit
 
Double_t fLLimit
 
Double_t fStability
 
- Protected Attributes inherited from VQwDataElement
TString fElementName
 Name of this data element. More...
 
UInt_t fNumberOfDataWords
 Number of raw data words in this data element. More...
 
Int_t fGoodEventCount
 Number of good events accumulated in this element. More...
 
TString fSubsystemName
 
TString fModuleType
 
UInt_t fErrorFlag
 This the standard error code generated for the channel that contains the global/local/stability flags and the Device error code (Unique error code for HW failures) More...
 
UInt_t fErrorConfigFlag
 contains the global/local/stability flags More...
 
- Protected Attributes inherited from MQwHistograms
std::vector< TH1_ptrfHistograms
 Histograms associated with this data element. More...
 
- Protected Attributes inherited from MQwMockable
bool fUseExternalRandomVariable
 Flag to use an externally provided normal random variable. More...
 
double fExternalRandomVariable
 Externally provided normal random variable. More...
 
Double_t fMockAsymmetry
 Helicity asymmetry. More...
 
Double_t fMockGaussianMean
 Mean of normal distribution. More...
 
Double_t fMockGaussianSigma
 Sigma of normal distribution. More...
 
std::vector< Double_t > fMockDriftAmplitude
 Harmonic drift amplitude. More...
 
std::vector< Double_t > fMockDriftFrequency
 Harmonic drift frequency. More...
 
std::vector< Double_t > fMockDriftPhase
 Harmonic drift phase. More...
 
- Static Protected Attributes inherited from VQwScaler_Channel
static const Bool_t kDEBUG = kFALSE
 
- Static Protected Attributes inherited from MQwMockable
static boost::mt19937 fRandomnessGenerator
 Internal randomness generator. More...
 
static
boost::normal_distribution
< double > 
fNormalDistribution
 Internal normal probability distribution. More...
 
static
boost::variate_generator
< boost::mt19937,
boost::normal_distribution
< double > > 
fNormalRandomVariable
 Internal normal random variable. More...
 

Detailed Description

template<UInt_t data_mask = 0xffffffff, UInt_t data_shift = 0>
class QwScaler_Channel< data_mask, data_shift >

Definition at line 200 of file QwScaler_Channel.h.

Constructor & Destructor Documentation

template<UInt_t data_mask = 0xffffffff, UInt_t data_shift = 0>
QwScaler_Channel< data_mask, data_shift >::QwScaler_Channel ( )
inline

Definition at line 205 of file QwScaler_Channel.h.

template<UInt_t data_mask = 0xffffffff, UInt_t data_shift = 0>
QwScaler_Channel< data_mask, data_shift >::QwScaler_Channel ( const QwScaler_Channel< data_mask, data_shift > &  source)
inline

Definition at line 206 of file QwScaler_Channel.h.

207  : VQwScaler_Channel(source) { };
template<UInt_t data_mask = 0xffffffff, UInt_t data_shift = 0>
QwScaler_Channel< data_mask, data_shift >::QwScaler_Channel ( TString  name,
TString  datatosave = "raw" 
)
inline

Definition at line 208 of file QwScaler_Channel.h.

209  : VQwScaler_Channel(name,datatosave) { };

Member Function Documentation

template<unsigned int data_mask, unsigned int data_shift>
void QwScaler_Channel< data_mask, data_shift >::EncodeEventData ( std::vector< UInt_t > &  buffer)
virtual

Encode the event data into a CODA buffer.

Implements VQwScaler_Channel.

Definition at line 143 of file QwScaler_Channel.cc.

144 {
145  if (IsNameEmpty()) {
146  // This channel is not used, but is present in the data stream.
147  // Fill in with zero.
148  buffer.push_back( 0 );
149  } else {
150  buffer.push_back( ((this->fValue_Raw<<data_shift)&data_mask) );
151  //std::cout<<"this->fValue="<<this->fValue<<std::endl;
152  }
153 }
Bool_t IsNameEmpty() const
Is the name of this element empty?
template<unsigned int data_mask, unsigned int data_shift>
Int_t QwScaler_Channel< data_mask, data_shift >::ProcessEvBuffer ( UInt_t *  buffer,
UInt_t  num_words_left,
UInt_t  subelement = 0 
)
virtual

Process the CODA event buffer for this element.

Implements VQwScaler_Channel.

Definition at line 157 of file QwScaler_Channel.cc.

159 {
160  UInt_t words_read = 0;
161  if (IsNameEmpty()){
162  // This channel is not used, but is present in the data stream.
163  // Skip over this data.
164  words_read = fNumberOfDataWords;
165  } else if (num_words_left >= fNumberOfDataWords) {
166  fValue_Raw = ((buffer[0] & data_mask) >> data_shift);
167  fValue = fCalibrationFactor * (Double_t(fValue_Raw) - Double_t(fValue_Raw_Old) - fPedestal);
168  words_read = fNumberOfDataWords;
169 
170  // Store old raw value for differential scalers
171  if (IsDifferentialScaler())
173  else
174  fValue_Raw_Old = 0;
175 
176  } else {
177  //QwError << "QwScaler_Channel::ProcessEvBuffer: Not enough words!"<< QwLog::endl;
178  }
179  return words_read;
180 }
Bool_t IsNameEmpty() const
Is the name of this element empty?
UInt_t fNumberOfDataWords
Number of raw data words in this data element.
virtual Bool_t IsDifferentialScaler()

The documentation for this class was generated from the following files: