StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMtdHitMaker.h
1 #ifndef STAR_StMtdHitMaker_H
2 #define STAR_StMtdHitMaker_H
3 
4 /***************************************************************************
5  *
6  * $Id: StMtdHitMaker.h,v 1.13 2015/01/22 22:10:58 marr Exp $
7  * StMtdHitMaker - class to fill StEvent from DAQ reader
8  *--------------------------------------------------------------------------
9  *
10  ***************************************************************************/
11 #include "StRTSBaseMaker.h"
12 #include "TH3D.h"
13 #include "StMtdUtil/StMtdConstants.h"
14 struct mtd_t;
15 
16 class StEvent;
17 class StMtdCollection;
18 class StMtdRawHit;
19 class StMtdHit;
20 class StBTofINLCorr;
21 
22 //
23 #if !defined(ST_NO_TEMPLATE_DEF_ARGS) || defined(__CINT__)
24 typedef vector<Int_t> IntVec;
25 typedef vector<UInt_t> UIntVec;
26 #else
27 typedef vector<Int_t, allocator<Int_t>> IntVec;
28 typedef vector<UInt_t, allocator<UInt_t>> UIntVec;
29 #endif
30 
31 struct MtdRawHit {
32  UInt_t tdc;
33  UInt_t dataword;
34  UChar_t fiberid;
35  UChar_t backlegid;
36  UChar_t globaltdcchan;
37 };
38 
39 struct MTDSingleHit{
40  Int_t fiberId;
41  Int_t backleg; // 1-30
42  Int_t tray; // 1-5
43  Int_t channel; // 0-23
44  IntVec leadingEdgeTime;
45  IntVec trailingEdgeTime;
46 };
47 
49  Int_t fiberId;
50  Int_t backleg; // 1-30
51  Int_t tray; // 1-5
52  Int_t channel; // 0-23
53  Double_t leadingEdgeTime;
54  Double_t trailingEdgeTime;
55 };
56 
57 #ifndef ST_NO_TEMPLATE_DEF_ARGS
58  typedef vector<MTDSingleHit> mtdSingleHitVector;
59 #else
60  typedef vector<MTDSingleHit,allocator<MTDSingleHit>> mtdSingleHitVector;
61 #endif
62  typedef vector<MTDSingleHit>::iterator mtdSingleHitVectorIter;
63 
64 #define VHRBIN2PS 24.4140625 // Very High resolution mode, pico-second per bin
65  // 1000*25/1024 (ps/chn)
66 #define HRBIN2PS 97.65625 // High resolution mode, pico-second per bin
67  // 97.65625= 1000*100/1024 (ps/chn)
68 
75  private:
76  StEvent *mStEvent;
77  mtd_t *fMtd;
78  Int_t mUseMuDst;
79  Bool_t mCosmicFlag;
80  TString mCosmicTrigTimeWinFile;
81  Bool_t mTriggerWndSelection;
82  Int_t mSwapBacklegInRun13; // 0 - do not swap; 1 - for first part of Run13
83  // 2 - for second part of Run13
84  Bool_t mReverseStripInRun14; // Reverse strips in backleg 7, module 5 in Run14
85  Int_t mYear;
86  Int_t mNValidTrays;
87 
88  StMtdCollection* mMtdCollection;
89  StBTofINLCorr* mINLCorr;
90 
91  static const Int_t nTHUB = 2;
92  static const Int_t mNFIBER = 1;
93  UInt_t mTriggerTimeStamp[nTHUB];
94  Int_t mTray2TdigMap[gMtdNBacklegs][gMtdNModules];
95  Int_t mTrayId[gMtdNBacklegs][gMtdNModules];
96  Int_t mTdigId[gMtdNModulesAll];
97  Int_t mtdStrip[gMtdNChannels];
98  Double_t mTriggerTimeWindow[gMtdNModulesAll][2];
99 
100  vector<MtdRawHit> MtdLeadingHits;
101  vector<MtdRawHit> MtdTrailingHits;
102  mtdSingleHitVector mSingleHitVec[gMtdNModulesAll];
103 
104  TH3D *hxhyhz;
105 
106 
107  protected:
109  Int_t UnpackMtdRawData();
111  StRtsTable *GetNextRaw(Int_t sec);
112  Int_t tdcChan2globalStrip11(Int_t, Int_t, Int_t, Int_t);
113  Int_t tdcChan2globalStrip(Int_t, Int_t, Int_t, Int_t);
114  Int_t getTdigBoardId(Int_t backlegid, Int_t tray, Int_t chn);
115  Int_t getLocalTdcChan(Int_t backlegid, Int_t tray, Int_t chn);
116  Int_t getTdigLocalChan(Int_t backlegid, Int_t itdigid);
117  void fillMtdHeader();
119  void fillMtdHitCollection();
120  void fillMtdSingleHits();
121  void fillStEvent();
122  IntVec GetValidTrays();
123  IntVec GetValidChannel(int backleg, int tray, int &fiber);
124  UIntVec GetLeadingTdc(int backleg, int tray, int channel);
125  UIntVec GetTrailingTdc(int backleg, int tray, int channel);
126 
127  public:
128 
130  StMtdHitMaker(const char *name="mtd_raw");
131  ~StMtdHitMaker() ;
132  void setUseMuDst(Int_t val);
133  void setTriggerWndSelection(Bool_t val);
134  void setSwapBacklegInRun13(Int_t swap);
135  void setReverseStripInRun14(Bool_t re);
136  void setCosmicEvent(Bool_t val);
137  void setCosmicTrigTimeWinFile(const char *file);
138 
139  void Clear(Option_t* option="");
140  Int_t Init();
141  Int_t InitRun(Int_t);
142  Int_t FinishRun(Int_t);
143  Int_t Finish();
144  Int_t Make();
145 
147  vector<MtdRawHit> getLeadingHits();
149  vector<MtdRawHit> getTrailingHits();
150 
152  virtual const char *GetCVS() const {
153  static const char cvs[]="Tag $Name: $Id: built " __DATE__ " " __TIME__ ; return cvs;
154  }
155 
156  ClassDef(StMtdHitMaker, 4)
157 };
158 
159 inline vector<MtdRawHit> StMtdHitMaker::getLeadingHits() { return MtdLeadingHits; }
160 inline vector<MtdRawHit> StMtdHitMaker::getTrailingHits() { return MtdTrailingHits;}
161 inline void StMtdHitMaker::setUseMuDst(Int_t val) { mUseMuDst = val;}
162 inline void StMtdHitMaker::setTriggerWndSelection(Bool_t val) { mTriggerWndSelection = val;}
163 inline void StMtdHitMaker::setSwapBacklegInRun13(Int_t swap) { mSwapBacklegInRun13 = swap; }
164 inline void StMtdHitMaker::setReverseStripInRun14(Bool_t re) { mReverseStripInRun14 = re; }
165 inline void StMtdHitMaker::setCosmicEvent(Bool_t val) { mCosmicFlag = val; }
166 inline void StMtdHitMaker::setCosmicTrigTimeWinFile(const char *file)
167 { mCosmicTrigTimeWinFile = file; }
168 
169 #endif
void fillMtdSingleHits()
Int_t InitRun(Int_t)
Class StRTSBaseMaker - is an abstract StMaker to define the interface to access the DAQ data from the...
vector< MtdRawHit > getLeadingHits()
obtain the whole list of leading edge hits
UChar_t globaltdcchan
1,2,...,117
Definition: StMtdHitMaker.h:36
UChar_t backlegid
0 1 2,3
Definition: StMtdHitMaker.h:35
Int_t FinishRun(Int_t)
void Clear(Option_t *option="")
User defined functions.
void fillMtdHitCollection()
StRtsTable * GetNextRaw()
This is an overloaded member function, provided for convenience.
UChar_t fiberid
data word before unpack
Definition: StMtdHitMaker.h:34
UInt_t dataword
tdc time (in bin) per hit.
Definition: StMtdHitMaker.h:33
IntVec GetValidTrays()
ship collection to StEvent and check
virtual const char * GetCVS() const
cvs
StMtdCollection * GetMtdCollection()
Int_t UnpackMtdRawData()
Int_t tdcChan2globalStrip11(Int_t, Int_t, Int_t, Int_t)
Int_t tdcChan2globalStrip(Int_t, Int_t, Int_t, Int_t)
StMtdHitMaker(const char *name="mtd_raw")
Default constructor.
Definition: daq_mtd.h:9
vector< MtdRawHit > getTrailingHits()
obtain the whole list of trainling edge hits
void fillMtdRawHitCollection()