First version of trigger preprocessor (only local and regional masks so far)
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 19 Oct 2007 13:58:02 +0000 (13:58 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 19 Oct 2007 13:58:02 +0000 (13:58 +0000)
(Laurent)

15 files changed:
MUON/AliMUONHVSubprocessor.cxx
MUON/AliMUONPreprocessor.cxx
MUON/AliMUONPreprocessor.h
MUON/AliMUONTrackerPreprocessor.cxx
MUON/AliMUONTriggerIO.cxx [new file with mode: 0644]
MUON/AliMUONTriggerIO.h [new file with mode: 0644]
MUON/AliMUONTriggerPreprocessor.cxx [new file with mode: 0644]
MUON/AliMUONTriggerPreprocessor.h [new file with mode: 0644]
MUON/AliMUONTriggerSubprocessor.cxx [new file with mode: 0644]
MUON/AliMUONTriggerSubprocessor.h [new file with mode: 0644]
MUON/MUONcalibLinkDef.h
MUON/MUONshuttleLinkDef.h
MUON/TestMUONPreprocessor.C
MUON/libMUONcalib.pkg
MUON/libMUONshuttle.pkg

index 44aff5ac2d8fe720174403a05b76d3a4190d0af5..b782e5ff69ad91ecf55cf75c5101872f6661ffa2 100644 (file)
@@ -13,7 +13,7 @@
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/
 
-/// $Id$
+// $Id$
 
 //-----------------------------------------------------------------------------
 /// \class AliMUONHVSubprocessor
index cb3a85493217947473c355d4c640040484599b0e..a3a8bc85b8660a03d91550adb64c72cda9327eb1 100644 (file)
@@ -92,17 +92,15 @@ AliMUONPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
   
   // Load mapping from CDB for this run
   
-  fIsValid = kTRUE;
-  
-  AliCDBEntry* e = GetFromOCDB("Calib", "Mapping");
-  if (!e)
+  AliCDBEntry* cdbEntry = GetFromOCDB("Calib", "Mapping");
+  if (!cdbEntry)
   {
     Log("Could not get Mapping from OCDB !");
     fIsValid = kFALSE;
   }
   
-  e = GetFromOCDB("Calib", "DDLStore");
-  if (!e)
+  cdbEntry = GetFromOCDB("Calib", "DDLStore");
+  if (!cdbEntry)
   {
     Log("Could not get DDLStore from OCDB");
     fIsValid = kFALSE;
@@ -116,6 +114,8 @@ AliMUONPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
       Subprocessor(i)->Initialize(run,startTime,endTime);
     }
   }
+
+  Log(Form("Initialize was %s",( IsValid() ? "fine" : "NOT OK")));
 }
 
 //_____________________________________________________________________________
index 6ec375fd21230162d20004d2d7786192ad2a5f57..f0bdfe0f53900befa0ffd7d03a65bd2691a1c307 100644 (file)
@@ -61,6 +61,8 @@ protected:
   void Add(AliMUONVSubprocessor* subProcessor, Bool_t processDCS=kFALSE); 
   void ClearSubprocessors();
   
+  Bool_t fIsValid; //!< whether we were correctly initialized
+
 private:
   /// Not implemented
   AliMUONPreprocessor(const AliMUONPreprocessor& rhs);
@@ -73,8 +75,7 @@ private:
 
   TObjArray* fSubprocessors; //!< sub processors to execute
   Bool_t fProcessDCS; //!< whether the current subprocessor(s) needs DCS or not
-  Bool_t fIsValid; //!< whether we were correctly initialized
-  
+
   ClassDef(AliMUONPreprocessor,3) // MUON Shuttle preprocessor
 };
 
index 7eda73b18f10f8d36dd6055680e872cad68207e8..f4988c7eb60050816b105a42bafdd420949cc9cf 100644 (file)
@@ -74,6 +74,8 @@ AliMUONTrackerPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTi
   
   TString runType = GetRunType();
   
