]> git.uio.no Git - u/mrichter/AliRoot.git/blob - VZERO/AliVZERORawStream.h
QA ref defaut storage setter in sim and rec
[u/mrichter/AliRoot.git] / VZERO / AliVZERORawStream.h
1 #ifndef ALIVZERORAWSTREAM_H
2 #define ALIVZERORAWSTREAM_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 ///////////////////////////////////////////////////////////////////////////////
7 ///
8 /// This is a class for reading the VZERO DDL raw data
9 /// The format of the raw data corresponds to the one
10 /// implemented in AliVZEROBuffer class.
11 ///
12 /// PLEASE NOTE that Int_t channel is here the FEE channel from 0 to 63 in the 
13 /// order defined by Yannick Zoccarato which is not the same order as the order 
14 /// defined in aliroot by the naming and numbering conventions.
15 /// Therefore one has to go from FEE_Channel to AliRoot_Channel using 
16 /// GetOfflineChannel(Int_t channel)  when going from Online to Offline !!!
17 ///
18 ///////////////////////////////////////////////////////////////////////////////
19
20 #include <TObject.h>
21
22 class AliRawReader;
23
24 class AliVZERORawStream: public TObject {
25   public :
26     AliVZERORawStream(AliRawReader* rawReader);
27     virtual ~AliVZERORawStream();
28
29     virtual void      Reset();
30     virtual Bool_t    Next();
31
32 // Getters of various scalers and Minimum Bias flags :
33
34    ULong64_t          GetBBScalers(Int_t channel) const  
35       { return        fBBScalers[channel]; }
36    ULong64_t          GetBGScalers(Int_t channel) const  
37       { return        fBGScalers[channel]; }
38    UInt_t             GetTriggerScalers(Int_t num_scaler) const 
39       { return        fScalers[num_scaler]; }
40    UInt_t             GetBunchNumbersMB(Int_t num_bunch) const 
41       { return        fBunchNumbers[num_bunch]; }
42    UShort_t           GetChargeMB(Int_t channel, Int_t num_bunch) const  
43       { return        fChargeMB[channel][num_bunch]; } 
44    Bool_t             GetIntMBFlag(Int_t channel, Int_t num_bunch) const   
45       { return        fIsIntMB[channel][num_bunch]; } 
46    Bool_t             GetBBMBFlag(Int_t channel, Int_t num_bunch) const   
47       { return        fIsBBMB[channel][num_bunch]; }  
48    Bool_t             GetBGMBFlag(Int_t channel, Int_t num_bunch) const   
49       { return        fIsBGMB[channel][num_bunch]; }      
50        
51 // Getters of ADC signals, ADC pedestals, time information and corresponding flags :
52
53     UShort_t          GetADC(Int_t channel) const
54       { return fADC[channel][kNEvOfInt/2]; }
55     UShort_t          GetPedestal(Int_t channel, Int_t event) const
56       { return fADC[channel][event]; }
57     Bool_t            GetIntegratorFlag(Int_t channel, Int_t event) const
58       { return fIsInt[channel][event]; }
59     Bool_t            GetBBFlag(Int_t channel, Int_t event) const
60       { return fIsBB[channel][event]; } 
61     Bool_t            GetBGFlag(Int_t channel, Int_t event) const
62       { return fIsBG[channel][event]; }   
63     UInt_t            GetTime(Int_t channel) const
64       { return fTime[channel]; }
65     UInt_t            GetWidth(Int_t channel) const
66       { return fWidth[channel]; }
67
68     UShort_t          GetTriggerInputs() const
69       { return fTrigger; }
70     UShort_t          GetTriggerInputsMask() const
71       { return fTriggerMask; }
72
73 // Getter of Offline Channel number as used in aliroot (defined by aliroot 
74 // numbering convention) from FEE channel (electronic channel number given 
75 // by the V0 electronics readout) - See comment above - 
76
77     Int_t              GetOfflineChannel(Int_t channel)  const
78       { Int_t  fOfflineChannel[64] = {39, 38, 37, 36, 35, 34, 33, 32, 
79                                       47, 46, 45, 44, 43, 42, 41, 40, 
80                                       55, 54, 53, 52, 51, 50, 49, 48, 
81                                       63, 62, 61, 60, 59, 58, 57, 56,
82                                        7,  6,  5,  4,  3,  2,  1,  0, 
83                                       15, 14, 13, 12, 11, 10,  9,  8,
84                                       23, 22, 21, 20, 19, 18, 17, 16, 
85                                       31, 30, 29, 28, 27, 26, 25, 24};
86                return fOfflineChannel[channel]; }       
87
88     enum EVZERORawDataParams {
89       kNChannels = 64, // number of electronic channels in V0 (FEE numbering)
90       kNEvOfInt  = 21, // number of events of interest
91       kNScalers  = 16, // number of scalers
92       kNBunches  = 10  // number of bunches used in Minimum Bias information 
93     };
94
95     enum EVZERORawStreamError {
96       kRawDataSizeErr = 1
97     };
98
99   private:
100
101     AliVZERORawStream(const AliVZERORawStream& stream);
102     AliVZERORawStream& operator = (const AliVZERORawStream& stream);
103
104     UInt_t GetNextWord();
105     UShort_t GetNextShort();
106
107     ULong64_t     fBBScalers[kNChannels];        // 'Beam-Beam' scalers for all channels
108     ULong64_t     fBGScalers[kNChannels];        // 'Beam-Gas' scalers for all channels
109     UInt_t        fScalers[kNScalers];           // Trigger scalers
110     UInt_t        fBunchNumbers[kNBunches];      // Bunch numbers for the previous 10 MB events
111     UShort_t      fChargeMB[kNChannels][kNBunches]; // ADC counts for all channels for the previous 10 MB events
112     Bool_t        fIsIntMB[kNChannels][kNBunches];  // 'Integrator' flag for all channels for the previous 10 MB events
113     Bool_t        fIsBBMB[kNChannels][kNBunches];   // 'Beam-Beam' flag for all channels for the previous 10 MB events
114     Bool_t        fIsBGMB[kNChannels][kNBunches];   // 'Beam-Gas' for all channels for the previous 10 MB events
115
116     UShort_t      fADC[kNChannels][kNEvOfInt];   // ADC counts for all channels and all events of interest
117     Bool_t        fIsInt[kNChannels][kNEvOfInt]; // 'Integrator' flag for all channels 
118     Bool_t        fIsBB[kNChannels][kNEvOfInt];  // 'Beam-Beam' flag for all channels
119     Bool_t        fIsBG[kNChannels][kNEvOfInt];  // 'Beam-Gas' flag for all channels
120     Int_t         fTime[kNChannels];             // leading time for all channels - from HPTDC
121     Int_t         fWidth[kNChannels];            // pulse width for all channels - from HPTDC
122
123     UShort_t      fTrigger;        // VZERO trigger inputs
124     UShort_t      fTriggerMask;    // VZERO trigger inputs mask
125
126     Int_t         fPosition;       // current position in the raw-data payload
127     
128
129     AliRawReader* fRawReader;      // object for reading the raw data
130
131     UChar_t*      fData;           // pointer to raw data payload
132
133     ClassDef(AliVZERORawStream, 0) // class for reading VZERO DDL raw data
134 };
135
136 #endif