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 ( HasPadByIndices(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::GetDimensionX() const
139 /// Return slat x dimensions
140 return Slat()->GetDimensionX();
143 //_____________________________________________________________________________
145 AliMpTriggerSegmentation::GetDimensionY() const
147 /// Return slat y dimensions
148 return Slat()->GetDimensionY();
151 //_____________________________________________________________________________
153 AliMpTriggerSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
155 /// Fill the array ecn with all manuIds
157 Slat()->GetAllLocalBoardNumbers(ecn);
160 //_____________________________________________________________________________
162 AliMpTriggerSegmentation::GetName() const
164 /// Name of that segmentation = TriggerSegmentation + slatName
165 TString name("TriggerSegmentation");
169 name += fkSlat->GetName();
174 //_____________________________________________________________________________
176 AliMpTriggerSegmentation::MaxPadIndexX() const
179 /// Returns the value of the largest pad index in x-direction.
182 return fkSlat->GetNofPadsX()-1;
185 //_____________________________________________________________________________
187 AliMpTriggerSegmentation::MaxPadIndexY() const
190 /// Returns the value of the largest pad index in y-direction.
193 return fkSlat->GetMaxNofPadsY()-1;
196 //_____________________________________________________________________________
198 AliMpTriggerSegmentation::PadByLocation(Int_t manuId, Int_t manuChannel,
199 Bool_t warning) const
202 /// Returns the pad specified by its location, where location is the
203 /// pair (ManuID,ManuChannel).
204 /// If warning=kTRUE and the pad does not exist, a warning message is
207 /// AliMpPad::Invalid() is returned if there's no pad at the given location.
211 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
213 AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i);
214 AliMpPad pi = seg->PadByLocation(manuId,manuChannel,kFALSE);
217 if ( !pad.IsValid() )
219 // uses PadByIndices to get the complete list of locations
220 return PadByIndices(pi.GetIx(), pi.GetIy(), warning);
224 if ( warning && !pad.IsValid() )
226 AliWarning(Form("No pad found at location (%d,%d)", manuId, manuChannel));
231 //_____________________________________________________________________________
233 AliMpTriggerSegmentation::PadByIndices(Int_t ix, Int_t iy,
234 Bool_t warning) const
237 /// Returns the pad specified by its integer indices.
238 /// If warning=kTRUE and the pad does not exist, a warning message is
241 /// AliMpPad::Invalid() is returned if there's no pad at the given location.
247 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
249 AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i);
250 AliMpPad pi = seg->PadByIndices(ix,iy,kFALSE);
253 if ( !pad.IsValid() )
257 pi.GetPositionX(),pi.GetPositionY(),
258 pi.GetDimensionX(), pi.GetDimensionY());
259 pad.AddLocation(pi.GetManuId(), pi.GetManuChannel());
263 pad.AddLocation(pi.GetManuId(), pi.GetManuChannel());
267 if ( warning && !pad.IsValid() )
269 AliWarning(Form("No pad found at indices (%d,%d)",ix, iy));
275 //_____________________________________________________________________________
277 AliMpTriggerSegmentation::PadByPosition(Double_t x, Double_t y,
278 Bool_t warning) const
281 /// Returns the pad specified by its (floating point) position.
282 /// If warning=kTRUE and the pad does not exist, a warning message is
285 /// AliMpPad::Invalid() is returned if there's no pad at the given location.
289 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
291 AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i);
292 AliMpPad pi = seg->PadByPosition(x,y,kFALSE);
295 if ( !pad.IsValid() )
299 pi.GetPositionX(),pi.GetPositionY(),
300 pi.GetDimensionX(), pi.GetDimensionY());
301 pad.AddLocation(pi.GetManuId(), pi.GetManuChannel());
305 pad.AddLocation(pi.GetManuId(), pi.GetManuChannel());
309 if ( warning && !pad.IsValid() )
311 AliWarning(Form("No pad found at position (%e,%e)",x,y));
317 //_____________________________________________________________________________
319 AliMpTriggerSegmentation::PlaneType() const
321 /// Return plane type
323 return Slat()->PlaneType();
326 //_____________________________________________________________________________
328 AliMpTriggerSegmentation::Slat() const
331 /// Returns the pointer to the referenced slat.
337 //_____________________________________________________________________________
339 AliMpTriggerSegmentation::GetNofElectronicCards() const
341 /// Get the number of local board numbers
344 fkSlat->GetAllLocalBoardNumbers(ecn);
345 return ecn.GetSize();
348 //_____________________________________________________________________________
350 AliMpTriggerSegmentation::GetPositionX() const
352 /// Return x position of origin
353 return Slat()->GetPositionX();
356 //_____________________________________________________________________________
358 AliMpTriggerSegmentation::GetPositionY() const
360 /// Return y position of origin
361 return Slat()->GetPositionY();
364 //_____________________________________________________________________________
366 AliMpTriggerSegmentation::MotifPosition(Int_t /* manuId */) const
368 /// No implemented (yet ?)
369 AliError("Not implemented");
373 //_____________________________________________________________________________
375 AliMpTriggerSegmentation::HasMotifPosition(Int_t manuId) const
377 /// Uses default implementation
378 return AliMpVSegmentation::HasMotifPosition(manuId);