]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpTriggerCrate.cxx
Fixing a backward compatibility issue
[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"
30f77987 27
28#include "AliLog.h"
29
30#include <Riostream.h>
31
32/// \cond CLASSIMP
33ClassImp(AliMpTriggerCrate)
34/// \endcond
35
36
37//______________________________________________________________________________
38TString 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
b00a2ea5 64//______________________________________________________________________________
92c23b09 65AliMpTriggerCrate::AliMpTriggerCrate(const Char_t* name, UShort_t id)
b00a2ea5 66 : TNamed(name, "mapping trigger crate"),
67 fId(id),
5cc125b2 68 fDdlId(-1),
92c23b09 69 fLocalBoard(false)
b00a2ea5 70
71{
5cc125b2 72/// Standard constructor
b00a2ea5 73}
74
30f77987 75//______________________________________________________________________________
76AliMpTriggerCrate::AliMpTriggerCrate(TRootIOCtor* /*ioCtor*/)
77 : TNamed(),
b00a2ea5 78 fId(),
30f77987 79 fDdlId(),
92c23b09 80 fLocalBoard()
30f77987 81{
82/// Root IO constructor
83}
84
85//______________________________________________________________________________
86AliMpTriggerCrate::~AliMpTriggerCrate()
87{
88/// Destructor
89}
90
91//
92// public methods
93//
94
95//______________________________________________________________________________
96Bool_t AliMpTriggerCrate::AddLocalBoard(Int_t localBoardId)
97{
5cc125b2 98/// Add local boards with given detElemId.
99/// Return true if the local board was added
30f77987 100
101 if ( HasLocalBoard(localBoardId) ) {
102 AliWarningStream()
103 << "Local board with Id=" << localBoardId << " already present."
104 << endl;
105 return false;
106 }
107
108 fLocalBoard.Add(localBoardId);
109 return true;
110}
111
112
113//______________________________________________________________________________
114Int_t AliMpTriggerCrate::GetNofLocalBoards() const
115{
116/// Return the number of local board in this crate
117
118 return fLocalBoard.GetSize();
119}
120
121//______________________________________________________________________________
122Int_t AliMpTriggerCrate::GetLocalBoardId(Int_t index) const
123{
124/// Return the local board by index (in loop)
125
6c7ff780 126 if (index >= 0 && index < fLocalBoard.GetSize())
127 return fLocalBoard.GetValue(index);
128 else
129 return 0; // begin at 1
30f77987 130}
131
132//______________________________________________________________________________
133Bool_t AliMpTriggerCrate::HasLocalBoard(Int_t localBoardId) const
134{
135/// Return true if crate has local boardwith given localBoardId
136
137 return fLocalBoard.HasValue(localBoardId);
138}
139