]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Adding first version of trigger LUT handling to Shuttle
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 23 Oct 2007 08:29:14 +0000 (08:29 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 23 Oct 2007 08:29:14 +0000 (08:29 +0000)
MUON/AliMUONPreprocessor.cxx
MUON/AliMUONTriggerIO.cxx
MUON/AliMUONTriggerIO.h
MUON/AliMUONTriggerLut.cxx
MUON/AliMUONTriggerLut.h
MUON/AliMUONTriggerSubprocessor.cxx

index a3a8bc85b8660a03d91550adb64c72cda9327eb1..3fe840195f1384d9bd5eb6cf03f75c8fca85bddb 100644 (file)
@@ -47,9 +47,9 @@ ClassImp(AliMUONPreprocessor)
 //_____________________________________________________________________________
 AliMUONPreprocessor::AliMUONPreprocessor(const char* detName, AliShuttleInterface* shuttle)
 : AliPreprocessor(detName, shuttle),
+  fIsValid(kFALSE),
   fSubprocessors(new TObjArray()),
-  fProcessDCS(kFALSE),
-  fIsValid(kFALSE)
+  fProcessDCS(kFALSE)
 {
   /// ctor
 }
index 81af613ff7e849c0a441c7fe90314ae9dfafed71..94f369d2916b432a6131770e5d728400bfc1aef3 100644 (file)
 #include "AliMUONTriggerIO.h"
 
 #include "AliLog.h"
+#include "AliMpCDB.h"
 #include "AliMpDDLStore.h"
 #include "AliMpTriggerCrate.h"
+#include "AliMUONTriggerLut.h"
 #include "AliMUONCalibParamNI.h"
 #include "AliMUONVStore.h"
 #include <Riostream.h>
@@ -31,6 +33,7 @@
 /// to be used by Shuttle and Trigger DA.
 /// 
 /// \author Laurent Aphecetche, Subatech
+/// \author Bogdan Vulpescu, LPC Clermont-Ferrand
 
 /// \cond CLASSIMP
 ClassImp(AliMUONTriggerIO)
@@ -43,12 +46,90 @@ AliMUONTriggerIO::AliMUONTriggerIO() :
   /// ctor
 }
 
+//_____________________________________________________________________________
+AliMUONTriggerIO::AliMUONTriggerIO(const char* regionalFileToRead) :
+TObject(), fLocalBoardIds(), fNofLocalBoards(0)
+{
+  /// ctor
+  ReadRegional(regionalFileToRead,0);
+}
+
 //_____________________________________________________________________________
 AliMUONTriggerIO::~AliMUONTriggerIO()
 {
   /// dtor
 }
 
