]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpTriggerCrate.cxx
In SetNofManusPerModule(): return false if no action
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpTriggerCrate.cxx
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
16
17 //
18 // --------------------
19 // Class AliMpTriggerCrate
20 // --------------------
21 // The class defines the properties of trigger crate
22 // Author: Ch. Finck, Subatech Nantes
23
24 #include "AliMpTriggerCrate.h"
25 #include "AliMpDEManager.h"
26
27 #include "AliLog.h"
28
29 #include <Riostream.h>
30
31 /// \cond CLASSIMP
32 ClassImp(AliMpTriggerCrate)
33 /// \endcond
34
35
36 //______________________________________________________________________________
37 TString AliMpTriggerCrate::GenerateName(Int_t crateId, Int_t ddlId, Int_t nofDDLs)
38 {
39 /// Generate name
40
41   TString name;
42   // \todo parameterise this
43   if (crateId == 23)
44       name = "2-3";
45   else 
46       name = Form("%d", crateId);
47  
48   if (ddlId == nofDDLs)
49       name.Append("R");
50   else 
51       name.Append("L"); 
52
53   return name;
54 }  
55  
56
57 //______________________________________________________________________________
58 AliMpTriggerCrate::AliMpTriggerCrate(const Char_t* name, Int_t ddlId)
59   : TNamed(name, "mapping trigger crate"),
60     fDdlId(ddlId),
61     fLocalBoard(false)
62  
63 {
64 /// Standard constructor
65 }
66
67 //______________________________________________________________________________
68 AliMpTriggerCrate::AliMpTriggerCrate(TRootIOCtor* /*ioCtor*/)
69   : TNamed(),
70     fDdlId(),
71     fLocalBoard()
72 {
73 /// Root IO constructor
74 }
75
76 //______________________________________________________________________________
77 AliMpTriggerCrate::~AliMpTriggerCrate()
78 {
79 /// Destructor
80 }
81
82 //
83 // public methods
84 //
85
86 //______________________________________________________________________________
87 Bool_t AliMpTriggerCrate::AddLocalBoard(Int_t localBoardId)
88 {
89 /// Add detection element with given detElemId.
90 /// Return true if the detection element was added
91
92   if ( HasLocalBoard(localBoardId) ) {
93     AliWarningStream() 
94       << "Local board with Id=" << localBoardId << " already present."
95       << endl;
96     return false;
97   }    
98
99   fLocalBoard.Add(localBoardId);
100   return true;
101 }   
102
103
104 //______________________________________________________________________________
105 Int_t AliMpTriggerCrate::GetNofLocalBoards() const
106 {  
107 /// Return the number of local board in this crate
108
109   return fLocalBoard.GetSize(); 
110 }
111
112 //______________________________________________________________________________
113 Int_t  AliMpTriggerCrate::GetLocalBoardId(Int_t index) const
114 {  
115 /// Return the local board by index (in loop)
116
117   return fLocalBoard.GetValue(index); 
118 }
119
120 //______________________________________________________________________________
121 Bool_t  AliMpTriggerCrate::HasLocalBoard(Int_t localBoardId) const
122 {  
123 /// Return true if crate has local boardwith given localBoardId
124
125   return fLocalBoard.HasValue(localBoardId); 
126 }
127