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"
30 //-----------------------------------------------------------------------------
31 /// \class AliMpTriggerSegmentation
33 /// Implementation of AliMpVSegmentation for trigger slats.
35 /// \todo Implement CreateIterator method, if needed.
37 /// \author Laurent Aphecetche
38 //-----------------------------------------------------------------------------
41 ClassImp(AliMpTriggerSegmentation)
44 //_____________________________________________________________________________
45 AliMpTriggerSegmentation::AliMpTriggerSegmentation()
46 : AliMpVSegmentation(),
52 /// Default ctor. Not to be used really.
54 AliDebug(1,Form("this=%p Empty ctor",this));
57 //_____________________________________________________________________________
58 AliMpTriggerSegmentation::AliMpTriggerSegmentation(
59 const AliMpTrigger* slat, Bool_t own)
60 : AliMpVSegmentation(),
68 AliDebug(1,Form("this=%p Normal ctor slat=%p",this,slat));
70 // Compute the number of strips.
71 // We have to loop over all possible pads, in order to properly take
72 // into account the fact that a given strip might be part of several
73 // layer. Otherwise we would double count pads.
76 for ( Int_t ix = 0; ix <= MaxPadIndexX(); ++ix )
78 for ( Int_t iy = 0; iy <= MaxPadIndexY(); ++iy )
80 if ( HasPad(AliMpIntPair(ix,iy)) )
88 //_____________________________________________________________________________
89 AliMpTriggerSegmentation::~AliMpTriggerSegmentation()
95 if ( fIsOwner ) delete fkSlat;
97 AliDebug(1,Form("this=%p",this));
100 //_____________________________________________________________________________
102 AliMpTriggerSegmentation::CreateIterator(const AliMpArea&) const
105 /// Returns an iterator to loop over the pad contained within given area.
106 /// Not implemented for trigger.
107 AliError("Not implemented for trigger");
111 //_____________________________________________________________________________
113 AliMpTriggerSegmentation::CreateIterator() const
116 /// Returns an iterator to loop over all the pads
117 /// Not implemented for trigger.
118 AliError("Not implemented for trigger");
123 //_____________________________________________________________________________
125 AliMpTriggerSegmentation::GetNeighbours(const AliMpPad& /*pad*/,
126 TObjArray& /*neighbours*/,
127 Bool_t /*includeSelf*/,
128 Bool_t /*includeVoid*/) const
131 AliError("Not implemented for trigger");
135 //_____________________________________________________________________________
137 AliMpTriggerSegmentation::Dimensions() const
139 /// Return dimensions
141 return Slat()->Dimensions();
144 //_____________________________________________________________________________
146 AliMpTriggerSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
148 /// Fill the array ecn with all manuIds
150 Slat()->GetAllLocalBoardNumbers(ecn);
153 //_____________________________________________________________________________
155 AliMpTriggerSegmentation::GetName() const
157 /// Name of that segmentation = TriggerSegmentation + slatName
158 TString name("TriggerSegmentation");
162 name += fkSlat->GetName();
167 //_____________________________________________________________________________
169 AliMpTriggerSegmentation::HasPad(const AliMpIntPair& indices) const
172 /// Test if this slat has a pad located at the position referenced
173 /// by the integer indices.
176 return PadByIndices(indices,kFALSE) != AliMpPad::Invalid();
179 //_____________________________________________________________________________
181 AliMpTriggerSegmentation::MaxPadIndexX() const
184 /// Returns the value of the largest pad index in x-direction.
187 return fkSlat->GetNofPadsX()-1;
190 //_____________________________________________________________________________
192 AliMpTriggerSegmentation::MaxPadIndexY() const
195 /// Returns the value of the largest pad index in y-direction.
198 return fkSlat->GetMaxNofPadsY()-1;
201 //_____________________________________________________________________________
203 AliMpTriggerSegmentation::PadByLocation(const AliMpIntPair& location,
204 Bool_t warning) const
207 /// Returns the pad specified by its location, where location is the
208 /// pair (ManuID,ManuChannel).
209 /// If warning=kTRUE and the pad does not exist, a warning message is
212 /// AliMpPad::Invalid() is returned if there's no pad at the given location.
217 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
219 AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i);
220 AliMpPad pi = seg->PadByLocation(location,kFALSE);
223 if ( !pad.IsValid() )
225 // uses PadByIndices to get the complete list of locations
226 return PadByIndices(pi.GetIndices(),warning);
230 if ( warning && !pad.IsValid() )
232 AliWarning(Form("No pad found at location (%d,%d)",location.GetFirst(),
233 location.GetSecond()));
238 //_____________________________________________________________________________
240 AliMpTriggerSegmentation::PadByIndices(const AliMpIntPair& indices,
241 Bool_t warning) const
244 /// Returns the pad specified by its integer indices.
245 /// If warning=kTRUE and the pad does not exist, a warning message is
248 /// AliMpPad::Invalid() is returned if there's no pad at the given location.
255 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
257 AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i);
258 AliMpPad pi = seg->PadByIndices(indices,kFALSE);
261 if ( !pad.IsValid() )
263 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
264 pad.AddLocation(pi.GetLocation());
268 pad.AddLocation(pi.GetLocation());
272 if ( warning && !pad.IsValid() )
274 AliWarning(Form("No pad found at indices (%d,%d)",indices.GetFirst(),
275 indices.GetSecond()));
281 //_____________________________________________________________________________
283 AliMpTriggerSegmentation::PadByPosition(const TVector2& position,
284 Bool_t warning) const
287 /// Returns the pad specified by its (floating point) position.
288 /// If warning=kTRUE and the pad does not exist, a warning message is
291 /// AliMpPad::Invalid() is returned if there's no pad at the given location.
296 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
298 AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i);
299 AliMpPad pi = seg->PadByPosition(position,kFALSE);
302 if ( !pad.IsValid() )
304 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
305 pad.AddLocation(pi.GetLocation());
309 pad.AddLocation(pi.GetLocation());
313 if ( warning && !pad.IsValid() )
315 AliWarning(Form("No pad found at position (%e,%e)",position.X(),
322 //_____________________________________________________________________________
324 AliMpTriggerSegmentation::PlaneType() const
326 /// Return plane type
328 return Slat()->PlaneType();
331 //_____________________________________________________________________________
333 AliMpTriggerSegmentation::Slat() const
336 /// Returns the pointer to the referenced slat.