Line data Source code
1 : /* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
2 : * See cxx source for full Copyright notice */
3 :
4 : /////////////////////////////////////////////////////
5 : // Class used for read-write the ALTRO data format //
6 : /////////////////////////////////////////////////////
7 :
8 : /*This class is an interface between the altro format file and the
9 : user, and can be used in write or read mode
10 : In the write mode a new altro file is created and filled using the method FillBuffer().
11 : The name of the file is specified as parameter in the constructor as well as the type mode.
12 : In the Read mode the specified file is open and the values can be read using the
13 : methods GetNext() and GetNextBackWord().
14 : The first method is used to read the file forward while the second is used to read backward
15 : */
16 :
17 : #ifndef AliALTROBUFFERV3_H
18 : #define AliALTROBUFFERV3_H
19 :
20 : #include "AliAltroBuffer.h"
21 :
22 : class AliAltroBufferV3: public AliAltroBuffer {
23 : public:
24 : AliAltroBufferV3(const char* fileName, AliAltroMapping *mapping = NULL);
25 : virtual ~AliAltroBufferV3();
26 :
27 : virtual void FillBuffer(Int_t val);
28 : //this method stores a word into the buffer
29 :
30 : virtual void WriteTrailer(Int_t wordsNumber, Short_t hwAddress);
31 : //this method is used to write the trailer
32 :
33 : virtual UChar_t WriteRCUTrailer(Int_t rcuId);
34 : //this method is used to write the RCU trailer
35 :
36 0 : void SetFECERRA(UInt_t v) { fFECERRA = v; }
37 0 : void SetFECERRB(UInt_t v) { fFECERRB = v; }
38 0 : void SetERRREG2(UInt_t v) { fERRREG2 = v; }
39 0 : void SetERRREG3(UInt_t v) { fERRREG3 = v; }
40 24 : void SetActiveFECsA(UShort_t m) { fActiveFECsA = m; }
41 24 : void SetActiveFECsB(UShort_t m) { fActiveFECsB = m; }
42 0 : void SetALTROCFG1(UInt_t cfg1) { fALTROCFG1 = cfg1; }
43 0 : void SetALTROCFG2(UInt_t cfg2) { fALTROCFG2 = cfg2; }
44 0 : void SetTSample(Double_t v) { fTSample = v; }
45 0 : void SetL1Phase(Double_t v) { fL1Phase = v; }
46 :
47 0 : void SetNChAddrMismatch(UShort_t v) { SetField(fERRREG3, 0, 0xFFF, v); }
48 0 : void SetNChLengthMismatch(UShort_t v) { SetField(fERRREG3, 12, 0x1FFF, v); }
49 :
50 0 : void SetBaselineCorr(UChar_t v) { SetField(fALTROCFG1, 0, 0xF, v); }
51 0 : void SetPolarity(Bool_t v) { SetField(fALTROCFG1, 4, 0x1, v); }
52 0 : void SetNPresamples(UChar_t v) { SetField(fALTROCFG1, 5, 0x3, v); }
53 0 : void SetNPostsamples(UChar_t v) { SetField(fALTROCFG1, 7, 0xF, v); }
54 0 : void SetSecondBaselineCorr(Bool_t v) { SetField(fALTROCFG1, 11, 0x1, v); }
55 0 : void SetGlitchFilter(UChar_t v) { SetField(fALTROCFG1, 12, 0x3, v); }
56 24 : void SetNNonZSPostsamples(UChar_t v) { SetField(fALTROCFG1, 14, 0x7, v); }
57 0 : void SetNNonZSPresamples(UChar_t v) { SetField(fALTROCFG1, 17, 0x3, v); }
58 12 : void SetZeroSupp(Bool_t v) { SetField(fALTROCFG1, 19, 0x1, v); }
59 0 : void SetNAltroBuffers(Bool_t v) { SetField(fALTROCFG2, 24, 0x1, v); }
60 24 : void SetNPretriggerSamples(UChar_t v) { SetField(fALTROCFG2, 20, 0xF, v); }
61 24 : void SetNSamplesPerCh(UShort_t v) { SetField(fALTROCFG2, 10, 0x3FF, v); }
62 0 : void SetSparseRO(Bool_t v) { SetField(fALTROCFG2, 9, 0x1, v); }
63 :
64 :
65 : enum { kMaxWords = 1024 };
66 :
67 : protected:
68 : UInt_t SetField(UInt_t& input, UShort_t start, UInt_t mask, UInt_t val) const;
69 : void ReverseAndWrite();
70 : //this method reverse the altro data order and write the buffer to the file
71 :
72 : AliAltroBufferV3(const AliAltroBufferV3& source);
73 : AliAltroBufferV3& operator = (const AliAltroBufferV3& source);
74 :
75 : UShort_t fArray[kMaxWords]; // Temporary array needed in reverting data order
76 : Int_t fN; // Size of the temporary array
77 : UInt_t fFECERRA; // FECERRA
78 : UInt_t fFECERRB; // FECERRB
79 : UInt_t fERRREG2; // ERRREG2
80 : UInt_t fERRREG3; // ERRREG3
81 : UShort_t fActiveFECsA;// ActiveFECsA
82 : UShort_t fActiveFECsB;// ActiveFECsB
83 : UInt_t fALTROCFG1; // ALTROCFG1
84 : UInt_t fALTROCFG2; // ALTROCFG2
85 : Double_t fTSample; // TSample
86 : Double_t fL1Phase; // L1Phase
87 :
88 122 : ClassDef(AliAltroBufferV3,0) // Interface to the Altro format
89 : };
90 :
91 : #endif
|