]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Classes for trigger raw data
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 9 May 2006 15:17:51 +0000 (15:17 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 9 May 2006 15:17:51 +0000 (15:17 +0000)
(Christian)

MUON/AliMUONDarcHeader.cxx [new file with mode: 0644]
MUON/AliMUONDarcHeader.h [new file with mode: 0644]
MUON/AliMUONLocalStruct.cxx [new file with mode: 0644]
MUON/AliMUONLocalStruct.h [new file with mode: 0644]
MUON/AliMUONRegHeader.cxx [new file with mode: 0644]
MUON/AliMUONRegHeader.h [new file with mode: 0644]

diff --git a/MUON/AliMUONDarcHeader.cxx b/MUON/AliMUONDarcHeader.cxx
new file mode 100644 (file)
index 0000000..259927b
--- /dev/null
@@ -0,0 +1,182 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+#include "AliMUONDarcHeader.h"
+#include "AliMUONRegHeader.h"
+
+/// 
+/// Darc structure for trigger raw data.
+/// Each DDL contains one Darc structure
+/// The structure includes the information of the Darc boards
+/// the Global board input and the global board output
+/// The structure containes the information of the 8 (at most) 
+/// regional structures.
+///
+
+ClassImp(AliMUONDarcHeader)
+ const Int_t AliMUONDarcHeader::fgkHeaderLength = 8;
+ const Int_t AliMUONDarcHeader::fgkDarcScalerLength   = 6;
+ const Int_t AliMUONDarcHeader::fgkGlobalScalerLength = 10;
+
+ const UInt_t AliMUONDarcHeader::fgkEndOfDarc   = 0xDEADFACE;
+ const UInt_t AliMUONDarcHeader::fgkEndOfGlobal = 0xDEADBEEF;
+
+
+//___________________________________________
+AliMUONDarcHeader::AliMUONDarcHeader()
+  :  TObject(),
+     fWord(0),
+     fGlobalOutput(0),
+
+     fGlobalL0(0), 
+     fGlobalClk(0),
+     fGlobalHold(0),      
+     fGlobalSpare(0),     
+
+     fDarcL0R(0),
+     fDarcL0U(0),
+     fDarcL0P(0),
+     fDarcL0S(0),
+     fDarcClk(0),
+     fDarcHold(0)
+{
+  //
+  // ctor
+  //
+  for (Int_t i = 0; i < 4; i++)
+    fGlobalInput[i] = 0;
+
+  for (Int_t i = 0; i < 6; i++)
+    fGlobalScaler[i] = 0;
+
+  fRegHeaderArray = new TClonesArray("AliMUONRegHeader",8);
+}
+
+//___________________________________________
+AliMUONDarcHeader::AliMUONDarcHeader(const AliMUONDarcHeader& event)
+  :  TObject(event)
+{
+  //
+  // copy ctor
+  //
+  fWord         = event.fWord;
+  fGlobalOutput = event.fGlobalOutput;
+  fGlobalL0     = event.fGlobalL0;
+  fGlobalClk    = event.fGlobalClk;
+  fGlobalHold   = event.fGlobalHold;   
+  fGlobalSpare  = event.fGlobalSpare;
+
+  fDarcL0R  = event.fDarcL0R;
+  fDarcL0U  = event.fDarcL0U;
+  fDarcL0P  = event.fDarcL0P;
+  fDarcL0S  = event.fDarcL0S;
+  fDarcClk  = event.fDarcClk;
+  fDarcHold = event.fDarcHold;
+
+ for (Int_t i = 0; i < 4; i++)
+    fGlobalInput[i] = event.fGlobalInput[i];
+
+  for (Int_t i = 0; i < 6; i++)
+    fGlobalScaler[i] = event.fGlobalScaler[i];
+
+  fRegHeaderArray = new TClonesArray("AliMUONRegHeader", 8);
+  for (Int_t index = 0; index < (event.fRegHeaderArray)->GetEntriesFast(); index++) {
+    new ((*fRegHeaderArray)[fRegHeaderArray->GetEntriesFast()]) 
+        AliMUONRegHeader(*(AliMUONRegHeader*)(event.fRegHeaderArray)->At(index));
+  }
+}
+
+//___________________________________________
+AliMUONDarcHeader& AliMUONDarcHeader::operator=(const AliMUONDarcHeader& event)
+{
+  // 
+  // assignment operator
+  //
+  if (this == &event) return *this;
+
+  fWord         = event.fWord;
+  fGlobalOutput = event.fGlobalOutput;
+  fGlobalL0     = event.fGlobalL0;
+  fGlobalClk    = event.fGlobalClk;
+  fGlobalHold   = event.fGlobalHold;   
+  fGlobalSpare  = event.fGlobalSpare;
+
+  fDarcL0R  = event.fDarcL0R;
+  fDarcL0U  = event.fDarcL0U;
+  fDarcL0P  = event.fDarcL0P;
+  fDarcL0S  = event.fDarcL0S;
+  fDarcClk  = event.fDarcClk;
+  fDarcHold = event.fDarcHold;
+
+  for (Int_t i = 0; i < 4; i++)
+    fGlobalInput[i] = event.fGlobalInput[i];
+
+  for (Int_t i = 0; i < 6; i++)
+    fGlobalScaler[i] = event.fGlobalScaler[i];
+
+  fRegHeaderArray = new TClonesArray("AliMUONRegHeader", 8);
+  for (Int_t index = 0; index < (event.fRegHeaderArray)->GetEntriesFast(); index++) {
+    new ((*fRegHeaderArray)[fRegHeaderArray->GetEntriesFast()]) 
+        AliMUONRegHeader(*(AliMUONRegHeader*)(event.fRegHeaderArray)->At(index));
+  }
+
+  return *this;
+}
+
+//___________________________________________
+AliMUONDarcHeader::~AliMUONDarcHeader()
+{
+  // 
+  // dtor
+  //
+  fRegHeaderArray->Delete();
+  delete fRegHeaderArray;
+}
+
+//___________________________________________
+void AliMUONDarcHeader::SetScalersNumbers()
+{
+  // set numbers for scaler events for Darc header
+  // since this is provided by the experiment
+  // put dummy numbers to check the monitoring
+  
+  fGlobalL0    = 1000;
+  fGlobalClk   = 10000;
+  fGlobalHold  = 100;    
+  fGlobalSpare = 1;    
+
+  fDarcL0R  = 1000;
+  fDarcL0U  = 900;
+  fDarcL0P  = 800;
+  fDarcL0S  = 700;
+  fDarcClk  = 10000;
+  fDarcHold = 100;
+
+   for (Int_t i = 0; i < 6; i++)
+    fGlobalScaler[i] = i;
+
+}
+
+//___________________________________________
+void AliMUONDarcHeader::Clear(Option_t* )
+{
+  // Clear TClones arrays
+  // instead of deleting
+  //
+  fRegHeaderArray->Clear("C");
+}
diff --git a/MUON/AliMUONDarcHeader.h b/MUON/AliMUONDarcHeader.h
new file mode 100644 (file)
index 0000000..228b2b0
--- /dev/null
@@ -0,0 +1,123 @@
+#ifndef ALIMUONDARCHEADER_H
+#define ALIMUONDARCHEADER_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/*$Id$*/
+
+/// \ingroup raw
+/// \class AliMUONDarcHeader
+/// \brief MUON Darc header for Trigger
+///
+/// \author Christian Finck
+
+#include <TObject.h>
+#include <TClonesArray.h>
+
+class AliMUONRegHeader;
+
+class AliMUONDarcHeader : public TObject {
+public:
+   AliMUONDarcHeader();
+   AliMUONDarcHeader(const AliMUONDarcHeader& event);
+   AliMUONDarcHeader& operator=(const AliMUONDarcHeader& event);
+
+   virtual ~AliMUONDarcHeader();
+
+
+   UInt_t  GetWord()               const {return fWord;}
+   Int_t   GetGlobalInput(Int_t n) const {return fGlobalInput[n];}
+   Int_t   GetGlobalOutput()       const {return fGlobalOutput;}
+
+   //DarcId:4,SerialNb:4,Version:8,EventType:4,GlobalFlag:4,MBZ:8;
+   Char_t  GetDarcId()     const {return (Char_t)(fWord >> 28) &  0xF;}
+   Char_t  GetSerialNb()   const {return (Char_t)(fWord >> 24) &  0xF;}
+   Char_t  GetVersion()    const {return (Char_t)(fWord >> 16) &  0xFF;}
+   Char_t  GetEventType()  const {return (Char_t)(fWord >> 12) &  0xF;}
+   Char_t  GetGlobalFlag() const {return (Char_t)(fWord >>  8) &  0xF;}
+
+   void    SetWord(UInt_t w) {fWord = w;}
+   void    SetGlobalInput(Int_t in, Int_t n) {fGlobalInput[n] = in;}
+   void    SetGlobalOutput(Int_t out) {fGlobalOutput = out;}
+
+   Int_t   GetHeaderLength() const {return fgkHeaderLength;}
+
+   UInt_t* GetHeader() {return &fWord;}
+   Int_t*  GetGlobalInput()    {return &fGlobalInput[0];}
+
+  // DARC get methods
+   UInt_t  GetDarcL0R()     const {return fDarcL0R;}
+   UInt_t  GetDarcL0U()     const {return fDarcL0U;}
+   UInt_t  GetDarcL0P()     const {return fDarcL0P;}
+   UInt_t  GetDarcL0S()     const {return fDarcL0S;}
+   UInt_t  GetDarcClock()   const {return fDarcClk;}
+   UInt_t  GetDarcHold()    const {return fDarcHold;}
+   
+   // don't use setting methods but memcpy
+   UInt_t* GetGlobalScalers()  {return &fGlobalL0;}
+   UInt_t* GetDarcScalers()    {return &fDarcL0R;} 
+
+   // global get methods
+   UInt_t  GetGlobalL0()      const {return fGlobalL0;}
+   UInt_t  GetGlobalClock()   const {return fGlobalClk;}
+   const UInt_t* GetGlobalScaler()  const {return fGlobalScaler;}
+   UInt_t  GetGlobalHold()    const {return fGlobalHold;}
+   UInt_t  GetGlobalSpare()   const {return fGlobalSpare;}
+
+   Int_t GetGlobalScalerLength() const {return fgkGlobalScalerLength;}
+   Int_t GetDarcScalerLength()   const {return fgkDarcScalerLength;} 
+
+   UInt_t GetEndOfDarc()     const {return fgkEndOfDarc;} 
+   UInt_t GetEndOfGlobal()   const {return fgkEndOfGlobal;} 
+
+   // set random numbers to fill variable
+   void SetScalersNumbers();
+
+  // get TClonesArray
+   TClonesArray*  GetRegHeaderArray()  const {return fRegHeaderArray;}
+
+   // get entries
+   Int_t GetRegHeaderEntries()  const {return fRegHeaderArray->GetEntriesFast();}
+
+   // get entry
+   AliMUONRegHeader* GetRegHeaderEntry(Int_t i) const  {
+     return (AliMUONRegHeader*)fRegHeaderArray->At(i);}
+
+   // clear
+   void Clear(Option_t* opt);
+
+ private:
+
+   UInt_t    fWord;              // first word
+   Int_t     fGlobalInput[4];    // global input
+   Int_t     fGlobalOutput;      // global ouput
+
+   static const Int_t fgkHeaderLength; // header length
+
+
+ // global card scalers   
+   UInt_t     fGlobalL0;         // global L0
+   UInt_t     fGlobalClk;        // global clock
+   UInt_t     fGlobalScaler[6];  // global ouput
+   UInt_t     fGlobalHold;       // global hold (dead time)
+   UInt_t     fGlobalSpare;      // global spare
+   static const Int_t      fgkGlobalScalerLength;  // length of global scaler in word
+
+   // DARC Scalers
+   UInt_t     fDarcL0R;       // DARC L0 received
+   UInt_t     fDarcL0U;       // DARC L0 used
+   UInt_t     fDarcL0P;       // DARC Physical L0
+   UInt_t     fDarcL0S;       // DARC Software (checking) L0
+   UInt_t     fDarcClk;       // DARC clock
+   UInt_t     fDarcHold;      // DARC hold (dead time)
+   static const Int_t      fgkDarcScalerLength;  // length of DARC scaler in word
+
+   static const UInt_t     fgkEndOfDarc;         // end of darc info word
+   static const UInt_t     fgkEndOfGlobal;       // end of global info word
+
+   TClonesArray* fRegHeaderArray; //container for regional header
+
+   ClassDef(AliMUONDarcHeader,1)  // MUON DDL Trigger
+};
+#endif
diff --git a/MUON/AliMUONLocalStruct.cxx b/MUON/AliMUONLocalStruct.cxx
new file mode 100644 (file)
index 0000000..e6c3a5a
--- /dev/null
@@ -0,0 +1,147 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+#include "AliMUONLocalStruct.h"
+
+/// 
+/// Local structure for trigger raw data.
+/// The structure includes the information
+///  about the x,y position of the 4 detection planes,
+/// the trigger word (address, local decision, y trigger, y position, x deviation,
+/// x position)
+///
+
+ClassImp(AliMUONLocalStruct)
+ const Int_t  AliMUONLocalStruct::fgkLength = 5;
+ const Int_t  AliMUONLocalStruct::fgkScalerLength = 45;
+ const UInt_t AliMUONLocalStruct::fgkEndOfLocal   = 0xCAFEFADE;
+
+//___________________________________________
+AliMUONLocalStruct::AliMUONLocalStruct()
+  :  TObject(),
+     fL0(0),   
+     fHold(0), 
+     fClk(0),   
+     fLPtNTrig(0), 
+     fHPtNTrig(0), 
+     fLPtRTrig(0), 
+     fHPtRTrig(0), 
+     fLPtLTrig(0), 
+     fHPtLTrig(0), 
+     fLPtSTrig(0), 
+     fHPtSTrig(0), 
+     fEOS(0),         
+     fReset(0)       
+{
+  //
+  // ctor
+  //
+  for (Int_t i = 0; i < 5; i++)
+    fData[i] = 0;
+
+  for (Int_t i = 0; i < 8*4; i++)
+    fScaler[i] = 0;
+
+
+}
+
+//___________________________________________
+AliMUONLocalStruct::AliMUONLocalStruct(const AliMUONLocalStruct& event)
+  :  TObject(event)
+{
+  //
+  // copy ctor
+  //
+  fL0       = event.fL0;
+  fHold     = event.fHold;
+  fClk      = event.fClk;
+  fLPtNTrig = event.fLPtNTrig;
+  fHPtNTrig = event.fHPtNTrig;
+  fLPtRTrig = event.fLPtRTrig;
+  fHPtRTrig = event.fHPtRTrig;
+  fLPtLTrig = event.fLPtLTrig;
+  fHPtLTrig = event.fHPtLTrig;
+  fLPtSTrig = event.fLPtSTrig;
+  fHPtSTrig = event.fHPtSTrig;
+  fEOS      = event.fEOS;
+  fReset    = event.fReset  ;
+
+  for (Int_t i = 0; i < 5; i++)
+    fData[i] = event.fData[i];
+
+  for (Int_t i = 0; i < 8*4; i++)
+    fScaler[i] = event.fScaler[i];
+
+
+}
+//___________________________________________
+AliMUONLocalStruct& 
+AliMUONLocalStruct::operator=(const AliMUONLocalStruct& event)
+{
+  // 
+  // assignment operator
+  //
+
+  if (this == &event) return *this;
+
+  fL0       = event.fL0;
+  fHold     = event.fHold;
+  fClk      = event.fClk;
+  fLPtNTrig = event.fLPtNTrig;
+  fHPtNTrig = event.fHPtNTrig;
+  fLPtRTrig = event.fLPtRTrig;
+  fHPtRTrig = event.fHPtRTrig;
+  fLPtLTrig = event.fLPtLTrig;
+  fHPtLTrig = event.fHPtLTrig;
+  fLPtSTrig = event.fLPtSTrig;
+  fHPtSTrig = event.fHPtSTrig;
+  fEOS      = event.fEOS;
+  fReset    = event.fReset;
+
+  for (Int_t i = 0; i < 5; i++)
+    fData[i] = event.fData[i];
+
+  for (Int_t i = 0; i < 8*4; i++)
+    fScaler[i] = event.fScaler[i];
+
+  return *this;
+}
+
+//___________________________________________
+void AliMUONLocalStruct::SetScalersNumbers()
+{
+  // set numbers for scaler events for local structure
+  // crasy numbers for scaler words, while no beam is coming
+  //
+
+  fL0       = 1000;   
+  fHold     = 100; 
+  fClk      = 10000;  
+  fLPtNTrig = 1; 
+  fHPtNTrig = 1; 
+  fLPtRTrig = 2; 
+  fHPtRTrig = 2; 
+  fLPtLTrig = 3; 
+  fHPtLTrig = 3; 
+  fLPtSTrig = 4; 
+  fHPtSTrig = 4; 
+  fEOS      = 0x2AA;         
+  fReset    = 10;     
+
+  for (Int_t i = 0; i < 8*4; i++)
+    fScaler[i] = i;
+
+}
diff --git a/MUON/AliMUONLocalStruct.h b/MUON/AliMUONLocalStruct.h
new file mode 100644 (file)
index 0000000..0515f4c
--- /dev/null
@@ -0,0 +1,111 @@
+#ifndef ALIMUONLOCALSTRUCT_H
+#define ALIMUONLOCALSTRUCT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/*$Id$*/
+
+/// \ingroup raw
+/// \class AliMUONLocalStruct
+/// \brief rawdata local card structure for trigger
+///
+/// \author Christian Finck
+
+#include <TObject.h>
+
+class AliMUONLocalStruct : public TObject{
+public:
+   AliMUONLocalStruct();
+   AliMUONLocalStruct(const AliMUONLocalStruct& event);
+   AliMUONLocalStruct& operator=(const AliMUONLocalStruct& event);
+
+
+   virtual ~AliMUONLocalStruct(){;}
+
+   // local board info
+   UInt_t  GetData(Int_t n) const {return fData[n];}
+
+   UShort_t GetX2() const {return (fData[0]     >> 16) &  0xFFFF;}
+   UShort_t GetX1() const {return (fData[0])           &  0xFFFF;}
+   UShort_t GetX4() const {return (fData[1] >> 16) &  0xFFFF;}
+   UShort_t GetX3() const {return (fData[1])       &  0xFFFF;}
+
+   UShort_t GetY2() const {return (fData[2] >> 16) &  0xFFFF;}
+   UShort_t GetY1() const {return (fData[2])       &  0xFFFF;}
+   UShort_t GetY4() const {return (fData[3] >> 16) &  0xFFFF;}
+   UShort_t GetY3() const {return (fData[3])       &  0xFFFF;}
+
+   Char_t   GetId()  const  {return fData[4] >> 19 &  0xF;}
+   Char_t   GetDec() const  {return fData[4] >> 15 &  0xF;}
+   Char_t   GetTriggerY() const {return fData[4] >> 14 &  0x1;}
+   Char_t   GetYPos() const {return fData[4] >> 10 &  0xF;}
+   Char_t   GetXDev() const {return fData[4] >> 5  &  0x1F;}
+   Char_t   GetXPos() const {return fData[4]       &  0x1F;}
+
+   Int_t   GetLpt() const {return (GetDec() & 0x3);}
+   Int_t   GetHpt() const {return (GetDec() >> 2) & 0x3;}
+
+   void    SetData(UInt_t d, Int_t n) {fData[n] = d;}
+
+   UInt_t* GetData() {return &fData[0];}
+
+ // Scaler methods
+   UInt_t  GetL0()      const {return fL0;}
+   UInt_t  GetHold()    const {return fHold;}
+   UInt_t  GetClock()   const {return fClk;}
+   UChar_t GetSwitch()  const {return (fEOS >> 2) & 0x3FF;}
+   UChar_t GetComptXY() const {return  fEOS & 3;}
+
+   UShort_t GetXY1(Int_t n) const {return  (n % 2 == 0) ? 
+       (fScaler[n] &  0xFFFF) : (fScaler[n] >> 16) &  0xFFFF;}
+   UShort_t GetXY2(Int_t n) const {return  (n % 2 == 0) ? 
+       (fScaler[8 + n] &  0xFFFF) : (fScaler[8 + n] >> 16) &  0xFFFF;}
+   UShort_t GetXY3(Int_t n) const {return  (n % 2 == 0) ? 
+       (fScaler[8*2 + n] &  0xFFFF) : (fScaler[8*2 + n] >> 16) &  0xFFFF;}
+   UShort_t GetXY4(Int_t n) const {return  (n % 2 == 0) ? 
+       (fScaler[8*3 + n] &  0xFFFF) : (fScaler[8*3 + n] >> 16) &  0xFFFF;}
+
+   UInt_t* GetScalers()  {return &fL0;} 
+
+   // get  length
+   Int_t  GetScalerLength()  const {return fgkScalerLength;} 
+   Int_t  GetLength()        const {return fgkLength;} 
+   UInt_t GetEndOfLocal()    const {return fgkEndOfLocal;}
+
+  // set random numbers to fill variable
+   void SetScalersNumbers();
+
+ private:
+  
+   // local info
+   UInt_t    fData[5];  // local data
+   
+   // local card scalers   
+   UInt_t     fL0;        // local L0
+   UInt_t     fHold;      // local hold (dead time)
+   UInt_t     fClk;       // local clock
+
+   UInt_t     fLPtNTrig;  // local low Pt no trigger
+   UInt_t     fHPtNTrig;  // local high Pt no trigger
+
+   UInt_t     fLPtRTrig;  // local low Pt right trigger
+   UInt_t     fHPtRTrig;  // local high Pt right trigger
+
+   UInt_t     fLPtLTrig;  // local low Pt left trigger
+   UInt_t     fHPtLTrig;  // local high Pt left trigger
+
+   UInt_t     fLPtSTrig;  // local low Pt straight trigger
+   UInt_t     fHPtSTrig;  // local high Pt straight trigger
+
+   UInt_t     fScaler[8*4];   // local data
+   UInt_t     fEOS;           // contains switches conf. & flag for reading X (0) or Y (1) in fScaler
+   UInt_t     fReset;         // reset signal
+
+   static const Int_t  fgkLength;       // local info length in word
+   static const Int_t  fgkScalerLength; // scaler length in word
+   static const UInt_t fgkEndOfLocal;   // end of local info word
+
+   ClassDef(AliMUONLocalStruct,3)
+};
+#endif
diff --git a/MUON/AliMUONRegHeader.cxx b/MUON/AliMUONRegHeader.cxx
new file mode 100644 (file)
index 0000000..8cc8b2a
--- /dev/null
@@ -0,0 +1,142 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+#include "AliMUONRegHeader.h"
+#include "AliMUONLocalStruct.h"
+
+
+
+/// 
+/// Regional structure for trigger raw data.
+/// Each Reg structure contains 16 (at most) local card structure.
+/// The structure includes the information of the Reg. boards and
+/// regional inputs
+/// 
+
+ClassImp(AliMUONRegHeader)
+ const Int_t  AliMUONRegHeader::fgkHeaderLength = 3;
+ const Int_t  AliMUONRegHeader::fgkScalerLength = 8;
+ const UInt_t AliMUONRegHeader::fgkEndOfReg     = 0xBEEFFACE;
+
+//___________________________________________
+AliMUONRegHeader::AliMUONRegHeader()
+  :  TObject(),
+     fWord(0),
+     fL0(0), 
+     fClk(0),
+     fHold(0)
+
+{
+  //
+  // ctor
+  //
+  fInput[0] = fInput[1] = 0;
+
+  for (Int_t i = 0; i < 8; i++)
+    fScaler[i] = 0;
+
+  fLocalArray  = new TClonesArray("AliMUONLocalStruct",16);
+
+}
+
+//___________________________________________
+AliMUONRegHeader::~AliMUONRegHeader()
+{
+  // 
+  // dtor
+  //
+  fLocalArray->Delete();
+  delete fLocalArray;
+}
+
+//___________________________________________
+AliMUONRegHeader::AliMUONRegHeader(const AliMUONRegHeader& event)
+  :  TObject(event)
+{
+  //
+  // copy ctor
+  //
+  fWord = event.fWord;
+  fL0   = event.fL0;
+  fClk  = event.fClk;
+  fHold = event.fHold;
+
+  fInput[0] = event.fInput[0];
+  fInput[1] = event.fInput[1];
+
+  for (Int_t i = 0; i < 8; i++)
+    fScaler[i] = event.fScaler[i];
+
+  fLocalArray = new TClonesArray("AliMUONLocalStruct", 16);
+  for (Int_t index = 0; index < (event.fLocalArray)->GetEntriesFast(); index++) {
+    {new ((*fLocalArray)[fLocalArray->GetEntriesFast()]) 
+        AliMUONLocalStruct(*(AliMUONLocalStruct*)(event.fLocalArray)->At(index));}
+  }
+}
+
+//___________________________________________
+AliMUONRegHeader& AliMUONRegHeader::operator=(const AliMUONRegHeader& event)
+{
+  // 
+  // assignment operator
+  //
+
+  if (this == &event) return *this;
+
+  fWord = event.fWord;
+  fL0   = event.fL0;
+  fClk  = event.fClk;
+  fHold = event.fHold;
+
+  fInput[0] = event.fInput[0];
+  fInput[1] = event.fInput[1];
+
+  for (Int_t i = 0; i < 8; i++)
+    fScaler[i] = event.fScaler[i];
+
+  fLocalArray = new TClonesArray("AliMUONLocalStruct", 16);
+  for (Int_t index = 0; index < (event.fLocalArray)->GetEntriesFast(); index++) {
+    {new ((*fLocalArray)[fLocalArray->GetEntriesFast()]) 
+        AliMUONLocalStruct(*(AliMUONLocalStruct*)(event.fLocalArray)->At(index));}
+  }
+
+  return *this;
+}
+
+//___________________________________________
+void AliMUONRegHeader::SetScalersNumbers()
+{
+  // set numbers for scaler events for Regional header
+  // since this is provided by the experiment
+  // put dummy numbers to check the monitoring
+  
+  fL0   = 1000;
+  fClk  = 10000;
+  fHold = 100; 
+  
+  for (Int_t i = 0; i < 8; i++)
+    fScaler[i] = i;  
+}
+
+//___________________________________________
+void AliMUONRegHeader::Clear(Option_t* )
+{
+  // Clear TClones arrays
+  // instead of deleting
+  //
+  fLocalArray->Clear("C");
+}
diff --git a/MUON/AliMUONRegHeader.h b/MUON/AliMUONRegHeader.h
new file mode 100644 (file)
index 0000000..85f84c6
--- /dev/null
@@ -0,0 +1,94 @@
+#ifndef ALIMUONREGHEADER_H
+#define ALIMUONREGHEADER_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/*$Id$*/
+
+/// \ingroup raw
+/// \class AliMUONRegHeader
+/// \brief MUON regional header for trigger
+///
+/// \author Christian Finck
+
+#include <TObject.h>
+#include <TClonesArray.h>
+
+class AliMUONLocalStruct;
+
+class AliMUONRegHeader : public TObject{
+public:
+   AliMUONRegHeader();
+   AliMUONRegHeader(const AliMUONRegHeader& event);
+   AliMUONRegHeader& operator=(const AliMUONRegHeader& event);
+
+   virtual ~AliMUONRegHeader();
+
+
+   UInt_t  GetWord()          const {return fWord;}
+   UInt_t  GetInput(Int_t n)  const {return fInput[n];}
+
+   //MBZ:3,serialNb:5,Version:8,Id:4,MBZ:4,Out:8
+   Char_t   GetSerialNb()  const {return (Char_t)(fWord >> 24) &  0x1F;}
+   Char_t   GetVersion()   const {return (Char_t)(fWord >> 16) &  0xFF;}
+   Char_t   GetId()        const {return (Char_t)(fWord >> 12) &  0x0F;}
+   Char_t   GetOutput()    const {return (Char_t)(fWord)       &  0xFF;}
+
+   void    SetWord(UInt_t w) {fWord = w;}
+   void    SetInput(UInt_t in, Int_t n) {fInput[n] = in;}
+   
+   Int_t   GetHeaderLength() const {return fgkHeaderLength;}
+   UInt_t  GetEndOfReg()     const {return fgkEndOfReg;}
+
+
+   UInt_t* GetHeader() {return &fWord;}
+
+  // scalar methods
+   UInt_t  GetL0()      const {return fL0;}
+   UInt_t  GetClock()   const {return fClk;}
+   const UInt_t* GetScaler()  const {return fScaler;}
+   UInt_t  GetHold()    const {return fHold;}
+
+   UInt_t* GetScalers()    {return &fL0;}   
+
+   // get scaler length
+   Int_t GetScalerLength()  const {return fgkScalerLength;} 
+
+  // set random numbers to fill variable
+   void SetScalersNumbers();
+
+  // get TClonesArray
+   TClonesArray*  GetLocalArray()  const {return fLocalArray;}
+
+   // get entries
+   Int_t GetLocalEntries()  const {return fLocalArray->GetEntriesFast();}
+
+   // get entry
+   AliMUONLocalStruct* GetLocalEntry(Int_t i) const {
+     return (AliMUONLocalStruct*)fLocalArray->At(i);}
+
+   // clear
+   void Clear(Option_t* opt);
+
+ private:
+   
+   // regional header
+   UInt_t    fWord;          // first word
+   UInt_t    fInput[2];      // regional input
+
+   // regional card scalers   
+   UInt_t     fL0;         // regional L0
+   UInt_t     fClk;        // regional clock
+   UInt_t     fScaler[8];  // regional ouput
+   UInt_t     fHold;       // regional hold (dead time)
+
+   static const Int_t  fgkScalerLength;  // length of regional scaler in word
+   static const Int_t  fgkHeaderLength;  // header length in word
+   static const UInt_t fgkEndOfReg;      // end of regional info word
+
+   TClonesArray* fLocalArray;   // array of local structure
+
+   ClassDef(AliMUONRegHeader,3)
+};
+#endif