]>
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 | ||
b80faac0 | 32 | using std::endl; |
30f77987 | 33 | /// \cond CLASSIMP |
34 | ClassImp(AliMpTriggerCrate) | |
35 | /// \endcond | |
36 | ||
37 | ||
38 | //______________________________________________________________________________ | |
39 | TString AliMpTriggerCrate::GenerateName(Int_t crateId, Int_t ddlId, Int_t nofDDLs) | |
40 | { | |
41 | /// Generate name | |
42 | ||
43 | TString name; | |
ba9a8543 | 44 | |
45 | if (crateId < 2) | |
46 | name = Form("%d", crateId+1); | |
47 | ||
48 | if (crateId == 2) | |
30f77987 | 49 | name = "2-3"; |
ba9a8543 | 50 | |
51 | if (crateId > 2) | |
30f77987 | 52 | name = Form("%d", crateId); |
ba9a8543 | 53 | |
54 | if (crateId > 7) | |
55 | printf("crateId index too large\n"); | |
30f77987 | 56 | |
57 | if (ddlId == nofDDLs) | |
58 | name.Append("R"); | |
59 | else | |
60 | name.Append("L"); | |
61 | ||
62 | return name; | |
63 | } | |
64 | ||
b00a2ea5 | 65 | //______________________________________________________________________________ |
92c23b09 | 66 | AliMpTriggerCrate::AliMpTriggerCrate(const Char_t* name, UShort_t id) |
b00a2ea5 | 67 | : TNamed(name, "mapping trigger crate"), |
68 | fId(id), | |
5cc125b2 | 69 | fDdlId(-1), |
92c23b09 | 70 | fLocalBoard(false) |
b00a2ea5 | 71 | |
72 | { | |
5cc125b2 | 73 | /// Standard constructor |
b00a2ea5 | 74 | } |
75 | ||
30f77987 | 76 | //______________________________________________________________________________ |
77 | AliMpTriggerCrate::AliMpTriggerCrate(TRootIOCtor* /*ioCtor*/) | |
78 | : TNamed(), | |
b00a2ea5 | 79 | fId(), |
30f77987 | 80 | fDdlId(), |
92c23b09 | 81 | fLocalBoard() |
30f77987 | 82 | { |
83 | /// Root IO constructor | |
84 | } | |
85 | ||
86 | //______________________________________________________________________________ | |
87 | AliMpTriggerCrate::~AliMpTriggerCrate() | |
88 | { | |
89 | /// Destructor | |
90 | } | |
91 | ||
92 | // | |
93 | // public methods | |
94 | // | |
95 | ||
96 | //______________________________________________________________________________ | |
97 | Bool_t AliMpTriggerCrate::AddLocalBoard(Int_t localBoardId) | |
98 | { | |
5cc125b2 | 99 | /// Add local boards with given detElemId. |
100 | /// Return true if the local board was added | |
30f77987 | 101 | |
102 | if ( HasLocalBoard(localBoardId) ) { | |
103 | AliWarningStream() | |
104 | << "Local board with Id=" << localBoardId << " already present." | |
105 | << endl; | |
106 | return false; | |
107 | } | |
108 | ||
109 | fLocalBoard.Add(localBoardId); | |
110 | return true; | |
111 | } | |
112 | ||
113 | ||
114 | //______________________________________________________________________________ | |
115 | Int_t AliMpTriggerCrate::GetNofLocalBoards() const | |
116 | { | |
117 | /// Return the number of local board in this crate | |
118 | ||
119 | return fLocalBoard.GetSize(); | |
120 | } | |
121 | ||
122 | //______________________________________________________________________________ | |
123 | Int_t AliMpTriggerCrate::GetLocalBoardId(Int_t index) const | |
124 | { | |
125 | /// Return the local board by index (in loop) | |
126 | ||
6c7ff780 | 127 | if (index >= 0 && index < fLocalBoard.GetSize()) |
128 | return fLocalBoard.GetValue(index); | |
129 | else | |
130 | return 0; // begin at 1 | |
30f77987 | 131 | } |
132 | ||
133 | //______________________________________________________________________________ | |
134 | Bool_t AliMpTriggerCrate::HasLocalBoard(Int_t localBoardId) const | |
135 | { | |
136 | /// Return true if crate has local boardwith given localBoardId | |
137 | ||
138 | return fLocalBoard.HasValue(localBoardId); | |
139 | } | |
140 |