QwAnalysis
QwRaster.h
Go to the documentation of this file.
1 /**********************************************************\
2 * File: QwRaster.h *
3 * *
4 * Author: J. Pan *
5 * jpan@jlab.org *
6 * *
7 * Tue Jun 29 00:16:14 CDT 2010 *
8 \**********************************************************/
9 
10 #ifndef __QWRASTER__
11 #define __QWRASTER__
12 
13 // System headers
14 #include <vector>
15 
16 // ROOT headers
17 #include "TTree.h"
18 #include "TFile.h"
19 #include "TProfile2D.h"
20 
21 // Qweak headers
22 #include "VQwSubsystemTracking.h"
23 #include "MQwV775TDC.h"
24 #include "QwScaler_Channel.h"
25 #include "QwVQWK_Channel.h"
26 #include "QwPMT_Channel.h"
27 
28 // Forward declarations
29 class QwDatabase;
30 
31 class QwRaster: public VQwSubsystemTracking, public MQwSubsystemCloneable<QwRaster>
32 {
33  private:
34  /// Private default constructor (not implemented, will throw linker error on use)
35  QwRaster();
36 
37  public:
38  /// Constructor with name
39  QwRaster(const TString& name);
40  /// Virtual destructor
41  virtual ~QwRaster();
42 
43  // VQwSubsystem methods
44  void ProcessOptions(QwOptions &options); //Handle command line options
45 
46  Int_t LoadEventCuts(TString filename) { return 0; };
47  Bool_t ApplySingleEventCuts() { return kTRUE; };
48  void PrintErrorCounters() const {};
49  Bool_t CheckRunningAverages(Bool_t ) { return kTRUE; };
50 
51  /* Member functions derived from VQwSubsystem. */
52  Int_t LoadChannelMap(TString mapfile);
53  Int_t GetDetectorInfo(std::vector< std::vector< QwDetectorInfo > > & detector_info){return 0;};
54  Int_t LoadInputParameters(TString parameterfile);
55  Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words);
56  void InitializeChannel(TString name, TString datatosave);
57  void ClearEventData();
58 
59  Int_t ProcessEvBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words);
60  void ProcessEvent();
61 
63  void ConstructHistograms(TDirectory *folder, TString &prefix);
64  void FillHistograms();
65 
67  void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector<Double_t> &values);
68  void FillTreeVector(std::vector<Double_t> &values) const;
69 
70  void FillDB(QwDatabase *db, TString type) {return;};
71 
72  void GetHitList(QwHitContainer & grandHitContainer){};
73  void ReportConfiguration();
74 
75  void PrintValue() { };
76  void PrintInfo();
77 
78  protected:
79 
81  Bool_t fDEBUG;
82 
84 
85  TString fRegion; /// Name of this subsystem (the region).
86 
87  protected:
89  Int_t fCurrentSlot;
91 
92  UInt_t fBankID[2]; //bank ID's of 2 different modules for QwRaster
93  //fBankID[0] for V792/V775 QDC_Bank
94  //fBankID[1] for SIS3801 SCA_Bank
95 
96  protected:
97  static const UInt_t kMaxNumberOfModulesPerROC;
98  static const UInt_t kMaxNumberOfChannelsPerModule;
100 
101  std::vector< std::vector<Int_t> > fModuleIndex; /// Module index, indexed by bank_index and slot_number
102 
103  std::vector< EQwModuleType > fModuleTypes;
104  std::vector< std::vector< std::pair< EQwModuleType, Int_t> > > fModulePtrs; // Indexed by Module_index and Channel
105 
106  // We need a mapping of module,channel into PMT index, ADC/TDC
107  std::vector< std::vector<QwPMT_Channel> > fPMTs; // for QDC/TDC and F1TDC
108 
109  std::vector<QwSIS3801D24_Channel> fSCAs;
110  std::map<TString,size_t> fSCAs_map;
111  std::vector<Int_t> fSCAs_offset;
112 
113  void FillRawWord(Int_t bank_index, Int_t slot_num, Int_t chan, UInt_t data);
115  Int_t RegisterROCNumber(const UInt_t roc_id);
116  Int_t RegisterSubbank(const UInt_t bank_id);
117 
118  // Tells this object that it will decode data from the current bank
119  Int_t RegisterSlotNumber(const UInt_t slot_id);
120  EQwModuleType RegisterModuleType(TString moduletype);
121  Int_t GetModuleIndex(size_t bank_index, size_t slot_num) const;
122  Bool_t IsSlotRegistered(Int_t bank_index, Int_t slot_num) const {
123  return (GetModuleIndex(bank_index,slot_num) != -1);
124  };
125 
126  Int_t LinkChannelToSignal(const UInt_t chan, const TString &name);
127  Int_t FindSignalIndex(const EQwModuleType modtype, const TString &name) const;
128 
129  //UInt_t GetEventcutErrorFlag() { return 0; };//return the error flag to the main routine
130 
131  // raster specified histograms
132  TH2D* fRateMap;
133 
134  private:
135 
136  //static const Bool_t bStoreRawData;
137 
144 
145  Double_t fPositionX_ADC;
146  Double_t fPositionY_ADC;
147 
152 
153  Double_t fbpm_3h07a_xp;
154  Double_t fbpm_3h07a_xm;
155  Double_t fbpm_3h07a_yp;
156  Double_t fbpm_3h07a_ym;
157  Double_t fbpm_3h09b_xp;
158  Double_t fbpm_3h09b_xm;
159  Double_t fbpm_3h09b_yp;
160  Double_t fbpm_3h09b_ym;
161 
166 
167 };
168 
169 
170 #endif
171 
Double_t fbpm_3h09b_intercept
Definition: QwRaster.h:151
Double_t fbpm_3h07a_ym
Definition: QwRaster.h:156
Int_t LoadEventCuts(TString filename)
Optional event cut file.
Definition: QwRaster.h:46
Double_t fChannel_Offset_Y
Definition: QwRaster.h:141
Bool_t IsSlotRegistered(Int_t bank_index, Int_t slot_num) const
Definition: QwRaster.h:122
std::map< TString, size_t > fSCAs_map
Definition: QwRaster.h:110
UInt_t fBankID[2]
Definition: QwRaster.h:92
Double_t fbpm_3h09b_slope
Definition: QwRaster.h:150
Bool_t CheckRunningAverages(Bool_t)
Definition: QwRaster.h:49
EQwModuleType RegisterModuleType(TString moduletype)
Definition: QwRaster.cc:662
Int_t LoadChannelMap(TString mapfile)
Mandatory map file definition.
Definition: QwRaster.cc:44
An options class.
Definition: QwOptions.h:133
void FillDB(QwDatabase *db, TString type)
Definition: QwRaster.h:70
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
Construct the branch and tree vector.
Definition: QwRaster.cc:495
Int_t RegisterSubbank(const UInt_t bank_id)
Definition: QwRaster.cc:621
A database interface class.
Definition: QwDatabase.h:45
Int_t LinkChannelToSignal(const UInt_t chan, const TString &name)
Definition: QwRaster.cc:682
size_t fCurrentBankIndex
Name of this subsystem (the region).
Definition: QwRaster.h:88
void PrintValue()
Definition: QwRaster.h:75
Double_t fPositionY_ADC
Definition: QwRaster.h:146
std::vector< QwSIS3801D24_Channel > fSCAs
Definition: QwRaster.h:109
Double_t fPositionOffsetX
Definition: QwRaster.h:138
Int_t LoadInputParameters(TString parameterfile)
Mandatory parameter file definition.
Definition: QwRaster.cc:113
void ProcessOptions(QwOptions &options)
Process the command line options.
Definition: QwRaster.cc:39
Bool_t ApplySingleEventCuts()
Definition: QwRaster.h:47
Double_t fbpm_3h07a_slope
Definition: QwRaster.h:148
void GetHitList(QwHitContainer &grandHitContainer)
Get the hit list.
Definition: QwRaster.h:72
Double_t fChannel_Offset_X
Definition: QwRaster.h:140
void FillHistograms()
Fill the histograms for this subsystem.
Definition: QwRaster.cc:431
Double_t fbpm_3h07a_xm
Definition: QwRaster.h:154
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
Definition: VQwSubsystem.h:209
QwRaster()
Private default constructor (not implemented, will throw linker error on use)
Int_t fCurrentSlot
Definition: QwRaster.h:89
void ProcessEvent()
Definition: QwRaster.cc:307
virtual ~QwRaster()
Virtual destructor.
Definition: QwRaster.cc:32
Int_t FindSignalIndex(const EQwModuleType modtype, const TString &name) const
Definition: QwRaster.cc:733
Double_t fbpm_3h07a_pos_y
Definition: QwRaster.h:163
Double_t fCal_Factor_QDC_X
Definition: QwRaster.h:142
void FillRawWord(Int_t bank_index, Int_t slot_num, Int_t chan, UInt_t data)
Definition: QwRaster.cc:691
TH2D * fRateMap
Definition: QwRaster.h:132
static const UInt_t kMaxNumberOfChannelsPerModule
Definition: QwRaster.h:98
Int_t RegisterSlotNumber(const UInt_t slot_id)
Definition: QwRaster.cc:632
MQwV775TDC fQDCTDC
Definition: QwRaster.h:83
Int_t RegisterROCNumber(const UInt_t roc_id)
Definition: QwRaster.cc:612
Double_t fbpm_3h07a_pos_x
Definition: QwRaster.h:162
static const UInt_t kMaxNumberOfModulesPerROC
Definition: QwRaster.h:97
Double_t fbpm_3h09b_pos_y
Definition: QwRaster.h:165
Double_t fPositionOffsetY
Definition: QwRaster.h:139
TString fRegion
Definition: QwRaster.h:85
Double_t fbpm_3h09b_pos_x
Definition: QwRaster.h:164
std::vector< std::vector< Int_t > > fModuleIndex
Definition: QwRaster.h:101
EQwModuleType
Definition: QwTypes.h:148
Double_t fbpm_3h07a_intercept
Definition: QwRaster.h:149
void PrintInfo()
Definition: QwRaster.cc:750
void ClearAllBankRegistrations()
Definition: QwRaster.cc:603
virtual void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)=0
Construct the branch and tree vector.
Double_t fbpm_3h07a_xp
Definition: QwRaster.h:153
Double_t fbpm_3h09b_ym
Definition: QwRaster.h:160
Double_t fbpm_3h09b_yp
Definition: QwRaster.h:159
Int_t GetModuleIndex(size_t bank_index, size_t slot_num) const
Definition: QwRaster.cc:718
Int_t fCurrentIndex
Definition: QwRaster.h:90
void ReportConfiguration()
Definition: QwRaster.cc:576
std::vector< std::vector< std::pair< EQwModuleType, Int_t > > > fModulePtrs
Definition: QwRaster.h:104
Int_t fNumberOfModules
Definition: QwRaster.h:99
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...
Definition: QwRaster.cc:235
void FillTreeVector(std::vector< Double_t > &values) const
Fill the tree vector.
Definition: QwRaster.cc:542
Double_t fbpm_3h09b_xp
Definition: QwRaster.h:157
Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
Definition: QwRaster.cc:229
void InitializeChannel(TString name, TString datatosave)
Double_t fCal_Factor_QDC_Y
Definition: QwRaster.h:143
Double_t fPositionX_ADC
Definition: QwRaster.h:145
std::vector< Int_t > fSCAs_offset
Definition: QwRaster.h:111
EQwModuleType fCurrentType
Definition: QwRaster.h:80
Double_t fbpm_3h07a_yp
Definition: QwRaster.h:155
Double_t fbpm_3h09b_xm
Definition: QwRaster.h:158
Int_t GetDetectorInfo(std::vector< std::vector< QwDetectorInfo > > &detector_info)
Definition: QwRaster.h:53
Bool_t fDEBUG
Definition: QwRaster.h:81
std::vector< std::vector< QwPMT_Channel > > fPMTs
Definition: QwRaster.h:107
std::vector< EQwModuleType > fModuleTypes
Module index, indexed by bank_index and slot_number.
Definition: QwRaster.h:103
void PrintErrorCounters() const
Definition: QwRaster.h:48
void ClearEventData()
Definition: QwRaster.cc:202