- Moved ReadLocalTrigger() method to static usable for online &
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerIO.h
CommitLineData
2ab3623b 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
890cc210 16# include <TArrayI.h>
2ab3623b 17#endif
18
19#ifndef ROOT_TObject
890cc210 20# include <TObject.h>
2ab3623b 21#endif
22
890cc210 23#include <Riostream.h>
5eff9abc 24#include "AliMpExMap.h"
5dde41b3 25#include "AliMpGlobalCrate.h"
890cc210 26
27class AliMUONTriggerLut;
2ab3623b 28class AliMUONVCalibParam;
29class AliMUONVStore;
5eff9abc 30class AliMpExMap;
31class AliMpTriggerCrate;
32class AliMpLocalBoard;
2ab3623b 33
34class AliMUONTriggerIO : public TObject
35{
36public:
37 AliMUONTriggerIO();
890cc210 38 AliMUONTriggerIO(const char* regionalFileToRead);
2ab3623b 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,
5eff9abc 46 AliMUONVCalibParam* globalMasks,
47 Bool_t warn = true);
2ab3623b 48
890cc210 49 Bool_t ReadLUT(const char* lutFileToRead, AliMUONTriggerLut& lut);
50
51 Bool_t WriteLUT(const AliMUONTriggerLut& lut,
52 const char* lutFileToWrite);
53
2ab3623b 54// void SetLocalBoardIds(const TArrayI& localBoardIds);
55
5eff9abc 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;
2ab3623b 64
5eff9abc 65
66 AliMpTriggerCrate* GetTriggerCrate(TString crateName, Bool_t warn = true) const;
67 AliMpLocalBoard* GetLocalBoard(Int_t localBoardId, Bool_t warn = true) const;
68
5dde41b3 69 void UpdateMapping(Bool_t writeFile = true) const;
5eff9abc 70
2ab3623b 71private:
72
890cc210 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
2ab3623b 80
81 /// Return number of local boards
82 Int_t NofLocalBoards() const { return fNofLocalBoards; }
83
5dde41b3 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);
5eff9abc 89
90 Bool_t WriteRegional(const char* regionalFile, AliMUONVStore* regionalMasks) const;
2ab3623b 91
5dde41b3 92 Int_t ReadLocalMasks(const char* localFile, AliMUONVStore& localMasks) const;
2ab3623b 93
5eff9abc 94 Bool_t WriteLocalMasks(const char* localFile, AliMUONVStore& localMasks) const;
95
5dde41b3 96 void ReadLocalLUT(AliMUONTriggerLut& lut, Int_t localBoardId, FILE* flut);
890cc210 97
5dde41b3 98 void WriteLocalLUT(const AliMUONTriggerLut& lut, Int_t localBoardId,
890cc210 99 FILE* flut);
100
2ab3623b 101
102private:
5dde41b3 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
2ab3623b 108
5eff9abc 109 ClassDef(AliMUONTriggerIO,1) // Read/Write trigger masks and LUT to/from online files
2ab3623b 110};
111
112#endif