X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TOF%2FAliTOFRawStream.h;h=29d77b704519743cddc5f866e4325c8dfeb7dd13;hb=f00081c81c76f92dbc145f7ae060d1bf4fa5a701;hp=00992199ee6bf58560ecfca61da602a28f51d1f7;hpb=bf33f8f0420274cbd5cab3fcc3a223dd191317a8;p=u%2Fmrichter%2FAliRoot.git diff --git a/TOF/AliTOFRawStream.h b/TOF/AliTOFRawStream.h index 00992199ee6..29d77b70451 100644 --- a/TOF/AliTOFRawStream.h +++ b/TOF/AliTOFRawStream.h @@ -12,10 +12,13 @@ /////////////////////////////////////////////////////////////// #include "TObject.h" -#include "AliTOFHitData.h" + +//#include "AliTOFHitData.h" #include "AliTOFHitDataBuffer.h" #include "AliTOFDecoder.h" +//#include "AliTOFCableLengthMap.h" +class AliTOFHitData; /********************************** * OLD DEFINITIONS @@ -26,30 +29,23 @@ GENERAL DATA FORMAT ******************************************/ //filler -#ifndef FILLER +//#ifndef FILLER #define FILLER 0x70000000 -#endif +//#endif //word type mask/position -#ifndef WORD_TYPE_MASK #define WORD_TYPE_MASK 0xf0000000 -#endif #define WORD_TYPE_POSITION 28 //global header word required bit pattern -#ifndef GLOBAL_HEADER #define GLOBAL_HEADER 0x40000000 -#endif //global trailer word required bit pattern -#ifndef GLOBAL_TRAILER #define GLOBAL_TRAILER 0x50000000 -#endif //error word required bit pattern -#ifndef ERROR -#define ERROR 0x30000000 -#endif +// already defined in AliTOFDecoder +//#define ERROR 0x30000000 //header slot ID mask/position #define HEADER_SLOT_ID_MASK 0x0000000f @@ -96,6 +92,14 @@ DRM DATA FORMAT #define DRM_C_BIT_MASK 0x00008000 #define DRM_C_BIT_POSITION 15 +//DRM Vers-ID mask/position +#define DRM_VERS_ID_MASK 0x001f0000 +#define DRM_VERS_ID_POSITION 16 + +//DRM DRM Header size mask/position +#define DRM_HEADER_SIZE_MASK 0x01e00000 +#define DRM_HEADER_SIZE_POSITION 21 + //DRM status header 2 word required bit pattern #define DRM_STATUS_HEADER_2 0x40000001 @@ -103,19 +107,53 @@ DRM DATA FORMAT #define DRM_ENABLE_ID_MASK 0x00007ff0 #define DRM_ENABLE_ID_POSITION 4 +//DRM zero in word2 mask/position +#define DRM_ZERO_WORD2_MASK 0x00008000 +#define DRM_ZERO_WORD2_POSITION 15 + //DRM fault ID mask/position #define DRM_FAULT_ID_MASK 0x07ff0000 #define DRM_FAULT_ID_POSITION 16 +//DRM RTO bit mask/position +#define DRM_RTO_BIT_MASK 0x08000000 +#define DRM_RTO_BIT_POSITION 27 + //DRM status header 3 word required bit pattern #define DRM_STATUS_HEADER_3 0x40000001 -//DRM TTC event counter mask/position -#define DRM_TTC_EVENT_COUNTER_MASK 0x0ffffff0 -#define DRM_TTC_EVENT_COUNTER_POSITION 4 +//DRM L0 BCID mask/position +#define DRM_L0_BCID_MASK 0x0000fff0 +#define DRM_L0_BCID_POSITION 4 + +//DRM Run Time Info mask/position +#define DRM_RUNTIME_INFO_MASK 0x0fff0000 +#define DRM_RUNTIME_INFO_POSITION 16 + +//DRM status header 4 word required bit pattern +#define DRM_STATUS_HEADER_4 0x40000001 + +//DRM Temperature mask/position +#define DRM_TEMPERATURE_MASK 0x00003ff0 +#define DRM_TEMPERATURE_POSITION 4 + +//DRM 1st zero in word4 mask/position +#define DRM_ZERO_1_WORD4_MASK 0x00004000 +#define DRM_ZERO_1_WORD4_POSITION 14 + +//DRM ACK mask/position +#define DRM_ACK_MASK 0x00008000 +#define DRM_ACK_POSITION 15 + +//DRM Sens AD mask/position +#define DRM_SENS_AD_MASK 0x00070000 +#define DRM_SENS_AD_POSITION 16 + +//DRM 2nd zero in word4 mask/position +#define DRM_ZERO_2_WORD4_MASK 0x00080000 +#define DRM_ZERO_2_WORD4_POSITION 19 //DRM event CRC mask/position -//#define DRM_EVENT_CRC_MASK 0x001ffff0 #define DRM_EVENT_CRC_MASK 0x000ffff0 #define DRM_EVENT_CRC_POSITION 4 @@ -219,14 +257,11 @@ TRM DATA FORMAT #define TRM_FIRST_SLOT_ID 3 //define hptdc time bin width -#ifndef TIME_BIN_WIDTH #define TIME_BIN_WIDTH 24.4e-3 //ns -#endif //define hptdc tot bin width -#ifndef TOT_BIN_WIDTH -#define TOT_BIN_WIDTH 48.4e-3 //ns -#endif +// already defined in AliTOFDecoder +//#define TOT_BIN_WIDTH 48.4e-3 //ns //TRM errors @@ -341,7 +376,6 @@ LTM DATA FORMAT class TClonesArray; class AliRawReader; -class AliTOFGeometry; class AliTOFrawData; class AliTOFRawStream: public TObject { @@ -351,6 +385,9 @@ class AliTOFRawStream: public TObject { AliTOFRawStream(AliRawReader* rawReader); // ctr virtual ~AliTOFRawStream(); // default dtr + AliTOFRawStream(const AliTOFRawStream& stream); // copy ctr + AliTOFRawStream& operator = (const AliTOFRawStream& stream); // ass. op. + virtual Bool_t Next(); virtual void LoadRawData(Int_t indexDDL); @@ -366,7 +403,6 @@ class AliTOFRawStream: public TObject { Int_t GetStrip() const {return fStrip;}; Int_t GetPadZ() const {return fPadZ;}; Int_t GetPadX() const {return fPadX;}; - Int_t GetIndex(Int_t *detId); // Get channel index for Online Calibration Int_t GetTofBin() const {return fTime;}; Int_t GetToTbin() const {return fToT;}; @@ -378,12 +414,16 @@ class AliTOFRawStream: public TObject { Int_t GetErrorFlag() const {return fErrorFlag;}; + Bool_t GetDecoderVersion() const {return fNewDecoderVersion;}; + void SetDDL(Int_t nDDL) {fDDL = nDDL;}; void SetTRM(Int_t nTRM) {fTRM = nTRM;}; void SetTDC(Int_t nTDC) {fTDC = nTDC;}; void SetTRMchain(Int_t nChain) {fTRMchain = nChain;}; void SetTDCchannel(Int_t nChannel) {fTDCchannel = nChannel;}; + void SetDecoderVersion(Bool_t version) {fNewDecoderVersion = version;}; + TClonesArray *GetRawData() const {return fTOFrawData;}; void SetSector(); @@ -392,34 +432,72 @@ class AliTOFRawStream: public TObject { void SetPadZ(); void SetPadX(); - void EquipmentId2VolumeId(Int_t nDDL, Int_t nTRM, Int_t iChain, - Int_t iTDC, Int_t iCH, Int_t *volume) const; + Bool_t GetBCCorrections() {return fgApplyBCCorrections;}; // getter for the BC application switch + Int_t GetDDLBCshift(Int_t ddl) {return fgkddlBCshift[ddl];}; // getter for the DDL BC shift + Int_t GetLocalEventCounterDRM() {return fLocalEventCounterDRM;}; // getter for the DRM event counter + Int_t GetLocalEventCounterLTM() {return fLocalEventCounterLTM;}; // getter for the LTM event counter + Int_t GetLocalEventCounterTRM(Int_t trm) {return fLocalEventCounterTRM[trm];}; // getter for the TRM event counter + Int_t GetLocalEventCounterChain(Int_t trm, Int_t chain) {return fLocalEventCounterChain[trm][chain];}; // getter for the chain event counter + Int_t GetChainBunchID(Int_t trm, Int_t chain) {return fChainBunchID[trm][chain];}; // getter for the chain BC ID + + + void Raw2Digits(AliRawReader* rawReader, TClonesArray* digitsArray); + void Raw2SDigits(AliRawReader* rawReader, TClonesArray* sdigitsArray); + + static void EquipmentId2VolumeId(Int_t nDDL, Int_t nTRM, Int_t iChain, + Int_t iTDC, Int_t iCH, Int_t *volume); void EquipmentId2VolumeId(AliTOFHitData *hitData, Int_t *volume) const; - Int_t Equip2VolNplate(Int_t iDDL, Int_t nTRM, Int_t nTDC) const ; - Int_t Equip2VolNstrip(Int_t iDDL, Int_t nTRM, Int_t nTDC) const ; - Int_t Equip2VolNpad(Int_t iDDL, Int_t iChain, Int_t nTDC, Int_t iCH) const ; - Int_t GetDDLnumberPerSector(Int_t nDDL) const; - Int_t GetSectorNumber(Int_t nDDL) const; + static Int_t Equip2VolNplate(Int_t iDDL, Int_t nTRM, Int_t nTDC); + static Int_t Equip2VolNstrip(Int_t iDDL, Int_t nTRM, Int_t nTDC); + static Int_t Equip2VolNpad(Int_t iDDL, Int_t iChain, Int_t nTDC, Int_t iCH); + static Int_t Equip2VolNpadX(Int_t iDDL, Int_t iChain, Int_t nTDC, Int_t iCH); + static Int_t Equip2VolNpadZ(Int_t iDDL, Int_t iChain, Int_t nTDC, Int_t iCH); + static Int_t GetDDLnumberPerSector(Int_t nDDL); + static Int_t GetSectorNumber(Int_t nDDL); + + static Int_t Geant2DDL(Int_t vol[]); + static Int_t Geant2TRM(Int_t vol[]); + static Int_t Geant2TDC(Int_t vol[]); + static Int_t Geant2Chain(Int_t vol[]); + static Int_t Geant2Channel(Int_t vol[]); + static void Geant2EquipmentId(Int_t vol[], Int_t eqId[]); Bool_t DecodeDDL(Int_t DDLMin, Int_t DDLMax, Int_t verbose); + Bool_t Decode(Int_t verbose); + AliTOFDecoder *GetDecoder() {return fDecoder;}; + void SetV2718Patch(Bool_t V2718Patch = kTRUE) {fDecoder->SetV2718Patch(V2718Patch);}; - AliTOFHitDataBuffer *GetDataBuffer(Int_t DDL) {return fDataBuffer[DDL];}; - AliTOFHitDataBuffer *GetPackedDataBuffer(Int_t DDL) {return fPackedDataBuffer[DDL];}; + void SetRawReader(AliRawReader *rawReader) {fRawReader=rawReader;}; - void ResetDataBuffer(Int_t DDL) {fDataBuffer[DDL]->Reset();}; - void ResetPackedDataBuffer(Int_t DDL) {fPackedDataBuffer[DDL]->Reset();}; + AliTOFHitDataBuffer *GetDataBuffer(Int_t DDL) {return &fDataBuffer[DDL];}; + AliTOFHitDataBuffer *GetPackedDataBuffer(Int_t DDL) {return &fPackedDataBuffer[DDL];}; + + void ResetDataBuffer(Int_t DDL) {fDataBuffer[DDL].Reset();}; + void ResetPackedDataBuffer(Int_t DDL) {fPackedDataBuffer[DDL].Reset();}; void ResetBuffers(); Bool_t LoadRawDataBuffers(Int_t indexDDL, Int_t verbose = 0); + static void ApplyBCCorrections(Bool_t Value = kTRUE) {fgApplyBCCorrections = Value;}; + Int_t GetEventID() const {return fEventID;}; // getter for the eventID1 (bunch crossing) in the common data header + + enum ETOFRawStreamError { + kPadXError = 0, + kPadAlongStripError = 1, + kPlateError = 2, + kStripError = 3, + kSectorError = 4, + kDDLMinError = 5, + kDDLMaxError = 6, + kDDLdataReading = 7, + kDDLDecoder = 8 + }; + private: Int_t GetField(UInt_t word, Int_t fieldMask, Int_t fieldPosition) const; - AliTOFRawStream(const AliTOFRawStream& stream); // copy ctr - AliTOFRawStream& operator = (const AliTOFRawStream& stream); // ass. op. - AliRawReader* fRawReader; // object for reading the raw data TClonesArray *fTOFrawData; // pointer to AliTOFrawData TClonesArray @@ -443,8 +521,6 @@ class AliTOFRawStream: public TObject { Int_t fPadX; // pad number along the strip [0;47] Int_t fPadZ; // pad-row number [0;1] - AliTOFGeometry *fTOFGeometry; // pointer to the TOF geometry - Int_t fPackedDigits; // counter for packed digits Int_t fWordType; // word type @@ -458,10 +534,27 @@ class AliTOFRawStream: public TObject { Bool_t fInsideTRMchain0; // inside/outside chain 0 Bool_t fInsideTRMchain1; // inside/outside chain 1 - AliTOFHitDataBuffer *fDataBuffer[72]; - AliTOFHitDataBuffer *fPackedDataBuffer[72]; + AliTOFHitDataBuffer fDataBuffer[72]; // AliTOFHitDataBuffer + AliTOFHitDataBuffer fPackedDataBuffer[72]; // AliTOFHitDataBuffer + + Int_t fLocalEventCounterDRM; // event counter recorded in the DRM global trailer + Int_t fLocalEventCounterLTM; // event counter recorded in the LTM global trailer + Int_t fLocalEventCounterTRM[13]; // event counter recorded in the TRMs global trailer + Int_t fLocalEventCounterChain[13][2]; // event counter recorded in the chains trailer + Int_t fChainBunchID[13][2]; // BC ID recorded in the chains header + + //AliTOFCableLengthMap * fCableLengthMap; // Pointer to the map of Amphenol cable length + + Int_t fEventID; // event ID1 in the common data header + + Bool_t fNewDecoderVersion; // setting whether to use the new decoder version + // -true -> new version + // -false ->old version (default value!!) + + static const Int_t fgkddlBCshift[72]; // DDL BC shifts + static Bool_t fgApplyBCCorrections; // switch to choose if apply or not the BC shift corrections - ClassDef(AliTOFRawStream, 2) // class for reading TOF raw digits + ClassDef(AliTOFRawStream, 3) // class for reading TOF raw digits }; #endif