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(),
65 AliDebug(1,Form("this=%p Normal ctor slat=%p",this,slat));
67 // Compute the number of strips.
68 // We have to loop over all possible pads, in order to properly take
69 // into account the fact that a given strip might be part of several
70 // layer. Otherwise we would double count pads.
73 for ( Int_t ix = 0; ix <= MaxPadIndexX(); ++ix )
75 for ( Int_t iy = 0; iy <= MaxPadIndexY(); ++iy )
77 if ( HasPad(AliMpIntPair(ix,iy)) )
85 //______________________________________________________________________________
86 AliMpTriggerSegmentation::AliMpTriggerSegmentation(const AliMpTriggerSegmentation& right)
87 : AliMpVSegmentation(right),
89 fNofStrips(right.fNofStrips)
91 /// Protected copy constructor (not implemented)
93 AliFatal("Copy constructor not provided.");
96 //_____________________________________________________________________________
97 AliMpTriggerSegmentation::~AliMpTriggerSegmentation()
102 AliDebug(1,Form("this=%p",this));
105 //______________________________________________________________________________
106 AliMpTriggerSegmentation&
107 AliMpTriggerSegmentation::operator=(const AliMpTriggerSegmentation& right)
109 /// Protected assignement operator (not implemented)
111 // check assignement to self
112 if (this == &right) return *this;
114 AliFatal("Assignement operator not provided.");
119 //_____________________________________________________________________________
121 AliMpTriggerSegmentation::CreateIterator(const AliMpArea&) const
124 // Returns an iterator to loop over the pad contained within given area.
125 // Not implemented for trigger.
130 //_____________________________________________________________________________
132 AliMpTriggerSegmentation::Dimensions() const
134 return Slat()->Dimensions();
137 //_____________________________________________________________________________
139 AliMpTriggerSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
141 Slat()->GetAllLocalBoardNumbers(ecn);
144 //_____________________________________________________________________________
146 AliMpTriggerSegmentation::GetName() const
148 // Name of that segmentation = TriggerSegmentation + slatName
149 TString name("TriggerSegmentation");
153 name += fkSlat->GetName();
158 //_____________________________________________________________________________
160 AliMpTriggerSegmentation::HasPad(const AliMpIntPair& indices) const
163 // Test if this slat has a pad located at the position referenced
164 // by the integer indices.
167 return PadByIndices(indices,kFALSE) != AliMpPad::Invalid();
170 //_____________________________________________________________________________
172 AliMpTriggerSegmentation::MaxPadIndexX() const
175 // Returns the value of the largest pad index in x-direction.
178 return fkSlat->GetNofPadsX()-1;
181 //_____________________________________________________________________________
183 AliMpTriggerSegmentation::MaxPadIndexY() const
186 // Returns the value of the largest pad index in y-direction.
189 return fkSlat->GetMaxNofPadsY()-1;
192 //_____________________________________________________________________________
194 AliMpTriggerSegmentation::PadByLocation(const AliMpIntPair& location,
195 Bool_t warning) const
198 // Returns the pad specified by its location, where location is the
199 // pair (ManuID,ManuChannel).
200 // If warning=kTRUE and the pad does not exist, a warning message is
203 // AliMpPad::Invalid() is returned if there's no pad at the given location.
208 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
210 const AliMpSlat* slat = fkSlat->GetLayer(i);
211 AliMpSlatSegmentation seg(slat);
212 AliMpPad pi = seg.PadByLocation(location,kFALSE);
215 if ( !pad.IsValid() )
217 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
218 pad.AddLocation(pi.GetLocation());
222 pad.AddLocation(pi.GetLocation());
226 if ( warning && !pad.IsValid() )
228 AliWarning(Form("No pad found at location (%d,%d)",location.GetFirst(),
229 location.GetSecond()));
234 //_____________________________________________________________________________
236 AliMpTriggerSegmentation::PadByIndices(const AliMpIntPair& indices,
237 Bool_t warning) const
240 // Returns the pad specified by its integer indices.
241 // If warning=kTRUE and the pad does not exist, a warning message is
244 // AliMpPad::Invalid() is returned if there's no pad at the given location.
251 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
253 const AliMpSlat* slat = fkSlat->GetLayer(i);
254 AliMpSlatSegmentation seg(slat);
255 AliMpPad pi = seg.PadByIndices(indices,kFALSE);
258 if ( !pad.IsValid() )
260 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
261 pad.AddLocation(pi.GetLocation());
265 pad.AddLocation(pi.GetLocation());
269 if ( warning && !pad.IsValid() )
271 AliWarning(Form("No pad found at indices (%d,%d)",indices.GetFirst(),
272 indices.GetSecond()));
278 //_____________________________________________________________________________
280 AliMpTriggerSegmentation::PadByPosition(const TVector2& position,
281 Bool_t warning) const
284 // Returns the pad specified by its (floating point) position.
285 // If warning=kTRUE and the pad does not exist, a warning message is
288 // AliMpPad::Invalid() is returned if there's no pad at the given location.
293 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
295 const AliMpSlat* slat = fkSlat->GetLayer(i);
296 AliMpSlatSegmentation seg(slat);
297 AliMpPad pi = seg.PadByPosition(position,kFALSE);
300 if ( !pad.IsValid() )
302 pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions());
303 pad.AddLocation(pi.GetLocation());
307 pad.AddLocation(pi.GetLocation());
311 if ( warning && !pad.IsValid() )
313 AliWarning(Form("No pad found at position (%e,%e)",position.X(),
320 //_____________________________________________________________________________
322 AliMpTriggerSegmentation::PlaneType() const
324 return Slat()->PlaneType();
327 //_____________________________________________________________________________
329 AliMpTriggerSegmentation::Slat() const
332 // Returns the pointer to the referenced slat.