]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTriggerIO.h
Gros chantier trigger:
[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_TObject
16 #  include <TObject.h>
17 #endif
18
19 #include "AliMpExMap.h"
20 #include "AliMpGlobalCrate.h"
21 #include "AliMpRegionalTrigger.h"
22
23
24
25 #ifndef ROOT_TArrayI
26 #  include <TArrayI.h>
27 #endif
28
29 class AliMUONTriggerLut;
30 class AliMUONVStore;
31 class AliMpExMap;
32 class AliMpDDL;
33 class AliMpTriggerCrate;
34 class AliMpLocalBoard;
35 class AliMUONGlobalCrateConfig;
36 class AliMUONRegionalTriggerConfig;
37
38
39 class AliMUONTriggerIO : public TObject
40 {
41 public:
42   AliMUONTriggerIO();
43   AliMUONTriggerIO(const char* regionalFileToRead);
44   virtual ~AliMUONTriggerIO();
45
46
47   Bool_t ReadConfig(const char* localFile,
48                    const char* regionalFile,
49                    const char* globalFile,
50                    AliMUONVStore* localMasks,
51                     AliMUONRegionalTriggerConfig* regionalConfig,
52                     AliMUONGlobalCrateConfig* globalConfig);
53
54   Bool_t ReadLUT(const char* lutFileToRead, AliMUONTriggerLut& lut);
55   
56   Bool_t WriteLUT(const AliMUONTriggerLut& lut,
57                   const char* lutFileToWrite);
58   
59   Bool_t WriteConfig(const char* localFile,
60                     const char* regionalFile,
61                     const char* globalFile,
62                     AliMUONVStore* localMasks,
63                     AliMUONRegionalTriggerConfig* regionalConfig,
64                     AliMUONGlobalCrateConfig* globalConfig) const;
65
66   
67   Int_t  ReadGlobalConfig(const char* globalFile, AliMUONGlobalCrateConfig* globalConfig);
68
69   Bool_t WriteGlobalConfig(const char* globalFile, AliMUONGlobalCrateConfig* globalConfig) const;
70
71   Int_t  ReadRegionalConfig(const char* regionalFile, AliMUONRegionalTriggerConfig* regionalConfig);
72
73   Bool_t WriteRegionalConfig(const char* regionalFile, AliMUONRegionalTriggerConfig* regionalConfig) const;
74
75   Int_t  ReadLocalMasks(const char* localFile, AliMUONVStore& localMasks) const;
76   
77   Bool_t WriteLocalMasks(const char* localFile, AliMUONVStore& localMasks, AliMUONRegionalTriggerConfig* regionalConfig) const;
78
79   void   ReadLocalLUT(AliMUONTriggerLut& lut, Int_t localBoardId, FILE* flut);
80   
81   void   WriteLocalLUT(const AliMUONTriggerLut& lut, Int_t localBoardId, 
82                        FILE* flut);
83                    
84   Int_t LocalBoardId(Int_t index) const;
85
86
87 private:
88   
89   Bool_t DeCompAddress(UChar_t &ypos, UChar_t &ytri, UChar_t &xdev, UChar_t &xpos, 
90                      UShort_t address) const;
91     
92   void FillLut(AliMUONTriggerLut& lut,
93                Int_t icirc, UChar_t istripX, UChar_t idev,  
94                Int_t lutLpt[16][2], Int_t lutHpt[16][2]) ;
95   
96   
97   /// Return number of local boards
98   Int_t NofLocalBoards() const { return fRegionalTrigger.GetNofLocalBoards(); }
99   
100   
101   
102 private:
103   AliMpRegionalTrigger  fRegionalTrigger; //!< Regional trigger
104   AliMpGlobalCrate      fGlobalCrate;     //!< Global crate object
105  
106   static const UInt_t  fgkLocalLutSize;  ///< length of the lut for one local board
107
108   
109   ClassDef(AliMUONTriggerIO,2) // Read/Write trigger masks and LUT to/from online files
110 };
111
112 #endif