QwAnalysis
QwTriggerScintillator.h
Go to the documentation of this file.
1 /**********************************************************\
2 * File: QwTriggerScintillator.h *
3 * *
4 * Author: P. M. King *
5 * Time-stamp: <2007-05-08 15:40> *
6 \**********************************************************/
7 
8 #ifndef __QWTRIGGERSCINTILLATOR__
9 #define __QWTRIGGERSCINTILLATOR__
10 
11 #include <vector>
12 #include "TTree.h"
13 
14 #include "VQwSubsystemTracking.h"
15 
16 #include "QwHit.h"
17 #include "QwHitContainer.h"
18 
19 #include "QwTypes.h"
20 #include "QwDetectorInfo.h"
21 
22 #include "MQwV775TDC.h"
23 #include "QwScaler_Channel.h"
24 #include "QwPMT_Channel.h"
25 #include "QwF1TDContainer.h"
26 #include "QwSoftwareMeantime.h"
27 
28 #include "QwColor.h"
29 #include "QwOptions.h"
30 
31 ///
32 /// \ingroup QwTracking
33 class QwTriggerScintillator: public VQwSubsystemTracking, public MQwSubsystemCloneable<QwTriggerScintillator> {
34  /******************************************************************
35  * Class: QwTriggerScintillator
36  *
37  *
38  ******************************************************************/
39  private:
40  /// Private default constructor (not implemented, will throw linker error on use)
42 
43  public:
44  /// Constructor with name
45  QwTriggerScintillator(const TString& name);
46  /// Virtual destructor
47  virtual ~QwTriggerScintillator();
48 
49  /* Member functions derived from VQwSubsystem. */
50  Int_t LoadChannelMap(TString mapfile);
51  Int_t LoadInputParameters(TString mapfile){return 0;};
52 
53 
55  void ConstructHistograms(TDirectory *folder, TString &prefix);
56  void FillHistograms();
57 
59  void ConstructBranchAndVector(TTree *tree, TString& prefix, std::vector<Double_t> &values);
60  void FillTreeVector(std::vector<Double_t> &values) const;
61 
62  Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words);
63  void ReportConfiguration(Bool_t verbose);
64  Int_t ProcessEvBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words);
65 
66  void ProcessEvent();
67 
68 
69  void FillRawTDCWord(Int_t bank_index, Int_t slot_num, Int_t chan, UInt_t data);
71 
72  void ClearEventData();
73 
74  static void DefineOptions(QwOptions& options);
75  void ProcessOptions(QwOptions& options);
76 
77 
78  void GetHitList(QwHitContainer & grandHitContainer) {
79  grandHitContainer.Append(fTDCHits);
80  };
81 
82 
84 
85  protected:
86 
88 
89  Bool_t fDEBUG;
90 
93 
94 
95  TString fRegion; /// Name of this subsystem (the region).
97  Int_t fCurrentSlot;
99 
100  UInt_t fBankID[3];
101  //bank ID's of 3 different modules for trigger scintillator
102  //fBankID[0] for V792/V775 QDC_Bank
103  //fBankID[1] for SIS3801 SCA_Bank
104  //fBankID[2] for F1TDC F1TDC_Bank
105 
106  static const UInt_t kMaxNumberOfModulesPerROC;
107  static const Int_t kF1ReferenceChannelNumber;
108 
109  static const Int_t kMaxNumberOfQwHitPlane;
110 
113 
114 
115 
121 
122  void FillRawWord(Int_t bank_index, Int_t slot_num, Int_t chan, UInt_t data);
123 
125  Int_t RegisterROCNumber (const UInt_t roc_id);
126  Int_t RegisterSubbank (const UInt_t bank_id);
127  Int_t RegisterSlotNumber (const UInt_t slot_id); // Tells this object that it will decode data from the current bank
128 
129  Int_t GetModuleIndex(size_t bank_index, size_t slot_num) const;
130 
131  Bool_t IsSlotRegistered(Int_t bank_index, Int_t slot_num) const {
132  return (GetModuleIndex(bank_index,slot_num) != -1);
133  };
134 
135 
136  EQwModuleType RegisterModuleType(TString moduletype);
137  Int_t LinkChannelToSignal(const UInt_t chan, const TString &name);
138  Int_t FindSignalIndex(const EQwModuleType modtype, const TString &name) const;
139 
140 
141 
142  void SubtractReferenceTimes(); // be executed in ProcessEvent()
143 
144  // add QwDetectorInfo into QwDetecotrInfor of QwHit
145  // add F1TDC resolution into fTimeRes of QwHit
146  // add calibrated time (fTime*F1TDC_resolution_ns) into fTimens of QwHit
147 
148  void UpdateHits(); // be executed in ProcessEvent()
149 
150  void AddSoftwareMeantimeToHits(Bool_t option);
151 
152  std::vector< QwHit > fTDCHits;
153 
154  std::vector< std::vector< QwDetectorID > > fDetectorIDs;
155  // Indexed by module_index and Channel; and so on....
156  std::vector< std::pair<Int_t, Int_t> > fReferenceChannels;
157  // reference chans number <first:tdc_index, second:channel_number>
158  // fReferenceChannels[tdc_index,channel_number][ num of [tdc,chan] set]
159  std::vector< std::vector<Double_t> > fReferenceData;
160  // fReferenceData[bank_index][channel_number]
161 
162 
163  std::vector< std::vector<Int_t> > fModuleIndex; // Module index, indexed by bank_index and slot_number
164 
165  std::vector< EQwModuleType > fModuleTypes;
166  std::vector< std::vector< std::pair< EQwModuleType, Int_t> > > fModulePtrs; // Indexed by Module_index and Channel; gives the plane and wire assignment.
167 
168  // We need a mapping of module,channel into PMT index, ADC/TDC
169  std::vector< std::vector<QwPMT_Channel> > fPMTs;
170  std::vector<QwSIS3801D24_Channel> fSCAs;
171  std::map<TString,size_t> fSCAs_map;
172  std::vector<Int_t> fSCAs_offset;
173 
174 
175  // For reference time subtraction
178  Double_t fRefTime;
179 
180  Bool_t IsF1ReferenceChannel (Int_t slot, Int_t chan) {
181  return ( slot == fRefTime_SlotNum && chan == fRefTime_ChanNum) ;
182  };
183 
184 };
185 
186 #endif
EQwModuleType RegisterModuleType(TString moduletype)
void FillTreeVector(std::vector< Double_t > &values) const
Fill the tree vector.
F1TDCs configuration and reference siganls container.
virtual ~QwTriggerScintillator()
Virtual destructor.
Int_t FindSignalIndex(const EQwModuleType modtype, const TString &name) const
Int_t RegisterSubbank(const UInt_t bank_id)
void GetHitList(QwHitContainer &grandHitContainer)
Get the hit list.
An options class.
Definition: QwOptions.h:133
std::vector< std::vector< QwPMT_Channel > > fPMTs
std::vector< std::pair< Int_t, Int_t > > fReferenceChannels
F1TDCReferenceContainer * fF1RefContainer
void ProcessOptions(QwOptions &options)
Process the command line options.
std::vector< EQwModuleType > fModuleTypes
Int_t LoadInputParameters(TString mapfile)
Mandatory parameter file definition.
void ReportConfiguration(Bool_t verbose)
QwTriggerScintillator & operator=(const QwTriggerScintillator &value)
std::vector< std::vector< QwDetectorID > > fDetectorIDs
Int_t fCurrentBankIndex
Name of this subsystem (the region).
Int_t GetModuleIndex(size_t bank_index, size_t slot_num) const
Int_t RegisterROCNumber(const UInt_t roc_id)
Software Meantime container.
std::vector< std::vector< Double_t > > fReferenceData
static const UInt_t kMaxNumberOfModulesPerROC
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
Definition: VQwSubsystem.h:209
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...
Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
std::map< TString, size_t > fSCAs_map
std::vector< Int_t > fSCAs_offset
static void DefineOptions()
Define options function (note: no virtual static functions in C++)
Definition: VQwSubsystem.h:88
Draft skeleton for the decoding-to-QTR interface class.
void FillRawTDCWord(Int_t bank_index, Int_t slot_num, Int_t chan, UInt_t data)
Int_t RegisterSlotNumber(const UInt_t slot_id)
EQwModuleType
Definition: QwTypes.h:148
std::vector< QwSIS3801D24_Channel > fSCAs
void AddSoftwareMeantimeToHits(Bool_t option)
void FillHardwareErrorSummary()
Hardware error summary.
std::vector< QwHit > fTDCHits
virtual void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)=0
Construct the branch and tree vector.
Int_t LinkChannelToSignal(const UInt_t chan, const TString &name)
static const Int_t kMaxNumberOfQwHitPlane
Bool_t IsF1ReferenceChannel(Int_t slot, Int_t chan)
QwTriggerScintillator()
Private default constructor (not implemented, will throw linker error on use)
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
Construct the branch and tree vector.
An options class which parses command line, config file and environment.
Int_t LoadChannelMap(TString mapfile)
Mandatory map file definition.
QwF1TDContainer * fF1TDContainer
std::vector< std::vector< Int_t > > fModuleIndex
std::vector< std::vector< std::pair< EQwModuleType, Int_t > > > fModulePtrs
static const Int_t kF1ReferenceChannelNumber
MeanTimeContainer * fSoftwareMeantimeContainer[2]
void FillHistograms()
Fill the histograms for this subsystem.
void Append(const QwHitContainer &mylist)
Bool_t IsSlotRegistered(Int_t bank_index, Int_t slot_num) const
void FillRawWord(Int_t bank_index, Int_t slot_num, Int_t chan, UInt_t data)