]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTriggerIO.h
Modifications to reflect latest changes in MUONTRGda
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerIO.h
1 #ifndef ALIMUONTRIGGERIO_H
2 #define ALIMUONTRIGGERIO_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice                               */
6
7 // $Id$
8
9 /// \ingroup trigger
10 /// \class AliMUONTriggerIO
11 /// \brief Handles read/write of masks and LUT to/from online files
12 /// 
13 //  Author Laurent Aphecetche, Subatech
14
15 #ifndef ROOT_TArrayI
16 #  include <TArrayI.h>
17 #endif
18
19 #ifndef ROOT_TObject
20 #  include <TObject.h>
21 #endif
22
23 #include <Riostream.h>
24 #include "AliMpExMap.h"
25 #include "AliMpGlobalCrate.h"
26
27 class AliMUONTriggerLut;
28 class AliMUONVCalibParam;
29 class AliMUONVStore;
30 class AliMpExMap;
31 class AliMpDDL;
32 class AliMpTriggerCrate;
33 class AliMpLocalBoard;
34
35 class AliMUONTriggerIO : public TObject
36 {
37 public:
38   AliMUONTriggerIO();
39   AliMUONTriggerIO(const char* regionalFileToRead);
40   virtual ~AliMUONTriggerIO();
41
42   Bool_t ReadMasks(const char* localFile,
43                    const char* regionalFile,
44                    const char* globalFile,
45                    AliMUONVStore* localMasks,
46                    AliMUONVStore* regionalMasks,
47                    AliMUONVCalibParam* globalMasks,
48                    Bool_t warn = true);
49   
50   Bool_t ReadLUT(const char* lutFileToRead, AliMUONTriggerLut& lut);
51   
52   Bool_t WriteLUT(const AliMUONTriggerLut& lut,
53                   const char* lutFileToWrite);
54   
55 //  void SetLocalBoardIds(const TArrayI& localBoardIds);
56   
57   Int_t LocalBoardId(Int_t index) const;
58
59   Bool_t WriteMasks(const char* localFile,
60                     const char* regionalFile,
61                     const char* globalFile,
62                     AliMUONVStore* localMasks,
63                     AliMUONVStore* regionalMasks,
64                     AliMUONVCalibParam* globalMasks) const;
65   
66
67   AliMpTriggerCrate* GetTriggerCrate(TString crateName, Bool_t warn = true) const;
68   AliMpLocalBoard*   GetLocalBoard(Int_t localBoardId, Bool_t warn = true) const;
69   AliMpDDL*          GetDDL(Int_t ddlId, Bool_t warn = true) const;
70   
71   void UpdateMapping(Bool_t writeFile = true) const;
72
73 private:
74   
75   void DeCompAddress(UChar_t &ypos, UChar_t &ytri, UChar_t &xdev, UChar_t &xpos, 
76                      UShort_t address) const;
77     
78   void FillLut(AliMUONTriggerLut& lut,
79                Int_t icirc, UChar_t istripX, UChar_t idev,  
80                Int_t lutLpt[16][2], Int_t lutHpt[16][2]) ;
81   
82   
83   /// Return number of local boards
84   Int_t NofLocalBoards() const { return fLocalBoards.GetSize(); }
85   
86   Int_t  ReadGlobal(const char* globalFile, AliMUONVCalibParam* globalMasks);
87
88   Bool_t WriteGlobal(const char* globalFile, AliMUONVCalibParam* globalMasks) const;
89
90   Int_t  ReadRegional(const char* regionalFile, AliMUONVStore* regionalMasks, Bool_t warn = true);
91
92   Bool_t WriteRegional(const char* regionalFile, AliMUONVStore* regionalMasks) const;
93
94   Int_t  ReadLocalMasks(const char* localFile, AliMUONVStore& localMasks) const;
95   
96   Bool_t WriteLocalMasks(const char* localFile, AliMUONVStore& localMasks) const;
97
98   void   ReadLocalLUT(AliMUONTriggerLut& lut, Int_t localBoardId, FILE* flut);
99   
100   void   WriteLocalLUT(const AliMUONTriggerLut& lut, Int_t localBoardId, 
101                        FILE* flut);
102     
103   
104 private:
105   AliMpExMap          fTriggerCrates;  //!< The map of trigger crate per their ID
106   AliMpExMap          fLocalBoards;    //!< The map of local board per their ID
107   AliMpGlobalCrate    fGlobalCrate;    //!< Global crate object
108   TObjArray           fDDLs;           //!< DDLs array object
109  
110   ClassDef(AliMUONTriggerIO,0) // Read/Write trigger masks and LUT to/from online files
111 };
112
113 #endif