]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpTriggerSegmentation.cxx
Restoring some modifications done in version 1.22
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpTriggerSegmentation.cxx
CommitLineData
ff7d3d1a 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$
13985652 17// $MpId: AliMpTriggerSegmentation.cxx,v 1.7 2006/05/24 13:58:52 ivana Exp $
ff7d3d1a 18
19#include "AliMpTriggerSegmentation.h"
20
21#include "AliLog.h"
22#include "AliMpConnection.h"
23#include "AliMpMotif.h"
24#include "AliMpMotifPosition.h"
25#include "AliMpMotifType.h"
26#include "AliMpPCB.h"
27#include "AliMpSlat.h"
28#include "AliMpSlatSegmentation.h"
29#include "AliMpTrigger.h"
30
85fec35d 31///
32/// \class AliMpTriggerSegmentation
33///
34/// Implementation of AliMpVSegmentation for trigger slats.
35///
36/// \todo Implement CreateIterator method, if needed.
37///
38/// \author Laurent Aphecetche
39
13985652 40/// \cond CLASSIMP
ff7d3d1a 41ClassImp(AliMpTriggerSegmentation)
13985652 42/// \endcond
ff7d3d1a 43
44//_____________________________________________________________________________
45AliMpTriggerSegmentation::AliMpTriggerSegmentation()
46: AliMpVSegmentation(),
efb408b3 47fkSlat(0),
48fNofStrips(0)
ff7d3d1a 49{
50 //
51 // Default ctor. Not to be used really.
52 //
53 AliDebug(1,Form("this=%p Empty ctor",this));
54}
55
56//_____________________________________________________________________________
57AliMpTriggerSegmentation::AliMpTriggerSegmentation(const AliMpTrigger* slat)
58: AliMpVSegmentation(),
59fkSlat(slat)
60{
61 //
62 // Normal ctor.
63 //
64 AliDebug(1,Form("this=%p Normal ctor slat=%p",this,slat));
efb408b3 65
66 // Compute the number of strips.
67 // We have to loop over all possible pads, in order to properly take
68 // into account the fact that a given strip might be part of several
69 // layer. Otherwise we would double count pads.
70
71 fNofStrips = 0;
72 for ( Int_t ix = 0; ix <= MaxPadIndexX(); ++ix )
73 {
74 for ( Int_t iy = 0; iy <= MaxPadIndexY(); ++iy )
75 {
76 if ( HasPad(AliMpIntPair(ix,iy)) )
77 {
78 ++fNofStrips;
79 }
80 }
81 }
ff7d3d1a 82}
83
884a73f1 84//______________________________________________________________________________
85AliMpTriggerSegmentation::AliMpTriggerSegmentation(const AliMpTriggerSegmentation& right)
86 : AliMpVSegmentation(right)
87{
88/// Protected copy constructor (not implemented)
89
90 AliFatal("Copy constructor not provided.");
91}
92
ff7d3d1a 93//_____________________________________________________________________________
94AliMpTriggerSegmentation::~AliMpTriggerSegmentation()
95{
96 //
97 // Dtor (empty).
98 //
99 AliDebug(1,Form("this=%p",this));
100}
101
884a73f1 102//______________________________________________________________________________
103AliMpTriggerSegmentation&
104AliMpTriggerSegmentation::operator=(const AliMpTriggerSegmentation& right)
105{
106/// Protected assignement operator (not implemented)
107
108 // check assignement to self
109 if (this == &right) return *this;
110
111 AliFatal("Assignement operator not provided.");
112
113 return *this;
114}
115
ff7d3d1a 116//_____________________________________________________________________________
117AliMpVPadIterator*
118AliMpTriggerSegmentation::CreateIterator(const AliMpArea&) const
119{
120 //
121 // Returns an iterator to loop over the pad contained within given area.
122 // Not implemented for trigger.
123
124 return 0;
125}
126
63bcb3c3 127//_____________________________________________________________________________
128TVector2
129AliMpTriggerSegmentation::Dimensions() const
130{
131 return Slat()->Dimensions();
132}
133
134//_____________________________________________________________________________
135void
136AliMpTriggerSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
137{
138 Slat()->GetAllLocalBoardNumbers(ecn);
139}
140
ff7d3d1a 141//_____________________________________________________________________________
142const char*
143AliMpTriggerSegmentation::GetName() const
144{
85fec35d 145 // Name of that segmentation = TriggerSegmentation + slatName
ff7d3d1a 146 TString name("TriggerSegmentation");
147 if ( fkSlat)
148 {
149 name += ".";
150 name += fkSlat->GetName();
151 }
152 return name.Data();
153}
154
155//_____________________________________________________________________________
156Bool_t
157AliMpTriggerSegmentation::HasPad(const AliMpIntPair& indices) const
158{
159 //
160 // Test if this slat has a pad located at the position referenced
161 // by the integer indices.
162 //
163
164 return PadByIndices(indices,kFALSE) != AliMpPad::Invalid();
165}
166
167//_____________________________________________________________________________
168Int_t
026b7442 169AliMpTriggerSegmentation::MaxPadIndexX() const
ff7d3d1a 170{
171 //
172 // Returns the value of the largest pad index in x-direction.
173 //
174
175 return fkSlat->GetNofPadsX()-1;
176}
177
178//_____________________________________________________________________________
179Int_t
026b7442 180AliMpTriggerSegmentation::MaxPadIndexY() const
ff7d3d1a 181{
182 //
183 // Returns the value of the largest pad index in y-direction.
184 //
185
186 return fkSlat->GetMaxNofPadsY()-1;
187}
188
189//_____________________________________________________________________________
190AliMpPad
191AliMpTriggerSegmentation::PadByLocation(const AliMpIntPair& location,
192 Bool_t warning) const
193{
194 //
195 // Returns the pad specified by its location, where location is the
196 // pair (ManuID,ManuChannel).
197 // If warning=kTRUE and the pad does not exist, a warning message is
198 // printed.
199 //
200 // AliMpPad::Invalid() is returned if there's no pad at the given location.
201 //
202 AliMpPad pad;
203 AliMpIntPair invloc;
204
205 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
206 {
207 const AliMpSlat* slat = fkSlat->GetLayer(i);
208 AliMpSlatSegmentation seg(slat);
85fec35d 209 AliMpPad pi = seg.PadByLocation(location,kFALSE);
210 if ( pi.IsValid() )
ff7d3d1a 211 {
212 if ( !pad.IsValid() )
213 {
85fec35d 214 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
215 pad.AddLocation(pi.GetLocation());
ff7d3d1a 216 }
217 else
218 {
85fec35d 219 pad.AddLocation(pi.GetLocation());
ff7d3d1a 220 }
221 }
222 }
223 if ( warning && !pad.IsValid() )
224 {
225 AliWarning(Form("No pad found at location (%d,%d)",location.GetFirst(),
226 location.GetSecond()));
227 }
228 return pad;
229}
230
231//_____________________________________________________________________________
232AliMpPad
233AliMpTriggerSegmentation::PadByIndices(const AliMpIntPair& indices,
234 Bool_t warning) const
235{
236 //
237 // Returns the pad specified by its integer indices.
238 // If warning=kTRUE and the pad does not exist, a warning message is
239 // printed.
240 //
241 // AliMpPad::Invalid() is returned if there's no pad at the given location.
242 //
243 //
244
245 AliMpPad pad;
246 AliMpIntPair invloc;
247
248 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
249 {
250 const AliMpSlat* slat = fkSlat->GetLayer(i);
251 AliMpSlatSegmentation seg(slat);
85fec35d 252 AliMpPad pi = seg.PadByIndices(indices,kFALSE);
253 if ( pi.IsValid() )
ff7d3d1a 254 {
255 if ( !pad.IsValid() )
256 {
85fec35d 257 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
258 pad.AddLocation(pi.GetLocation());
ff7d3d1a 259 }
260 else
261 {
85fec35d 262 pad.AddLocation(pi.GetLocation());
ff7d3d1a 263 }
264 }
265 }
266 if ( warning && !pad.IsValid() )
267 {
268 AliWarning(Form("No pad found at indices (%d,%d)",indices.GetFirst(),
269 indices.GetSecond()));
270 }
271
272 return pad;
273}
274
275//_____________________________________________________________________________
276AliMpPad
277AliMpTriggerSegmentation::PadByPosition(const TVector2& position,
278 Bool_t warning) const
279{
280 //
281 // Returns the pad specified by its (floating point) position.
282 // If warning=kTRUE and the pad does not exist, a warning message is
283 // printed.
284 //
285 // AliMpPad::Invalid() is returned if there's no pad at the given location.
286 //
287 AliMpPad pad;
288 AliMpIntPair invloc;
289
290 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
291 {
292 const AliMpSlat* slat = fkSlat->GetLayer(i);
293 AliMpSlatSegmentation seg(slat);
85fec35d 294 AliMpPad pi = seg.PadByPosition(position,kFALSE);
295 if ( pi.IsValid() )
ff7d3d1a 296 {
297 if ( !pad.IsValid() )
298 {
85fec35d 299 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
300 pad.AddLocation(pi.GetLocation());
ff7d3d1a 301 }
302 else
303 {
85fec35d 304 pad.AddLocation(pi.GetLocation());
ff7d3d1a 305 }
306 }
307 }
308 if ( warning && !pad.IsValid() )
309 {
310 AliWarning(Form("No pad found at position (%e,%e)",position.X(),
311 position.Y()));
312 }
313
314 return pad;
315}
316
63bcb3c3 317//_____________________________________________________________________________
318AliMpPlaneType
319AliMpTriggerSegmentation::PlaneType() const
320{
321 return Slat()->PlaneType();
322}
323
ff7d3d1a 324//_____________________________________________________________________________
325const AliMpTrigger*
326AliMpTriggerSegmentation::Slat() const
327{
328 //
329 // Returns the pointer to the referenced slat.
330 //
331
332 return fkSlat;
333}