In mapping:
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 Jul 2008 13:21:20 +0000 (13:21 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 Jul 2008 13:21:20 +0000 (13:21 +0000)
- Added new regional trigger reader (AliMpRegionalTriggerReader)
  and interfaced it for mapping and configuration
- Added number of local board in RegionalCrate.dat
- Fixed bug in reading local board information (using number of boards and not mask !)
- In AliMUONTriggerIO: added new method to retrieve local board id form ddl,
  crate and local indexes
(Christian)

MUONTRGda.cxx
- Put "pedestal" as default command
- Call WriteLastCurrentFile at the end of the versionning process
- Export files before reading rawdata
- Check the argument list, if rawdata stream present
- Put time out for monitor
- Update version of the file by the current counter and not version number
- Remove copy to FES when local masks are modified by the DA
- Write current configuration when local masks are modified by the DA
- Copy to DB the MtgCurrent.dat when local masks are modified by the DA
- Get right local board id from TriggerIO
- Right handling of the DA flag
(Christian)

In AliMUONRecoParam
- Fixed comments for Doxygen
(Ivana)

15 files changed:
MUON/AliMUONRecoParam.h
MUON/AliMUONRegionalTriggerConfig.cxx
MUON/AliMUONTrackerData.h
MUON/AliMUONTriggerIO.cxx
MUON/AliMUONTriggerIO.h
MUON/Calib/MappingData/Run0_999999999_v0_s0.root
MUON/MUONTRGda.cxx
MUON/MUONmappingLinkDef.h
MUON/READMEmtrda.txt
MUON/libMUONmapping.pkg
MUON/mapping/AliMpRegionalTrigger.cxx
MUON/mapping/AliMpRegionalTriggerReader.cxx [new file with mode: 0644]
MUON/mapping/AliMpRegionalTriggerReader.h [new file with mode: 0644]
MUON/mapping/AliMpTriggerReader.cxx
MUON/mapping/data/stationTrigger/RegionalCrate.dat

index de72a94e60f65acb34313041ed6f3404de01b21a..7090e4597e2681c466e4a86d8318300f0a9d751d 100644 (file)
@@ -299,15 +299,15 @@ private:
   
   Bool_t     fRequestStation[5]; ///< kTRUE to request at least one cluster in station i to validate the track
   
-       Double32_t fGainA1Limits[2]; //< Low and High threshold for gain a0 parameter
-  Double32_t fGainA2Limits[2]; //< Low and High threshold for gain a1 parameter
-  Double32_t fGainThresLimits[2]; //< Low and High threshold for gain threshold parameter
-  Double32_t fHVSt12Limits[2]; //< Low and High threshold for St12 HV
-  Double32_t fHVSt345Limits[2]; //< Low and High threshold for St345 HV
-  Double32_t fPedMeanLimits[2]; //< Low and High threshold for pedestal mean
-  Double32_t fPedSigmaLimits[2]; //< Low and High threshold for pedestal sigma
+       Double32_t fGainA1Limits[2]; ///< Low and High threshold for gain a0 parameter
+  Double32_t fGainA2Limits[2]; ///< Low and High threshold for gain a1 parameter
+  Double32_t fGainThresLimits[2]; ///< Low and High threshold for gain threshold parameter
+  Double32_t fHVSt12Limits[2]; ///< Low and High threshold for St12 HV
+  Double32_t fHVSt345Limits[2]; ///< Low and High threshold for St345 HV
+  Double32_t fPedMeanLimits[2]; ///< Low and High threshold for pedestal mean
+  Double32_t fPedSigmaLimits[2]; ///< Low and High threshold for pedestal sigma
        
-       UInt_t fPadGoodnessMask; //< goodness mask (see AliMUONPadStatusMaker)
+       UInt_t fPadGoodnessMask; ///< goodness mask (see AliMUONPadStatusMaker)
        
   // functions
   void SetLowFluxParam();
index 1741bbee2368aae3afe524c775e6a0c999ff83f1..0d2b6b91025dd0c52283fdfc1851b2109410f7b7 100644 (file)
 #include "AliMpFiles.h"
 #include "AliMpHelper.h"
 #include "AliMpExMapIterator.h"
+#include "AliMpRegionalTriggerReader.h"
 #include "AliLog.h"
 
 #include <TArrayI.h>
 #include <Riostream.h>
 #include <TClass.h>
 #include <TSystem.h>
+#include <TList.h>
 
 
 /// \cond CLASSIMP
@@ -91,85 +93,33 @@ AliMUONRegionalTriggerConfig::~AliMUONRegionalTriggerConfig()
 //______________________________________________________________________________
 Int_t AliMUONRegionalTriggerConfig::ReadData(const TString& fileName)
 {
-/// Load the Regional trigger from ASCII data files
-/// and return its instance
-    
-    TString inFileName(fileName);
-    if ( inFileName == "" )
-      inFileName = AliMpFiles::LocalTriggerBoardMapping();
-    
-    inFileName = gSystem->ExpandPathName(inFileName.Data());
-
-    ifstream in(inFileName.Data(), ios::in);
+    /// Load the Regional trigger from ASCII data files
 
-    if (!in) {
-      AliErrorStream()
-         << "Local Trigger Board Mapping File " << fileName.Data() << " not found" << endl;
-      return kFALSE;
+    ifstream inFile(fileName.Data(), ios::in);
+    if ( ! inFile.good() ) {
+        AliErrorStream()
+           << "Local Trigger Board Mapping File " << fileName.Data() << " not found" << endl;
+        return 0;
     }
 
-    AliMUONTriggerCrateConfig* crate = 0x0;
-
-    TArrayI list;
-    UShort_t crateId, mask;
-    Int_t mode, coincidence;
-    Int_t localBoardId = 0;
-    char line[80];
-   
-    while (!in.eof())
-    {
-      in.getline(line,80);
-      if (!strlen(line)) break;
-      TString crateName(AliMpHelper::Normalize(line));
-      
-      in.getline(line,80);    
-      sscanf(line,"%hx",&crateId);
-  
-      in.getline(line,80);
-      sscanf(line,"%d",&mode);
-      
-      in.getline(line,80);
-      sscanf(line,"%d",&coincidence);
-      
-      in.getline(line,80);
-      sscanf(line,"%hx",&mask);
-      
-      crate = (AliMUONTriggerCrateConfig*)(fTriggerCrates.GetValue(crateName.Data()));
-      if (!crate) 
-      {
-        // cout << "Creating crate: " << crateName.Data() << endl;
-        crate = new AliMUONTriggerCrateConfig(crateName.Data(), crateId, mask, mode, coincidence);
-        fTriggerCrates.Add(crateName.Data(), crate);
-      }
-      
-      Char_t localBoardName[20];
-      Int_t slot;
-      UInt_t switches;
-      
-      for ( Int_t i = 0; i < AliMpConstants::LocalBoardNofChannels(); ++i ) 
-      {
-        if ( (mask >> i ) & 0x1 )
-        {
-          // read local board
-          in.getline(line,80);
-          sscanf(line,"%02d %s %03d %03x",&slot,localBoardName,&localBoardId,&switches);
-          crate->AddLocalBoard(localBoardId);
-
-          // skip DEs for local board
-          in.getline(line,80);
-
-          // skip copy number and transverse connector
-          in.getline(line,80);
-         }
-      }
-    }
-    return fTriggerCrates.GetSize();
+    TList list;
+    list.AddAt(&fTriggerCrates,0);
+    
+    Int_t status = AliMpRegionalTriggerReader::ReadData(list, inFile);
+    
+    if (status == -1) {
+        AliErrorStream()
+        << "Regional Trigger configuration File " << fileName.Data() << " not found" << endl;
+        return 0;
+    } 
+    
+    return status;
 }
 
-
 //______________________________________________________________________________
 AliMUONTriggerCrateConfig* AliMUONRegionalTriggerConfig::FindTriggerCrate(TString name, 
-                                                          Bool_t warn) const  {
+                                                          Bool_t warn) const  
+{
     /// Return trigger crate with given name
 
     AliMUONTriggerCrateConfig* crate
index 66e0498bb0719b6fde54c92a9b26b8edfa2adc73..2b39b1fcb5b228936e363c356070a78520fb1fbf 100644 (file)
@@ -208,8 +208,8 @@ private:
   Double_t fXmax; ///< max x value for histograms
   static const Int_t fgkExtraDimension; ///< to hold extra information
   static const Int_t fgkVirtualExtraDimension; ///< to give access to information not stored, but computed on the fly
-  Bool_t fIsChannelLevelEnabled; //< whether we allow storing of channel (fChannelValues) values
-  Bool_t fIsManuLevelEnabled; //< whether we allow storing of manu (fManuValues) values
+  Bool_t fIsChannelLevelEnabled; ///< whether we allow storing of channel (fChannelValues) values
+  Bool_t fIsManuLevelEnabled; ///< whether we allow storing of manu (fManuValues) values
        
   ClassDef(AliMUONTrackerData,6) // Implementation of AliMUONVTrackerData
 };
index 9d96642f426f8157ea5dc34890948e4e0da8e03c..840189c08aca8373fa82764ef34d2030cbd5e92c 100644 (file)
@@ -209,7 +209,7 @@ AliMUONTriggerIO::ReadLocalMasks(const char* localFile, AliMUONVStore& localMask
   
   UShort_t maskBuffer[8];
   
-  Int_t nLocalBoards(0);
+  Int_t nLocalBoards(1);
     
   while ( fread ( maskBuffer, 2, 8, fp ) )
   {
@@ -395,7 +395,7 @@ AliMUONTriggerIO::ReadConfig(const char* localFile,
   }
   
   Int_t nCrates = ReadRegionalConfig(regionalFile, regionalConfig);
-  
+
   if (!nCrates) return kFALSE;
   
   if (localMasks && localFile)
@@ -789,3 +789,17 @@ AliMUONTriggerIO::LocalBoardId(Int_t index) const
 
   return fRegionalTrigger.LocalBoardId(index);
 }
+
+
+//______________________________________________________________________________
+
+Int_t AliMUONTriggerIO::LocalBoardId(Int_t ddlId, Int_t crateId, Int_t localId) const
+{
+    /// Return local board id from crate and local indexes.
+    
+    Int_t nofDDLs = 0;
+    TString name = AliMpTriggerCrate::GenerateName(crateId, ddlId, nofDDLs);
+
+    AliMpTriggerCrate* crate = fRegionalTrigger.FindTriggerCrate(name, false);
+    return crate->GetLocalBoardId(localId);
+}
index 816c2cce6941ccb5837bf60b26b9f3be95d3b0e9..adf3b5070d4182a67ac271bf9e43cd5b3f15f33e 100644 (file)
@@ -81,6 +81,7 @@ public:
                        FILE* flut);
                    
   Int_t LocalBoardId(Int_t index) const;
+  Int_t LocalBoardId(Int_t ddlId, Int_t crateId, Int_t localId) const;
 
 
 private:
index bcb0f36adcfeb327188959d1b1cd50da6ecd7257..9ae0ca84543e52a99fcf3f7202f3939878a38528 100644 (file)
Binary files a/MUON/Calib/MappingData/Run0_999999999_v0_s0.root and b/MUON/Calib/MappingData/Run0_999999999_v0_s0.root differ
index 4db4cdc7777f8db868265bb1da86942788d6f8d3..b8c7b6a4a46635b75d7e72d893ab7a4899068910 100644 (file)
@@ -1,4 +1,6 @@
 /*
+MTR DA for online
+
 Contact: Franck Manso <manso@clermont.in2p3.fr>
 Link: http://aliceinfo.cern.ch/static/Offline/dimuon/muon_html/README_mtrda.html
 Run Type:  ELECTRONICS_CALIBRATION_RUN (calib), DETECTOR_CALIBRATION_RUN (ped)
@@ -87,9 +89,9 @@ extern "C" {
 #include "TArrayS.h"
 
 // global variables
-const Int_t gkNLocalBoard = AliMpConstants::TotalNofLocalBoards();
+const Int_t gkNLocalBoard = AliMpConstants::TotalNofLocalBoards()+1;
 
-TString gCommand("");
+TString gCommand("ped");
 
 TString gCurrentFileName("MtgCurrent.dat");
 TString gLastCurrentFileName("MtgLastCurrent.dat");
@@ -285,7 +287,6 @@ void ReadFileNames()
     if (!ReadCurrentFile(gLastCurrentFileName, true)) 
     {
       ReadCurrentFile(gCurrentFileName, true);
-      WriteLastCurrentFile();
     } 
 
     // any case read current file
@@ -304,6 +305,9 @@ Bool_t ExportFiles()
     // setenv DATE_ROLE_NAME
     // setenv DATE_DETECTOR_CODE
 
+    // for offline purposes
+    // gSystem->Setenv("DAQDALIB_PATH", "$DATE_SITE/infoLogger");
+
     // update files
     Int_t status = 0;
 
@@ -317,10 +321,10 @@ Bool_t ExportFiles()
     if (!out.good()) {
        printf("Failed to create file: %s\n",file.Data());
        return false;
-    }      file = gGlobalFileName.Data();
+    }      
 
+    file = gGlobalFileName.Data();
     if (gGlobalFileLastVersion != gGlobalFileVersion) {
-
       status = daqDA_FES_storeFile(file.Data(), file.Data());
       if (status) {
        printf("Failed to export file: %s\n",gGlobalFileName.Data());
@@ -330,9 +334,9 @@ Bool_t ExportFiles()
       if(gPrintLevel) printf("Export file: %s\n",gGlobalFileName.Data());
     }
 
+    file = gLocalMaskFileName;  
     if (gLocalMaskFileLastVersion != gLocalMaskFileVersion) {
       modified = true;
-      file = gLocalMaskFileName;
       // export to FES
       status = daqDA_FES_storeFile(file.Data(), file.Data());
       if (status) {
@@ -350,8 +354,8 @@ Bool_t ExportFiles()
       out << gLocalMaskFileName.Data() << endl;
     }
 
+    file = gLocalLutFileName;
     if (gLocalLutFileLastVersion != gLocalLutFileVersion) {
-      file = gLocalLutFileName;
       modified = true;
       status = daqDA_FES_storeFile(file.Data(), file.Data());
       if (status) {
@@ -364,8 +368,8 @@ Bool_t ExportFiles()
     }
 
     // exported regional file whenever mask or/and Lut are modified
+    file = gRegionalFileName;
     if ( (gRegionalFileLastVersion != gRegionalFileVersion) || modified) {
-      file = gRegionalFileName;
       status = daqDA_FES_storeFile(file.Data(), file.Data());
       if (status) {
        printf("Failed to export file: %s\n",gRegionalFileName.Data());
@@ -385,6 +389,9 @@ Bool_t ExportFiles()
     }
     if(gPrintLevel) printf("Export file: %s\n",fileExp.Data());
 
+    // write last current file
+    WriteLastCurrentFile();
+
     return true;
 }
 //__________________
@@ -398,6 +405,10 @@ Bool_t ImportFiles()
 
       Int_t status = 0;
 
+    // for offline test
+    //gSystem->Setenv("DAQDALIB_PATH", "$DATE_SITE/db");
+    //gSystem->Setenv("DAQDA_TEST_DIR", "v3r3data");
+
     status = daqDA_DB_getFile(gCurrentFileName.Data(), gCurrentFileName.Data());
     if (status) {
       printf("Failed to get current config file from DB: %s\n",gCurrentFileName.Data());
@@ -437,7 +448,7 @@ Bool_t ImportFiles()
 void ReadMaskFiles()
 {
     // read mask files
-    gLocalMasks    = new AliMUON1DArray(gkNLocalBoard+9);
+    gLocalMasks    = new AliMUON1DArray(gkNLocalBoard);
     gRegionalMasks = new AliMUONRegionalTriggerConfig();
     gGlobalMasks   = new AliMUONGlobalCrateConfig();
 
@@ -597,12 +608,27 @@ void MakePatternStore(Bool_t pedestal = true)
 
       TString tmp(gLocalMaskFileName);
       Int_t pos = tmp.First("-");
-      gLocalMaskFileName = tmp(0,pos+1) + Form("%d",gLocalMaskFileVersion) + ".dat"; 
-
-      // write last current file
-      WriteLastCurrentFile();
+      TString sNumber = tmp(pos+1,1);
+      Int_t currentFileNumber =  sNumber.Atoi()+1;
 
+      gLocalMaskFileName = tmp(0,pos+1) + Form("%d",currentFileNumber) + ".dat"; 
       gTriggerIO.WriteConfig(gLocalMaskFileName, gRegionalFileName, gGlobalFileName, gLocalMasks, gRegionalMasks, gGlobalMasks);
+
+      WriteLastCurrentFile(gCurrentFileName);
+
+
+      Int_t status = daqDA_DB_storeFile(gLocalMaskFileName.Data(), gLocalMaskFileName.Data());
+      if (status) {
+        printf("Failed to export file to DB: %s\n",gLocalMaskFileName.Data());
+        return;
+      }
+
+      status = daqDA_DB_storeFile(gCurrentFileName.Data(), gCurrentFileName.Data());
+      if (status) {
+        printf("Failed to export file to DB: %s\n",gCurrentFileName.Data());
+        return;
+      }
+
     }
 }
 
@@ -619,7 +645,14 @@ int main(Int_t argc, Char_t **argv)
     Int_t skipEvents = 0;
     Int_t maxEvents  = 1000000;
     Char_t inputFile[256];
-    strcpy(inputFile, "");
+    inputFile[0] = 0;
+    if (argc > 1)
+      if (argv[1] != NULL)
+        strncpy(inputFile, argv[1], 256);
+      else {
+        printf("MUONTRGda : No input File !\n");
+        return -1;
+      }
     TString flatOutputFile;
 
 // option handler
@@ -715,13 +748,12 @@ int main(Int_t argc, Char_t **argv)
       return -1;
     }
 
-    if (!gDAFlag) {
-      if(!ExportFiles()) return -1;
-      return 0;
-    }
-
     ReadMaskFiles();
 
+    if(!ExportFiles())
+       return -1;
+
+  
     status = monitorSetDataSource(inputFile);
     if (status) {
       cerr << "ERROR : monitorSetDataSource status (hex) = " << hex << status
@@ -735,7 +767,12 @@ int main(Int_t argc, Char_t **argv)
       return -1;
     }
 
-    cout << "MUONTRKda : Reading data from file " << inputFile <<endl;
+    /* define wait event timeout - 1s max */
+    monitorSetNowait();
+    monitorSetNoWaitNetworkTimeout(1000);
+
+
+    cout << "MUONTRGda : Reading data from file " << inputFile <<endl;
 
     while(1) 
     {
@@ -756,7 +793,7 @@ int main(Int_t argc, Char_t **argv)
       // starts reading
       status = monitorGetEventDynamic(&event);
       if (status < 0)  {
-       cout<<"EOF found"<<endl;
+       cout << "MUONTRGda : EOF found" << endl;
        break;
       }
 
@@ -768,7 +805,10 @@ int main(Int_t argc, Char_t **argv)
       Int_t eventType = rawReader->GetType();
       gRunNumber = rawReader->GetRunNumber();
     
-
+      // L1Swc1
+      // CALIBRATION_EVENT 
+      // SYSTEM_SOFTWARE_TRIGGER_EVENT
+      // DETECTOR_SOFTWARE_TRIGGER_EVENT
       if (eventType != PHYSICS_EVENT) 
          continue; // for the moment
 
@@ -779,7 +819,6 @@ int main(Int_t argc, Char_t **argv)
       AliMUONRawStreamTrigger* rawStream  = new AliMUONRawStreamTrigger(rawReader);
       //rawStream->SetMaxReg(1);
 
-      Int_t index = 0;
       // loops over DDL 
       while((status = rawStream->NextDDL())) {
 
@@ -804,7 +843,8 @@ int main(Int_t argc, Char_t **argv)
 
            localStruct = regHeader->GetLocalEntry(iLocal);
 
-           Int_t localBoardId = gTriggerIO.LocalBoardId(index++);
+           Int_t localBoardId = gTriggerIO.LocalBoardId(rawStream->GetDDL(), iReg, iLocal);
+            if (localBoardId == 0) continue;
            if (gPrintLevel) printf("local %d\n",  localBoardId );
 
            TArrayS xPattern(4);
@@ -826,14 +866,12 @@ int main(Int_t argc, Char_t **argv)
 
     } // while (1)
 
-    if (gCommand.Contains("ped")) 
+    if (gCommand.Contains("ped") && gDAFlag
        MakePatternStore();
 
-    if (gCommand.Contains("cal"))
+    if (gCommand.Contains("cal") && gDAFlag)
        MakePatternStore(false);
 
-    if (!ExportFiles())
-       return -1;
 
     timers.Stop();
 
@@ -846,7 +884,7 @@ int main(Int_t argc, Char_t **argv)
 
     delete gLocalMasks;
     delete gRegionalMasks;
-    delete gGlobalMasks; // in case
+    delete gGlobalMasks; 
     delete gPatternStore;
 
     return status;
index 91b6cc2283f41ab8e3e2e7d2aa26fc25b2d98c89..62e0ac4877e5a38f14f61b0b4f2109d4b65dd8d5 100644 (file)
 #pragma link C++ class  AliMpRegionalTrigger+;
 #pragma link C++ class  AliMpTriggerCrate+;
 #pragma link C++ class  AliMpLocalBoard+;
+#pragma link C++ class  AliMpRegionalTriggerReader+;
 
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
index e0693e0d32fe7e1e76fb684697b43e76faff5ffa..b51729263f12b43a7c24bdcbe15b43775e54a663 100644 (file)
@@ -12,11 +12,11 @@ The main code is located in MUONTRGda.cxx and it runs in the MUON Trigger LDC.
 The main goal of the DA is the transfert of the modified configuration files to the FES.
 The configuration files stored in the online DB are the following:
 
-MtgGlobalCrate-<version>.dat:   contains the global crate information
-MtgRegionalCrate-<version>.dat: contains the regional crate information
-MtgLocalMask-<version>.dat:     contains the local mask
-MtgLocalLut-<version>.dat:      contains the local LUT 
-MtgCurrent.dat:                 contains the name list of the above files with their version 
+MtgGlobalCrate-<version>.dat:   contains the global crate information
+MtgRegionalCrate-<version>.dat: contains the regional crate information
+MtgLocalMask-<version>.dat:     contains the local mask
+MtgLocalLut-<version>.dat:      contains the local LUT 
+MtgCurrent.dat:                 contains the name list of the above files with their version 
                                 and the flag for master/slave status on the DA
 
 The copy onto the FES for the modified local masks is only done when the flag is set to master for the DA.
index f15edfc4408e84f24e1d2f041650d8e2bea9a73f..9b18790ad10425a6bdca81171a6aef3557e1b0dd 100644 (file)
@@ -81,7 +81,8 @@ SRCS +=  \
         mapping/AliMpTriggerSegmentation.cxx  \
          mapping/AliMpRegionalTrigger.cxx \
          mapping/AliMpTriggerCrate.cxx \
-         mapping/AliMpLocalBoard.cxx 
+         mapping/AliMpLocalBoard.cxx \
+         mapping/AliMpRegionalTriggerReader.cxx
 
 # Category management
 #
index 906378c0534d53ffa9b6cd58e2a60fe210128b50..c4394903456925776ef2e26867697d1f6747c310 100644 (file)
@@ -24,6 +24,7 @@
 //-----------------------------------------------------------------------------
 
 #include "AliMpRegionalTrigger.h"
+#include "AliMpRegionalTriggerReader.h"
 #include "AliMpExMapIterator.h"
 #include "AliMpTriggerCrate.h"
 #include "AliMpLocalBoard.h"
@@ -113,92 +114,22 @@ Bool_t AliMpRegionalTrigger::ReadData(istream& in)
 /// Load the Regional trigger from ASCII data files
 /// and return its instance
     
+    TList list;
+    list.AddAt(&fTriggerCrates, 0);
+    list.AddAt(&fLocalBoardMap, 1);
+    list.AddAt(&fLocalBoardArray, 2);
 
-    AliMpLocalBoard* board = 0x0;
-    AliMpTriggerCrate* crate = 0x0;
-
-
-    Int_t localBoardId = 0;
-    TArrayI list;
-    UShort_t crateId, mask;
+    Int_t status = AliMpRegionalTriggerReader::ReadData(list, in);
     
-    char line[80];
-   
-    while (!in.eof())
-    {
-      in.getline(line,80);
-      if (!strlen(line)) break;
-      TString crateName(AliMpHelper::Normalize(line));
-      
-      in.getline(line,80);    
-      sscanf(line,"%hx",&crateId);
-  
-      // skip mode
-      in.getline(line,80);
-      
-      // skip coincidence
-      in.getline(line,80);
-      
-      // skip mask
-      in.getline(line,80);
-      sscanf(line,"%hx",&mask);
-      
-      crate = (AliMpTriggerCrate*)(fTriggerCrates.GetValue(crateName.Data()));
-      if (!crate) 
-      {
-        // cout << "Creating crate: " << crateName.Data() << endl;
-        crate = new AliMpTriggerCrate(crateName.Data(), crateId);
-        fTriggerCrates.Add(crateName.Data(), crate);
-      }
-      
-      Char_t localBoardName[20];
-      Int_t slot;
-      UInt_t switches;
-      
-      for ( Int_t i = 0; i < AliMpConstants::LocalBoardNofChannels(); ++i ) 
-      {
-        if ( (mask >> i ) & 0x1 )
-        {
-          in.getline(line,80);
-          sscanf(line,"%02d %s %03d %03x",&slot,localBoardName,&localBoardId,&switches);
-          // cout << "  Creating local board: " << localBoardId << endl;
-          board = new AliMpLocalBoard(localBoardId, localBoardName, slot); 
-          board->SetSwitch(switches);
-          board->SetCrate(crateName);
-          
-          if (localBoardId > AliMpConstants::NofLocalBoards())
-            board->SetNotified(false); // copy cards
-          
-          crate->AddLocalBoard(localBoardId);
-
-          // add  list of DEs for local board
-          list.Reset();
-          in.getline(line,80);
-          TString tmp(AliMpHelper::Normalize(line));
-          AliMpHelper::DecodeName(tmp,' ',list);
-          for (Int_t ii = 0; ii < list.GetSize(); ++ii) { 
-            if ( list[ii] ) board->AddDE(list[ii]);
-          }  
-
-          // set copy number and transverse connector
-          in.getline(line,80);
-          tmp = AliMpHelper::Normalize(line);
-          AliMpHelper::DecodeName(tmp,' ',list);
+    if (status == -1) {
+        AliErrorStream()
+        << "Regional Trigger Mapping File not found" << endl;
+        return kFALSE;
+    } 
     
-          board->SetInputXfrom(list[0]);
-          board->SetInputXto(list[1]);
-          
-          board->SetInputYfrom(list[2]);
-          board->SetInputYto(list[3]);
-          
-          board->SetTC(list[4]);
-          
-          // add local board into array
-          fLocalBoardArray.AddAt(board,board->GetId());
-          fLocalBoardMap.Add(board->GetId(),board);
-        }
-      }
-    }
+    if (!status)
+      return kFALSE;
+      
     
     return kTRUE;
 }
diff --git a/MUON/mapping/AliMpRegionalTriggerReader.cxx b/MUON/mapping/AliMpRegionalTriggerReader.cxx
new file mode 100644 (file)
index 0000000..a58939a
--- /dev/null
@@ -0,0 +1,209 @@
+/**************************************************************************
+ * 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$
+// $MpId: AliMpTrigger.cxx,v 1.4 2006/05/24 13:58:52 ivana Exp $
+
+//-----------------------------------------------------------------------------
+// Class AliMpRegionalTriggerReader
+// --------------------
+// The class to read the  regional trigger crate files
+// Author: Ch. Finck, Subatech Nantes
+//-----------------------------------------------------------------------------
+
+#include "AliMpRegionalTriggerReader.h"
+#include "AliMpTriggerCrate.h"
+#include "AliMpLocalBoard.h"
+#include "AliMUONRegionalTriggerConfig.h"
+#include "AliMUONTriggerCrateConfig.h"
+#include "AliMpConstants.h"
+#include "AliMpFiles.h"
+#include "AliMpHelper.h"
+#include "AliMpExMap.h"
+
+#include "AliLog.h"
+
+#include <TArrayI.h>
+#include <TObjArray.h>
+#include <Riostream.h>
+#include <TClass.h>
+#include <TSystem.h>
+
+
+/// \cond CLASSIMP
+ClassImp(AliMpRegionalTriggerReader)
+/// \endcond
+
+
+//______________________________________________________________________________
+AliMpRegionalTriggerReader::AliMpRegionalTriggerReader()
+  : TObject()
+{
+/// constructor
+}
+
+//______________________________________________________________________________
+AliMpRegionalTriggerReader::~AliMpRegionalTriggerReader()
+{
+/// Destructor
+}
+
+//
+// public methods
+//
+
+//______________________________________________________________________________
+Int_t AliMpRegionalTriggerReader::ReadData(TList& list, istream& in)
+{
+/// Load the Regional trigger from ASCII data files
+/// and fill objects
+    
+    if (!in) {
+      return -1;
+    }
+     
+    AliMpExMap* triggerCrates = 0x0;
+    AliMpExMap* localBoardMap = 0x0;
+    TObjArray*  localBoardArray = 0x0;
+    
+    // common trigger crate map for mapping/config
+    triggerCrates = static_cast<AliMpExMap*> (list.At(0));
+
+    Bool_t mapping = false;
+    // only for mapping
+    if (list.GetSize() == 3) 
+    {
+      mapping = true;
+      localBoardMap   = static_cast<AliMpExMap*> (list.At(1));
+      localBoardArray = static_cast<TObjArray*>  (list.At(2));
+    }
+              
+    AliMpLocalBoard* board = 0x0;
+    AliMpTriggerCrate* crate = 0x0;
+    AliMUONTriggerCrateConfig* crateConfig = 0x0;
+
+    Int_t localBoardId = 0;
+    TArrayI listInt;
+    UShort_t crateId, mask;
+    Int_t mode, coincidence;
+    Int_t nofBoards;
+    char line[80];
+   
+    // decode file and store in objects
+    while (!in.eof())
+    {
+      in.getline(line,80);
+      if (!strlen(line)) break;
+      TString crateName(AliMpHelper::Normalize(line));
+      
+      in.getline(line,80);    
+      sscanf(line,"%hx",&crateId);
+  
+      // read mode
+      in.getline(line,80);
+      sscanf(line,"%d",&mode);
+
+      // read coincidence
+      in.getline(line,80);
+      sscanf(line,"%d",&coincidence);
+
+      // read mask
+      in.getline(line,80);
+      sscanf(line,"%hx",&mask);
+      
+      // read # local board
+      in.getline(line,80);
+      sscanf(line,"%d",&nofBoards);
+
+      if (mapping)
+      {
+        crate = (AliMpTriggerCrate*)(triggerCrates->GetValue(crateName.Data()));
+        if (!crate) 
+        {
+          crate = new AliMpTriggerCrate(crateName.Data(), crateId);
+          triggerCrates->Add(crateName.Data(), crate);
+        }
+      }
+      else
+      {
+        crateConfig = (AliMUONTriggerCrateConfig*)(triggerCrates->GetValue(crateName.Data()));
+        if (!crateConfig) 
+        {
+          crateConfig = new AliMUONTriggerCrateConfig(crateName.Data(), crateId, mask, mode, coincidence);
+          triggerCrates->Add(crateName.Data(), crateConfig);
+        }
+      }
+      
+      Char_t localBoardName[20];
+      Int_t slot;
+      UInt_t switches;
+      
+      for ( Int_t i = 0; i < nofBoards; ++i ) 
+      {
+          in.getline(line,80);
+          sscanf(line,"%02d %s %03d %03x",&slot,localBoardName,&localBoardId,&switches);
+          if (mapping)
+          {
+            board = new AliMpLocalBoard(localBoardId, localBoardName, slot); 
+            board->SetSwitch(switches);
+            board->SetCrate(crateName);
+            
+            if (localBoardId > AliMpConstants::NofLocalBoards())
+              board->SetNotified(false); // copy cards
+            
+            crate->AddLocalBoard(localBoardId);
+          }
+          else
+          {
+            crateConfig->AddLocalBoard(localBoardId);
+          }
+          
+          // add  list of DEs for local board
+          listInt.Reset();
+          in.getline(line,80);
+          if (mapping)
+          {
+            TString tmp(AliMpHelper::Normalize(line));
+            AliMpHelper::DecodeName(tmp,' ',listInt);
+            for (Int_t ii = 0; ii < listInt.GetSize(); ++ii) { 
+              if ( listInt[ii] ) board->AddDE(listInt[ii]);
+            }  
+          }
+          
+          // set copy number and transverse connector
+          in.getline(line,80);
+          if (mapping)
+          {
+            TString tmp1 = AliMpHelper::Normalize(line);
+            AliMpHelper::DecodeName(tmp1,' ',listInt);
+            
+            board->SetInputXfrom(listInt[0]);
+            board->SetInputXto(listInt[1]);
+            
+            board->SetInputYfrom(listInt[2]);
+            board->SetInputYto(listInt[3]);
+            
+            board->SetTC(listInt[4]);
+            
+            // add local board into array
+            localBoardArray->AddAt(board,board->GetId());
+            localBoardMap->Add(board->GetId(),board);
+          
+        }
+      }
+    }
+    
+    return triggerCrates->GetSize();
+  }
diff --git a/MUON/mapping/AliMpRegionalTriggerReader.h b/MUON/mapping/AliMpRegionalTriggerReader.h
new file mode 100644 (file)
index 0000000..2ee4cc1
--- /dev/null
@@ -0,0 +1,53 @@
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+// $MpId: $ 
+
+/// \ingroup mptrigger
+/// \class AliMpRegionalTriggerReader
+/// \brief The class to read regional trigger crate file
+///
+/// \author Ch. Finck, Subatech Nantes
+
+#ifndef ALI_MP_REGIONAL_TRIGGER_READER_H
+#define ALI_MP_REGIONAL_TRIGGER_READER_H
+
+#include <TObject.h>
+#include <TList.h>
+
+class AliMpRegionalTriggerReader : public  TObject{
+
+  public:
+    AliMpRegionalTriggerReader();
+    virtual ~AliMpRegionalTriggerReader();
+    
+    // methods
+    static Int_t ReadData(TList& list, istream& in);
+    
+
+  private:
+    /// Not implemented
+    AliMpRegionalTriggerReader(const AliMpRegionalTriggerReader& rhs);
+    /// Not implemented
+    AliMpRegionalTriggerReader& operator=(const AliMpRegionalTriggerReader& rhs);
+
+  ClassDef(AliMpRegionalTriggerReader,0) // Regional trigger crate reader
+};
+
+
+#endif //ALI_MP_REGIONAL_CRATE_READER_H
+
+
+
+
+
+
+
+
+
+
+
+
+
+
index 990de9bbcbc9047a5bcd4b1fb72112a6720c4357..121b67d0f73405414470a14574ea57ed3a0ad9ff 100644 (file)
@@ -552,7 +552,8 @@ AliMpTriggerReader::ReadLocalBoardMapping()
   Char_t localBoardName[20];
   Int_t j,localBoardId;
   UInt_t switches;
-  
+  Int_t nofBoards;
+
   while (!in.eof())
   {
     for (Int_t i = 0; i < 4; ++i)
@@ -561,22 +562,25 @@ AliMpTriggerReader::ReadLocalBoardMapping()
     // read mask
     if (!in.getline(line,80)) break;
     sscanf(line,"%hx",&mask);
-    
-    for ( Int_t i = 0; i < 16; ++i ) 
+   // read # boards
+    if (!in.getline(line,80)) break;
+    sscanf(line,"%d",&nofBoards);
+   
+    for ( Int_t i = 0; i < nofBoards; ++i ) 
     {      
-      if ( (mask >> i ) & 0x1 )
+  
+      if (!in.getline(line,80)) break; 
+      sscanf(line,"%02d %s %03d %03x", &j, localBoardName, &localBoardId, &switches);
+      if (localBoardId <= AliMpConstants::NofLocalBoards()) 
       {
-        if (!in.getline(line,80)) break; 
-        sscanf(line,"%02d %s %03d %03x", &j, localBoardName, &localBoardId, &switches);
-        if (localBoardId <= AliMpConstants::NofLocalBoards()) 
-        {
-          fLocalBoardMap.Add(new TObjString(localBoardName), new TObjString(Form("%d",localBoardId)));
-          AliDebugClass(10,Form("Board %s has number %d\n", localBoardName, localBoardId));
-        }
-        // skip 2 following lines
-        if (!in.getline(line,80)) break; 
-        if (!in.getline(line,80)) break; 
-       }
+       fLocalBoardMap.Add(new TObjString(localBoardName), new TObjString(Form("%d",localBoardId)));
+       AliDebugClass(10,Form("Board %s has number %d\n", localBoardName, localBoardId));
+      }
+      // skip 2 following lines
+      if (!in.getline(line,80)) break; 
+      if (!in.getline(line,80)) break; 
+       
     }
   }
   
index 0e5e497ef3adcf25ea820ef8268ba3aa50a2e66e..ab164c0069c8e10746a387a56e55ad65f2e590a4 100644 (file)
@@ -3,6 +3,7 @@
 2
 0
 ffff
+16
 01 RC1L1B12 001 1d4
  1114 1214 1314 1414 
     0    0    0    0    0
@@ -56,6 +57,7 @@ ffff
 2
 0
 ffff
+16
 01 RC2L1B12 017 1d4
  1114 1214 1314 1414 
     0    0    0    0    0
@@ -109,6 +111,7 @@ ffff
 2
 0
 ffff
+16
 01 RIntC2-Dw 236 010
     0 
    31    0   31    0    0
@@ -162,6 +165,7 @@ ffff
 2
 0
 ffff
+16
 01 RC3L1B12 039 1d4
  1114 1214 1314 1414 
     0    0    0    0    0
@@ -215,6 +219,7 @@ ffff
 2
 0
 ffff
+16
 01 RC4L1B12 061 1d4
  1114 1214 1314 1414 
     0    0    0    0    0
@@ -268,6 +273,7 @@ ffff
 2
 0
 ffff
+16
 01 RC5L1B12 077 1d4
  1114 1214 1314 1414 
     0    0    0    0    0
@@ -321,6 +327,7 @@ ffff
 2
 0
 ffff
+16
 01 RC6L1B12 093 1d4
  1114 1214 1314 1414 
     0    0    0    0    0
@@ -374,6 +381,7 @@ ffff
 2
 0
 01ff
+09
 01 RC7L1B12 109 054
  1114 1214 1314 1414 
     0    0    0    0    0
@@ -406,6 +414,7 @@ ffff
 2
 0
 ffff
+16
 01 LC1L1B12 118 1d4
  1113 1213 1313 1413 
     0    0    0    0    0
@@ -459,6 +468,7 @@ ffff
 2
 0
 ffff
+16
 01 LC2L1B12 134 1d4
  1113 1213 1313 1413 
     0    0    0    0    0
@@ -512,6 +522,7 @@ ffff
 2
 0
 ffff
+16
 01 LIntC2-Dw 240 010
     0 
   148    0  148    0    0
@@ -565,6 +576,7 @@ ffff
 2
 0
 ffff
+16
 01 LC3L1B12 156 1d4
  1113 1213 1313 1413 
     0    0    0    0    0
@@ -618,6 +630,7 @@ ffff
 2
 0
 ffff
+16
 01 LC4L1B12 178 1d4
  1113 1213 1313 1413 
     0    0    0    0    0
@@ -671,6 +684,7 @@ ffff
 2
 0
 ffff
+16
 01 LC5L1B12 194 1d4
  1113 1213 1313 1413 
     0    0    0    0    0
@@ -724,6 +738,7 @@ ffff
 2
 0
 ffff
+16
 01 LC6L1B12 210 1d4
  1113 1213 1313 1413 
     0    0    0    0    0
@@ -777,6 +792,7 @@ ffff
 2
 0
 01ff
+09
 01 LC7L1B12 226 054
  1113 1213 1313 1413 
     0    0    0    0    0