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.
106 AliError("Not implemented for trigger");
110 //_____________________________________________________________________________
112 AliMpTriggerSegmentation::CreateIterator() const
115 /// Returns an iterator to loop over all the pads
116 /// Not implemented for trigger.
117 AliError("Not implemented for trigger");
122 //_____________________________________________________________________________
124 AliMpTriggerSegmentation::GetNeighbours(const AliMpPad& /*pad*/,
125 TObjArray& /*neighbours*/,
126 Bool_t /*includeSelf*/,
127 Bool_t /*includeVoid*/) const
130 AliError("Not implemented for trigger");
134 //_____________________________________________________________________________
136 AliMpTriggerSegmentation::Dimensions() const
138 /// Return dimensions
140 return Slat()->Dimensions();
143 //_____________________________________________________________________________
145 AliMpTriggerSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
147 /// Fill the array ecn with all manuIds
149 Slat()->GetAllLocalBoardNumbers(ecn);
152 //_____________________________________________________________________________
154 AliMpTriggerSegmentation::GetName() const
156 /// Name of that segmentation = TriggerSegmentation + slatName
157 TString name("TriggerSegmentation");
161 name += fkSlat->GetName();
166 //_____________________________________________________________________________
168 AliMpTriggerSegmentation::HasPad(const AliMpIntPair& indices) const
171 /// Test if this slat has a pad located at the position referenced
172 /// by the integer indices.
175 return PadByIndices(indices,kFALSE) != AliMpPad::Invalid();
178 //_____________________________________________________________________________
180 AliMpTriggerSegmentation::MaxPadIndexX() const
183 /// Returns the value of the largest pad index in x-direction.
186 return fkSlat->GetNofPadsX()-1;
189 //_____________________________________________________________________________
191 AliMpTriggerSegmentation::MaxPadIndexY() const
194 /// Returns the value of the largest pad index in y-direction.
197 return fkSlat->GetMaxNofPadsY()-1;
200 //_____________________________________________________________________________
202 AliMpTriggerSegmentation::PadByLocation(const AliMpIntPair& location,
203 Bool_t warning) const
206 /// Returns the pad specified by its location, where location is the
207 /// pair (ManuID,ManuChannel).
208 /// If warning=kTRUE and the pad does not exist, a warning message is
211 /// AliMpPad::Invalid() is returned if there's no pad at the given location.
216 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
218 AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i);
219 AliMpPad pi = seg->PadByLocation(location,kFALSE);
222 if ( !pad.IsValid() )
224 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
225 pad.AddLocation(pi.GetLocation());
229 pad.AddLocation(pi.GetLocation());
233 if ( warning && !pad.IsValid() )
235 AliWarning(Form("No pad found at location (%d,%d)",location.GetFirst(),
236 location.GetSecond()));
241 //_____________________________________________________________________________
243 AliMpTriggerSegmentation::PadByIndices(const AliMpIntPair& indices,
244 Bool_t warning) const
247 /// Returns the pad specified by its integer indices.
248 /// If warning=kTRUE and the pad does not exist, a warning message is
251 /// AliMpPad::Invalid() is returned if there's no pad at the given location.
258 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
260 AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i);
261 AliMpPad pi = seg->PadByIndices(indices,kFALSE);
264 if ( !pad.IsValid() )
266 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
267 pad.AddLocation(pi.GetLocation());
271 pad.AddLocation(pi.GetLocation());
275 if ( warning && !pad.IsValid() )
277 AliWarning(Form("No pad found at indices (%d,%d)",indices.GetFirst(),
278 indices.GetSecond()));
284 //_____________________________________________________________________________
286 AliMpTriggerSegmentation::PadByPosition(const TVector2& position,
287 Bool_t warning) const
290 /// Returns the pad specified by its (floating point) position.
291 /// If warning=kTRUE and the pad does not exist, a warning message is
294 /// AliMpPad::Invalid() is returned if there's no pad at the given location.
299 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
301 AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i);
302 AliMpPad pi = seg->PadByPosition(position,kFALSE);
305 if ( !pad.IsValid() )
307 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
308 pad.AddLocation(pi.GetLocation());
312 pad.AddLocation(pi.GetLocation());
316 if ( warning && !pad.IsValid() )
318 AliWarning(Form("No pad found at position (%e,%e)",position.X(),
325 //_____________________________________________________________________________
327 AliMpTriggerSegmentation::PlaneType() const
329 /// Return plane type
331 return Slat()->PlaneType();
334 //_____________________________________________________________________________
336 AliMpTriggerSegmentation::Slat() const
339 /// Returns the pointer to the referenced slat.