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