Line data Source code
1 : #ifndef ALIADRAWSTREAM_H
2 : #define ALIADRAWSTREAM_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 AD DDL raw data
9 : /// The format of the raw data corresponds to the one
10 : /// implemented in AliADBuffer class.
11 : ///
12 : /// PLEASE NOTE that Int_t channel is here the FEE channel from 0 to 16 in the
13 : /// not yet defined order which may be 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 : #include <TMath.h>
22 :
23 : class AliRawReader;
24 :
25 : class AliADRawStream: public TObject {
26 : public :
27 : AliADRawStream(AliRawReader* rawReader);
28 : virtual ~AliADRawStream();
29 :
30 : virtual void Reset();
31 : virtual Bool_t Next();
32 :
33 : // Getters of various scalers and Minimum Bias flags :
34 :
35 : ULong64_t GetBBScalers(Int_t channel) const
36 0 : { return fBBScalers[channel]; }
37 : ULong64_t GetBGScalers(Int_t channel) const
38 0 : { return fBGScalers[channel]; }
39 : UInt_t GetTriggerScalers(Int_t num_scaler) const
40 0 : { return fScalers[num_scaler]; }
41 : UInt_t GetBunchNumbersMB(Int_t num_bunch) const
42 0 : { return fBunchNumbers[num_bunch]; }
43 : UShort_t GetChargeMB(Int_t channel, Int_t num_bunch) const
44 0 : { return fChargeMB[channel][num_bunch]; }
45 : Bool_t GetIntMBFlag(Int_t channel, Int_t num_bunch) const
46 0 : { return fIsIntMB[channel][num_bunch]; }
47 : Bool_t GetBBMBFlag(Int_t channel, Int_t num_bunch) const
48 0 : { return fIsBBMB[channel][num_bunch]; }
49 : Bool_t GetBGMBFlag(Int_t channel, Int_t num_bunch) const
50 0 : { return fIsBGMB[channel][num_bunch]; }
51 :
52 : // Getters of ADC signals, ADC pedestals, time information and corresponding flags :
53 :
54 : Short_t GetADC(Int_t channel) const
55 0 : { return TMath::MaxElement(kNEvOfInt, fADC[channel]); } // maximum value instead of central clock
56 : // { return fADC[channel][kNEvOfInt/2]; }
57 :
58 : Short_t GetPedestal(Int_t channel, Int_t event) const
59 0 : { return fADC[channel][20-event]; }
60 : Bool_t GetIntegratorFlag(Int_t channel, Int_t event) const
61 0 : { return fIsInt[channel][20-event]; }
62 : Bool_t GetBBFlag(Int_t channel, Int_t event) const
63 0 : { return fIsBB[channel][20-event]; }
64 : Bool_t GetBGFlag(Int_t channel, Int_t event) const
65 0 : { return fIsBG[channel][20-event]; }
66 : Short_t GetTime(Int_t channel) const
67 0 : { return fTime[channel]; }
68 : Short_t GetWidth(Int_t channel) const
69 0 : { return fWidth[channel]; }
70 :
71 : UShort_t GetTriggerInputs() const
72 0 : { return fTrigger; }
73 : UShort_t GetTriggerInputsMask() const
74 0 : { return fTriggerMask; }
75 :
76 : enum EADRawDataParams {
77 : kNChannels = 16, // number of electronic channels in AD (FEE numbering)
78 : kNEvOfInt = 21, // number of events of interest
79 : kNScalers = 16, // number of scalers
80 : kNBunches = 10 // number of bunches used in Minimum Bias information
81 : };
82 :
83 : enum EADRawStreamError {
84 : kRawDataSizeErr = 1
85 : };
86 :
87 : private:
88 :
89 : AliADRawStream(const AliADRawStream& stream);
90 : AliADRawStream& operator = (const AliADRawStream& stream);
91 :
92 : UInt_t GetNextWord();
93 : UShort_t GetNextShort();
94 :
95 : ULong64_t fBBScalers[kNChannels]; // 'Beam-Beam' scalers for all channels
96 : ULong64_t fBGScalers[kNChannels]; // 'Beam-Gas' scalers for all channels
97 : UInt_t fScalers[kNScalers]; // Trigger scalers
98 : UInt_t fBunchNumbers[kNBunches]; // Bunch numbers for the previous 10 MB events
99 : UShort_t fChargeMB[kNChannels][kNBunches]; // ADC counts for all channels for the previous 10 MB events
100 : Bool_t fIsIntMB[kNChannels][kNBunches]; // 'Integrator' flag for all channels for the previous 10 MB events
101 : Bool_t fIsBBMB[kNChannels][kNBunches]; // 'Beam-Beam' flag for all channels for the previous 10 MB events
102 : Bool_t fIsBGMB[kNChannels][kNBunches]; // 'Beam-Gas' for all channels for the previous 10 MB events
103 :
104 : Short_t fADC[kNChannels][kNEvOfInt]; // ADC counts for all channels and all events of interest
105 : Bool_t fIsInt[kNChannels][kNEvOfInt]; // 'Integrator' flag for all channels
106 : Bool_t fIsBB[kNChannels][kNEvOfInt]; // 'Beam-Beam' flag for all channels
107 : Bool_t fIsBG[kNChannels][kNEvOfInt]; // 'Beam-Gas' flag for all channels
108 : Short_t fTime[kNChannels]; // leading time for all channels - from HPTDC - in HPTDC units
109 : Short_t fWidth[kNChannels]; // pulse width for all channels - from HPTDC - in HPTDC units
110 :
111 : UShort_t fTrigger; // AD trigger inputs
112 : UShort_t fTriggerMask; // AD trigger inputs mask
113 :
114 : Int_t fPosition; // current position in the raw-data payload
115 :
116 :
117 : AliRawReader* fRawReader; // object for reading the raw data
118 :
119 : UChar_t* fData; // pointer to raw data payload
120 :
121 16 : ClassDef(AliADRawStream, 0) // class for reading AD DDL raw data
122 : };
123 :
124 : #endif
|