StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EMC_Reader.hh
1 /***************************************************************************
2  *
3  * Authors: Herbert Ward, Subhasis Chattopadhya, Mike Levine
4  ***************************************************************************
5  * Description: common definitions for EMC Bank and EMC_Reader
6  ***************************************************************************
7  *
8  *
9  **************************************************************************/
10 
17 #ifndef EMC_READER_HH
18 #define EMC_READER_HH
19 #include "StDaqLib/GENERIC/EventReader.hh"
20 #include "StDaqLib/GENERIC/RecHeaderFormats.hh"
21 #include "StDaqLib/GENERIC/swaps.hh"
22 #include "StDaqLib/TRG/TRG_Reader.hh"
23 
24 struct Bank_EMCP: public Bank
25 {
26  struct Pointer EMCSecPointer[6] ; /* BEMC (tower,prs,smd), EEMC */
27 };
28 
29 struct Bank_EMCSECP: public Bank
30 {
31  struct Pointer FiberPointer[12] ; /* No of fibere to daq from each subdetector, can be maximum 12 */
32 };
33 
34 struct Bank_EMCRBP: public Bank
35 {
36  struct Pointer EMCADCR; /* RAW DATA */
37  struct Pointer EMCADCD ; /* one tower block*/
38  struct Pointer EMCPEDR;
39  struct Pointer EMCRMSR ; /* one tower block*/
40 };
41 
47 struct Bank_TOWERADCR: public Bank
48 {
49  int dummy ;
50  short fiberHeader[64] ;
51  short TDCHeader[120] ;
52  short fiberData[4800] ;
53 };
54 
60 struct BTOWERDATA
61 {
62  const char * BankType;
63  unsigned int DetFlag;
64  unsigned int EventNumber;
65  unsigned int PedFlag;
66  unsigned int ReceivedByteCount;
67  unsigned int NTowerHits;
68  unsigned int TDCErrorFlag;
69  unsigned int NTDCChannels;
70 
71  unsigned short TDCData[30][160];
72  unsigned short TDCError[30];
73  unsigned short TDCToken[30];
74  unsigned short TDCTrigger[30];
75  unsigned short TDCCrateId[30];
76  unsigned short TDCCount[30];
77 
78  unsigned short TowerMatrix[120][20][2];
79  unsigned short TowerADCArray[4800];
80  unsigned short TDCHeader[120];
81 };
82 
83 // similar banks for ADCR, ADCD, PED and RMS
84 
85 struct Bank_BTOWERADCR: public BTOWERDATA{};
86 struct Bank_BTOWERADCD: public BTOWERDATA{};
87 struct Bank_BTOWERPEDR: public BTOWERDATA{};
88 struct Bank_BTOWERRMSR: public BTOWERDATA{};
89 
95 struct Bank_SMDADCR: public Bank
96 {
97  int dummy ;
98  short fiberHeader[128] ;
99  short fiberData[4800] ;
100 };
101 
107 struct BSMDDATA
108 {
109  const char *BankType;
110  unsigned int DetFlag;
111  unsigned int EventNumber;
112  unsigned int PedFlag;
113  unsigned int SMDErrorFlag;
114  unsigned int ReceivedByteCount;
115  unsigned int NSmdHits;
116  unsigned int TimeBin[12];
117  unsigned short SMDADCArray[12][4800] ;
118  unsigned short SmdE_ADCMatrix[120][150] ;
119  unsigned short SmdP_ADCMatrix[120][10][15] ;
120  unsigned short SmdHeader[12][128];
121  unsigned short HasData[12];
122 };
123 
124 
125 struct Bank_BSMDADCR: public BSMDDATA{};
126 struct Bank_BSMDADCD: public BSMDDATA{};
127 struct Bank_BSMDPEDR: public BSMDDATA{};
128 struct Bank_BSMDRMSR: public BSMDDATA{};
129 
130 
131 
133 {
134  void ProcessEvent(const Bank_EMCP *EmcPTR, const Bank_TRGP *TrgPTR);
135 
136  public:
137  EMC_Reader(EventReader *er, Bank_EMCP *pEMCP, Bank_TRGP *pTRGP);
138  ~EMC_Reader() {};
139 
141  bool isTowerPresent();
142  int getTowerADC(int,int,int,unsigned short&);
143  int getTowerADC(int,unsigned short&);
144  int NTowerHits();
145 
146  Bank_BSMDADCR& getSMD_ADCR();
147  bool isSmdPresent();
148  int getSMD_ADC(int,int,unsigned short&);
149  int getSMDE_ADC(int,int,unsigned short&);
150  int getSMDP_ADC(int,int,int,unsigned short&);
151  int getSMD_TIMEBIN(int,unsigned int&);
152  int NSmdHits();
153 
154  protected:
155 
156  // copy of EventReader pointer
157  EventReader *ercpy;
158  Bank_EMCP *pBankEMCP;
159 
160  // Data Banks
161  Bank_BTOWERADCR mTheTowerAdcR;
162  Bank_BTOWERADCD mTheTowerAdcD;
163  Bank_BTOWERPEDR mTheTowerPedR;
164  Bank_BTOWERRMSR mTheTowerRMSR;
165 
166  Bank_BSMDADCR mTheSmdAdcR;
167  Bank_BSMDADCD mTheSmdAdcD;
168  Bank_BSMDPEDR mTheSmdPedR;
169  Bank_BSMDRMSR mTheSmdRMSR;
170  bool mTowerPresent;
171  bool mSmdPresent;
172 };
173 
174 EMC_Reader *getEMCReader(EventReader *er);
175 
176 
177 #endif
unsigned short TDCData[30][160]
data from each TDC channel
Definition: EMC_Reader.hh:71
int getSMD_TIMEBIN(int, unsigned int &)
Get SMD time bin (capacitor number) for a given fiber (RDO)
Definition: EMC_Reader.cxx:219
unsigned int TDCErrorFlag
Error from TDC.
Definition: EMC_Reader.hh:68
int NTowerHits()
Return number of valid hits on towers.
Definition: EMC_Reader.cxx:80
Bank_BTOWERADCR & getBTOWERADCR()
EMC_Reader destructor.
Definition: EMC_Reader.cxx:246
unsigned int EventNumber
Token number.
Definition: EMC_Reader.hh:111
int NSmdHits()
Return number of valid hits on SMD.
Definition: EMC_Reader.cxx:95
unsigned int PedFlag
Pedestal subtracted or not (??)
Definition: EMC_Reader.hh:65
const char * BankType
Will be filled with a 9 char array (8 letters + NULL)
Definition: EMC_Reader.hh:109
int dummy
4 bytes of junk - should read as 0x00c0ffee
Definition: EMC_Reader.hh:49
int getSMD_ADC(int, int, unsigned short &)
Get SMD ADC for a given index and fiber (RDO) number.
Definition: EMC_Reader.cxx:199
unsigned short TDCCrateId[30]
vector with crate Id for each TDC channel
Definition: EMC_Reader.hh:75
unsigned short TDCCount[30]
vector with byte count for each TDC channel
Definition: EMC_Reader.hh:76
int getSMDP_ADC(int, int, int, unsigned short &)
Get ADC for SMDP with given module, eta and sub.
Definition: EMC_Reader.cxx:176
const char * BankType
Will be filled with a 9 char array (8 letters + NULL)
Definition: EMC_Reader.hh:62
unsigned short TowerADCArray[4800]
Matrix of ADC's as obtained from daq.
Definition: EMC_Reader.hh:79
short TDCHeader[120]
TDC header - error flag etc.
Definition: EMC_Reader.hh:51
int getTowerADC(int, int, int, unsigned short &)
Get ADC value for one tower with given module, eta and sub.
Definition: EMC_Reader.cxx:111
unsigned short SmdHeader[12][128]
SMDHeader for each fiber.
Definition: EMC_Reader.hh:120
unsigned int NSmdHits
Total number of channels.
Definition: EMC_Reader.hh:115
short fiberHeader[128]
256 bytes (64 words of 32 bits) of standard FEE header the same for event pool
Definition: EMC_Reader.hh:98
unsigned int DetFlag
Daq detector flag.
Definition: EMC_Reader.hh:110
unsigned int SMDErrorFlag
Error from TDC.
Definition: EMC_Reader.hh:113
unsigned short TDCHeader[120]
This is the TDC event header.
Definition: EMC_Reader.hh:80
unsigned short HasData[12]
1 if there is data for that fiber
Definition: EMC_Reader.hh:121
short fiberHeader[64]
128 bytes of standard FEE header
Definition: EMC_Reader.hh:50
unsigned short SMDADCArray[12][4800]
Matrix of ADC's as obtained from daq.
Definition: EMC_Reader.hh:117
unsigned int ReceivedByteCount
Total number of channels.
Definition: EMC_Reader.hh:114
unsigned int NTowerHits
Total number of valid channels.
Definition: EMC_Reader.hh:67
unsigned int EventNumber
Token number.
Definition: EMC_Reader.hh:64
short fiberData[4800]
stuff on the fiber - (Raw data)
Definition: EMC_Reader.hh:52
unsigned int PedFlag
Pedestal subtracted or not (??)
Definition: EMC_Reader.hh:112
unsigned short TowerMatrix[120][20][2]
Matrix of ADC's in Physical Positions.
Definition: EMC_Reader.hh:78
unsigned int ReceivedByteCount
Total number of Bytes.
Definition: EMC_Reader.hh:66
EMC_Reader(EventReader *er, Bank_EMCP *pEMCP, Bank_TRGP *pTRGP)
EMC_Reader constructor.
Definition: EMC_Reader.cxx:51
short fiberData[4800]
stuff on the fiber - (Raw data)
Definition: EMC_Reader.hh:99
int getSMDE_ADC(int, int, unsigned short &)
Get ADC for SMDE with given module and stip number.
Definition: EMC_Reader.cxx:153
unsigned short TDCToken[30]
vector with crate token for each TDC channel
Definition: EMC_Reader.hh:73
unsigned int NTDCChannels
Total number of valid TDC channels.
Definition: EMC_Reader.hh:69
unsigned short TDCTrigger[30]
vector with trigger number for each TDC channel
Definition: EMC_Reader.hh:74
unsigned int TimeBin[12]
Time bin for each SMD fiber. Now it has 12 fibers for the PSD detector.
Definition: EMC_Reader.hh:116
unsigned short SmdE_ADCMatrix[120][150]
Matrix of ADC's in Physical Positions for SMD_Eta.
Definition: EMC_Reader.hh:118
unsigned int DetFlag
DAQ Detector flag for BEMC, PRS, SMDE or SMDP.
Definition: EMC_Reader.hh:63
unsigned short TDCError[30]
vector with TDC error for each TDC channel
Definition: EMC_Reader.hh:72
unsigned short SmdP_ADCMatrix[120][10][15]
Matrix of ADC's in Physical Positions for SMD_Phi.
Definition: EMC_Reader.hh:119
int dummy
4 bytes of junk - should read as 0x00c0ffee
Definition: EMC_Reader.hh:97