]>
Commit | Line | Data |
---|---|---|
30f77987 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
3d1463c8 | 16 | // $Id$ |
17 | // $MpId: AliMpTrigger.cxx,v 1.4 2006/05/24 13:58:52 ivana Exp $ | |
30f77987 | 18 | |
3d1463c8 | 19 | //----------------------------------------------------------------------------- |
30f77987 | 20 | // Class AliMpTriggerCrate |
21 | // -------------------- | |
22 | // The class defines the properties of trigger crate | |
23 | // Author: Ch. Finck, Subatech Nantes | |
3d1463c8 | 24 | //----------------------------------------------------------------------------- |
30f77987 | 25 | |
26 | #include "AliMpTriggerCrate.h" | |
30f77987 | 27 | |
28 | #include "AliLog.h" | |
29 | ||
30 | #include <Riostream.h> | |
31 | ||
32 | /// \cond CLASSIMP | |
33 | ClassImp(AliMpTriggerCrate) | |
34 | /// \endcond | |
35 | ||
36 | ||
37 | //______________________________________________________________________________ | |
38 | TString AliMpTriggerCrate::GenerateName(Int_t crateId, Int_t ddlId, Int_t nofDDLs) | |
39 | { | |
40 | /// Generate name | |
41 | ||
42 | TString name; | |
ba9a8543 | 43 | |
44 | if (crateId < 2) | |
45 | name = Form("%d", crateId+1); | |
46 | ||
47 | if (crateId == 2) | |
30f77987 | 48 | name = "2-3"; |
ba9a8543 | 49 | |
50 | if (crateId > 2) | |
30f77987 | 51 | name = Form("%d", crateId); |
ba9a8543 | 52 | |
53 | if (crateId > 7) | |
54 | printf("crateId index too large\n"); | |
30f77987 | 55 | |
56 | if (ddlId == nofDDLs) | |
57 | name.Append("R"); | |
58 | else | |
59 | name.Append("L"); | |
60 | ||
61 | return name; | |
62 | } | |
63 | ||
64 | ||
65 | //______________________________________________________________________________ | |
66 | AliMpTriggerCrate::AliMpTriggerCrate(const Char_t* name, Int_t ddlId) | |
67 | : TNamed(name, "mapping trigger crate"), | |
b00a2ea5 | 68 | fId(0), |
30f77987 | 69 | fDdlId(ddlId), |
b00a2ea5 | 70 | fLocalBoard(false), |
71 | fMask(0), | |
72 | fMode(0), | |
73 | fCoinc(0) | |
30f77987 | 74 | |
75 | { | |
76 | /// Standard constructor | |
77 | } | |
78 | ||
b00a2ea5 | 79 | //______________________________________________________________________________ |
80 | AliMpTriggerCrate::AliMpTriggerCrate(const Char_t* name, UShort_t id, UShort_t mask, UShort_t mode, UShort_t coinc) | |
81 | : TNamed(name, "mapping trigger crate"), | |
82 | fId(id), | |
83 | fDdlId(0), | |
84 | fLocalBoard(false), | |
85 | fMask(mask), | |
86 | fMode(mode), | |
87 | fCoinc(coinc) | |
88 | ||
89 | { | |
90 | /// Standard constructor for Shuttle + DA | |
91 | } | |
92 | ||
30f77987 | 93 | //______________________________________________________________________________ |
94 | AliMpTriggerCrate::AliMpTriggerCrate(TRootIOCtor* /*ioCtor*/) | |
95 | : TNamed(), | |
b00a2ea5 | 96 | fId(), |
30f77987 | 97 | fDdlId(), |
b00a2ea5 | 98 | fLocalBoard(), |
99 | fMask(), | |
100 | fMode(), | |
101 | fCoinc() | |
30f77987 | 102 | { |
103 | /// Root IO constructor | |
104 | } | |
105 | ||
106 | //______________________________________________________________________________ | |
107 | AliMpTriggerCrate::~AliMpTriggerCrate() | |
108 | { | |
109 | /// Destructor | |
110 | } | |
111 | ||
112 | // | |
113 | // public methods | |
114 | // | |
115 | ||
116 | //______________________________________________________________________________ | |
117 | Bool_t AliMpTriggerCrate::AddLocalBoard(Int_t localBoardId) | |
118 | { | |
119 | /// Add detection element with given detElemId. | |
120 | /// Return true if the detection element was added | |
121 | ||
122 | if ( HasLocalBoard(localBoardId) ) { | |
123 | AliWarningStream() | |
124 | << "Local board with Id=" << localBoardId << " already present." | |
125 | << endl; | |
126 | return false; | |
127 | } | |
128 | ||
129 | fLocalBoard.Add(localBoardId); | |
130 | return true; | |
131 | } | |
132 | ||
133 | ||
134 | //______________________________________________________________________________ | |
135 | Int_t AliMpTriggerCrate::GetNofLocalBoards() const | |
136 | { | |
137 | /// Return the number of local board in this crate | |
138 | ||
139 | return fLocalBoard.GetSize(); | |
140 | } | |
141 | ||
142 | //______________________________________________________________________________ | |
143 | Int_t AliMpTriggerCrate::GetLocalBoardId(Int_t index) const | |
144 | { | |
145 | /// Return the local board by index (in loop) | |
146 | ||
6c7ff780 | 147 | if (index >= 0 && index < fLocalBoard.GetSize()) |
148 | return fLocalBoard.GetValue(index); | |
149 | else | |
150 | return 0; // begin at 1 | |
30f77987 | 151 | } |
152 | ||
153 | //______________________________________________________________________________ | |
154 | Bool_t AliMpTriggerCrate::HasLocalBoard(Int_t localBoardId) const | |
155 | { | |
156 | /// Return true if crate has local boardwith given localBoardId | |
157 | ||
158 | return fLocalBoard.HasValue(localBoardId); | |
159 | } | |
160 |