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 **************************************************************************/
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"
31 ClassImp(AliMpTriggerSegmentation)
33 //_____________________________________________________________________________
34 AliMpTriggerSegmentation::AliMpTriggerSegmentation()
35 : AliMpVSegmentation(),
39 // Default ctor. Not to be used really.
41 AliDebug(1,Form("this=%p Empty ctor",this));
44 //_____________________________________________________________________________
45 AliMpTriggerSegmentation::AliMpTriggerSegmentation(const AliMpTrigger* slat)
46 : AliMpVSegmentation(),
52 AliDebug(1,Form("this=%p Normal ctor slat=%p",this,slat));
55 //_____________________________________________________________________________
56 AliMpTriggerSegmentation::~AliMpTriggerSegmentation()
61 AliDebug(1,Form("this=%p",this));
64 //_____________________________________________________________________________
66 AliMpTriggerSegmentation::CreateIterator(const AliMpArea&) const
69 // Returns an iterator to loop over the pad contained within given area.
70 // Not implemented for trigger.
75 //_____________________________________________________________________________
77 AliMpTriggerSegmentation::GetName() const
79 TString name("TriggerSegmentation");
83 name += fkSlat->GetName();
88 //_____________________________________________________________________________
90 AliMpTriggerSegmentation::HasPad(const AliMpIntPair& indices) const
93 // Test if this slat has a pad located at the position referenced
94 // by the integer indices.
97 return PadByIndices(indices,kFALSE) != AliMpPad::Invalid();
100 //_____________________________________________________________________________
102 AliMpTriggerSegmentation::MaxPadIndexX()
105 // Returns the value of the largest pad index in x-direction.
108 return fkSlat->GetNofPadsX()-1;
111 //_____________________________________________________________________________
113 AliMpTriggerSegmentation::MaxPadIndexY()
116 // Returns the value of the largest pad index in y-direction.
119 return fkSlat->GetMaxNofPadsY()-1;
122 //_____________________________________________________________________________
124 AliMpTriggerSegmentation::PadByLocation(const AliMpIntPair& location,
125 Bool_t warning) const
128 // Returns the pad specified by its location, where location is the
129 // pair (ManuID,ManuChannel).
130 // If warning=kTRUE and the pad does not exist, a warning message is
133 // AliMpPad::Invalid() is returned if there's no pad at the given location.
138 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
140 const AliMpSlat* slat = fkSlat->GetLayer(i);
141 AliMpSlatSegmentation seg(slat);
142 AliMpPad p_i = seg.PadByLocation(location,kFALSE);
145 if ( !pad.IsValid() )
147 pad = AliMpPad(invloc,p_i.GetIndices(),p_i.Position(),p_i.Dimensions());
148 pad.AddLocation(p_i.GetLocation());
152 pad.AddLocation(p_i.GetLocation());
156 if ( warning && !pad.IsValid() )
158 AliWarning(Form("No pad found at location (%d,%d)",location.GetFirst(),
159 location.GetSecond()));
164 //_____________________________________________________________________________
166 AliMpTriggerSegmentation::PadByIndices(const AliMpIntPair& indices,
167 Bool_t warning) const
170 // Returns the pad specified by its integer indices.
171 // If warning=kTRUE and the pad does not exist, a warning message is
174 // AliMpPad::Invalid() is returned if there's no pad at the given location.
181 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
183 const AliMpSlat* slat = fkSlat->GetLayer(i);
184 AliMpSlatSegmentation seg(slat);
185 AliMpPad p_i = seg.PadByIndices(indices,kFALSE);
188 if ( !pad.IsValid() )
190 pad = AliMpPad(invloc,p_i.GetIndices(),p_i.Position(),p_i.Dimensions());
191 pad.AddLocation(p_i.GetLocation());
195 pad.AddLocation(p_i.GetLocation());
199 if ( warning && !pad.IsValid() )
201 AliWarning(Form("No pad found at indices (%d,%d)",indices.GetFirst(),
202 indices.GetSecond()));
208 //_____________________________________________________________________________
210 AliMpTriggerSegmentation::PadByPosition(const TVector2& position,
211 Bool_t warning) const
214 // Returns the pad specified by its (floating point) position.
215 // If warning=kTRUE and the pad does not exist, a warning message is
218 // AliMpPad::Invalid() is returned if there's no pad at the given location.
223 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
225 const AliMpSlat* slat = fkSlat->GetLayer(i);
226 AliMpSlatSegmentation seg(slat);
227 AliMpPad p_i = seg.PadByPosition(position,kFALSE);
230 if ( !pad.IsValid() )
232 pad = AliMpPad(invloc,p_i.GetIndices(),p_i.Position(),p_i.Dimensions());
233 pad.AddLocation(p_i.GetLocation());
237 pad.AddLocation(p_i.GetLocation());
241 if ( warning && !pad.IsValid() )
243 AliWarning(Form("No pad found at position (%e,%e)",position.X(),
250 //_____________________________________________________________________________
252 AliMpTriggerSegmentation::Slat() const
255 // Returns the pointer to the referenced slat.