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