AliMpSlat::AliMpSlat()
: TObject(),
fId(""),
+ fPlaneType(kNonBendingPlane),
fDX(0),
fDY(0),
fNofPadsX(0),
- fMaxNofPadsY(0)
+ fMaxNofPadsY(0),
+ fManuMap()
{
//
// Empty ctor.
}
//_____________________________________________________________________________
-AliMpSlat::AliMpSlat(const char* id)
+AliMpSlat::AliMpSlat(const char* id, AliMpPlaneType bendingOrNonBending)
: TObject(),
fId(id),
+ fPlaneType(bendingOrNonBending),
fDX(0),
fDY(0),
fNofPadsX(0),
- fMaxNofPadsY(0)
+ fMaxNofPadsY(0),
+ fManuMap(kTRUE)
{
//
// Normal ctor
{
ixOffset = GetPCB(GetSize()-1)->Ixmax()+1;
}
+ else
+ {
+ ixOffset = pcbType->Ixmin();
+ }
Double_t xOffset = DX()*2;
AliMpPCB* pcb = pcbType->Clone(manuList,ixOffset,xOffset);
#ifdef WITH_ROOT
#else
fPCBs.push_back(pcb);
#endif
- fDY = pcb->DY();
+ fDY = TMath::Max(pcb->DY(),fDY);
fDX += pcb->DX();
fNofPadsX += pcb->GetNofPadsX();
fMaxNofPadsY = std::max(fMaxNofPadsY,pcb->GetNofPadsY());
Int_t manuID = mp->GetID();
// Before inserting a new key, check if it's already there
#ifdef WITH_ROOT
- Long_t there = fManuMap.GetValue((Long_t)manuID);
+ TObject* there = fManuMap.GetValue(manuID);
if ( there == 0 )
{
- fManuMap.Add((Long_t)manuID,(Long_t)mp);
+ fManuMap.Add(manuID,(TObject*)mp);
}
else
{
fManuMap[manuID] = mp;
#endif
}
+ fPosition.Set(DX(),DY());
}
//_____________________________________________________________________________
// Returns the motifPosition referenced by it manuID
//
#ifdef WITH_ROOT
- Long_t rv = fManuMap.GetValue((Long_t)manuID);
+ TObject* rv = fManuMap.GetValue(manuID);
if ( rv )
{
return (AliMpMotifPosition*)(rv);
return -1;
}
+//_____________________________________________________________________________
+void
+AliMpSlat::ForcePosition(const TVector2& pos)
+{
+ //
+ // Force the position to be different from (DX(),DY()).
+ // Normally only used by triggerSlats (for layers).
+ // Beware that this method must be called once all PCB have been added,
+ // as the Add() method resets the position.
+ //
+ fPosition = pos;
+}
+
+//_____________________________________________________________________________
+void
+AliMpSlat::GetAllElectronicCardNumbers(TArrayI& ecn) const
+{
+ ecn.Set(GetNofElectronicCards());
+ TExMapIter it(fManuMap.GetIterator());
+ Long_t key;
+ Long_t value;
+ Int_t n(0);
+ while ( it.Next(key,value) == kTRUE )
+ {
+ ecn.AddAt((Int_t)(key),n);
+ ++n;
+ }
+}
+
//_____________________________________________________________________________
const char*
AliMpSlat::GetID() const
return fMaxNofPadsY;
}
+//_____________________________________________________________________________
+const char*
+AliMpSlat::GetName() const
+{
+ TString name(GetID());
+ if ( fPlaneType == kBendingPlane )
+ {
+ name += ".Bending";
+ }
+ else if ( fPlaneType == kNonBendingPlane )
+ {
+ name += ".NonBending";
+ }
+ else
+ {
+ name += ".Invalid";
+ }
+ return name.Data();
+}
+
+//_____________________________________________________________________________
+Int_t
+AliMpSlat::GetNofElectronicCards() const
+{
+ return fManuMap.GetSize();
+}
+
//_____________________________________________________________________________
Int_t
AliMpSlat::GetNofPadsX() const
#endif
}
+//_____________________________________________________________________________
+TVector2
+AliMpSlat::Position() const
+{
+ return fPosition;
+}
+
//_____________________________________________________________________________
void
AliMpSlat::Print(Option_t* option) const
// Prints the slat characteristics.
//
cout << "SLAT " << GetID() << " 1/2 DIM = (" << DX() << "," << DY() << ")"
- << " NPADSX = " << GetNofPadsX() << " NPCBs=" << GetSize() << endl;
+ << " POS = " << Position().X() << "," << Position().Y()
+ << " NPADSX = " << GetNofPadsX()
+ << " MAXNPADSY = " << GetMaxNofPadsY()
+ << " NPCBs=" << GetSize() << endl;
+
+ TString soption(option);
- if ( option && option[0] == 'P' )
+ if ( soption.Contains("P") )
{
for ( Size_t i = 0; i < GetSize() ; ++i )
{
}
}
}
+
+ if ( soption.Contains("M") || soption.Contains("L") )
+ {
+ cout << fManuMap.GetSize() << " ";
+ cout << "Electronic card (manu or local board) Ids : ";
+
+ TExMapIter iter(fManuMap.GetIterator());
+ Long_t key, value;
+ while ( iter.Next(key,value) )
+ {
+ cout << key << " ";
+ }
+ cout << endl;
+ }
}
#include <TObject.h>
#ifndef ROOT_TString
-#include "TString.h"
+# include "TString.h"
+#endif
+
+#ifndef ALI_MP_PAD_H
+# include "AliMpPad.h"
#endif
#ifndef ALI_MP_V_SEGMENTATION_H
-#include "AliMpVSegmentation.h"
+# include "AliMpVSegmentation.h"
#endif
-#ifndef ALI_MP_PAD_H
-#include "AliMpPad.h"
+#ifndef ALI_MP_PLANE_TYPE_H
+# include "AliMpPlaneType.h"
#endif
#include "AliMpContainers.h"
class TArrayI;
#ifdef WITH_ROOT
-# include "TExMap.h"
+# include "AliMpExMap.h"
# include "TObjArray.h"
#else
# include <vector>
class AliMpMotifPosition;
class AliMpPCB;
+class TArrayI;
class AliMpSlat : public TObject
{
#endif
AliMpSlat();
- AliMpSlat(const char* id);
+ AliMpSlat(const char* id, AliMpPlaneType bendingOrNonBending);
virtual ~AliMpSlat();
TVector2 Dimensions() const;
-
+ TVector2 Position() const;
+
+ const char* GetName() const;
+
const char* GetID() const;
void Add(AliMpPCB* pcbType, const TArrayI& manuList);
/// Returns the MotifPosition containing the pad located at (ix,iy).
AliMpMotifPosition* FindMotifPosition(Int_t ix, Int_t iy) const;
- /// Returns the number of PCBs of this slat.
- Size_t GetSize() const;
-
+ /// Return the ids of the electronic cards (either manu or local board).
+ void GetAllElectronicCardNumbers(TArrayI& ecn) const;
+
+ /** Returns the max. number of pads in the x-direction contained in this slat.
+ This is a max only as for e.g. non-bending slats, the y-dimension depends
+ on the x-position.
+ */
+ Int_t GetMaxNofPadsY() const;
+
+ /// Return the number of electronic cards (either manu or local board).
+ Int_t GetNofElectronicCards() const;
+
/// Returns the number of pads in the x-direction contained in this slat.
Int_t GetNofPadsX() const;
- /** Returns the max. number of pads in the x-direction contained in this slat.
- This is a max only as for e.g. non-bending slats, the y-dimension depends
- on the x-position.
- */
- Int_t GetMaxNofPadsY() const;
-
+ /// Returns the number of PCBs of this slat.
+ Size_t GetSize() const;
+
void Print(Option_t* option="") const;
+ /** This is normally only used by triggerSlats, as for ST345 slats,
+ the position is DX(),DY() simply.
+ */
+ void ForcePosition(const TVector2& pos);
+
private:
TString fId;
+ AliMpPlaneType fPlaneType;
Double_t fDX;
Double_t fDY;
Int_t fNofPadsX;
Int_t fMaxNofPadsY;
#ifdef WITH_ROOT
TObjArray fPCBs; // array of AliMpPCB*
- mutable TExMap fManuMap; // map of int to AliMpMotifPosition*
+ mutable AliMpExMap fManuMap; // map of int to AliMpMotifPosition*
#else
std::vector<AliMpPCB*> fPCBs;
std::map<int,AliMpMotifPosition*> fManuMap;
#endif
+ TVector2 fPosition;
ClassDef(AliMpSlat,1) // A slat for stations 3,4,5
};