]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpManuList.cxx
Add the det.element id for each local board
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpManuList.cxx
CommitLineData
77865eec 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// $Id$
17
18#include "AliMpManuList.h"
19
20#include "AliMpDEIterator.h"
21#include "AliMpDEManager.h"
666ada1e 22#include "AliMpSegmentation.h"
77865eec 23#include "AliMpStationType.h"
cddd101e 24#include "AliMpCathodType.h"
77865eec 25#include "AliMpVSegmentation.h"
26#include "TArrayI.h"
27#include "TList.h"
28
29///
30/// \class AliMpManuList
31///
32/// A sort of cache for mapping information we use often (or that are
33/// time consuming to recompute).
34///
35/// \author Laurent Aphecetche
36
37/// \cond CLASSIMP
38ClassImp(AliMpManuList)
39/// \endcond
40
77865eec 41//_____________________________________________________________________________
42AliMpManuList::AliMpManuList()
43{
44 /// ctor
45}
46
47//_____________________________________________________________________________
48AliMpManuList::~AliMpManuList()
49{
50 /// dtor
51}
52
53//_____________________________________________________________________________
54Bool_t
55AliMpManuList::DoesChannelExist(Int_t detElemId, Int_t manuID, Int_t manuChannel)
56{
57 /// Whether a given (detElemId,manuID,manuChannel) combination is a valid one
58
666ada1e 59 const AliMpVSegmentation* seg =
60 AliMpSegmentation::Instance()
61 ->GetMpSegmentationByElectronics(detElemId,manuID);
77865eec 62 if (!seg) return kFALSE;
63
64 if ( seg->PadByLocation(AliMpIntPair(manuID,manuChannel),kFALSE).IsValid() )
65 {
66 return kTRUE;
67 }
68 else
69 {
70 return kFALSE;
71 }
72}
73
74//_____________________________________________________________________________
75TList*
76AliMpManuList::ManuList()
77{
78 /// Create a TList of AliMpIntPair<detElemId,manuID> of all MUON TRK manus
79 /// The returned list must be deleted by the client
80
81 TList* manuList = new TList;
82
83 manuList->SetOwner(kTRUE);
84
85 AliMpDEIterator it;
86
87 it.First();
88
89 while ( !it.IsDone() )
90 {
cddd101e 91 Int_t detElemId = it.CurrentDEId();
92 AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
93 if ( stationType != AliMp::kStationTrigger )
77865eec 94 {
cddd101e 95 for ( Int_t cath = AliMp::kCath0; cath <=AliMp::kCath1 ; ++cath )
77865eec 96 {
666ada1e 97 const AliMpVSegmentation* seg
cddd101e 98 = AliMpSegmentation::Instance()
99 ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath));
77865eec 100
101 TArrayI manus;
102
103 seg->GetAllElectronicCardIDs(manus);
104
105 for ( Int_t im = 0; im < manus.GetSize(); ++im )
106 {
107 manuList->Add(new AliMpIntPair(detElemId,manus[im]));
108 }
109 }
110 }
111 it.Next();
112 }
113 return manuList;
114}
115
116//_____________________________________________________________________________
117Int_t
118AliMpManuList::NumberOfChannels(Int_t detElemId, Int_t manuId)
119{
120 /// Returns the number of channels in that manuID. Answer should be <=64
121 /// whatever happens.
122
666ada1e 123 const AliMpVSegmentation* seg =
124 AliMpSegmentation::Instance()
125 ->GetMpSegmentationByElectronics(detElemId,manuId);
77865eec 126 Int_t n(0);
127 for ( Int_t i = 0; i < 64; ++i )
128 {
129 AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId,i),kFALSE);
130 if (pad.IsValid()) ++n;
131 }
132 return n;
133}
134
135//_____________________________________________________________________________
136Int_t
137AliMpManuList::NumberOfManus(Int_t detElemId)
138{
139 /// Returns the number of manus contained in the given detection element.
140 Int_t n(0);
cddd101e 141 for ( Int_t i = AliMp::kCath0; i <= AliMp::kCath1; ++i )
77865eec 142 {
666ada1e 143 const AliMpVSegmentation* seg
cddd101e 144 = AliMpSegmentation::Instance()
145 ->GetMpSegmentation(detElemId,AliMp::GetCathodType(i));
146
77865eec 147 TArrayI manus;
148 seg->GetAllElectronicCardIDs(manus);
149 n += manus.GetSize();
150 }
151 return n;
152}
153