+//_____________________________________________________________________________
+void 
+AliMUONTriggerIO::DeCompAddress(UChar_t &ypos, UChar_t &ytri, UChar_t &xdev, UChar_t &xpos, 
+                                UShort_t address) const
+{  
+  /// decompose the 15-bits address
+  
+  UChar_t bitsYpos = 4;
+  UChar_t bitsYtri = 1;
+  UChar_t bitsXdev = 5;
+  //  UChar_t bitsXpos = 5;
+  
+  UShort_t maskYpos = 0x000F; // ...0 00001111
+  UShort_t maskYtri = 0x0001; // ...0 00000001
+  UShort_t maskXdev = 0x001F; // ...0 00011111
+  UShort_t maskXpos = 0x001F; // ...0 00011111
+  
+  ypos =  address                                  & maskYpos;
+  ytri = (address >>  bitsYpos)                    & maskYtri;
+  xdev = (address >> (bitsYpos+bitsYtri))          & maskXdev;
+  xpos = (address >> (bitsYpos+bitsYtri+bitsXdev)) & maskXpos;
+}
+
+//_____________________________________________________________________________
+void 
+AliMUONTriggerIO::FillLut(AliMUONTriggerLut& lut,
+                          Int_t icirc, UChar_t istripX, UChar_t idev,  
+                          Int_t lutLpt[16][2], Int_t lutHpt[16][2]) 
+{
+  /// Fill the LUT histograms
+  
+  if (icirc == 0 && istripX == 0 && idev == 0) 
+  {
+    AliDebug(1,"Copy board, not filled ...");
+    return;
+  }
+  
+  Short_t iLptPlus, iLptMinu, iLptUnde;
+  Short_t iHptPlus, iHptMinu, iHptUnde;
+
+  iLptPlus = iLptMinu = iLptUnde = 0;
+  iHptPlus = iHptMinu = iHptUnde = 0;
+  
+  for (Int_t istripY=0; istripY<16; istripY++) 
+  {
+    if (lutLpt[istripY][1] == 0 && lutLpt[istripY][0] ==1)
+      iLptMinu=iLptMinu+(1 << istripY);
+    if (lutLpt[istripY][1] == 1 && lutLpt[istripY][0] ==0)
+      iLptPlus=iLptPlus+(1 << istripY);
+    if (lutLpt[istripY][1] == 1 && lutLpt[istripY][0] ==1)
+      iLptUnde=iLptUnde+(1 << istripY);
+    
+    if (lutHpt[istripY][1] == 0 && lutHpt[istripY][0] ==1)
+      iHptMinu=iHptMinu+(1 << istripY);
+    if (lutHpt[istripY][1] == 1 && lutHpt[istripY][0] ==0)
+      iHptPlus=iHptPlus+(1 << istripY);
+    if (lutHpt[istripY][1] == 1 && lutHpt[istripY][0] ==1)
+      iHptUnde=iHptUnde+(1 << istripY);
+    
+  } // loop on istripY
+  
+  lut.SetContent("LptMinu",icirc,istripX,idev,iLptMinu);
+  lut.SetContent("LptUnde",icirc,istripX,idev,iLptUnde);
+  lut.SetContent("LptPlus",icirc,istripX,idev,iLptPlus);
+
+  lut.SetContent("HptMinu",icirc,istripX,idev,iLptMinu);
+  lut.SetContent("HptUnde",icirc,istripX,idev,iLptUnde);
+  lut.SetContent("HptPlus",icirc,istripX,idev,iLptPlus);
+}
+
 //_____________________________________________________________________________
 Int_t 
 AliMUONTriggerIO::LocalBoardId(Int_t index) const
@@ -127,14 +208,139 @@ AliMUONTriggerIO::ReadLocalMasks(const char* localFile, AliMUONVStore& localMask
   return nLocalBoards;
 }
 
