]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONRawStreamTriggerHP.h
In AliMUONClusterInfo:
[u/mrichter/AliRoot.git] / MUON / AliMUONRawStreamTriggerHP.h
index 8f03cad7cb078ba638d8cdf15aa23e791ace1c50..6b0aa2088e33c174775d9a53784a2c93fc7d74a6 100644 (file)
@@ -19,6 +19,8 @@
 #include "AliMUONTriggerDDLDecoder.h"
 #include "TArrayS.h"
 
+class AliMUONDDLTrigger;
+
 
 class AliMUONRawStreamTriggerHP : public AliMUONVRawStreamTrigger
 {
@@ -48,6 +50,9 @@ public:
                            UChar_t& xPos, Bool_t& triggerY, Bool_t& triggerX,
                            TArrayS& xPattern, TArrayS& yPattern);
        
+       /// Construct and return a pointer to the DDL payload object.
+       virtual AliMUONDDLTrigger* GetDDLTrigger() const;
+       
        /// Returns the next local trigger structure.
        const AliLocalStruct* Next();
        
@@ -55,13 +60,10 @@ public:
        virtual Int_t GetMaxDDL() const { return fgkMaxDDL; }
        
        /// Return maximum number of regional cards in the DDL.
-       virtual Int_t GetMaxReg() const { return (Int_t) fDecoder.RegionalsDecoded(); }
-       
-       /// Return maximum allowed number of regional cards in the DDL.
-       virtual Int_t GetMaxRegAllowed() const { return (Int_t) fDecoder.MaxRegionals(); }
+       virtual Int_t GetMaxReg() const { return (Int_t) fDecoder.MaxRegionals(); }
        
-       /// Set the maximum allowed number of regional cards in the DDL.
-       virtual void SetMaxRegAllowed(Int_t reg);
+       /// Set the maximum number of regional cards in the DDL.
+       virtual void SetMaxReg(Int_t reg);
        
        /// Return maximum number of local cards in the DDL.
        virtual Int_t GetMaxLoc() const { return (Int_t) fDecoder.MaxLocals(); }
@@ -136,7 +138,7 @@ public:
                /// Return first word
                UInt_t   GetWord()               const {return GetDarcHeader();}
                /// Return global input
-               Int_t    GetGlobalInput(Int_t n) const {return fGlobalHeader->fInput[n];}
+               UInt_t   GetGlobalInput(Int_t n) const {return fGlobalHeader->fInput[n];}
                /// Return global output
                UChar_t  GetGlobalOutput() const {return AliMUONTriggerDDLDecoderEventHandler::GetGlobalOutput(fGlobalHeader);}
                /// Return global config
@@ -563,8 +565,8 @@ public:
        /// Returns the current local struct being decoded or NULL if none found.
        const AliLocalStruct* CurrentLocalStruct() const
        {
-               return (fCurrentLocalStruct != fDecoder.GetHandler().EndOfLocalStructs()) ?
-                       fCurrentLocalStruct : NULL;
+               return (fkCurrentLocalStruct != fDecoder.GetHandler().EndOfLocalStructs()) ?
+                       fkCurrentLocalStruct : NULL;
        }
 
        /// Returns the current regional structure being decoded
@@ -667,9 +669,10 @@ private:
                }
                
                /// Handler for new regional card structures.
-               void OnNewRegionalStruct(const AliMUONRegionalHeaderStruct* header,
-                                        const AliMUONRegionalScalarsStruct* scalars,
-                                        const void* data);
+               void OnNewRegionalStructV2(UInt_t iReg,
+                                          const AliMUONRegionalHeaderStruct* header,
+                                          const AliMUONRegionalScalarsStruct* scalars,
+                                          const void* data);
                
                /// Handler for new local card structures.
                void OnLocalStruct(const AliMUONLocalInfoStruct* localStruct,
@@ -702,15 +705,18 @@ private:
                UInt_t fRegEoWErrors;     //!< Number of end of regional word errors.
                UInt_t fLocalEoWErrors;   //!< Number of end of local word errors.
                Bool_t fWarnings;       //!< Flag indicating if we should generate a warning for errors.
+               
+               static const AliMUONRegionalHeaderStruct fgkEmptyHeader;  //!< Empty header for skipped regional structures.
        };
        
        AliMUONTriggerDDLDecoder<AliDecoderEventHandler> fDecoder;  //!< The decoder for the DDL payload.
        Int_t fDDL;         //!< The current DDL number being handled.
        Int_t fBufferSize;  //!< This is the buffer size in bytes of fBuffer.
        UChar_t* fBuffer;   //!< This is the buffer in which we store the DDL payload read from AliRawReader.
-       const AliLocalStruct* fCurrentLocalStruct;  //!< The current local trigger structure being handled by Next().
+       const AliLocalStruct* fkCurrentLocalStruct;  //!< The current local trigger structure being handled by Next().
        Bool_t fHadError;   //!< Flag indicating if there was a decoding error or not.
        Bool_t fDone;       //!< Flag indicating if the iteration is done or not.
+       mutable AliMUONDDLTrigger* fDDLObject; //!< Temporary DDL object used by GetDDLTrigger() for caching.
        
        static const Int_t  fgkMaxDDL;     //!< Maximum number of DDLs
        
@@ -725,14 +731,15 @@ inline const AliMUONRawStreamTriggerHP::AliLocalStruct* AliMUONRawStreamTriggerH
        /// When no more local triggers are found then NULL is returned.
 
        do {
-               if (fCurrentLocalStruct != fDecoder.GetHandler().EndOfLocalStructs())
-                       return fCurrentLocalStruct++;
+               if (fkCurrentLocalStruct != fDecoder.GetHandler().EndOfLocalStructs())
+                       return fkCurrentLocalStruct++;
        } while (NextDDL());
        return NULL;
 }
 
 
-inline void AliMUONRawStreamTriggerHP::AliDecoderEventHandler::OnNewRegionalStruct(
+inline void AliMUONRawStreamTriggerHP::AliDecoderEventHandler::OnNewRegionalStructV2(
+               UInt_t iReg,
                const AliMUONRegionalHeaderStruct* header,
                const AliMUONRegionalScalarsStruct* scalars,
                const void* /*data*/
@@ -743,18 +750,16 @@ inline void AliMUONRawStreamTriggerHP::AliDecoderEventHandler::OnNewRegionalStru
        /// the appropriate counters.
        
        assert( header != NULL );
-       assert( fCurrentRegional != NULL );
-       assert( fRegionalsCount < (UInt_t)fRawStream->GetMaxReg() );
+       assert( iReg < fRegionalsCount );
        
-       // Link the previous regional structure unless it is the first one.
-       if (fRegionalsCount > 0)
+       fCurrentRegional = fRegionals+iReg;
+       *fCurrentRegional = AliRegionalHeader(fCurrentLocal+1, header, scalars);
+       
+       // Link to the next regional structure unless this is the last one.
+       if (iReg+1 < fRegionalsCount)
        {
                fCurrentRegional->SetNext(fCurrentRegional+1);
        }
-       
-       fCurrentRegional++;
-       *fCurrentRegional = AliRegionalHeader(fCurrentLocal+1, header, scalars);
-       fRegionalsCount++;
 }