StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PMD_Reader.hh
1 /****************************************************************************
2  * Author : Susanta and Subhasis
3  *
4  * Description : Reads PMD Raw and Pedestals Data and fills PMD Specific Bank.
5  * PMD has been taken as Extended Detector as defined by Tonko.
6  * Designed based on Event Pool Reader of PMD ( Ref: Tonko )
7  *
8  * **************************************************************************/
9 #ifndef PMD_READER_HH
10 #define PMD_READER_HH
11 
12 #include "StDaqLib/GENERIC/EventReader.hh"
13 #include "StDaqLib/GENERIC/RecHeaderFormats.hh"
14 #include "StDaqLib/GENERIC/swaps.hh"
15 
16 #define PMD_SECTOR 2
17 #define PMD_CRAMS_MAX 12
18 #define PMD_CRAMS_BLOCK 2
19 #define PMD_CRAMS_CH_MAX 1728
20 //#define PMD_CRAMS_CH_MAX 2016
21 
22 // bank seqeuence in the SECP bank
23 #define PMD_ADCD_N 0
24 #define PMD_PEDR_N 1
25 #define PMD_RMSR_N 2
26 #define PMD_THRR_N 3
27 
28 #define SM 15
29 #define ROW 15
30 #define COL 15
31 struct Bank_PMDP: public Bank
32 {
33  struct Pointer sec[PMD_SECTOR];
34 } ;
35 
36 struct Bank_PMDSECP: public Bank
37 {
38  struct Pointer type[4];
39 };
40 
41 struct Bank_PMDADCD: public Bank
42 {
43  unsigned long data[PMD_CRAMS_MAX*2*(1+PMD_CRAMS_CH_MAX)];
44 };
45 
46 struct Bank_PMDPEDR: public Bank
47 {
48  unsigned int data[PMD_CRAMS_MAX*2*(1+PMD_CRAMS_CH_MAX)];
49 };
50 
51 struct Bank_PMDRMSR: public Bank
52 {
53  unsigned int data[PMD_CRAMS_MAX*2*(1+PMD_CRAMS_CH_MAX)];
54 };
55 
56 struct Bank_PMDTHRR: public Bank
57 {
58  unsigned int data[PMD_CRAMS_MAX*2*(1+PMD_CRAMS_CH_MAX)];
59 };
60 
61 
62 struct data{
63  int mode ; // 0 normal, 1 ped
64  int channels ;
65  int max_channels ; // 2*10*2*2016
66  int no_of_channels_in_cram_blk[2][PMD_CRAMS_MAX][PMD_CRAMS_CH_MAX];
67  // 2 sectors, 10 CRAMS, 2 CRAM channels, 2016 values max
68  unsigned short adc[2][PMD_CRAMS_MAX][2][PMD_CRAMS_CH_MAX] ;
69 
70  unsigned short ped[2][PMD_CRAMS_MAX][2][PMD_CRAMS_CH_MAX] ;
71  unsigned short rms[2][PMD_CRAMS_MAX][2][PMD_CRAMS_CH_MAX] ;
72  unsigned short thr[2][PMD_CRAMS_MAX][2][PMD_CRAMS_CH_MAX] ;
73 
74 } ;
75 
76 struct Bank_DATA: public data{};
77 
78 
79 class PMD_Reader{
80  int ProcessEvent(const Bank_PMDP *PmdPTR);
81 public:
82  PMD_Reader(EventReader *er, Bank_PMDP *pPMDP);
83  ~PMD_Reader() {};
84  int adcReader(int sec, Bank_PMDADCD *adcd);
85  int pedReader(int sec, int type, Bank_PMDPEDR *pedr);
86  int NPMDHits(); // Not Implemented yet
87  int NCPVHits(); // Not Implemented yet
88  Bank_DATA getPMD_ADC();
89 
90 protected:
91  // copy of EventReader pointer
92  EventReader *ercpy;
93  Bank_PMDP *pBankPMDP;
94 
95  // Data Banks
96  Bank_PMDADCD mThePmdAdcD;
97  Bank_PMDPEDR mThePmdPedR;
98  Bank_PMDRMSR mThePmdRmsR;
99  Bank_PMDTHRR mThePmdThrR;
100  Bank_DATA mThePmd;
101 
102  bool mPmdPresent;
103  bool mCpvPresent;
104 };
105 
106 PMD_Reader *getPMDReader(EventReader *er);
107 
108 
109 #endif
PMD_Reader(EventReader *er, Bank_PMDP *pPMDP)
Process PMD+CPV events.
Definition: PMD_Reader.cxx:206
int adcReader(int sec, Bank_PMDADCD *adcd)
PMD_Reader destructor.
Definition: PMD_Reader.cxx:134
~PMD_Reader()
PMD_Reader constructor.
Definition: PMD_Reader.hh:83