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 "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
41 ClassImp(AliMpTriggerSegmentation)
44 //_____________________________________________________________________________
45 AliMpTriggerSegmentation::AliMpTriggerSegmentation()
46 : AliMpVSegmentation(),
51 // Default ctor. Not to be used really.
53 AliDebug(1,Form("this=%p Empty ctor",this));
56 //_____________________________________________________________________________
57 AliMpTriggerSegmentation::AliMpTriggerSegmentation(const AliMpTrigger* slat)
58 : AliMpVSegmentation(),
64 AliDebug(1,Form("this=%p Normal ctor slat=%p",this,slat));
66 // Compute the number of strips.
67 // We have to loop over all possible pads, in order to properly take
68 // into account the fact that a given strip might be part of several
69 // layer. Otherwise we would double count pads.
72 for ( Int_t ix = 0; ix <= MaxPadIndexX(); ++ix )
74 for ( Int_t iy = 0; iy <= MaxPadIndexY(); ++iy )
76 if ( HasPad(AliMpIntPair(ix,iy)) )
84 //______________________________________________________________________________
85 AliMpTriggerSegmentation::AliMpTriggerSegmentation(const AliMpTriggerSegmentation& right)
86 : AliMpVSegmentation(right)
88 /// Protected copy constructor (not implemented)
90 AliFatal("Copy constructor not provided.");
93 //_____________________________________________________________________________
94 AliMpTriggerSegmentation::~AliMpTriggerSegmentation()
99 AliDebug(1,Form("this=%p",this));
102 //______________________________________________________________________________
103 AliMpTriggerSegmentation&
104 AliMpTriggerSegmentation::operator=(const AliMpTriggerSegmentation& right)
106 /// Protected assignement operator (not implemented)
108 // check assignement to self
109 if (this == &right) return *this;
111 AliFatal("Assignement operator not provided.");
116 //_____________________________________________________________________________
118 AliMpTriggerSegmentation::CreateIterator(const AliMpArea&) const
121 // Returns an iterator to loop over the pad contained within given area.
122 // Not implemented for trigger.
127 //_____________________________________________________________________________
129 AliMpTriggerSegmentation::Dimensions() const
131 return Slat()->Dimensions();
134 //_____________________________________________________________________________
136 AliMpTriggerSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
138 Slat()->GetAllLocalBoardNumbers(ecn);
141 //_____________________________________________________________________________
143 AliMpTriggerSegmentation::GetName() const
145 // Name of that segmentation = TriggerSegmentation + slatName
146 TString name("TriggerSegmentation");
150 name += fkSlat->GetName();
155 //_____________________________________________________________________________
157 AliMpTriggerSegmentation::HasPad(const AliMpIntPair& indices) const
160 // Test if this slat has a pad located at the position referenced
161 // by the integer indices.
164 return PadByIndices(indices,kFALSE) != AliMpPad::Invalid();
167 //_____________________________________________________________________________
169 AliMpTriggerSegmentation::MaxPadIndexX() const
172 // Returns the value of the largest pad index in x-direction.
175 return fkSlat->GetNofPadsX()-1;
178 //_____________________________________________________________________________
180 AliMpTriggerSegmentation::MaxPadIndexY() const
183 // Returns the value of the largest pad index in y-direction.
186 return fkSlat->GetMaxNofPadsY()-1;
189 //_____________________________________________________________________________
191 AliMpTriggerSegmentation::PadByLocation(const AliMpIntPair& location,
192 Bool_t warning) const
195 // Returns the pad specified by its location, where location is the
196 // pair (ManuID,ManuChannel).
197 // If warning=kTRUE and the pad does not exist, a warning message is
200 // AliMpPad::Invalid() is returned if there's no pad at the given location.
205 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
207 const AliMpSlat* slat = fkSlat->GetLayer(i);
208 AliMpSlatSegmentation seg(slat);
209 AliMpPad pi = seg.PadByLocation(location,kFALSE);
212 if ( !pad.IsValid() )
214 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
215 pad.AddLocation(pi.GetLocation());
219 pad.AddLocation(pi.GetLocation());
223 if ( warning && !pad.IsValid() )
225 AliWarning(Form("No pad found at location (%d,%d)",location.GetFirst(),
226 location.GetSecond()));
231 //_____________________________________________________________________________
233 AliMpTriggerSegmentation::PadByIndices(const AliMpIntPair& indices,
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.
248 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
250 const AliMpSlat* slat = fkSlat->GetLayer(i);
251 AliMpSlatSegmentation seg(slat);
252 AliMpPad pi = seg.PadByIndices(indices,kFALSE);
255 if ( !pad.IsValid() )
257 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
258 pad.AddLocation(pi.GetLocation());
262 pad.AddLocation(pi.GetLocation());
266 if ( warning && !pad.IsValid() )
268 AliWarning(Form("No pad found at indices (%d,%d)",indices.GetFirst(),
269 indices.GetSecond()));
275 //_____________________________________________________________________________
277 AliMpTriggerSegmentation::PadByPosition(const TVector2& position,
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.
290 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
292 const AliMpSlat* slat = fkSlat->GetLayer(i);
293 AliMpSlatSegmentation seg(slat);
294 AliMpPad pi = seg.PadByPosition(position,kFALSE);
297 if ( !pad.IsValid() )
299 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
300 pad.AddLocation(pi.GetLocation());
304 pad.AddLocation(pi.GetLocation());
308 if ( warning && !pad.IsValid() )
310 AliWarning(Form("No pad found at position (%e,%e)",position.X(),
317 //_____________________________________________________________________________
319 AliMpTriggerSegmentation::PlaneType() const
321 return Slat()->PlaneType();
324 //_____________________________________________________________________________
326 AliMpTriggerSegmentation::Slat() const
329 // Returns the pointer to the referenced slat.