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.7 2006/05/24 13:58:52 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 "AliMpTrigger.h"
31 /// \class AliMpTriggerSegmentation
33 /// Implementation of AliMpVSegmentation for trigger slats.
35 /// \todo Implement CreateIterator method, if needed.
37 /// \author Laurent Aphecetche
40 ClassImp(AliMpTriggerSegmentation)
43 //_____________________________________________________________________________
44 AliMpTriggerSegmentation::AliMpTriggerSegmentation()
45 : AliMpVSegmentation(),
51 // Default ctor. Not to be used really.
53 AliDebug(1,Form("this=%p Empty ctor",this));
56 //_____________________________________________________________________________
57 AliMpTriggerSegmentation::AliMpTriggerSegmentation(
58 const AliMpTrigger* slat, Bool_t own)
59 : AliMpVSegmentation(),
67 AliDebug(1,Form("this=%p Normal ctor slat=%p",this,slat));
69 // Compute the number of strips.
70 // We have to loop over all possible pads, in order to properly take
71 // into account the fact that a given strip might be part of several
72 // layer. Otherwise we would double count pads.
75 for ( Int_t ix = 0; ix <= MaxPadIndexX(); ++ix )
77 for ( Int_t iy = 0; iy <= MaxPadIndexY(); ++iy )
79 if ( HasPad(AliMpIntPair(ix,iy)) )
87 //_____________________________________________________________________________
88 AliMpTriggerSegmentation::~AliMpTriggerSegmentation()
94 if ( fIsOwner ) delete fkSlat;
96 AliDebug(1,Form("this=%p",this));
99 //_____________________________________________________________________________
101 AliMpTriggerSegmentation::CreateIterator(const AliMpArea&) const
104 // Returns an iterator to loop over the pad contained within given area.
105 // Not implemented for trigger.
110 //_____________________________________________________________________________
112 AliMpTriggerSegmentation::Dimensions() const
114 return Slat()->Dimensions();
117 //_____________________________________________________________________________
119 AliMpTriggerSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
121 Slat()->GetAllLocalBoardNumbers(ecn);
124 //_____________________________________________________________________________
126 AliMpTriggerSegmentation::GetName() const
128 // Name of that segmentation = TriggerSegmentation + slatName
129 TString name("TriggerSegmentation");
133 name += fkSlat->GetName();
138 //_____________________________________________________________________________
140 AliMpTriggerSegmentation::HasPad(const AliMpIntPair& indices) const
143 // Test if this slat has a pad located at the position referenced
144 // by the integer indices.
147 return PadByIndices(indices,kFALSE) != AliMpPad::Invalid();
150 //_____________________________________________________________________________
152 AliMpTriggerSegmentation::MaxPadIndexX() const
155 // Returns the value of the largest pad index in x-direction.
158 return fkSlat->GetNofPadsX()-1;
161 //_____________________________________________________________________________
163 AliMpTriggerSegmentation::MaxPadIndexY() const
166 // Returns the value of the largest pad index in y-direction.
169 return fkSlat->GetMaxNofPadsY()-1;
172 //_____________________________________________________________________________
174 AliMpTriggerSegmentation::PadByLocation(const AliMpIntPair& location,
175 Bool_t warning) const
178 // Returns the pad specified by its location, where location is the
179 // pair (ManuID,ManuChannel).
180 // If warning=kTRUE and the pad does not exist, a warning message is
183 // AliMpPad::Invalid() is returned if there's no pad at the given location.
188 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
190 AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i);
191 AliMpPad pi = seg->PadByLocation(location,kFALSE);
194 if ( !pad.IsValid() )
196 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
197 pad.AddLocation(pi.GetLocation());
201 pad.AddLocation(pi.GetLocation());
205 if ( warning && !pad.IsValid() )
207 AliWarning(Form("No pad found at location (%d,%d)",location.GetFirst(),
208 location.GetSecond()));
213 //_____________________________________________________________________________
215 AliMpTriggerSegmentation::PadByIndices(const AliMpIntPair& indices,
216 Bool_t warning) const
219 // Returns the pad specified by its integer indices.
220 // If warning=kTRUE and the pad does not exist, a warning message is
223 // AliMpPad::Invalid() is returned if there's no pad at the given location.
230 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
232 AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i);
233 AliMpPad pi = seg->PadByIndices(indices,kFALSE);
236 if ( !pad.IsValid() )
238 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
239 pad.AddLocation(pi.GetLocation());
243 pad.AddLocation(pi.GetLocation());
247 if ( warning && !pad.IsValid() )
249 AliWarning(Form("No pad found at indices (%d,%d)",indices.GetFirst(),
250 indices.GetSecond()));
256 //_____________________________________________________________________________
258 AliMpTriggerSegmentation::PadByPosition(const TVector2& position,
259 Bool_t warning) const
262 // Returns the pad specified by its (floating point) position.
263 // If warning=kTRUE and the pad does not exist, a warning message is
266 // AliMpPad::Invalid() is returned if there's no pad at the given location.
271 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
273 AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i);
274 AliMpPad pi = seg->PadByPosition(position,kFALSE);
277 if ( !pad.IsValid() )
279 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
280 pad.AddLocation(pi.GetLocation());
284 pad.AddLocation(pi.GetLocation());
288 if ( warning && !pad.IsValid() )
290 AliWarning(Form("No pad found at position (%e,%e)",position.X(),
297 //_____________________________________________________________________________
299 AliMpTriggerSegmentation::PlaneType() const
301 return Slat()->PlaneType();
304 //_____________________________________________________________________________
306 AliMpTriggerSegmentation::Slat() const
309 // Returns the pointer to the referenced slat.