QwAnalysis
QwIntegratedRaster.h
Go to the documentation of this file.
1 /**********************************************************\
2 * File: QwIntegratedRaster.h *
3 * *
4 * Author: *
5 * Time-stamp: *
6 \**********************************************************/
7 
8 #ifndef __QwIntegratedRaster__
9 #define __QwIntegratedRaster__
10 
11 // System headers
12 #include <vector>
13 
14 // ROOT headers
15 #include "TTree.h"
16 
17 // Qweak headers
18 #include "VQwSubsystemParity.h"
19 
21 #include "QwTypes.h"
22 
23 
25 
26  public:
27 
29  fIndex(-1),
30  fSubelement(999999),fmoduletype(""),fdetectorname("")
31  {};
32 
33  int fSubbankIndex;
34  int fWordInSubbank; //first word reported for this channel in the subbank
35  //(eg VQWK channel report 6 words for each event, scalers oly report one word per event)
36  // The first word of the subbank gets fWordInSubbank=0
37 
38  // EQwInstrumentType fTypeID; // type of detector
39  int fIndex; // index of this detector in the vector containing all the detector of same type
40  UInt_t fSubelement; // some detectors have many subelements (eg stripline have 4 antenas) some have only one sub element(eg lumis have one channel)
41 
42  TString fmoduletype; // eg: VQWK, SCALER
43  TString fdetectorname;
44  TString fdetectortype; // IntegratedRasterChannel,fLumiCounter .. this string is encoded by fTypeID
45  // std::vector<TString> fCombinedChannelNames;
46  // std::vector<Double_t> fWeight;
47  void Print() const;
48 
49 };
50 
51 
52 /*****************************************************************
53 * Class:
54 ******************************************************************/
55 class QwIntegratedRaster : public VQwSubsystemParity, public MQwSubsystemCloneable<QwIntegratedRaster> {
56  /////
57 
58  private:
59  /// Private default constructor (not implemented, will throw linker error on use)
61 
62  public:
63  /// Constructor with name
64  QwIntegratedRaster(const TString& name)
65  : VQwSubsystem(name),VQwSubsystemParity(name)
66  { };
67  /// Copy constructor
69  : VQwSubsystem(source),VQwSubsystemParity(source),
71  { }
72  /// Virtual destructor
73  virtual ~QwIntegratedRaster() { };
74 
75 
76  /* derived from VQwSubsystem */
77 
78  /// \brief Define options function
79  static void DefineOptions(QwOptions &options);
80 
81 
82  void ProcessOptions(QwOptions &options);//Handle command line options
83  Int_t LoadChannelMap(TString mapfile);
84  Int_t LoadInputParameters(TString pedestalfile);
85  Int_t LoadEventCuts(TString filename);//derived from VQwSubsystemParity
87  Bool_t ApplySingleEventCuts();//derived from VQwSubsystemParity
88  void PrintErrorCounters() const;// report number of events failed due to HW and event cut faliures
89  UInt_t GetEventcutErrorFlag();//return the error flag
90 
91  //update the error flag in the subsystem level from the top level routines related to stability checks. This will uniquely update the errorflag at each channel based on the error flag in the corresponding channel in the ev_error subsystem
92  void UpdateErrorFlag(const VQwSubsystem *ev_error){
93  };
94 
96  //remove one entry from the running sums for devices
98  };
100 
101  Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words);
102  Int_t ProcessEvBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words);
103  void PrintDetectorID() const;
104 
105  void ClearEventData();
106  Bool_t IsGoodEvent();
107 
108  void ProcessEvent();
110  void ProcessEvent_2(){};
111 
112  void SetRandomEventParameters(Double_t mean, Double_t sigma);
113  void SetRandomEventAsymmetry(Double_t asymmetry);
114  void RandomizeEventData(int helicity = 0, double time = 0.0);
115  void EncodeEventData(std::vector<UInt_t> &buffer);
116 
120  void Sum(VQwSubsystem *value1, VQwSubsystem *value2);
121  void Difference(VQwSubsystem *value1, VQwSubsystem *value2);
122  void Ratio(VQwSubsystem *numer, VQwSubsystem *denom);
123  void Scale(Double_t factor);
124 
126  void ConstructHistograms(TDirectory *folder, TString &prefix);
127  void FillHistograms();
128 
129  void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector<Double_t> &values);
130  void ConstructBranch(TTree *tree, TString &prefix);
131  void ConstructBranch(TTree *tree, TString &prefix, QwParameterFile& trim_file);
132  void FillTreeVector(std::vector<Double_t> &values) const;
133  void FillDB(QwParityDB *db, TString datatype);
134  void FillErrDB(QwParityDB *db, TString datatype);
135  void WritePromptSummary(QwPromptSummary *ps, TString type);
136 
137  const VQwDataElement* GetChannel(const TString name) const;
138 
139  Bool_t Compare(VQwSubsystem *source);
140 
141  void PrintValue() const;
142  void PrintInfo() const;
143 
144 /////
145 protected:
146 
147  // EQwPMTInstrumentType GetDetectorTypeID(TString name);
148 
149  Int_t GetDetectorIndex(TString name);
150 
151  std::vector <QwIntegratedRasterChannel<QwVQWK_Channel> > fIntegratedRasterChannel;
152  std::vector <QwIntegratedRasterDetectorID> fDetectorIDs;
153 
154 protected:
155 
156 /////
157 private:
159 
160  static const Bool_t bDEBUG=kFALSE;
161 
162 };
163 
164 
165 
166 
167 #endif
virtual ~QwIntegratedRaster()
Virtual destructor.
void SetRandomEventParameters(Double_t mean, Double_t sigma)
const VQwDataElement * GetChannel(const TString name) const
void PrintValue() const
Print values of all channels.
Bool_t ApplySingleEventCuts()
Apply the single event cuts.
void Scale(Double_t factor)
Int_t ProcessEvBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware v...
void PrintErrorCounters() const
Report the number of events failed due to HW and event cut failures.
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
Construct the branch and tree vector.
Int_t LoadInputParameters(TString pedestalfile)
Mandatory parameter file definition.
static const Bool_t bDEBUG
void FillHistograms()
Fill the histograms for this subsystem.
An options class.
Definition: QwOptions.h:133
void Difference(VQwSubsystem *value1, VQwSubsystem *value2)
void PrintInfo() const
Print some information about the subsystem.
std::vector< QwIntegratedRasterDetectorID > fDetectorIDs
Virtual base class for the parity subsystems.
void FillDB(QwParityDB *db, TString datatype)
Fill the database.
VQwSubsystem & operator+=(VQwSubsystem *value)
void RandomizeEventData(int helicity=0, double time=0.0)
void Ratio(VQwSubsystem *numer, VQwSubsystem *denom)
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
Definition: VQwSubsystem.h:209
QwIntegratedRaster(const QwIntegratedRaster &source)
Copy constructor.
void FillTreeVector(std::vector< Double_t > &values) const
Fill the tree vector.
void FillErrDB(QwParityDB *db, TString datatype)
The pure virtual base class of all data elements.
Int_t LoadEventCuts(TString filename)
Load the event cuts file.
void SetRandomEventAsymmetry(Double_t asymmetry)
static void DefineOptions()
Define options function (note: no virtual static functions in C++)
Definition: VQwSubsystem.h:88
void EncodeEventData(std::vector< UInt_t > &buffer)
VQwSubsystem & operator=(VQwSubsystem *value)
Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsy...
UInt_t GetEventcutErrorFlag()
Return the error flag to the top level routines related to stability checks and ErrorFlag updates...
void ExchangeProcessedData()
Request processed data from other subsystems for internal use in the second event processing stage...
Int_t LoadChannelMap(TString mapfile)
Mandatory map file definition.
void UpdateErrorFlag(const VQwSubsystem *ev_error)
update the error flag in the subsystem level from the top level routines related to stability checks...
Int_t GetDetectorIndex(TString name)
std::vector< QwIntegratedRasterChannel< QwVQWK_Channel > > fIntegratedRasterChannel
void IncrementErrorCounters()
Increment the error counters.
void PrintDetectorID() const
The pure virtual base class of all subsystems.
Definition: VQwSubsystem.h:59
void AccumulateRunningSum(VQwSubsystem *value)
Update the running sums for devices.
Bool_t Compare(VQwSubsystem *source)
void WritePromptSummary(QwPromptSummary *ps, TString type)
Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
QwIntegratedRaster()
Private default constructor (not implemented, will throw linker error on use)
void Sum(VQwSubsystem *value1, VQwSubsystem *value2)
void CalculateRunningAverage()
Calculate the average for all good events.
void DeaccumulateRunningSum(VQwSubsystem *value)
remove one entry from the running sums for devices
void ConstructBranch(TTree *tree, TString &prefix)
Construct the branch and tree vector.
VQwSubsystem & operator-=(VQwSubsystem *value)
void ProcessEvent_2()
Process the event data again, including data from other subsystems. Not all derived classes will requ...
void ProcessOptions(QwOptions &options)
Process the command line options.
QwIntegratedRaster(const TString &name)
Constructor with name.