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