]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTriggerIO.h
- Added read/write of global crate file
[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 AliMpTriggerCrate;
32 class AliMpLocalBoard;
33
34 class AliMUONTriggerIO : public TObject
35 {
36 public:
37   AliMUONTriggerIO();
38   AliMUONTriggerIO(const char* regionalFileToRead);
39   virtual ~AliMUONTriggerIO();
40
41   Bool_t ReadMasks(const char* localFile,
42                    const char* regionalFile,
43                    const char* globalFile,
44                    AliMUONVStore* localMasks,
45                    AliMUONVStore* regionalMasks,
46                    AliMUONVCalibParam* globalMasks,
47                    Bool_t warn = true);
48   
49   Bool_t ReadLUT(const char* lutFileToRead, AliMUONTriggerLut& lut);
50   
51   Bool_t WriteLUT(const AliMUONTriggerLut& lut,
52                   const char* lutFileToWrite);
53   
54 //  void SetLocalBoardIds(const TArrayI& localBoardIds);
55   
56   Int_t LocalBoardId(Int_t index) const;
57
58   Bool_t WriteMasks(const char* localFile,
59                     const char* regionalFile,
60                     const char* globalFile,
61                     AliMUONVStore* localMasks,
62                     AliMUONVStore* regionalMasks,
63                     AliMUONVCalibParam* globalMasks) const;
64   
65
66   AliMpTriggerCrate* GetTriggerCrate(TString crateName, Bool_t warn = true) const;
67   AliMpLocalBoard*   GetLocalBoard(Int_t localBoardId, Bool_t warn = true) const;
68
69   void UpdateMapping(Bool_t writeFile = true) const;
70
71 private:
72   
73   void DeCompAddress(UChar_t &ypos, UChar_t &ytri, UChar_t &xdev, UChar_t &xpos, 
74                      UShort_t address) const;
75     
76   void FillLut(AliMUONTriggerLut& lut,
77                Int_t icirc, UChar_t istripX, UChar_t idev,  
78                Int_t lutLpt[16][2], Int_t lutHpt[16][2]) ;
79   
80   
81   /// Return number of local boards
82   Int_t NofLocalBoards() const { return fNofLocalBoards; }
83   
84   Int_t  ReadGlobal(const char* globalFile, AliMUONVCalibParam* globalMasks);
85
86   Bool_t WriteGlobal(const char* globalFile, AliMUONVCalibParam* globalMasks) const;
87
88   Int_t  ReadRegional(const char* regionalFile, AliMUONVStore* regionalMasks, Bool_t warn = true);
89
90   Bool_t WriteRegional(const char* regionalFile, AliMUONVStore* regionalMasks) const;
91
92   Int_t  ReadLocalMasks(const char* localFile, AliMUONVStore& localMasks) const;
93   
94   Bool_t WriteLocalMasks(const char* localFile, AliMUONVStore& localMasks) const;
95
96   void   ReadLocalLUT(AliMUONTriggerLut& lut, Int_t localBoardId, FILE* flut);
97   
98   void   WriteLocalLUT(const AliMUONTriggerLut& lut, Int_t localBoardId, 
99                        FILE* flut);
100     
101   
102 private:
103   TArrayI             fLocalBoardIds;  //!< order of the localboards
104   Int_t               fNofLocalBoards; //!< number of local boards
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   
109   ClassDef(AliMUONTriggerIO,1) // Read/Write trigger masks and LUT to/from online files
110 };
111
112 #endif