LCOV - code coverage report
Current view: top level - MUON/MUONmapping - AliMpFiles.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 92 152 60.5 %
Date: 2016-06-14 17:26:59 Functions: 41 49 83.7 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : // $Id$
      17             : // $MpId: AliMpFiles.cxx,v 1.12 2006/05/23 13:09:54 ivana Exp $
      18             : // Category: basic
      19             : 
      20             : //-----------------------------------------------------------------------------
      21             : // Class AliMpFiles
      22             : // ----------------
      23             : // Class for generating file names and paths.
      24             : // The input files:
      25             : // zones.dat, zones_special.dat - sector description
      26             : // motif*.dat   - motif description (generated from Exceed)
      27             : // padPos*.dat  - pad positions in motif
      28             : //
      29             : // Included in AliRoot: 2003/05/02
      30             : // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
      31             : //-----------------------------------------------------------------------------
      32             : 
      33             : #include "AliMpFiles.h"
      34             : 
      35             : #include "AliLog.h"
      36             : 
      37             : #include <TClass.h>
      38             : #include <Riostream.h>
      39             : 
      40             : #include <stdlib.h>
      41             : 
      42             : using std::endl;
      43             : /// \cond CLASSIMP
      44          18 : ClassImp(AliMpFiles)
      45             : /// \endcond
      46             : 
      47             : //
      48             : // static private methods
      49             : //
      50             : 
      51             : //______________________________________________________________________________
      52             : const TString& AliMpFiles::GetDataDir() 
      53             : {
      54             :   /// data directory
      55       16893 :   static const TString kDataDir = "/data";
      56        8442 :   return kDataDir;
      57           0 : }  
      58             :   
      59             : //______________________________________________________________________________
      60             : const TString& AliMpFiles::GetDataRunDir() 
      61             : {
      62             :   /// directory for run dependent data
      63         630 :   static const TString kDataRunDir = "/data_run";
      64         312 :   return kDataRunDir;
      65           0 : }
      66             : 
      67             : //______________________________________________________________________________
      68             : const TString& AliMpFiles::GetStationDir() 
      69             : {
      70             :   /// station directory
      71       17499 :   static const TString kStationDir = "/station";
      72        8745 :   return kStationDir;
      73           0 : }  
      74             :   
      75             : //______________________________________________________________________________
      76             : const TString& AliMpFiles::GetBendingDir() 
      77             : {
      78             :   /// bending plane directory
      79         699 :   static const TString kBendingDir = "bending_plane/";
      80         345 :   return kBendingDir;
      81           0 : }  
      82             :   
      83             : //______________________________________________________________________________
      84             : const TString& AliMpFiles::GetNonBendingDir() 
      85             : {
      86             :   /// non-bending plane directory
      87         693 :   static const TString kNonBendingDir = "non-bending_plane/";
      88         342 :   return kNonBendingDir;
      89           0 : }  
      90             : 
      91             : //______________________________________________________________________________
      92             : const TString& AliMpFiles::GetDENames() 
      93             : {
      94             :   /// DE names data file name
      95          33 :   static const TString kDENames = "denames"; 
      96          12 :   return kDENames;
      97           0 : }  
      98             :   
      99             : //______________________________________________________________________________
     100             : const TString& AliMpFiles::GetSector() 
     101             : {
     102             :   /// sector data file name
     103          33 :   static const TString kSector  = "zones"; 
     104          12 :   return kSector;
     105           0 : }  
     106             :   
     107             : //______________________________________________________________________________
     108             : const TString& AliMpFiles::GetSectorSpecial() 
     109             : {
     110             :   /// sector special data file name
     111          33 :   static const TString kSectorSpecial = "zones_special";
     112          12 :   return kSectorSpecial;
     113           0 : }  
     114             :   
     115             : //______________________________________________________________________________
     116             : const TString& AliMpFiles::GetSectorSpecial2() 
     117             : {
     118             :   /// sector special data file name
     119          33 :   static const TString kSectorSpecial2 = "zones_special_outer";
     120          12 :   return kSectorSpecial2;
     121           0 : }  
     122             : 
     123             : //______________________________________________________________________________
     124             : const TString& AliMpFiles::GetMotifPrefix() 
     125             : {
     126             :   /// motif data file name
     127        1287 :   static const TString kMotifPrefix   = "motif"; 
     128         639 :   return kMotifPrefix;
     129           0 : }   
     130             :     
     131             : 
     132             : //______________________________________________________________________________
     133             : const TString& AliMpFiles::GetMotifSpecialPrefix() 
     134             : {
     135             :   /// special motif data file name 
     136          63 :   static const TString kMotifSpecialPrefix ="motifSpecial";
     137          27 :   return kMotifSpecialPrefix;
     138           0 : }  
     139             : 
     140             : //______________________________________________________________________________
     141             : const TString& AliMpFiles::GetManuToSerial() 
     142             : {
     143             :   /// manu to serial file name suffix
     144         630 :   static const TString kManuToSerial ="_manu";
     145         312 :   return kManuToSerial;
     146           0 : }  
     147             : 
     148             : //______________________________________________________________________________
     149             : const TString& AliMpFiles::GetPadPosPrefix() 
     150             : {  
     151             :   /// pad position data file name
     152        1287 :   static const TString kPadPosPrefix  = "padPos"; 
     153         639 :   return kPadPosPrefix;
     154           0 : }  
     155             : 
     156             : //______________________________________________________________________________
     157             : const TString& AliMpFiles::GetDataExt() 
     158             : {
     159             :   /// file extension
     160        5505 :   static const TString kDataExt = ".dat"; 
     161        2748 :   return kDataExt;
     162           0 : }
     163             :        
     164             : //______________________________________________________________________________
     165             : const TString& AliMpFiles::GetBergToGCFileName() 
     166             : {
     167             :   /// BergToGC mapping file name
     168        1287 :   static const TString kBergToGCFileName = "bergToGC"; 
     169         639 :   return kBergToGCFileName;
     170           0 : }  
     171             : 
     172             : //______________________________________________________________________________
     173             : const TString& AliMpFiles::GetTriggerLocalBoards() 
     174             : {
     175             :   ///  local board name to id mapping
     176         879 :   static const TString kTriggerLocalBoards = "RegionalCrate";
     177         435 :   return kTriggerLocalBoards;
     178           0 : }  
     179             : 
     180             : //______________________________________________________________________________
     181             : const TString& AliMpFiles::GetTriggerGlobalBoards() 
     182             : {
     183             :   ///  global board name to id mapping
     184           0 :   static const TString kTriggerGlobalBoards = "GlobalCrate";
     185           0 :   return kTriggerGlobalBoards;
     186           0 : }  
     187             :   
     188             : //______________________________________________________________________________
     189             : const TString& AliMpFiles::GetBusPatchFileName() 
     190             : {
     191             :   /// DetElemIdToBusPatch file name
     192          15 :   static const TString kBusPatchFileName = "DetElemIdToBusPatch";
     193           3 :   return kBusPatchFileName;
     194           0 : }  
     195             :   
     196             : //______________________________________________________________________________
     197             : const TString& AliMpFiles::GetBusPatchInfoFileName() 
     198             : {
     199             :   /// BusPatch length file name
     200          15 :   static const TString kBusPatchInfoFileName = "BusPatchInfo";
     201           3 :   return kBusPatchInfoFileName;
     202           0 : }  
     203             :   
     204             : //______________________________________________________________________________
     205             : const TString& AliMpFiles::GetBusPatchSpecialFileName() 
     206             : {
     207             :   /// BusPatch special file name
     208          15 :   static const TString kBusPatchSpecialFileName = "BusPatchSpecial";
     209           3 :   return kBusPatchSpecialFileName;
     210           0 : }  
     211             :   
     212             : //______________________________________________________________________________
     213             : const TString& AliMpFiles::GetSerialToBinFileName() 
     214             : {
     215             :   /// serial to bin  number file name
     216           0 :   static const TString kSerialToBinFileName = "ManuSerialToBin";
     217           0 :   return kSerialToBinFileName;
     218           0 : }  
     219             :   
     220             : //
     221             : // static public methods
     222             : //
     223             : 
     224             : //______________________________________________________________________________
     225             : TString AliMpFiles::PlaneDataDir(AliMp::StationType station, 
     226             :                                  AliMq::Station12Type station12Type,
     227             :                                  AliMp::PlaneType plane)
     228             : {
     229             : /// Returns path to data files with sector description
     230             : /// for a specified plane.
     231             : 
     232       14694 :   switch (station) {
     233             :   case AliMp::kStation12:
     234         687 :     switch (plane) {
     235             :     case AliMp::kBendingPlane:
     236        2415 :       return GetTop() + GetDataDir() + StationDataDir(station, station12Type) + GetBendingDir();
     237             :       ;;
     238             :     case AliMp::kNonBendingPlane:   
     239        2394 :       return GetTop() + GetDataDir() + StationDataDir(station, station12Type) + GetNonBendingDir();
     240             :       ;;
     241             :     }   
     242             :     break;
     243             :   case AliMp::kStation345:
     244             :   case AliMp::kStationTrigger:  
     245       33300 :     return GetTop() + GetDataDir() + StationDataDir(station, AliMq::kNotSt12);
     246             :     break;
     247             :   default:  
     248           0 :     AliFatalClass("Incomplete switch on AliMp::PlaneType");
     249           0 :     break;
     250             :   }
     251           0 :   return TString();
     252        7347 : }
     253             : 
     254             : //______________________________________________________________________________
     255             : TString AliMpFiles::StationDataDir(AliMp::StationType station,
     256             :                                    AliMq::Station12Type station12Type)
     257             : {
     258             : /// Returns the station directory name for the specified station number.
     259             : 
     260       17490 :   TString stationDataDir(GetStationDir());
     261        8745 :   switch (station) {
     262             :   case AliMp::kStation12: 
     263        1043 :     switch (station12Type) {
     264             :     case AliMq::kStation1:
     265         259 :       stationDataDir += "1/";
     266             :       break;
     267             :       ;;
     268             :     case AliMq::kStation2:   
     269         784 :       stationDataDir += "2/";
     270             :       break;
     271             :       ;;
     272             :     case AliMq::kNotSt12:   
     273           0 :       AliFatalClass("Incorrect switch on AliMq::Station12Type");
     274             :       break;
     275             :     }   
     276             :     break;
     277             :     ;;
     278             :   case AliMp::kStation345: 
     279        1813 :     stationDataDir += "345/";
     280             :     break;
     281             :     ;;      
     282             :   case AliMp::kStationTrigger:
     283        5889 :     stationDataDir += "Trigger/";
     284             :     break;
     285             :     ;;
     286             :   default:
     287           0 :     stationDataDir += "Invalid/";
     288             :     break;
     289             :   }   
     290             :   return stationDataDir;
     291       17490 : }
     292             : 
     293             : //______________________________________________________________________________
     294             : TString AliMpFiles::BusPatchFilePath()
     295             : {
     296             : /// Return path to data file with bus patch mapping.
     297             : 
     298          27 :   return GetTop() + GetDataDir() + "/" + GetBusPatchFileName() + GetDataExt();
     299           0 : }  
     300             : 
     301             : //______________________________________________________________________________
     302             : TString AliMpFiles::BusPatchInfoFilePath()
     303             : {
     304             : /// Return path to data file with bus patch mapping.
     305             : 
     306          27 :   return GetTop() + GetDataDir() + "/" + GetBusPatchInfoFileName() + GetDataExt();
     307           0 : }  
     308             : 
     309             : //______________________________________________________________________________
     310             : TString AliMpFiles::BusPatchSpecialFilePath()
     311             : {
     312             : /// Return path to data file with special bus patch mapping.
     313             : 
     314          27 :   return GetTop() + GetDataDir() + "/" + GetBusPatchSpecialFileName() + GetDataExt();
     315           0 : }  
     316             : 
     317             : //______________________________________________________________________________
     318             : TString AliMpFiles::SerialToBinFilePath()
     319             : {
     320             : /// Return path to data file containing manu serial numbers with their bin.
     321             : 
     322           0 :   return GetTop() + GetDataDir() + "/" + GetSerialToBinFileName() + GetDataExt();
     323           0 : }  
     324             : 
     325             : 
     326             : //______________________________________________________________________________
     327             : TString AliMpFiles::DENamesFilePath(AliMp::StationType station,
     328             :                                     AliMq::Station12Type station12Type)
     329             : {
     330             : /// Return path to data file with DE names for given station.
     331             :  
     332          72 :   return GetTop() + GetDataDir() + StationDataDir(station, station12Type) 
     333          48 :            + GetDENames() + GetDataExt();
     334           0 : }
     335             : 
     336             : //______________________________________________________________________________
     337             : TString AliMpFiles::LocalTriggerBoardMapping()
     338             : {
     339             : /// Return path to data file with local trigger board mapping.
     340             : 
     341        1740 :   return GetTop() + GetDataDir() 
     342         870 :           + StationDataDir(AliMp::kStationTrigger, AliMq::kNotSt12) 
     343        1740 :           + GetTriggerLocalBoards() + GetDataExt();;
     344           0 : }
     345             : 
     346             : //______________________________________________________________________________
     347             : TString AliMpFiles::GlobalTriggerBoardMapping()
     348             : {
     349             : /// Return path to data file with local trigger board mapping.
     350             : 
     351           0 :   return GetTop() + GetDataDir() 
     352           0 :       + StationDataDir(AliMp::kStationTrigger, AliMq::kNotSt12) 
     353           0 :       + GetTriggerGlobalBoards() + GetDataExt();;
     354           0 : }
     355             : 
     356             : //_____________________________________________________________________________
     357             : TString AliMpFiles::SlatFilePath(AliMp::StationType stationType,
     358             :                                  const char* slatType,
     359             :                                  AliMp::PlaneType plane)
     360             : {
     361             : /// \todo add ..
     362             : 
     363        3690 :   return TString(PlaneDataDir(stationType, AliMq::kNotSt12, plane) 
     364        3690 :                  + slatType + "." +
     365        2460 :                  ( plane == AliMp::kNonBendingPlane ? "NonBending":"Bending" ) + ".slat");
     366           0 : }
     367             : 
     368             : //_____________________________________________________________________________
     369             : TString AliMpFiles::SlatPCBFilePath(AliMp::StationType stationType,
     370             :                                     const char* pcbType)
     371             : {
     372             : /// Get the full path for a given PCB (only relevant to stations 3,
     373             : /// 4, 5 and trigger). The bending parameter below is of no use in this case, but
     374             : /// we use it to re-use the PlaneDataDir() method untouched.
     375             : 
     376       14328 :   return TString(PlaneDataDir(stationType, AliMq::kNotSt12, AliMp::kNonBendingPlane) 
     377        9552 :                  + pcbType + ".pcb");
     378           0 : }
     379             : 
     380             : //______________________________________________________________________________
     381             : TString AliMpFiles::SectorFilePath(AliMq::Station12Type station12Type, 
     382             :                                    AliMp::PlaneType plane)
     383             : {
     384             : /// Return path to data file with sector description.
     385             :  
     386          36 :   return TString(PlaneDataDir(AliMp::kStation12, station12Type, plane) 
     387          48 :                  + GetSector() + GetDataExt());
     388           0 : }
     389             :     
     390             : //______________________________________________________________________________
     391             : TString AliMpFiles::SectorSpecialFilePath(AliMq::Station12Type station12Type,
     392             :                                           AliMp::PlaneType plane)
     393             : {
     394             : /// Return path to data file with sector special description (irregular motifs).
     395             : 
     396          36 :   return TString(PlaneDataDir(AliMp::kStation12, station12Type, plane) 
     397          48 :                  + GetSectorSpecial() + GetDataExt());
     398           0 : }
     399             :     
     400             : //______________________________________________________________________________
     401             : TString AliMpFiles::SectorSpecialFilePath2(AliMq::Station12Type station12Type, 
     402             :                                            AliMp::PlaneType plane)
     403             : {
     404             : /// Returns path to data file with sector special description (irregular motifs).
     405             : 
     406          36 :   return TString(PlaneDataDir(AliMp::kStation12, station12Type, plane) 
     407          48 :                  + GetSectorSpecial2() + GetDataExt());
     408           0 : }
     409             : 
     410             : //______________________________________________________________________________
     411             : TString AliMpFiles::MotifFileName(const TString& motifTypeID)
     412             : {
     413             :   /// Returns name of data file for a given motif type.
     414             :   
     415        2556 :   return TString(GetMotifPrefix() +  motifTypeID + GetDataExt());
     416           0 : }
     417             : 
     418             : //______________________________________________________________________________
     419             : TString AliMpFiles::MotifFilePath(AliMp::StationType station, 
     420             :                                   AliMq::Station12Type station12Type,
     421             :                                   AliMp::PlaneType plane, 
     422             :                                   const TString& motifTypeID)
     423             : {
     424             : /// Returns path to data file for a given motif type.
     425             : 
     426        1917 :   return TString(PlaneDataDir(station, station12Type, plane) 
     427        1278 :                  + MotifFileName(motifTypeID));
     428           0 : }
     429             : 
     430             : //______________________________________________________________________________
     431             : TString AliMpFiles::PadPosFileName(const TString& motifTypeID)
     432             : {
     433             :   /// Returns name of data file with pad positions for a given motif type.
     434             :   
     435        2556 :   return TString(GetPadPosPrefix() +  motifTypeID + GetDataExt());
     436           0 : }
     437             : 
     438             : //______________________________________________________________________________
     439             : TString AliMpFiles::PadPosFilePath(AliMp::StationType station, 
     440             :                                    AliMq::Station12Type station12Type,
     441             :                                    AliMp::PlaneType plane, 
     442             :                                    const TString& motifTypeID)
     443             : {
     444             : /// Returns path to data file with pad positions for a given motif type.
     445             : 
     446        1917 :   return TString(PlaneDataDir(station, station12Type, plane) 
     447        1278 :                  + PadPosFileName(motifTypeID));
     448           0 : }
     449             : 
     450             : //______________________________________________________________________________ 
     451             : TString AliMpFiles::MotifSpecialFileName(const TString& motifID)
     452             : {
     453             :   /// Returns name of data file with pad dimensions for a given motif ID.
     454             :   
     455         108 :   return TString(GetMotifSpecialPrefix() + motifID + GetDataExt());
     456             :   
     457           0 : }
     458             : 
     459             : //______________________________________________________________________________ 
     460             : TString AliMpFiles::MotifSpecialFilePath(AliMp::StationType station, 
     461             :                                          AliMq::Station12Type station12Type,
     462             :                                          AliMp::PlaneType plane,
     463             :                                          const TString& motifID)
     464             : {
     465             : /// Returns path to data file with pad dimensions for a given motif ID.
     466             : 
     467          81 :   return TString(PlaneDataDir(station, station12Type, plane) 
     468          54 :                  + MotifSpecialFileName(motifID));
     469           0 : }
     470             : 
     471             : //______________________________________________________________________________ 
     472             : TString AliMpFiles::BergToGCFilePath(AliMp::StationType station,
     473             :                                      AliMq::Station12Type station12Type)
     474             : {
     475             : /// Returns the path of the file which describes the correspondance between
     476             : /// the berg number and the gassiplex channel.
     477             : 
     478        3834 :   return GetTop() + GetDataDir() + StationDataDir(station, station12Type)
     479        2556 :               + GetBergToGCFileName() + GetDataExt();
     480           0 : }
     481             : 
     482             : //______________________________________________________________________________ 
     483             : TString AliMpFiles::ManuToSerialPath(const TString& deName, 
     484             :                                      AliMp::StationType station,
     485             :                                      AliMq::Station12Type station12Type)
     486             : {
     487             : /// Returns the path of the file for the manu id to their serial number
     488             : 
     489        1872 :   return  GetTop() + GetDataRunDir() + StationDataDir(station, station12Type)
     490        1560 :               + deName + GetManuToSerial() + GetDataExt(); 
     491           0 : }
     492             : 
     493             : 
     494             : //______________________________________________________________________________ 
     495             : void 
     496             : AliMpFiles::SetTopPath(const TString& topPath)
     497             : { 
     498             : /// Set top file path
     499             : 
     500           0 :   GetTop() = topPath; 
     501           0 : }
     502             : 
     503             : //______________________________________________________________________________
     504             : TString AliMpFiles::GetTop()
     505             : {
     506             : /// Return top path to mapping data defined either via MINSTALL
     507             : /// or ALICE_ROOT environment variable.                                      \n
     508             : /// If both variables are defined, MINSTALL is used.
     509             : 
     510       35046 :   TString top = getenv("MINSTALL");    
     511       35046 :   if ( ! top.IsNull() ) return top;
     512             : 
     513       35046 :   TString ntop = getenv("ALICE_ROOT");
     514       35046 :   if ( ntop.IsNull() ) {
     515           0 :     AliErrorClassStream() << "Cannot find path to mapping data." << endl;
     516           0 :     return ntop;
     517             :   }  
     518       17523 :   ntop += "/MUON/mapping";
     519       35046 :   return ntop;
     520       35046 : }
     521             : 
     522             : //
     523             : // ctors, dtor
     524             : //
     525             : 
     526             : //______________________________________________________________________________
     527             : AliMpFiles::~AliMpFiles() 
     528           0 : {
     529             : /// Destructor
     530           0 : }
     531             : 

Generated by: LCOV version 1.11