]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpTriggerCrate.cxx
- Added class for Global Crate object
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpTriggerCrate.cxx
CommitLineData
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"
27#include "AliMpDEManager.h"
28
29#include "AliLog.h"
30
31#include <Riostream.h>
32
33/// \cond CLASSIMP
34ClassImp(AliMpTriggerCrate)
35/// \endcond
36
37
38//______________________________________________________________________________
39TString AliMpTriggerCrate::GenerateName(Int_t crateId, Int_t ddlId, Int_t nofDDLs)
40{
41/// Generate name
42
43 TString name;
44 // \todo parameterise this
45 if (crateId == 23)
46 name = "2-3";
47 else
48 name = Form("%d", crateId);
49
50 if (ddlId == nofDDLs)
51 name.Append("R");
52 else
53 name.Append("L");
54
55 return name;
56}
57
58
59//______________________________________________________________________________
60AliMpTriggerCrate::AliMpTriggerCrate(const Char_t* name, Int_t ddlId)
61 : TNamed(name, "mapping trigger crate"),
b00a2ea5 62 fId(0),
30f77987 63 fDdlId(ddlId),
b00a2ea5 64 fLocalBoard(false),
65 fMask(0),
66 fMode(0),
67 fCoinc(0)
30f77987 68
69{
70/// Standard constructor
71}
72
b00a2ea5 73//______________________________________________________________________________
74AliMpTriggerCrate::AliMpTriggerCrate(const Char_t* name, UShort_t id, UShort_t mask, UShort_t mode, UShort_t coinc)
75 : TNamed(name, "mapping trigger crate"),
76 fId(id),
77 fDdlId(0),
78 fLocalBoard(false),
79 fMask(mask),
80 fMode(mode),
81 fCoinc(coinc)
82
83{
84/// Standard constructor for Shuttle + DA
85}
86
30f77987 87//______________________________________________________________________________
88AliMpTriggerCrate::AliMpTriggerCrate(TRootIOCtor* /*ioCtor*/)
89 : TNamed(),
b00a2ea5 90 fId(),
30f77987 91 fDdlId(),
b00a2ea5 92 fLocalBoard(),
93 fMask(),
94 fMode(),
95 fCoinc()
30f77987 96{
97/// Root IO constructor
98}
99
100//______________________________________________________________________________
101AliMpTriggerCrate::~AliMpTriggerCrate()
102{
103/// Destructor
104}
105
106//
107// public methods
108//
109
110//______________________________________________________________________________
111Bool_t AliMpTriggerCrate::AddLocalBoard(Int_t localBoardId)
112{
113/// Add detection element with given detElemId.
114/// Return true if the detection element was added
115
116 if ( HasLocalBoard(localBoardId) ) {
117 AliWarningStream()
118 << "Local board with Id=" << localBoardId << " already present."
119 << endl;
120 return false;
121 }
122
123 fLocalBoard.Add(localBoardId);
124 return true;
125}
126
127
128//______________________________________________________________________________
129Int_t AliMpTriggerCrate::GetNofLocalBoards() const
130{
131/// Return the number of local board in this crate
132
133 return fLocalBoard.GetSize();
134}
135
136//______________________________________________________________________________
137Int_t AliMpTriggerCrate::GetLocalBoardId(Int_t index) const
138{
139/// Return the local board by index (in loop)
140
6c7ff780 141 if (index >= 0 && index < fLocalBoard.GetSize())
142 return fLocalBoard.GetValue(index);
143 else
144 return 0; // begin at 1
30f77987 145}
146
147//______________________________________________________________________________
148Bool_t AliMpTriggerCrate::HasLocalBoard(Int_t localBoardId) const
149{
150/// Return true if crate has local boardwith given localBoardId
151
152 return fLocalBoard.HasValue(localBoardId);
153}
154