QwAnalysis
QwSciFiDetector.h
Go to the documentation of this file.
1 //
2 // File: QwSciFiDetector.h
3 // Author: Jeong Han Lee
4 // Time-stamp: Sunday, January 15 17:26:13 EST 2012
5 //
6 
7 #ifndef __QWSCIFIDETECTOR__
8 #define __QWSCIFIDETECTOR__
9 
10 //#include "TH1F.h"
11 //#include "TH2F.h"
12 #include "TTree.h"
13 
14 #include "QwHit.h"
15 #include "QwHitContainer.h"
16 
17 #include "QwTypes.h"
18 #include "QwDetectorInfo.h"
19 
20 #include <exception>
21 #include <iostream>
22 #include <fstream>
23 #include <string>
24 #include <iomanip>
25 
26 #include "VQwSubsystemTracking.h"
27 #include "QwF1TDContainer.h"
28 #include "QwScaler_Channel.h"
29 
30 class QwHitContainer;
31 
32 
33 class QwSciFiDetector: public VQwSubsystemTracking, public MQwSubsystemCloneable<QwSciFiDetector>
34 {
35 
36  private:
37  /// Private default constructor (not implemented, will throw linker error on use)
39 
40  public:
41  QwSciFiDetector(const TString& name);
42  virtual ~QwSciFiDetector();
43 
44  /* Member functions derived from VQwSubsystemTracking. */
45  Int_t LoadChannelMap(TString mapfile );
46  Int_t LoadInputParameters(TString mapfile);
47 
48 
49  void FillListOfHits(QwHitContainer& hitlist);
50 
52  void ConstructHistograms(TDirectory *folder, TString &prefix);
53  void FillHistograms();
54  void DeleteHistograms();
55 
57  void ConstructBranchAndVector(TTree *tree, TString& prefix, std::vector<Double_t> &values);
58  void FillTreeVector(std::vector<Double_t> &values) const;
59 
60 
61 
62 
63  Int_t ProcessEvBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words);
64 
65  Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words);
66  void PrintConfigurationBuffer(UInt_t *buffer,UInt_t num_words);
67  void ReportConfiguration(Bool_t verbose);
68  void ProcessEvent();
69 
70  void FillRawTDCWord(Int_t bank_index, Int_t slot_num, Int_t chan, UInt_t data);
72 
73 
74  void ClearEventData();
75 
76 
77 
78  void GetHitList(QwHitContainer & grandHitContainer){
79  grandHitContainer.Append(fTDCHits);
80  };
81 
82 
83 
84  protected:
85 
86 
87  static const UInt_t kMaxNumberOfSlotsPerROC;
88  static const Int_t kF1ReferenceChannelNumber;
89 
90  TString kRegion; /// Name of this subsystem (the region).
92  Int_t fCurrentSlot;
96  // Int_t kNumberOfF1TDCs;
97 
98 
99 
100 
104 
106  Int_t RegisterROCNumber (const UInt_t roc_id);
107  Int_t RegisterSubbank (const UInt_t bank_id);
108  Int_t RegisterSlotNumber (const UInt_t slot_id); // Tells this object that it will decode data from the current bank
109 
110  Int_t GetModuleIndex(size_t bank_index, size_t slot_num) const;
111 
112  Bool_t IsSlotRegistered(Int_t bank_index, Int_t slot_num) const {
113  return (GetModuleIndex(bank_index,slot_num) != -1);
114  };
115 
116 
117 
118  void SubtractReferenceTimes(); // be executed in ProcessEvent()
119 
120  // add QwDetectorInfo into QwDetecotrInfor of QwHit
121  // add F1TDC resolution into fTimeRes of QwHit
122  // add calibrated time (fTime*F1TDC_resolution_ns) into fTimens of QwHit
123 
124  void UpdateHits(); // be executed in ProcessEvent()
125 
126 
127  std::vector< QwHit > fTDCHits;
128  std::vector< std::vector<Int_t> > fModuleIndex;
129  // Module index, indexed by bank_index and slot_number
130  // std::vector< EQwModuleType > fModuleTypes;
131 
132  std::vector< std::vector< QwDetectorID > > fDetectorIDs;
133  // Indexed by module_index and Channel; and so on....
134 
135  std::vector< std::pair<Int_t, Int_t> > fReferenceChannels;
136  // reference chans number <first:tdc_index, second:channel_number>
137  // fReferenceChannels[tdc_index,channel_number][ num of [tdc,chan] set]
138  std::vector< std::vector<Double_t> > fReferenceData;
139  // fReferenceData[bank_index][channel_number]
140 
141  std::vector<QwSIS3801D24_Channel> fSCAs;
142  std::map<TString,size_t> fSCAs_map;
143  std::vector<Int_t> fSCAs_offset;
144 
145 
146  // Currently, we have only one scaler, if one wants to add more
147  // change this to vector or others.
148  // Wednesday, January 18 16:07:23 EST 2012,jhlee
150 
151 };
152 
153 #endif
void ReportConfiguration(Bool_t verbose)
Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
F1TDCs configuration and reference siganls container.
void ClearAllBankRegistrations()
F1TDCReferenceContainer * fF1RefContainer
std::vector< QwHit > fTDCHits
void FillRawTDCWord(Int_t bank_index, Int_t slot_num, Int_t chan, UInt_t data)
std::vector< std::pair< Int_t, Int_t > > fReferenceChannels
void SubtractReferenceTimes()
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
Construct the branch and tree vector.
Int_t LoadInputParameters(TString mapfile)
Mandatory parameter file definition.
Int_t GetModuleIndex(size_t bank_index, size_t slot_num) const
std::vector< Int_t > fSCAs_offset
UInt_t kMaxNumberOfChannelsPerF1TDC
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
Definition: VQwSubsystem.h:209
QwF1TDContainer * fF1TDContainer
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...
std::vector< std::vector< Int_t > > fModuleIndex
Bool_t IsSlotRegistered(Int_t bank_index, Int_t slot_num) const
Draft skeleton for the decoding-to-QTR interface class.
QwSciFiDetector()
Private default constructor (not implemented, will throw linker error on use)
Int_t RegisterROCNumber(const UInt_t roc_id)
void FillTreeVector(std::vector< Double_t > &values) const
Fill the tree vector.
static const Int_t kF1ReferenceChannelNumber
void FillHardwareErrorSummary()
Hardware error summary.
void FillHistograms()
Fill the histograms for this subsystem.
void FillListOfHits(QwHitContainer &hitlist)
std::vector< std::vector< Double_t > > fReferenceData
Int_t fCurrentBankIndex
Name of this subsystem (the region).
static const UInt_t kMaxNumberOfSlotsPerROC
void PrintConfigurationBuffer(UInt_t *buffer, UInt_t num_words)
virtual void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)=0
Construct the branch and tree vector.
Int_t LoadChannelMap(TString mapfile)
Mandatory map file definition.
void GetHitList(QwHitContainer &grandHitContainer)
Get the hit list.
MQwF1TDC fF1TDCDecoder
void Append(const QwHitContainer &mylist)
std::map< TString, size_t > fSCAs_map
Int_t RegisterSubbank(const UInt_t bank_id)
Int_t RegisterSlotNumber(const UInt_t slot_id)
std::vector< QwSIS3801D24_Channel > fSCAs
std::vector< std::vector< QwDetectorID > > fDetectorIDs
virtual ~QwSciFiDetector()