+  fIsValid = kTRUE;
+  
   if ( runType == "PEDESTAL_RUN" ) // FIXME : check the name
   {
     Add(fPedestalSubprocessor); // to be called only for pedestal runs
@@ -98,6 +100,7 @@ AliMUONTrackerPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTi
   else
   {
     Log(Form("ERROR-Unknown RunType=%",runType.Data()));
+    fIsValid = kFALSE;
   }
   
   AliMUONPreprocessor::Initialize(run,startTime,endTime);
diff --git a/MUON/AliMUONTriggerIO.cxx b/MUON/AliMUONTriggerIO.cxx
new file mode 100644 (file)
index 0000000..81af613
--- /dev/null
@@ -0,0 +1,248 @@
+/**************************************************************************
+* 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.                  *
+**************************************************************************/
+
+// $Id$
+
+#include "AliMUONTriggerIO.h"
+
+#include "AliLog.h"
+#include "AliMpDDLStore.h"
+#include "AliMpTriggerCrate.h"
+#include "AliMUONCalibParamNI.h"
+#include "AliMUONVStore.h"
+#include <Riostream.h>
+#include <TSystem.h>
+
+/// \class AliMUONTriggerIO
+///
+/// Handles read/write of masks and LUT to/from online files, 
+/// to be used by Shuttle and Trigger DA.
+/// 
+/// \author Laurent Aphecetche, Subatech
+
+/// \cond CLASSIMP
+ClassImp(AliMUONTriggerIO)
+/// \endcond
+
+//_____________________________________________________________________________
+AliMUONTriggerIO::AliMUONTriggerIO() :
+ TObject(), fLocalBoardIds(), fNofLocalBoards(0)
+{
+  /// ctor
+}
+
+//_____________________________________________________________________________
+AliMUONTriggerIO::~AliMUONTriggerIO()
+{
+  /// dtor
+}
+
+//_____________________________________________________________________________
+Int_t 
+AliMUONTriggerIO::LocalBoardId(Int_t index) const
+{
+  /// Return the i-th localBoardId, or -1 if index is out of bounds
+  if ( index >= 0 && index < fNofLocalBoards ) 
+  {
+    return fLocalBoardIds[index];
+  }
+  return -1;
+}
+
+//_____________________________________________________________________________
+Int_t
+AliMUONTriggerIO::ReadLocalMasks(const char* localFile, AliMUONVStore& localMasks) const
+{
+  /// Fills the local masks store from file
+  
+  if ( !NofLocalBoards() )
+  {
+    AliError("No local board to read");
+    return 0;
+  }
+  
+  FILE* fp = fopen(gSystem->ExpandPathName(localFile),"r");
+  if (!fp)
+  {
+    AliError(Form("Could not read file %s",localFile));
+    return 0;
+  }
+  
+  UShort_t maskBuffer[8];
+  
+  Int_t nLocalBoards(0);
+  
+  while ( fread ( maskBuffer, 2, 8, fp ) )
+  {
+    Int_t localBoardId = LocalBoardId(nLocalBoards);
+    AliDebug(1,Form("LB %03d X1 %4x X2 %4x X3 %4x X4 %4x "
+                    "Y1 %4x Y2 %4x Y3 %4x Y4 %4x",
+                    localBoardId,
+                    maskBuffer[0],
+                    maskBuffer[1],
+                    maskBuffer[2],
+                    maskBuffer[3],
+                    maskBuffer[4],
+                    maskBuffer[5],
+                    maskBuffer[6],
+                    maskBuffer[7]));
+    
+    if ( localBoardId ) 
+    {
+      AliMUONVCalibParam* localBoard = new AliMUONCalibParamNI(1,8,localBoardId,0,0);
+      for ( Int_t x = 0; x < 2; ++x )
+      {
+        for ( Int_t y = 0; y < 4; ++y )
+        {
+          Int_t index = x*4+y;
+          localBoard->SetValueAsInt(index,0,maskBuffer[index]);
+        }
+      }
+      localMasks.Add(localBoard);
+    }
+    
+    ++nLocalBoards;
+  }
+  
+  if ( nLocalBoards != NofLocalBoards() ) 
+  {
+    AliError(Form("Read %d out of %d local boards",
+                  nLocalBoards, NofLocalBoards()));
+  }
+  
+  fclose(fp);
+  
+  return nLocalBoards;
+}
+
+//_____________________________________________________________________________
+Bool_t 
+AliMUONTriggerIO::ReadMasks(const char* localFile,
+                            const char* regionalFile,
+                            const char* globalFile,
+                            AliMUONVStore* localMasks,
+                            AliMUONVStore* regionalMasks,
+                            AliMUONVCalibParam* globalMasks)
+{
+  /// Fill the various masks store from files
+  
+  if ( !regionalFile ) 
+  {
+    AliError("Must have a regional file name to proceeed");
+    return kFALSE;
+  }
+  
+  Int_t nCrates = ReadRegional(regionalFile,regionalMasks);
+  
+  if (!nCrates) return kFALSE;
+  
+  if (localMasks && localFile)
+  {
+    Int_t nLocal = ReadLocalMasks(localFile,*localMasks);
+    AliDebug(1,Form("Read masks for %d local boards",nLocal));
+  }
+  
+  return kTRUE;
+}
+
+//_____________________________________________________________________________
+Int_t
+AliMUONTriggerIO::ReadRegional(const char* regionalFile, AliMUONVStore* regionalMasks)
+{
+  /// Read regional file to fill the regional mask store *AND* 
+  /// determine the order in which local boards will appear in local 
+  /// and lut files.
+  
+  fLocalBoardIds.Reset();
+  fNofLocalBoards = 0;
+  
+  std::ifstream in(gSystem->ExpandPathName(regionalFile));
+  if (!in.good()) 
+  {
+    AliError(Form("Cannot read file %s",regionalFile));
+    return 0;
+  }
+
+  char name[80];
+  char line[80];
+  
+  Int_t nCrates(0);
+  
+  while (!in.eof())
+  {
+    in.getline(name,80);
+    
+    if (!strlen(name)) break;
+
+    AliDebug(1,Form("Looking for crate %s",name));
+    
+    AliMpTriggerCrate* triggerCrate = AliMpDDLStore::Instance()->GetTriggerCrate(name);
+    
+    if (!triggerCrate)
+    {
+      AliError(Form("Mapping error : could not get crate %s",name));
+      return 0;
+    }
+    
+    ++nCrates;
+    
+    UShort_t id, mask;
+    Int_t mode, coincidence;
+    
+    in.getline(line,80);    
+    sscanf(line,"%hx",&id);
+
+    in.getline(line,80);
+    sscanf(line,"%d",&mode);
+    
+    in.getline(line,80);
+    sscanf(line,"%d",&coincidence);
+    
+    in.getline(line,80);
+    sscanf(line,"%hx",&mask);
+
+    if ( regionalMasks ) 
+    {
+      AliMUONVCalibParam* regionalBoard = new AliMUONCalibParamNI(1,16,id,0,0);
+      regionalBoard->SetValueAsInt(0,0,mask);
+      regionalMasks->Add(regionalBoard);
+      //FIXME: lines below should not be needed, as regionalMask should be only 1 16 bits word, not 16 16 bits word...
+      for ( Int_t j = 1; j < 16; ++j )
+      {
+        regionalBoard->SetValueAsInt(j,0,0x3F);
+      }      
+    }
+    
+    AliDebug(1,Form("Name %s ID %x Mode %d Coin %d Mask %x",
+                    name,id,mode,coincidence,mask));
+    
+    for ( Int_t i = 0; i < 16; ++i ) 
+    {
+      if ( (mask >> i ) & 0x1 )
+      {          
+        in.getline(line,80);
+        char localBoardName[20];
+        int j,localBoardId,switches;
+        sscanf(line,"%02d %s %03d %03x",&j,localBoardName,&localBoardId,&switches);
+        AliDebug(1,Form("%02d %s %03d %03x",j,localBoardName,localBoardId,switches));
+        fLocalBoardIds.Set(fNofLocalBoards+1);
+        fLocalBoardIds[fNofLocalBoards] = localBoardId;
+        ++fNofLocalBoards;
+      }
+    }
+  }
+  
+  return nCrates;  
+}
diff --git a/MUON/AliMUONTriggerIO.h b/MUON/AliMUONTriggerIO.h
new file mode 100644 (file)
index 0000000..9a167bd
--- /dev/null
@@ -0,0 +1,66 @@
+#ifndef ALIMUONTRIGGERIO_H
+#define ALIMUONTRIGGERIO_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice                               */
+
+// $Id$
+
+/// \ingroup trigger
+/// \class AliMUONTriggerIO
+/// \brief Handles read/write of masks and LUT to/from online files
+/// 
+//  Author Laurent Aphecetche, Subatech
+
+#ifndef ROOT_TArrayI
+#  include "TArrayI.h"
+#endif
+
+#ifndef ROOT_TObject
+#  include "TObject.h"
+#endif
+
+//class AliMUONTriggerLut;
+class AliMUONVCalibParam;
+class AliMUONVStore;
+
+class AliMUONTriggerIO : public TObject
+{
+public:
+  AliMUONTriggerIO();
+  virtual ~AliMUONTriggerIO();
+
+  Bool_t ReadMasks(const char* localFile,
+                   const char* regionalFile,
+                   const char* globalFile,
+                   AliMUONVStore* localMasks,
+                   AliMUONVStore* regionalMasks,
+                   AliMUONVCalibParam* globalMasks);
+  
+//  void SetLocalBoardIds(const TArrayI& localBoardIds);
+  
+//  Bool_t WriteMasks(AliMUONVStore* localMasks,
+//                    AliMUONVStore* regionalMasks,
+//                    AliMUONVCalibParam* globalMasks) const;
+  
+private:
+  
+  Int_t LocalBoardId(Int_t index) const;
+  
+  /// Return number of local boards
+  Int_t NofLocalBoards() const { return fNofLocalBoards; }
+  
+  Int_t ReadRegional(const char* regionalFile, AliMUONVStore* regionalMasks);
+
+  Int_t ReadLocalMasks(const char* localFile, AliMUONVStore& localMasks) const;
+  
+//  void WriteRegional() const;
+  
+private:
+  TArrayI fLocalBoardIds; //!< order of the localboards
+  Int_t fNofLocalBoards; //!< number of local boards
+  
+  ClassDef(AliMUONTriggerIO,0) // Read/Write trigger masks and LUT to/from online files
+};
+
+#endif
diff --git a/MUON/AliMUONTriggerPreprocessor.cxx b/MUON/AliMUONTriggerPreprocessor.cxx
new file mode 100644 (file)
index 0000000..adbcf01
--- /dev/null
@@ -0,0 +1,78 @@
+/**************************************************************************
+* 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.                  *
+**************************************************************************/
+
+// $Id$
+
+#include "AliMUONTriggerPreprocessor.h"
+
+#include "AliLog.h"
+#include "AliMUONTriggerSubprocessor.h"
+#include "AliShuttleInterface.h"
+#include "Riostream.h"
+
+//-----------------------------------------------------------------------------
+/// \class AliMUONTriggerPreprocessor
+///
+/// Shuttle preprocessor for MUON trigger. The real worker
+/// class is AliMUONTriggerSubprocessor
+/// 
+/// \author Laurent Aphecetche
+//-----------------------------------------------------------------------------
+
+/// \cond CLASSIMP
+ClassImp(AliMUONTriggerPreprocessor)
+/// \endcond
+
+//_____________________________________________________________________________
+AliMUONTriggerPreprocessor::AliMUONTriggerPreprocessor(AliShuttleInterface* shuttle)
+: AliMUONPreprocessor("MTR",shuttle),
+fTriggerSubprocessor(new AliMUONTriggerSubprocessor(this))
+{
+  /// ctor. 
+}
+
+//_____________________________________________________________________________
+AliMUONTriggerPreprocessor::~AliMUONTriggerPreprocessor()
+{
+  /// dtor
+  delete fTriggerSubprocessor;
+}
+
+//_____________________________________________________________________________
+void
+AliMUONTriggerPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
+{
+  /// Re-register the subprocessor(s) depending on the actual runType
+
+  ClearSubprocessors();
+  
+  fIsValid = kTRUE;
+  
+  TString runType = GetRunType();
+  
+  if ( runType == "PHYSICS" ||
+       runType == "ELECTRONICS_CALIBRATION_RUN" ||
+       runType == "DETECTOR_CALIBRATION_RUN" ) 
+  {
+    Add(fTriggerSubprocessor);
+  }
+  else
+  {
+    Log(Form("ERROR-Unknown RunType=%",runType.Data()));
+    fIsValid = kFALSE;
+  }
+  
+  AliMUONPreprocessor::Initialize(run,startTime,endTime);  
+}
diff --git a/MUON/AliMUONTriggerPreprocessor.h b/MUON/AliMUONTriggerPreprocessor.h
new file mode 100644 (file)
index 0000000..3ac6b12
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef ALIMUONTRIGGERPREPROCESSOR_H
+#define ALIMUONTRIGGERPREPROCESSOR_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice                               */
+
+// $Id$
+
+/// \ingroup shuttle
+/// \class AliMUONTriggerPreprocessor
+/// \brief Shuttle preprocessor for MUON trigger
+/// 
+//  Author Laurent Aphecetche, Subatech
+
+#include "AliMUONPreprocessor.h"
+
+class AliMUONTriggerSubprocessor;
+
+class AliMUONTriggerPreprocessor : public AliMUONPreprocessor
+{
+public:
+  AliMUONTriggerPreprocessor(AliShuttleInterface* shuttle);
+  virtual ~AliMUONTriggerPreprocessor();
+  
+  virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+
+private:
+  /// Not implemented
+  AliMUONTriggerPreprocessor(const AliMUONTriggerPreprocessor& rhs);
+  /// Not implemented
+  AliMUONTriggerPreprocessor& operator=(const AliMUONTriggerPreprocessor& rhs);
+  
+
+private:
+  AliMUONTriggerSubprocessor* fTriggerSubprocessor; //!< the real worker class
+  
+  ClassDef(AliMUONTriggerPreprocessor,1) // MUON Trigger Shuttle preprocessor
+};
+
+#endif
diff --git a/MUON/AliMUONTriggerSubprocessor.cxx b/MUON/AliMUONTriggerSubprocessor.cxx
new file mode 100644 (file)
index 0000000..3c9ab14
--- /dev/null
@@ -0,0 +1,170 @@
+/**************************************************************************
+* 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.                  *
+**************************************************************************/
+
+// $Id$
+
+#include "AliMUONTriggerSubprocessor.h"
+
+#include "AliCDBMetaData.h"
+#include "AliLog.h"
+#include "AliMUON1DArray.h"
+#include "AliMUONCalibParamNI.h"
+#include "AliMUONPreprocessor.h"
+#include "AliMUONTriggerIO.h"
+#include "AliMUONTriggerLut.h"
+#include "AliMpConstants.h"
+#include <Riostream.h>
+#include <TList.h>
+#include <TObjString.h>
+#include <TSystem.h>
+
+/// \class AliMUONTriggerSubprocessor
+///
+/// Implementation of AliMUONVSubprocessor for MUON trigger system
+///
+/// Reads masks and LUT online files to feed the OCDB
+///
+/// \author L. Aphecetche
+
+/// \cond CLASSIMP
+ClassImp(AliMUONTriggerSubprocessor)
+/// \endcond
+
+//_____________________________________________________________________________
+AliMUONTriggerSubprocessor::AliMUONTriggerSubprocessor(AliMUONPreprocessor* master)
+: AliMUONVSubprocessor(master,
+                       "Triggers",
+                       "Upload MUON Trigger masks and LUT to OCDB"),
+fRegionalMasks(0x0),
+fLocalMasks(0x0),
+fGlobalMasks(0x0),
+fLUT(0x0)
+{
+  /// default ctor
+}
+
+//_____________________________________________________________________________
+AliMUONTriggerSubprocessor::~AliMUONTriggerSubprocessor()
+{
+  /// dtor
+  delete fRegionalMasks;
+  delete fLocalMasks;
+  delete fGlobalMasks;
+  delete fLUT;
+}
+
+//_____________________________________________________________________________
+TString
+AliMUONTriggerSubprocessor::GetFileName(const char* fid) const
+{
+  /// Get filename for a given id
+  
+  const Int_t kSystem = AliMUONPreprocessor::kDAQ;
+  
+  TList* sources = Master()->GetFileSources(kSystem,fid);
+  if ( sources && sources->GetSize() == 1 ) 
+  {
+    return Master()->GetFile(kSystem,fid,static_cast<TObjString*>(sources->First())->GetName());
+  }
+  return "";
+}
+
+//_____________________________________________________________________________
+void 
+AliMUONTriggerSubprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
+{
+  /// When starting a new run, reads in the trigger online files.
+  
+  Master()->Log(Form("Reading trigger masks for Run %d startTime %ld endTime %ld",
+                     run,startTime,endTime));
+    
+  delete fRegionalMasks;
+  delete fLocalMasks;
+  delete fGlobalMasks;
+  
+  fRegionalMasks = new AliMUON1DArray(16);
+  fLocalMasks = new AliMUON1DArray(AliMpConstants::NofLocalBoards()+1);
+  fGlobalMasks = 0x0; // new AliMUONCalibParamNI(1,16,1,0,0);
+
+  AliMUONTriggerIO tio;
+  
+  tio.ReadMasks(GetFileName("LOCAL").Data(),
+                GetFileName("REGIONAL").Data(),
+                GetFileName("GLOBAL").Data(),
+                fLocalMasks,fRegionalMasks,fGlobalMasks);
+
+  delete fLUT;
+  fLUT = 0x0; // new AliMUONTriggerLut;
+    
+//  Master()->Log(Form("Reading trigger LUT for Run %d startTime %ld endTime %ld",
+//                     run,startTime,endTime));
+//  tio.ReadLut(lutFile,fLUT);
+}
+
+//_____________________________________________________________________________
+UInt_t 
+AliMUONTriggerSubprocessor::Process(TMap* /*dcsAliasMap*/)
+{
+  /// Store the trigger masks into the CDB
+  
+  if ( !fGlobalMasks && !fRegionalMasks && !fLocalMasks && !fLUT )
+  {
+    // nothing to do
+    return 0;
+  }
+  
+  Master()->Log(Form("N global = %d N regional = %d N local %d",                     
+                     (fGlobalMasks ? 1 : 0 ),
+                     (fRegionalMasks ? fRegionalMasks->GetSize() : 0 ),
+                     (fLocalMasks ? fLocalMasks->GetSize() : 0 )));
+  
+  AliCDBMetaData metaData;
+       metaData.SetBeamPeriod(0);
+       metaData.SetResponsible("MUON TRG");
+       metaData.SetComment("Computed by AliMUONTriggerSubprocessor $Id$");
+  
+  Bool_t validToInfinity = kTRUE;
+
+       Bool_t result1(kTRUE);
+  Bool_t result2(kTRUE);
+  Bool_t result3(kTRUE);
+  Bool_t result4(kTRUE);
+  
+  if ( fGlobalMasks ) 
+  {
+    result1 = Master()->Store("Calib", "GlobalTriggerBoardMasks", fGlobalMasks, 
+                              &metaData, 0, validToInfinity);
+  }
+  
+  if ( fRegionalMasks && fRegionalMasks->GetSize() > 0 )
+  {
+    result2 = Master()->Store("Calib", "RegionalTriggerBoardMasks", fRegionalMasks, 
+                              &metaData, 0, validToInfinity);
+  }
+  
+  if ( fLocalMasks && fLocalMasks->GetSize() > 0 ) 
+  {
+    result3 = Master()->Store("Calib", "LocalTriggerBoardMasks", fLocalMasks, 
+                              &metaData, 0, validToInfinity);
+  }
+
+  if ( fLUT )
+  {
+    result4 = Master()->Store("Calib", "TriggerLut", fLUT, 
+                              &metaData, 0, validToInfinity);
+  }
+  
+  return ( result1 != kTRUE && result2 != kTRUE && result3 != kTRUE && result4 != kTRUE ); // return 0 if everything is ok.  
+}
diff --git a/MUON/AliMUONTriggerSubprocessor.h b/MUON/AliMUONTriggerSubprocessor.h
new file mode 100644 (file)
index 0000000..6b24b0e
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef ALIMUONTRIGGERSUBPROCESSOR_H
+#define ALIMUONTRIGGERSUBPROCESSOR_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice                               */
+
+// $Id$
+
+/// \ingroup shuttle
+/// \class AliMUONTriggerSubprocessor
+/// \brief Implementation of AliMUONVSubprocessor for MUON TRK masks
+/// 
+//  Author Laurent Aphecetche, Subatech
+
+#ifndef ALIMUONVSUBPROCESSOR_H
+#  include "AliMUONVSubprocessor.h"
+#endif
+
+class AliMUONTriggerLut;
+class AliMUONVStore;
+class AliMUONVCalibParam;
+class TString;
+
+class AliMUONTriggerSubprocessor : public AliMUONVSubprocessor
+{
+public:
+  AliMUONTriggerSubprocessor(AliMUONPreprocessor* master);
+  virtual ~AliMUONTriggerSubprocessor();
+  
+  void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+  UInt_t Process(TMap* dcsAliasMap);
+  
+private:
+
+  TString GetFileName(const char* fid) const;
+  
+  /// Not implemented
+  AliMUONTriggerSubprocessor(const AliMUONTriggerSubprocessor&);
+  /// Not implemented
+  AliMUONTriggerSubprocessor& operator=(const AliMUONTriggerSubprocessor&);
+  
+private:
+  AliMUONVStore* fRegionalMasks; //!< regional masks
+  AliMUONVStore* fLocalMasks; //!< local masks
+  AliMUONVCalibParam* fGlobalMasks; //!< global masks
+  AliMUONTriggerLut* fLUT; //!< look-up table(s)
+  
+  ClassDef(AliMUONTriggerSubprocessor,1) // A shuttle preprocessor for MUON TRK masks
+};
+
+#endif
index 3f47d30d16cd0821556a4abd6280c930dbfbd937..cffa6ee8f715f5ff830a8897b2ad664449268675 100644 (file)
@@ -26,6 +26,7 @@
 #pragma link C++ class AliMUON2DStoreValidator+;
 #pragma link C++ class AliMUONVStore+;
 #pragma link C++ class AliMUONTreeManager+;
+#pragma link C++ class AliMUONTriggerIO+;
 
 #endif
 
index af307d38c643aae39a91c7041795d72b78b94368..905079cedeb03d7a20260d0482bc5aec2a29999d 100644 (file)
@@ -12,5 +12,7 @@
 #pragma link C++ class AliMUONPedestalSubprocessor+;
 #pragma link C++ class AliMUONGainSubprocessor+;
 #pragma link C++ class AliMUONGMSSubprocessor+;
+#pragma link C++ class AliMUONTriggerSubprocessor+;
+#pragma link C++ class AliMUONTriggerPreprocessor+;
 
 #endif
index 55c3302316315ec501adb21e064f3e29fc2322a1..d1f22e7c3b1e154613200813b4237dad90a31714 100644 (file)
@@ -42,6 +42,7 @@
 #include "TestMUONPreprocessor.h"
 
 #include "AliMUONTrackerPreprocessor.h"
+#include "AliMUONTriggerPreprocessor.h"
 
 #include "AliLog.h"
 
@@ -122,6 +123,12 @@ void TestMUONPreprocessor(Int_t runNumber=80, const char* runType="PEDESTAL_RUN"
   // and GMS file
   shuttle->AddInputFile(AliTestShuttle::kDCS,"MCH","GMS","GMS","$ALICE_ROOT/MUON/data/GMS.root");
 
+  // and then the trigger stuff
+  shuttle->AddInputFile(AliTestShuttle::kDAQ,"MTR","LOCAL","LDC0","$ALICE_ROOT/MUON/data/MtgLocalMask-1.dat");
+  shuttle->AddInputFile(AliTestShuttle::kDAQ,"MTR","REGIONAL","LDC0","$ALICE_ROOT/MUON/data/MtgRegionalCrate-1.dat");
+  shuttle->AddInputFile(AliTestShuttle::kDAQ,"MTR","GLOBAL","LDC0","$ALICE_ROOT/MUON/data/MtgGlobalCrate-1.dat");
+  shuttle->AddInputFile(AliTestShuttle::kDAQ,"MTR","LUT","LDC0","$ALICE_ROOT/MUON/data/MtgLocalLut-1.dat");
+  
   // The shuttle can read run parameters stored in the DAQ run logbook.
   // To test it, we must provide the run parameters manually. They will be retrieved in the preprocessor
   // using GetRunParameter function.
@@ -130,7 +137,8 @@ void TestMUONPreprocessor(Int_t runNumber=80, const char* runType="PEDESTAL_RUN"
   
   // Create the preprocessor that should be tested, it registers itself automatically to the shuttle
   new AliMUONTrackerPreprocessor(shuttle);
-
+  new AliMUONTriggerPreprocessor(shuttle);
+  
   shuttle->Print();
   
   // Test the preprocessor
index 4ac053ec8d7e30d18b846b05e39657774911fd91..5f735eecbee8098488f3916ffb08cf8f5b37ba68 100644 (file)
@@ -17,7 +17,8 @@ SRCS:=  AliMUONObjectPair.cxx \
         AliMUONCheckItem.cxx \
         AliMUONCheckItemIterator.cxx \
         AliMUONVStore.cxx \
-        AliMUONTreeManager.cxx
+        AliMUONTreeManager.cxx \
+        AliMUONTriggerIO.cxx
 
 HDRS:= $(SRCS:.cxx=.h)
 
index d4d44c35041ecd276e38aa2a7155e69a41556a15..67cc8693b515eff65230583ab3a565d07507555a 100644 (file)
@@ -7,7 +7,9 @@ AliMUONPedestalSubprocessor.cxx \
 AliMUONGMSSubprocessor.cxx \
 AliMUONHVSubprocessor.cxx \
 AliMUONGainSubprocessor.cxx \
-AliMUONTrackerPreprocessor.cxx
+AliMUONTrackerPreprocessor.cxx \
+AliMUONTriggerSubprocessor.cxx \
+AliMUONTriggerPreprocessor.cxx
 
 HDRS:= $(SRCS:.cxx=.h)