+//_____________________________________________________________________________
+void
+AliMUONTriggerIO::ReadLocalLUT(AliMUONTriggerLut& lut,
+                               Int_t localBoardId,
+                               FILE* flut)
+{
+  /// Read the LUT for one local board from an online file
+
+  UShort_t address;
+  
+  UChar_t buffer;
+  UChar_t mask1 = 0xF0;
+  UChar_t mask2 = 0x0F;
+  UChar_t maskLpt = 0x0C;
+  UChar_t maskHpt = 0x03;
+  UChar_t lh, lpt, hpt;
+  
+  UChar_t xpos, xdev, ypos, ytri;
+  
+  Int_t lutLpt[16][2], lutHpt[16][2];
+
+  Int_t boardnr = localBoardId;
+  
+  AliDebug(1,Form("Reading LUT values for local board %d",boardnr));
+  
+  Int_t ny = 0;
+  
+  // create the 32767 addresses for the 4-bits lpt and hpt half-bytes
+  for (UShort_t ilut = 0; ilut < 0x7FFF; ilut += 2) 
+  {
+    // read two lut addresses at once
+    fread(&buffer,1,1,flut);
+    
+    // 1st 4-bits half-byte
+    address = ilut;   
+    lh = (buffer & mask1) >> 4;
+    
+    // Lpt and Hpt response
+    lpt = (lh & maskLpt) >> 2;
+    hpt =  lh & maskHpt;
+    
+    // decompose the 15-bits address
+    DeCompAddress(ypos,ytri,xdev,xpos,address);
+    
+    // calculate group of y-strips
+    if (ny < 16) 
+    {
+      lutLpt[ny][0] =  lpt & 1;
+      lutLpt[ny][1] = (lpt & 2) >> 1;
+      lutHpt[ny][0] =  hpt & 1;
+      lutHpt[ny][1] = (hpt & 2) >> 1;
+      ny++;
+      if (ny == 16) 
+      {
+        ny = 0;
+        // ytri == 1 means no trigger in y-direction
+        if (ytri == 0) 
+        {
+          FillLut(lut,boardnr,xpos,xdev,lutLpt,lutHpt);
+        }
+      }
+    }
+    
+    // 2nd 4-bits half-byte
+    address = ilut+1; 
+    lh = (buffer & mask2);
+    
+    // Lpt and Hpt response
+    lpt = (lh & maskLpt) >> 2;
+    hpt =  lh & maskHpt;
+    
+    // decompose the 15-bits address
+    DeCompAddress(ypos,ytri,xdev,xpos,address);
+    
+    // calculate group of y-strips
+    if (ny < 16) 
+    {
+      lutLpt[ny][0] =  lpt & 1;
+      lutLpt[ny][1] = (lpt & 2) >> 1;
+      lutHpt[ny][0] =  hpt & 1;
+      lutHpt[ny][1] = (hpt & 2) >> 1;
+      ny++;
+      if (ny == 16) 
+      {
+        ny = 0;
+        // ytri == 1 means no trigger in y-direction
+        if (ytri == 0) 
+        {
+          FillLut(lut,boardnr,xpos,xdev,lutLpt,lutHpt);
+        }
+      }
+    }
+  }
+}
+
+//_____________________________________________________________________________
+Bool_t 
+AliMUONTriggerIO::ReadLUT(const char* lutFileToRead, AliMUONTriggerLut& lut)
+{
+  /// Fill the LUT object from online file
+  
+  if ( !NofLocalBoards() )
+  {
+    AliError("No local board id defined. Must read a regional file first");
+    return kFALSE;
+  }
+  
+  FILE* flut = fopen(gSystem->ExpandPathName(lutFileToRead),"rb");
+  if (!flut) 
+  {
+    AliError(Form("Could not create output LUT file %s",lutFileToRead));
+    return kFALSE;
+  }   
+  
+  for ( Int_t i = 0; i < NofLocalBoards(); ++i ) 
+  {
+    ReadLocalLUT(lut,LocalBoardId(i),flut);
+  }
+  
+  fclose(flut);
+  
+  return kTRUE;
+  
+}
+
 //_____________________________________________________________________________
 Bool_t 
 AliMUONTriggerIO::ReadMasks(const char* localFile,
                             const char* regionalFile,
-                            const char* globalFile,
+                            const char* /* globalFile */,
                             AliMUONVStore* localMasks,
                             AliMUONVStore* regionalMasks,
-                            AliMUONVCalibParam* globalMasks)
+                            AliMUONVCalibParam* /* globalMasks */)
 {
   /// Fill the various masks store from files
   
@@ -180,6 +386,11 @@ AliMUONTriggerIO::ReadRegional(const char* regionalFile, AliMUONVStore* regional
   
   Int_t nCrates(0);
   
+  if (!AliMpDDLStore::Instance(kFALSE))
+  {
+    AliMpCDB::LoadDDLStore();
+  }
+  
   while (!in.eof())
   {
     in.getline(name,80);
@@ -246,3 +457,86 @@ AliMUONTriggerIO::ReadRegional(const char* regionalFile, AliMUONVStore* regional
   
   return nCrates;  
 }
+
+//_____________________________________________________________________________
+Bool_t 
+AliMUONTriggerIO::WriteLUT(const AliMUONTriggerLut& lut,
+                           const char* lutFileToWrite)
+{
+  /// Convert an offline lut into an online (binary) lut file
+  
+  if ( !NofLocalBoards() )
+  {
+    AliError("No local board id defined. Must read a regional file first");
+    return kFALSE;
+  }
+  
+  FILE* flut = fopen(gSystem->ExpandPathName(lutFileToWrite),"wb");
+  if (!flut) 
+  {
+    AliError(Form("Could not create output LUT file %s",lutFileToWrite));
+    return kFALSE;
+  }   
+  
+  for ( Int_t i = 0; i < NofLocalBoards(); ++i ) 
+  {
+    WriteLocalLUT(lut,LocalBoardId(i),flut);
+  }
+  
+  fclose(flut);
+  
+  return kTRUE;
+}
+
+//_____________________________________________________________________________
+void
+AliMUONTriggerIO::WriteLocalLUT(const AliMUONTriggerLut& lut,
+                                Int_t localBoardId,
+                                FILE* flut)
+{
+  /// loop over the address for the 4-bits lpt and hpt decisions
+
+  const Int_t kMaskYpos = 0x0F;
+  const Int_t kMaskYtri = 0x01;
+  const Int_t kMaskXdev = 0x1F;
+  const Int_t kMaskXpos = 0x1F;
+  
+  for (Int_t i = 0; i < 32768; ++i) 
+  {
+    Int_t lutLpt[2] = { 0 };
+    Int_t lutHpt[2] = { 0 };
+    
+    // decompose address
+    Int_t iYpos =   i                    & kMaskYpos;  
+    Int_t iYtri = ( i >>   4           ) & kMaskYtri;
+    Int_t iXdev = ( i >> ( 4 + 1 )     ) & kMaskXdev;
+    Int_t iXpos = ( i >> ( 4 + 1 + 5 ) ) & kMaskXpos;
+    
+    // iYtri == 1 means no trigger in y-direction
+    if (iYtri == 0) 
+    {
+      lut.GetLutOutput(localBoardId,iXpos,iXdev,iYpos,lutLpt,lutHpt);
+    }
+    
+    UChar_t buffer;
+    
+    // fill byte
+    if (i%2 == 0) 
+    {
+      // upper half-byte
+      buffer = 0;          
+      buffer += lutLpt[1] << 7;
+      buffer += lutLpt[0] << 6;
+      buffer += lutHpt[1] << 5;
+      buffer += lutHpt[0] << 4;
+    } else {
+      // lower half-byte
+      buffer += lutLpt[1] << 3;
+      buffer += lutLpt[0] << 2;
+      buffer += lutHpt[1] << 1;
+      buffer += lutHpt[0] << 0;
+      fwrite(&buffer,1,1,flut);
+    }
+  }
+}  
+  
index 9a167bd7b47b6990fec4b6a826058044983c22c0..d8f782706db0b55810bab1ab84264b4ddf26bd88 100644 (file)
 //  Author Laurent Aphecetche, Subatech
 
 #ifndef ROOT_TArrayI
-#  include "TArrayI.h"
+#  include <TArrayI.h>
 #endif
 
 #ifndef ROOT_TObject
-#  include "TObject.h"
+#  include <TObject.h>
 #endif
 
-//class AliMUONTriggerLut;
+#include <Riostream.h>
+
+class AliMUONTriggerLut;
 class AliMUONVCalibParam;
 class AliMUONVStore;
 
@@ -28,6 +30,7 @@ class AliMUONTriggerIO : public TObject
 {
 public:
   AliMUONTriggerIO();
+  AliMUONTriggerIO(const char* regionalFileToRead);
   virtual ~AliMUONTriggerIO();
 
   Bool_t ReadMasks(const char* localFile,
@@ -37,6 +40,11 @@ public:
                    AliMUONVStore* regionalMasks,
                    AliMUONVCalibParam* globalMasks);
   
+  Bool_t ReadLUT(const char* lutFileToRead, AliMUONTriggerLut& lut);
+  
+  Bool_t WriteLUT(const AliMUONTriggerLut& lut,
+                  const char* lutFileToWrite);
+  
 //  void SetLocalBoardIds(const TArrayI& localBoardIds);
   
 //  Bool_t WriteMasks(AliMUONVStore* localMasks,
@@ -45,6 +53,13 @@ public:
   
 private:
   
+  void DeCompAddress(UChar_t &ypos, UChar_t &ytri, UChar_t &xdev, UChar_t &xpos, 
+                     UShort_t address) const;
+    
+  void FillLut(AliMUONTriggerLut& lut,
+               Int_t icirc, UChar_t istripX, UChar_t idev,  
+               Int_t lutLpt[16][2], Int_t lutHpt[16][2]) ;
+  
   Int_t LocalBoardId(Int_t index) const;
   
   /// Return number of local boards
@@ -54,6 +69,11 @@ private:
 
   Int_t ReadLocalMasks(const char* localFile, AliMUONVStore& localMasks) const;
   
+  void ReadLocalLUT(AliMUONTriggerLut& lut, Int_t localBoardId, FILE* flut);
+  
+  void WriteLocalLUT(const AliMUONTriggerLut& lut, Int_t localBoardId, 
+                       FILE* flut);
+    
 //  void WriteRegional() const;
   
 private:
index e7f2ac181cd7797ddad8c5a14b97494befd956e9..bb32ac82f29dfef7d723831062165e4591e97796 100644 (file)
 /// Local Trigger Look Up Table
 /// reading interface LUT data is stored into TH3S histograms and readout 
 /// from the Local Trigger algorithm
+///
+/// Histograms structure is :
+/// X 234 bins, 1 to 235   = local board number
+/// Y  31 bins, 0 to  31   = x strip
+/// Z  31 bins, 0 to  31   = x deviation
+/// content = Short_t      = y strip mask
+///
+///  overflow bin is used !
+///
 /// \author Philippe Crochet
 //-----------------------------------------------------------------------------
 
 
 #include "AliLog.h"
 
-#include "TFile.h"
-#include "TH3.h"
+#include <TFile.h>
+#include <TH3.h>
+#include <TMap.h>
+#include <TObjString.h>
 
 /// \cond CLASSIMP
 ClassImp(AliMUONTriggerLut)
@@ -46,7 +57,8 @@ AliMUONTriggerLut::AliMUONTriggerLut()
       fHptUnde(0),
       fAptPlus(0),
       fAptMinu(0),
-      fAptUnde(0)
+      fAptUnde(0),
+  fMap(0x0)
 {
 /// ctor
 }
@@ -65,6 +77,68 @@ AliMUONTriggerLut::~AliMUONTriggerLut()
   delete fAptPlus;  
   delete fAptMinu;
   delete fAptUnde;
+  delete fMap;
+}
+
+//----------------------------------------------------------------------
+Int_t
+AliMUONTriggerLut::Compare(TH3* h1, TH3* h2) const
+{
+/// Return 0 if both histograms are strictly equal (at the bin-by-bin level)
+
+  AliDebug(1,Form("h1 %s h2 %s",h1 ? h1->GetName() : "null", h2 ? h2->GetName() : "null"));
+
+  if (!h1 || !h2) 
+  {
+    return 0;
+  }
+  
+  for ( Int_t i = 0; i < h1->GetBufferSize(); ++i ) 
+  {
+    Double_t x1 = h1->GetBinContent(i);
+    Double_t x2 = h2->GetBinContent(i);
+    if ( x1 != x2 ) return 0;
+  }
+
+  AliDebug(1,"same");
+  
+  return 1;
+}
+
+//----------------------------------------------------------------------
+Int_t 
+AliMUONTriggerLut::Compare(const TObject* object) const
+{
+/// Return 0 if the two luts are strictly equal
+
+  const AliMUONTriggerLut* lut = static_cast<const AliMUONTriggerLut*>(object);
+  
+  Int_t rvLpt(0);
+  
+  rvLpt += Compare(fLptPlus,lut->fLptPlus);
+  rvLpt += Compare(fLptMinu,lut->fLptMinu);
+  rvLpt += Compare(fLptUnde,lut->fLptUnde);
+
+  Int_t rvHpt(0);
+  
+  rvHpt += Compare(fHptPlus,lut->fHptPlus);
+  rvHpt += Compare(fHptMinu,lut->fHptMinu);
+  rvHpt += Compare(fHptUnde,lut->fHptUnde);
+  
+  Int_t rv(0);
+  
+  rv += Compare(fAptPlus,lut->fAptPlus);
+  rv += Compare(fAptMinu,lut->fAptMinu);
+  rv += Compare(fAptUnde,lut->fAptUnde);
+  
+  AliDebug(1,Form("Same Lpt %d Hpt %d Apt %d",rvLpt,rvHpt,rv));
+  
+  if ( rvLpt == 3 && rvHpt == 3 ) 
+  {
+    return 0;
+  }
+
+  return 1;
 }
 
 //----------------------------------------------------------------------
@@ -81,16 +155,6 @@ void AliMUONTriggerLut::ReadFromFile(const char* filename)
   
   AliDebug(1,Form("filename=%s",filename));
   
-//  fLptPlus = (TH3*)(f.Get("LptPlus")->Clone());  
-//  fLptMinu = (TH3*)(f.Get("LptMinu")->Clone());
-//  fLptUnde = (TH3*)(f.Get("LptUnde")->Clone());
-//  fHptPlus = (TH3*)(f.Get("HptPlus")->Clone());  
-//  fHptMinu = (TH3*)(f.Get("HptMinu")->Clone());
-//  fHptUnde = (TH3*)(f.Get("HptUnde")->Clone());
-//  fAptPlus = (TH3*)(f.Get("AptPlus")->Clone());  
-//  fAptMinu = (TH3*)(f.Get("AptMinu")->Clone());
-//  fAptUnde = (TH3*)(f.Get("AptUnde")->Clone());
-
   fLptPlus = (TH3*)(f.Get("LptPlus"));  
   fLptMinu = (TH3*)(f.Get("LptMinu"));
   fLptUnde = (TH3*)(f.Get("LptUnde"));
@@ -111,18 +175,81 @@ void AliMUONTriggerLut::ReadFromFile(const char* filename)
   fAptPlus->SetDirectory(0);
   fAptMinu->SetDirectory(0);
   fAptUnde->SetDirectory(0);
+  
+  RegisterHistos();
+}
+
+//----------------------------------------------------------------------
+void
+AliMUONTriggerLut::RegisterHistos()
+{
+/// Add histos to our internal map
+
+  Add(fLptPlus);
+  Add(fLptMinu);
+  Add(fLptUnde);
+
+  Add(fHptPlus);
+  Add(fHptMinu);
+  Add(fHptUnde);
+
+  Add(fAptPlus);
+  Add(fAptMinu);
+  Add(fAptUnde);
+}
+
+//----------------------------------------------------------------------
+void
+AliMUONTriggerLut::Add(TH3* h)
+{
+  /// Update internal map
+  if (!fMap)
+  {
+    fMap = new TMap;
+    fMap->SetOwner(kTRUE);
+  }
+  
+  if (h) fMap->Add(new TObjString(h->GetName()),h);
+}
+
+//----------------------------------------------------------------------
+void 
+AliMUONTriggerLut::SetContent(const char* hname, Int_t icirc, UChar_t istripX, 
+                              UChar_t idev, Short_t value)
+{
+  /// Set the content of one bin of one histogram
+  
+  if (!fMap)
+  {
+    //..........................................circuit/stripX/deviation
+    fLptPlus = new TH3S("LptPlus","LptPlus",234,0,234,31,0,31,31,0,31);
+    fLptMinu = new TH3S("LptMinu","LptMinu",234,0,234,31,0,31,31,0,31);
+    fLptUnde = new TH3S("LptUnde","LptUnde",234,0,234,31,0,31,31,0,31);
+    
+    fHptPlus = new TH3S("HptPlus","HptPlus",234,0,234,31,0,31,31,0,31);
+    fHptMinu = new TH3S("HptMinu","HptMinu",234,0,234,31,0,31,31,0,31);
+    fHptUnde = new TH3S("HptUnde","HptUnde",234,0,234,31,0,31,31,0,31);
+    
+    RegisterHistos();
+  }
+  
+  TH3* h = static_cast<TH3*>(fMap->GetValue(hname));
+  
+  Int_t bin = h->GetBin(icirc,istripX,idev);
+  h->SetBinContent(bin,value);
 }
 
 //----------------------------------------------------------------------
 void AliMUONTriggerLut::GetLutOutput(Int_t circuit, Int_t xstrip, Int_t idev,
-                                    Int_t ystrip, Int_t lutLpt[2], 
-                                    Int_t lutHpt[2])
+                                     Int_t ystrip, Int_t lutLpt[2], 
+                                     Int_t lutHpt[2]) const
 {
 /// Return output of LuT for corresponding TH3S  
 
   if ( !fLptPlus )
   {
-    ReadFromFile("$(ALICE_ROOT)/MUON/data/MUONTriggerLut.root");
+    AliError("LUT not initialized");
+//    ReadFromFile("$(ALICE_ROOT)/MUON/data/MUONTriggerLut.root");
   }
   
   Int_t bin;
@@ -171,7 +298,7 @@ void AliMUONTriggerLut::GetLutOutput(Int_t circuit, Int_t xstrip, Int_t idev,
 }
 
 //----------------------------------------------------------------------
-Int_t AliMUONTriggerLut::GetMask(Int_t ystrip)
+Int_t AliMUONTriggerLut::GetMask(Int_t ystrip) const
 {
 /// Return the mask corresponding to ystrip
 
index c40300d3c8c5d0b0c2752d0c9e3dee8b187ca804..cfaeb9151490af35210083076de991acf7eaa1fe 100644 (file)
@@ -15,6 +15,7 @@
 #include <TNamed.h>
 
 class TH3;
+class TMap;
 
 //----------------------------------------------
 class AliMUONTriggerLut : public TNamed 
@@ -23,19 +24,31 @@ class AliMUONTriggerLut : public TNamed
   AliMUONTriggerLut();    // constructor
   virtual ~AliMUONTriggerLut();   // destructor
 
-  void ReadFromFile(const char* filename);
+  Int_t Compare(const TObject* object) const;
   
   void GetLutOutput(Int_t circuit, Int_t xstrip, Int_t idev, Int_t ystrip, 
-                   Int_t lutLpt[2], Int_t lutHpt[2]);
+                   Int_t lutLpt[2], Int_t lutHpt[2]) const;
+
+  void ReadFromFile(const char* filename);
+  
+  void SetContent(const char* hname, Int_t icirc, UChar_t istripX, 
+                  UChar_t idev, Short_t value); 
 
  private:
-  /// Not implemented copy constructor
+  
+    /// Not implemented copy constructor
   AliMUONTriggerLut (const AliMUONTriggerLut& AliMUONTriggerLut);
   /// Not implemented assignment operator
   AliMUONTriggerLut& operator=(const AliMUONTriggerLut& AliMUONTriggerLut); 
 
-  Int_t GetMask(Int_t ystrip);
+  void Add(TH3* h);
 
+  Int_t Compare(TH3* h1, TH3* h2) const;
+  
+  Int_t GetMask(Int_t ystrip) const;
+
+  void RegisterHistos();
+  
 private:
   TH3 *fLptPlus; ///< 3-d histogram with 234x32x31 bins Low pt Plus  
   TH3 *fLptMinu; ///< 3-d histogram with 234x32x31 bins Low pt Minus
@@ -47,7 +60,9 @@ private:
   TH3 *fAptMinu; ///< 3-d histogram with 234x32x31 bins All pt Minus  
   TH3 *fAptUnde; ///< 3-d histogram with 234x32x31 bins All pt Undefined    
 
-  ClassDef(AliMUONTriggerLut,1) // Trigger Look up Table class
+  TMap* fMap; //!< from name to histo
+  
+  ClassDef(AliMUONTriggerLut,2) // Trigger Look up Table class
 
 };
 #endif
index 3c9ab14abe2cc2f0d499349d670898063705cfcc..6bc32de67cd23fd079fd7f52a888f9550a95743d 100644 (file)
@@ -100,17 +100,36 @@ AliMUONTriggerSubprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTi
 
   AliMUONTriggerIO tio;
   
-  tio.ReadMasks(GetFileName("LOCAL").Data(),
-                GetFileName("REGIONAL").Data(),
-                GetFileName("GLOBAL").Data(),
-                fLocalMasks,fRegionalMasks,fGlobalMasks);
+  Bool_t ok = tio.ReadMasks(GetFileName("LOCAL").Data(),
+                            GetFileName("REGIONAL").Data(),
+                            GetFileName("GLOBAL").Data(),
+                            fLocalMasks,fRegionalMasks,fGlobalMasks);
+  
+  if (!ok)
+  {
+    Master()->Log("ERROR : ReadMasks failed");
+    delete fLocalMasks;
+    delete fRegionalMasks;
+    delete fGlobalMasks;
+    fLocalMasks = 0x0;
+    fRegionalMasks = 0x0;
+    fGlobalMasks = 0x0;
+  }
 
   delete fLUT;
-  fLUT = 0x0; // new AliMUONTriggerLut;
+  fLUT = new AliMUONTriggerLut;
     
-//  Master()->Log(Form("Reading trigger LUT for Run %d startTime %ld endTime %ld",
-//                     run,startTime,endTime));
-//  tio.ReadLut(lutFile,fLUT);
+  Master()->Log(Form("Reading trigger LUT for Run %d startTime %ld endTime %ld",
+                     run,startTime,endTime));
+  
+  tio.ReadLUT(GetFileName("LUT").Data(),*fLUT);
+
+  if (!ok)
+  {
+    Master()->Log("ERROR : ReadLUT failed");
+    delete fLUT;
+    fLUT = 0x0;
+  }
 }
 
 //_____________________________________________________________________________