1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 // $MpId: AliMpTriggerSegmentation.cxx,v 1.5 2006/03/17 16:42:39 ivana Exp $
19 #include "AliMpTriggerSegmentation.h"
22 #include "AliMpConnection.h"
23 #include "AliMpMotif.h"
24 #include "AliMpMotifPosition.h"
25 #include "AliMpMotifType.h"
27 #include "AliMpSlat.h"
28 #include "AliMpSlatSegmentation.h"
29 #include "AliMpTrigger.h"
32 /// \class AliMpTriggerSegmentation
34 /// Implementation of AliMpVSegmentation for trigger slats.
36 /// \todo Implement CreateIterator method, if needed.
38 /// \author Laurent Aphecetche
40 ClassImp(AliMpTriggerSegmentation)
42 //_____________________________________________________________________________
43 AliMpTriggerSegmentation::AliMpTriggerSegmentation()
44 : AliMpVSegmentation(),
49 // Default ctor. Not to be used really.
51 AliDebug(1,Form("this=%p Empty ctor",this));
54 //_____________________________________________________________________________
55 AliMpTriggerSegmentation::AliMpTriggerSegmentation(const AliMpTrigger* slat)
56 : AliMpVSegmentation(),
62 AliDebug(1,Form("this=%p Normal ctor slat=%p",this,slat));
64 // Compute the number of strips.
65 // We have to loop over all possible pads, in order to properly take
66 // into account the fact that a given strip might be part of several
67 // layer. Otherwise we would double count pads.
70 for ( Int_t ix = 0; ix <= MaxPadIndexX(); ++ix )
72 for ( Int_t iy = 0; iy <= MaxPadIndexY(); ++iy )
74 if ( HasPad(AliMpIntPair(ix,iy)) )
82 //______________________________________________________________________________
83 AliMpTriggerSegmentation::AliMpTriggerSegmentation(const AliMpTriggerSegmentation& right)
84 : AliMpVSegmentation(right)
86 /// Protected copy constructor (not implemented)
88 AliFatal("Copy constructor not provided.");
91 //_____________________________________________________________________________
92 AliMpTriggerSegmentation::~AliMpTriggerSegmentation()
97 AliDebug(1,Form("this=%p",this));
100 //______________________________________________________________________________
101 AliMpTriggerSegmentation&
102 AliMpTriggerSegmentation::operator=(const AliMpTriggerSegmentation& right)
104 /// Protected assignement operator (not implemented)
106 // check assignement to self
107 if (this == &right) return *this;
109 AliFatal("Assignement operator not provided.");
114 //_____________________________________________________________________________
116 AliMpTriggerSegmentation::CreateIterator(const AliMpArea&) const
119 // Returns an iterator to loop over the pad contained within given area.
120 // Not implemented for trigger.
125 //_____________________________________________________________________________
127 AliMpTriggerSegmentation::Dimensions() const
129 return Slat()->Dimensions();
132 //_____________________________________________________________________________
134 AliMpTriggerSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
136 Slat()->GetAllLocalBoardNumbers(ecn);
139 //_____________________________________________________________________________
141 AliMpTriggerSegmentation::GetName() const
143 // Name of that segmentation = TriggerSegmentation + slatName
144 TString name("TriggerSegmentation");
148 name += fkSlat->GetName();
153 //_____________________________________________________________________________
155 AliMpTriggerSegmentation::HasPad(const AliMpIntPair& indices) const
158 // Test if this slat has a pad located at the position referenced
159 // by the integer indices.
162 return PadByIndices(indices,kFALSE) != AliMpPad::Invalid();
165 //_____________________________________________________________________________
167 AliMpTriggerSegmentation::MaxPadIndexX() const
170 // Returns the value of the largest pad index in x-direction.
173 return fkSlat->GetNofPadsX()-1;
176 //_____________________________________________________________________________
178 AliMpTriggerSegmentation::MaxPadIndexY() const
181 // Returns the value of the largest pad index in y-direction.
184 return fkSlat->GetMaxNofPadsY()-1;
187 //_____________________________________________________________________________
189 AliMpTriggerSegmentation::PadByLocation(const AliMpIntPair& location,
190 Bool_t warning) const
193 // Returns the pad specified by its location, where location is the
194 // pair (ManuID,ManuChannel).
195 // If warning=kTRUE and the pad does not exist, a warning message is
198 // AliMpPad::Invalid() is returned if there's no pad at the given location.
203 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
205 const AliMpSlat* slat = fkSlat->GetLayer(i);
206 AliMpSlatSegmentation seg(slat);
207 AliMpPad pi = seg.PadByLocation(location,kFALSE);
210 if ( !pad.IsValid() )
212 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
213 pad.AddLocation(pi.GetLocation());
217 pad.AddLocation(pi.GetLocation());
221 if ( warning && !pad.IsValid() )
223 AliWarning(Form("No pad found at location (%d,%d)",location.GetFirst(),
224 location.GetSecond()));
229 //_____________________________________________________________________________
231 AliMpTriggerSegmentation::PadByIndices(const AliMpIntPair& indices,
232 Bool_t warning) const
235 // Returns the pad specified by its integer indices.
236 // If warning=kTRUE and the pad does not exist, a warning message is
239 // AliMpPad::Invalid() is returned if there's no pad at the given location.
246 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
248 const AliMpSlat* slat = fkSlat->GetLayer(i);
249 AliMpSlatSegmentation seg(slat);
250 AliMpPad pi = seg.PadByIndices(indices,kFALSE);
253 if ( !pad.IsValid() )
255 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
256 pad.AddLocation(pi.GetLocation());
260 pad.AddLocation(pi.GetLocation());
264 if ( warning && !pad.IsValid() )
266 AliWarning(Form("No pad found at indices (%d,%d)",indices.GetFirst(),
267 indices.GetSecond()));
273 //_____________________________________________________________________________
275 AliMpTriggerSegmentation::PadByPosition(const TVector2& position,
276 Bool_t warning) const
279 // Returns the pad specified by its (floating point) position.
280 // If warning=kTRUE and the pad does not exist, a warning message is
283 // AliMpPad::Invalid() is returned if there's no pad at the given location.
288 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
290 const AliMpSlat* slat = fkSlat->GetLayer(i);
291 AliMpSlatSegmentation seg(slat);
292 AliMpPad pi = seg.PadByPosition(position,kFALSE);
295 if ( !pad.IsValid() )
297 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
298 pad.AddLocation(pi.GetLocation());
302 pad.AddLocation(pi.GetLocation());
306 if ( warning && !pad.IsValid() )
308 AliWarning(Form("No pad found at position (%e,%e)",position.X(),
315 //_____________________________________________________________________________
317 AliMpTriggerSegmentation::PlaneType() const
319 return Slat()->PlaneType();
322 //_____________________________________________________________________________
324 AliMpTriggerSegmentation::Slat() const
327 // Returns the pointer to the referenced slat.