QwAnalysis
QwComptonPhotonDetector.h
Go to the documentation of this file.
1 /**
2  * \class QwComptonPhotonDetector QwComptonPhotonDetector.h
3  *
4  * \brief Class for the analysis of Compton photon detector data
5  *
6  * \author W. Deconinck
7  * \date 2009-09-04 18:06:23
8  * \ingroup QwCompton
9  *
10  * The QwComptonPhotonDetector class is defined as a parity subsystem that
11  * contains all data modules of the photon detector (SIS3320, V775, V792).
12  * It reads in a channel map and pedestal file, and defines the histograms
13  * and output trees.
14  *
15  */
16 
17 #ifndef __QwComptonPhotonDetector__
18 #define __QwComptonPhotonDetector__
19 
20 // System headers
21 #include <vector>
22 
23 // ROOT headers
24 #include <TTree.h>
25 
26 // Qweak headers
27 #include "VQwSubsystemParity.h"
28 #include "QwSIS3320_Channel.h"
29 #include "QwPMT_Channel.h"
30 #include "MQwV775TDC.h"
31 
33  public VQwSubsystemParity,
34  public MQwV775TDC,
35  public MQwSubsystemCloneable<QwComptonPhotonDetector> {
36 
37  private:
38  /// Private default constructor (not implemented, will throw linker error on use)
40 
41  public:
42 
43  /// Constructor with name
44  QwComptonPhotonDetector(TString name): VQwSubsystem(name), VQwSubsystemParity(name) { };
45  /// Copy constructor
47  : VQwSubsystem(source),VQwSubsystemParity(source),
48  fSamplingADC(source.fSamplingADC),
51  { }
52  /// Virtual destructor
53  virtual ~QwComptonPhotonDetector() { };
54 
55 
56  // Handle command line options
57  static void DefineOptions(QwOptions &options);
58  void ProcessOptions(QwOptions &options);
59 
60  /* derived from VQwSubsystem */
61  Int_t LoadChannelMap(TString mapfile);
62  Int_t LoadInputParameters(TString pedestalfile);
63  Int_t LoadEventCuts(TString & filename);
64  Bool_t SingleEventCuts();
65  Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words);
66  Int_t ProcessEvBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words);
67 
68  void ClearEventData();
69  void ProcessEvent();
70  Bool_t IsGoodEvent();
71 
72  void RandomizeEventData(int helicity = 0);
73  void EncodeEventData(std::vector<UInt_t> &buffer);
74 
78  void Sum(VQwSubsystem *value1, VQwSubsystem *value2);
79  void Difference(VQwSubsystem *value1, VQwSubsystem *value2);
80  void Ratio(VQwSubsystem *numer, VQwSubsystem *denom);
81  void Scale(Double_t factor);
82 
83  Int_t LoadEventCuts(TString filename) { return 0; };
84  Bool_t ApplySingleEventCuts() { return kTRUE; };
86  void PrintErrorCounters() const {};
87  UInt_t GetEventcutErrorFlag() { return 0; };
88 
89  //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
90  void UpdateErrorFlag(const VQwSubsystem *ev_error){
91  };
92  Bool_t CheckRunningAverages(Bool_t ) { return kTRUE; };
93 
95  //remove one entry from the running sums for devices
97  };
99 
101  void ConstructHistograms(TDirectory *folder, TString &prefix);
102  void FillHistograms();
103 
105  void ConstructTree(TDirectory *folder, TString &prefix);
106  void FillTree();
107  void DeleteTree();
108 
110  void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector<Double_t> &values);
111  void ConstructBranch(TTree *tree, TString& prefix) { };
112  void ConstructBranch(TTree *tree, TString& prefix, QwParameterFile& trim_file) { };
113  void FillTreeVector(std::vector<Double_t> &values) const;
114 
115  Bool_t Compare(VQwSubsystem *source);
116  Bool_t CompareADC(VQwSubsystem *source);
117  Bool_t CompareTDC(VQwSubsystem *source);
118  Bool_t CompareQDC(VQwSubsystem *source);
119 
120  void PrintValue() const;
121  void PrintInfo() const;
122 
123  QwSIS3320_Channel* GetSIS3320Channel(const TString name);
124 
125  protected:
126 
127  /// Expert tree
128  TTree* fTree;
129  /// Expert tree fields
131 
132  /// Mapping from ROC/subbank to channel type
134  std::map< Int_t, ChannelType_t > fMapping;
135 
136  /// List of sampling ADC channels
137  typedef std::map< Int_t, std::vector <std::vector <Int_t> > > SamplingADC_Mapping_t;
139  std::vector< QwSIS3320_Channel > fSamplingADC;
140 
141  /// List of integrating QDC channels
142  typedef std::map< Int_t, std::vector< std::vector< Int_t > > > IntegratingADC_Mapping_t;
144  std::vector< QwPMT_Channel > fMultiQDC_Channel;
145  std::vector< std::vector< QwPMT_Channel > > fMultiQDC_Events;
146 
147  /// List of integrating TDC channels
148  typedef std::map< Int_t, std::vector< std::vector< Int_t > > > IntegratingTDC_Mapping_t;
150  std::vector< QwPMT_Channel > fMultiTDC_Channel;
151  std::vector< std::vector< QwPMT_Channel > > fMultiTDC_Events;
152 
153  private:
154 
155  // Number of good events
157 
158  static const Bool_t kDebug = kTRUE;
159 
160 };
161 
162 #endif // __QwComptonPhotonDetector__
void PrintErrorCounters() const
Report the number of events failed due to HW and event cut failures.
std::map< Int_t, std::vector< std::vector< Int_t > > > IntegratingTDC_Mapping_t
List of integrating TDC channels.
std::vector< QwPMT_Channel > fMultiTDC_Channel
Class for the decoding of the SIS3320 sampling ADC data.
QwSIS3320_Channel * GetSIS3320Channel(const TString name)
std::vector< QwPMT_Channel > fMultiQDC_Channel
Int_t LoadInputParameters(TString pedestalfile)
Int_t LoadEventCuts(TString &filename)
void ConstructBranch(TTree *tree, TString &prefix, QwParameterFile &trim_file)
Construct the branch and tree vector based on the trim file.
Int_t LoadEventCuts(TString filename)
Load the event cuts file.
void Ratio(VQwSubsystem *numer, VQwSubsystem *denom)
void Sum(VQwSubsystem *value1, VQwSubsystem *value2)
Int_t fTree_fNEvents
Expert tree fields.
std::vector< std::vector< QwPMT_Channel > > fMultiTDC_Events
An options class.
Definition: QwOptions.h:133
void IncrementErrorCounters()
Increment the error counters.
std::map< Int_t, ChannelType_t > fMapping
void AccumulateRunningSum(VQwSubsystem *value)
VQwSubsystem & operator=(VQwSubsystem *value)
void DeaccumulateRunningSum(VQwSubsystem *value)
remove one entry from the running sums for devices
VQwSubsystem & operator-=(VQwSubsystem *value)
std::vector< std::vector< QwPMT_Channel > > fMultiQDC_Events
Virtual base class for the parity subsystems.
void EncodeEventData(std::vector< UInt_t > &buffer)
QwComptonPhotonDetector(TString name)
Constructor with name.
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
Definition: VQwSubsystem.h:209
QwComptonPhotonDetector()
Private default constructor (not implemented, will throw linker error on use)
Bool_t CompareQDC(VQwSubsystem *source)
void Difference(VQwSubsystem *value1, VQwSubsystem *value2)
std::map< Int_t, std::vector< std::vector< Int_t > > > IntegratingADC_Mapping_t
List of integrating QDC channels.
virtual ~QwComptonPhotonDetector()
Virtual destructor.
IntegratingTDC_Mapping_t fMultiTDC_Mapping
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
VQwSubsystem & operator+=(VQwSubsystem *value)
static void DefineOptions()
Define options function (note: no virtual static functions in C++)
Definition: VQwSubsystem.h:88
void ProcessOptions(QwOptions &options)
Process the command line options.
QwComptonPhotonDetector(const QwComptonPhotonDetector &source)
Copy constructor.
UInt_t GetEventcutErrorFlag()
Return the error flag to the top level routines related to stability checks and ErrorFlag updates...
void RandomizeEventData(int helicity=0)
Bool_t Compare(VQwSubsystem *source)
std::vector< QwSIS3320_Channel > fSamplingADC
Bool_t CompareADC(VQwSubsystem *source)
The pure virtual base class of all subsystems.
Definition: VQwSubsystem.h:59
Int_t ProcessEvBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
ChannelType_t
Mapping from ROC/subbank to channel type.
SamplingADC_Mapping_t fSamplingADC_Mapping
virtual void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)=0
Construct the branch and tree vector.
Class for the analysis of Compton photon detector data.
Bool_t ApplySingleEventCuts()
Apply the single event cuts.
std::map< Int_t, std::vector< std::vector< Int_t > > > SamplingADC_Mapping_t
List of sampling ADC channels.
virtual void ConstructTree()
Construct the tree for this subsystem.
Definition: VQwSubsystem.h:257
void FillTreeVector(std::vector< Double_t > &values) const
Int_t LoadChannelMap(TString mapfile)
Bool_t CompareTDC(VQwSubsystem *source)
IntegratingADC_Mapping_t fMultiQDC_Mapping
void UpdateErrorFlag(const VQwSubsystem *ev_error)
update the error flag in the subsystem level from the top level routines related to stability checks...
void ConstructBranch(TTree *tree, TString &prefix)
Construct the branch and tree vector.