StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StBemcRaw.h
1 // $Id: StBemcRaw.h,v 1.17 2010/12/22 22:58:57 stevens4 Exp $
2 // $Log: StBemcRaw.h,v $
3 // Revision 1.17 2010/12/22 22:58:57 stevens4
4 // Patch for BSMDE mapping problem in P10ih and P10ij productions (RT #2043)
5 //
6 // Revision 1.16 2009/02/26 12:00:40 mattheww
7 // added token check to BTOW header check
8 //
9 // Revision 1.15 2009/02/04 21:05:42 kocolosk
10 // Refactor StEEmcDb(Maker), new location for StEmcDecoder. Fixes RT #1388.
11 //
12 // Revision 1.14 2009/01/28 15:42:44 mattheww
13 // Put back some obsolete methods to satisfy StBemcData
14 //
15 // Revision 1.13 2009/01/27 19:58:36 mattheww
16 // Updates to StEmcRawMaker to be compatible with 2009 DAQ Format
17 //
18 // Revision 1.12 2008/10/24 18:19:07 mattheww
19 // Added option to throw out all hits in an event if any crates are corrupted
20 //
21 // Revision 1.11 2008/07/03 20:58:49 mattheww
22 // Added checking of every status table for each hit. Status table checks can be toggled using an option added to setCheckStatus. Also fixed a small bug.
23 //
24 // Revision 1.10 2007/09/10 22:21:41 kocolosk
25 // Support for new BPRS swap fixes (off by default for 06/07 production, on for analysis).
26 // StBemcTables now matches map fixes in case end users want to use this copy.
27 //
28 // Revision 1.9 2006/01/16 11:12:00 suaide
29 // tower map bug fixed and astyle run
30 //
31 // Revision 1.8 2005/01/07 20:33:18 suaide
32 // created a new method to correct for the PSD map problem
33 //
34 // Revision 1.7 2004/12/21 12:53:49 suaide
35 // moved StBemcTables to StEmcUtil
36 // corrected for y2005 PSD data banks
37 //
38 // Revision 1.6 2004/12/14 11:32:11 suaide
39 // added histograms for status tables creation
40 //
41 // Revision 1.5 2004/11/22 12:46:22 suaide
42 // added new flags for hit reconstruction. Status are not checked
43 // dureing production anymore in order to avoid bad status loaded in
44 // DB
45 //
46 // Revision 1.4 2004/10/21 00:01:50 suaide
47 // small changes in histogramming and messages for BEMC
48 // Complete version for EEMC done by Jan Balewski
49 //
50 // Revision 1.3 2004/10/19 17:53:00 suaide
51 // code clean up
52 //
53 // Revision 1.2 2004/10/19 13:10:38 suaide
54 // small fix
55 //
56 // Revision 1.1 2004/10/18 18:20:07 suaide
57 // New Maker. Will replace StEmcADCtoEMaker in production.
58 // It reads only DAQ structures. Output is StEvent.
59 //
60 //
70 #ifndef STAR_StBemcRaw
71 #define STAR_StBemcRaw
72 
73 #include "TObject.h"
74 #include "TDataSet.h"
75 #include "StEmcUtil/database/StBemcTables.h"
76 
77 #include "tables/St_controlADCtoE_Table.h"
78 #include "defines.h"
79 #include "TH2.h"
80 #include "StChain/StRTSBaseMaker.h"
81 class StEvent;
82 class StEmcRawData;
83 class StEmcCollection;
84 class StEmcRawMaker;
85 class StEmcDecoder;
86 
87 class StBemcRaw : public TObject
88 {
89 protected:
90  enum {kZero, kCrate, kStatus, kRms, kPed, kEn, kCalib, kOK};
91 
92  // BARREL HISTOGRAMS
93  TH2F* mBarrelNHitHist;
94  TH2F* mBarrelEtotHist;
95  TH2F* mBarrelAdcSumHist;
96  TH2F* mBarrelNCratesHist;
97  TH2F* mBarrelCrateStatusHist;
98  TH2F* mBarrelQAHisto[MAXDETBARREL];
99 
100  StEmcDecoder* mDecoder;
101  StBemcTables* mTables;
102  controlADCtoE_st* mControlADCtoE;
103 
104  Bool_t mSaveAllStEvent;
105  Bool_t mSaveAllBTOW;
106  Bool_t mPsdMapBug;
107  Bool_t mPsdMapBug2;
108  Bool_t mTowerMapBug;
109  Bool_t mSmdMapBug;
110  string mProdVer;
111 
112  Int_t mDate;
113  Int_t mTime;
114  Int_t mNZ[MAXDETBARREL];
115  Int_t mNCRATE[MAXDETBARREL];
116  Int_t mNSTATUS[MAXDETBARREL];
117  Int_t mNRMS[MAXDETBARREL];
118  Int_t mNPED[MAXDETBARREL];
119  Int_t mNOK[MAXDETBARREL];
120  Int_t mNTOTAL[MAXDETBARREL];
121  Int_t mADCSUM[MAXDETBARREL];
122  Int_t mNCRATESOK[MAXDETBARREL];
123  Float_t mTOTALE[MAXDETBARREL];
124  Int_t mCrateStatus[MAXDETBARREL][MAXCRATES];
125  Bool_t mIsCorrupted[MAXDETBARREL];
126  Int_t mCheckStatus[MAXDETBARREL][4];
127  Int_t mCrateVeto;
128  Bool_t mAnyCorrupted;
129 public:
130 
131  StBemcRaw();
132  virtual ~StBemcRaw();
133 
134  void initHisto();
135  void initQAHisto();
136  void fillHisto();
137 
138  Bool_t make(StEmcRawMaker * TheData, StEvent* event);
139  Bool_t convertFromDaq(StEmcRawMaker * DAQ, StEmcRawData* RAW);
140  //make(TDataSet*,StEvent*)made obsolete in 2009 with new DAQ format
141  Bool_t make(TDataSet*,StEvent*);
142  Bool_t make(StEmcRawData*,StEvent*);
143  //convertFromDaq(TDataSet*,StEmcRawData*)made obsolete in 2009 with new DAQ format
144  Bool_t convertFromDaq(TDataSet*, StEmcRawData*);
145  Int_t getBemcADCRaw(Int_t, Int_t, StEmcRawData*, Int_t&, Int_t&);
149  Int_t makeHit(StEmcCollection*, Int_t, Int_t, Int_t, Int_t, Int_t, Float_t&);
150  void createDecoder(Int_t,Int_t);
151  Bool_t isCorrupted(Int_t det)
152  {
153  return mIsCorrupted[det-1];
154  } // return kTRUE if the event is corrupted for that detector
155 
159  void setCheckStatus(Int_t det, Int_t flag, const char* option = "");
160  void setCrateVeto(Int_t flag);
161  void clearStats(Int_t);
162  void updateStats(Int_t,Int_t,Int_t, Float_t);
163  void printStats(Int_t);
164  void printConf();
165 
166  void setDate(Int_t d)
167  {
168  mDate = d;
169  }
170  void setTime(Int_t t)
171  {
172  mTime = t;
173  }
174  void setProdVer(string prodVer)
175  {
176  mProdVer = prodVer;
177  }
178  void saveAllStEvent(Bool_t a)
179  {
180  mSaveAllStEvent = a;
181  }
182  void saveAllBTOW(Bool_t a)
183  {
184  mSaveAllBTOW = a;
185  }
186  void psdMapBug(Bool_t a)
187  {
188  mPsdMapBug = a;
189  }
190  void psdMapBug2(Bool_t a)
191  {
192  mPsdMapBug2 = a;
193  delete mTables;
194  mTables = new StBemcTables(mTowerMapBug, mPsdMapBug2);
195  }
196  void towerMapBug(Bool_t a)
197  {
198  mTowerMapBug = a;
199  delete mTables;
200  mTables = new StBemcTables(mTowerMapBug, mPsdMapBug2);
201  }
202  void smdMapBug(Bool_t a)
203  {
204  mSmdMapBug = a;
205  }
206 
208  {
209  return mTables;
210  }
212  {
213  return mDecoder;
214  }
215  controlADCtoE_st* getControlTable()
216  {
217  return mControlADCtoE;
218  }
219 
220  Int_t getCrateStatus(Int_t det,Int_t c)
221  {
222  return mCrateStatus[det-1][c-1];
223  }
224  Int_t getTotalHits(Int_t det)
225  {
226  return mNTOTAL[det-1];
227  }
228  Int_t getTotalSaved(Int_t det)
229  {
230  return mNOK[det-1];
231  }
232  Int_t getTotalADC(Int_t det)
233  {
234  return mADCSUM[det-1];
235  }
236  Float_t getTotalE(Int_t det)
237  {
238  return mTOTALE[det-1];
239  }
240  Int_t getRejectPed(Int_t det)
241  {
242  return mNRMS[det-1]+mNPED[det-1];
243  }
244  Int_t getRejectZero(Int_t det)
245  {
246  return mNZ[det-1];
247  }
248  Int_t getRejectStatus(Int_t det)
249  {
250  return mNSTATUS[det-1];
251  }
252  Int_t getRejectCrate(Int_t det)
253  {
254  return mNCRATE[det-1];
255  }
256  Int_t getNCratesOK(Int_t det)
257  {
258  return mNCRATESOK[det-1];
259  }
260  ClassDef(StBemcRaw, 1)
261 };
262 
263 #endif
void psdMapBug2(Bool_t a)
Set to ktrue to correct PSD swaps in 2006 and 2007 data.
Definition: StBemcRaw.h:190
Int_t getCrateStatus(Int_t det, Int_t c)
Return the status of the crate C.
Definition: StBemcRaw.h:220
void setCheckStatus(Int_t det, Int_t flag, const char *option="")
Definition: StBemcRaw.cxx:806
Float_t getTotalE(Int_t det)
Return the Total Energy Sum for the detector 'det'.
Definition: StBemcRaw.h:236
void emptyEmcCollection(StEmcCollection *)
empty current emcCollection
Definition: StBemcRaw.cxx:449
void printStats(Int_t)
Print statistics for detector 'det'.
Definition: StBemcRaw.cxx:555
Int_t getRejectStatus(Int_t det)
Return the Total number of hits rejected because of STATUS issues for the detector 'det'...
Definition: StBemcRaw.h:248
Int_t makeHit(StEmcCollection *, Int_t, Int_t, Int_t, Int_t, Int_t, Float_t &)
make StEmcRawHit
Definition: StBemcRaw.cxx:662
void checkHeaders(StEmcRawData *, StEvent *)
Check all BEMC detector headers.
Definition: StBemcRaw.cxx:412
Int_t getRejectPed(Int_t det)
Return the Total number of hits rejected by pedestal issues for the detector 'det'.
Definition: StBemcRaw.h:240
Int_t getBemcADCRaw(Int_t, Int_t, StEmcRawData *, Int_t &, Int_t &)
get ADC from StEmcRawData structure
Definition: StBemcRaw.cxx:572
Int_t getNCratesOK(Int_t det)
Return the Total number of good crates for the detector 'det' (only tower)
Definition: StBemcRaw.h:256
void saveAllBTOW(Bool_t a)
Set to kTRUE if all BTOW hits are to be saved on StEvent (for picoDst/triggerSimu) ...
Definition: StBemcRaw.h:182
void smdMapBug(Bool_t a)
Set to ktrue to correct SMD swaps.
Definition: StBemcRaw.h:202
void setProdVer(string prodVer)
Set event date.
Definition: StBemcRaw.h:174
Int_t getTotalADC(Int_t det)
Return the Total ADC sum for the detector 'det'.
Definition: StBemcRaw.h:232
controlADCtoE_st * getControlTable()
Return Control table (NULL)
Definition: StBemcRaw.h:215
void clearStats(Int_t)
Clear statistics for detector 'det'.
Definition: StBemcRaw.cxx:522
StBemcTables * getTables()
Return the StBemcTable pointer.
Definition: StBemcRaw.h:207
void setDate(Int_t d)
Set event date.
Definition: StBemcRaw.h:166
void updateStats(Int_t, Int_t, Int_t, Float_t)
Update statistics for detector 'det'.
Definition: StBemcRaw.cxx:534
Int_t getTotalSaved(Int_t det)
Return the Total number of SAVED hits for the detector 'det'.
Definition: StBemcRaw.h:228
void createDecoder(Int_t, Int_t)
Create new StEmcDecoder.
Definition: StBemcRaw.cxx:233
StEmcDecoder * getDecoder()
Return the StEmcDecoder pointer.
Definition: StBemcRaw.h:211
Int_t getTotalHits(Int_t det)
Return the Total number of hits for the detector 'det'.
Definition: StBemcRaw.h:224
void psdMapBug(Bool_t a)
Set to ktrue to correct PSD map inthe P04* productions.
Definition: StBemcRaw.h:186
void towerMapBug(Bool_t a)
Set to ktrue to correct for the tower map bug (only runs before 2006)
Definition: StBemcRaw.h:196
virtual ~StBemcRaw()
StBemcRaw destructor.
Definition: StBemcRaw.cxx:208
Bool_t mPsdMapBug
switch for saving all BTOW hits (used in daq->picoDst production)
Definition: StBemcRaw.h:106
void saveAllStEvent(Bool_t a)
Set to kTRUE if all hits are to be saved on StEvent.
Definition: StBemcRaw.h:178
void printConf()
Print configuration.
Definition: StBemcRaw.cxx:217
Int_t getRejectZero(Int_t det)
Return the Total number of hits rejected because of zero ADC for the detector 'det'.
Definition: StBemcRaw.h:244
Int_t getRejectCrate(Int_t det)
Return the Total number of hits rejected because of BAD crates for the detector 'det' (only tower) ...
Definition: StBemcRaw.h:252
void setTime(Int_t t)
Set event time.
Definition: StBemcRaw.h:170
StBemcRaw()
StBemcRaw constructor.
Definition: StBemcRaw.cxx:160
void checkBtowCrates(StEmcRawData *, StEvent *)
check tower crates
Definition: StBemcRaw.cxx:486