+++ /dev/null
-// $Id$
-// Category: plane
-//
-// Class AliMpPlane
-// ----------------
-// Class represents the plane composed of 4 sector positions:
-// I. FS II. | I.
-// II. BS inverted in x _____ | ____
-// III. FS inverted in x, y |
-// IV. BS inverted in y III. | IV.
-//
-// FS - front sector
-// BS - back sector
-//
-// Included in AliRoot: 2003/05/02
-// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-
-#include <Riostream.h>
-#include <TError.h>
-
-#include "AliMpPlane.h"
-#include "AliMpReader.h"
-#include "AliMpSector.h"
-#include "AliMpSectorPosition.h"
-#include "AliMpIntPair.h"
-
-ClassImp(AliMpPlane)
-
-//
-// static methods
-//
-
-//______________________________________________________________________________
-AliMpPlane*
-AliMpPlane::Create(AliMpStationType station, AliMpPlaneType type,
- const TVector2& q1Position, const TVector2& q2Position,
- const TVector2& q3Position, const TVector2& q4Position)
-{
-// Factory method for creating planes.
-// ---
-
- // Build sectors
- AliMpReader bReader(station, kBendingPlane);
- // bReader.SetVerboseLevel(1);
- AliMpSector* bSector = bReader.BuildSector();
- cout << "bending sector is built" << endl;
-
- AliMpReader nbReader(station, kNonBendingPlane);
- // nbReader.SetVerboseLevel(1);
- AliMpSector* nbSector = nbReader.BuildSector();
- cout << "non-bending sector is built" << endl;
-
- if (type == kBendingPlane)
- return new AliMpPlane(bSector, nbSector,
- q1Position, q2Position, q3Position, q4Position );
- else
- return new AliMpPlane(nbSector, bSector,
- q1Position, q2Position, q3Position, q4Position );
-}
-
-//______________________________________________________________________________
-AliMpPlane* AliMpPlane::Create(AliMpStationType station, AliMpPlaneType type)
-{
-// Factory method for creating planes with
-// not shifted qudrants.
-// ---
-
- return Create(station, type, TVector2(), TVector2(), TVector2(), TVector2());
-}
-
-//
-// constructors, destructors
-//
-
-//______________________________________________________________________________
-AliMpPlane::AliMpPlane(AliMpSector* frontSector, AliMpSector* backSector,
- const TVector2& q1Position, const TVector2& q2Position,
- const TVector2& q3Position, const TVector2& q4Position)
- : TObject(),
- fkFrontSector(frontSector),
- fkBackSector(backSector),
- fSectorPositions()
-{
-//
-
-#ifdef WITH_STL
- // Create sector positions
- fSectorPositions.push_back(
- new AliMpSectorPosition(fkFrontSector, q1Position, AliMpIntPair( 1, 1)));
- fSectorPositions.push_back(
- new AliMpSectorPosition(fkBackSector, q2Position, AliMpIntPair(-1, 1)));
- fSectorPositions.push_back(
- new AliMpSectorPosition(fkFrontSector, q3Position, AliMpIntPair(-1,-1)));
- fSectorPositions.push_back(
- new AliMpSectorPosition(fkBackSector, q4Position, AliMpIntPair( 1,-1)));
-#endif
-
-#ifdef WITH_ROOT
- // Create sector positions
- fSectorPositions.Add(
- new AliMpSectorPosition(fkFrontSector, q1Position, AliMpIntPair( 1, 1)));
- fSectorPositions.Add(
- new AliMpSectorPosition(fkBackSector, q2Position, AliMpIntPair(-1, 1)));
- fSectorPositions.Add(
- new AliMpSectorPosition(fkFrontSector, q3Position, AliMpIntPair(-1,-1)));
- fSectorPositions.Add(
- new AliMpSectorPosition(fkBackSector, q4Position, AliMpIntPair( 1,-1)));
-#endif
-}
-
-//_____________________________________________________________________________
-AliMpPlane::AliMpPlane(const AliMpPlane& right)
- : TObject(right) {
-//
- Fatal("AliMpPlane", "Copy constructor not provided.");
-}
-
-//______________________________________________________________________________
-AliMpPlane::AliMpPlane()
- : TObject(),
- fkFrontSector(0),
- fkBackSector(0),
- fSectorPositions()
-{
-//
-}
-
-//______________________________________________________________________________
-AliMpPlane::~AliMpPlane() {
-//
-
- delete fkFrontSector;
- delete fkBackSector;
-
- for (Int_t i=0; i<GetNofSectorPositions(); i++)
- delete GetSectorPosition(i);
-}
-
-//
-// operators
-//
-
-//_____________________________________________________________________________
-AliMpPlane& AliMpPlane::operator=(const AliMpPlane& right)
-{
- // check assignement to self
- if (this == &right) return *this;
-
- Fatal("operator =", "Assignement operator not provided.");
-
- return *this;
-}
-
-//
-// public methods
-//
-
-//______________________________________________________________________________
-const AliMpSectorPosition*
-AliMpPlane::SectorPosition(const AliMpIntPair& scale) const
-{
-// Returns the sector position specified by scale.
-// ---
-
- for (Int_t i=0; i<GetNofSectorPositions(); i++)
- if (GetSectorPosition(i)->GetScale() == scale) return GetSectorPosition(i);
-
- Fatal("SectorPosition", "Wrong scale");
- return 0;
-}
-
-//______________________________________________________________________________
-Int_t AliMpPlane::GetNofSectorPositions() const
-{
-// Returns number of sector positions.
-// ---
-
-#ifdef WITH_STL
- return fSectorPositions.size();
-#endif
-
-#ifdef WITH_ROOT
- return fSectorPositions.GetEntriesFast();
-#endif
-}
-
-
-//______________________________________________________________________________
-AliMpSectorPosition* AliMpPlane::GetSectorPosition(Int_t i) const
-{
-// Returns i-th sector position.
-// ---
-
-#ifdef WITH_STL
- return fSectorPositions[i];
-#endif
-
-#ifdef WITH_ROOT
- return (AliMpSectorPosition*)fSectorPositions[i];
-#endif
-}
-
-
+++ /dev/null
-// $Id$
-// Category: plane
-//
-// Class AliMpPlane
-// ----------------
-// Class represents the plane composed of 4 sector positions:
-//
-// I. FS II. | I.
-// II. BS inverted in x _____ | ____
-// III. FS inverted in x, y |
-// IV. BS inverted in y III. | IV.
-//
-// FS - front sector
-// BS - back sector
-//
-// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-
-#ifndef ALI_MP_PLANE_H
-#define ALI_MP_PLANE_H
-
-#include <TObject.h>
-
-#include "AliMpPlaneTypes.h"
-#include "AliMpStationType.h"
-#include "AliMpPlaneType.h"
-
-class TVector2;
-
-class AliMpSector;
-class AliMpSectorPosition;
-class AliMpIntPair;
-
-class AliMpPlane : public TObject
-{
- public:
- AliMpPlane(AliMpSector* frontSector, AliMpSector* backSector,
- const TVector2& q1Position, const TVector2& q2Position,
- const TVector2& q3Position, const TVector2& q4Position);
- AliMpPlane();
- virtual ~AliMpPlane();
-
- // factory methods
- static AliMpPlane* Create(AliMpStationType station, AliMpPlaneType type,
- const TVector2& q1Position, const TVector2& q2Position,
- const TVector2& q3Position, const TVector2& q4Position);
- static AliMpPlane* Create(AliMpStationType station, AliMpPlaneType type);
-
- // methods
- const AliMpSectorPosition* SectorPosition(const AliMpIntPair& scale) const;
-
- // get methods
- const AliMpSector* GetFrontSector() const;
- const AliMpSector* GetBackSector() const;
- Int_t GetNofSectorPositions() const;
- AliMpSectorPosition* GetSectorPosition(Int_t i) const;
-
- protected:
- AliMpPlane(const AliMpPlane& right);
- AliMpPlane& operator = (const AliMpPlane& right);
-
- private:
- // data members
- const AliMpSector* fkFrontSector; // front sector in the 1st quadrant
- const AliMpSector* fkBackSector; // back sector in the 1st quadrant
- SectorPositionVector fSectorPositions; // sector positions
-
- ClassDef(AliMpPlane,1) //Plane
-};
-
-// inline functions
-
-inline const AliMpSector* AliMpPlane::GetFrontSector() const
-{ return fkFrontSector; }
-
-inline const AliMpSector* AliMpPlane::GetBackSector() const
-{ return fkBackSector; }
-
-#endif //ALI_MP_PLANE_H
-
+++ /dev/null
-// $Id$
-// Category: plane
-//
-// Class AliMpPlaneAreaPadIterator
-// -------------------------------
-// Class, which defines an iterator over the pads
-// inside a given area in a plane in horizontal direction.
-// Included in AliRoot: 2003/05/02
-// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-
-#include <Riostream.h>
-#include <TVector2.h>
-
-#include "AliMpPlaneAreaPadIterator.h"
-#include "AliMpTransformPadIterator.h"
-#include "AliMpPlaneSegmentation.h"
-#include "AliMpSectorSegmentation.h"
-
-ClassImp(AliMpPlaneAreaPadIterator)
-
-//______________________________________________________________________________
-AliMpPlaneAreaPadIterator::AliMpPlaneAreaPadIterator(
- const AliMpPlaneSegmentation* segmentation,
- const AliMpArea& area)
- : AliMpVPadIterator(),
- fkPlaneSegmentation(segmentation),
- fkArea(area),
- fPadIterators()
-{
-// Normal constructor, start in invalid position
-
- DecomposeArea();
-
-#ifdef WITH_STL
- fCurrentIterator = fPadIterators.end();
-#endif
-
-#ifdef WITH_ROOT
- fCurrentIterator = fPadIterators.GetEntriesFast();
-#endif
-}
-
-//______________________________________________________________________________
-AliMpPlaneAreaPadIterator::AliMpPlaneAreaPadIterator(
- const AliMpPlaneAreaPadIterator& right)
- : AliMpVPadIterator(right)
-{
-// Copy constructor
-
- Fatal("Copy constructor", "Not implemented");
-}
-
-//______________________________________________________________________________
-AliMpPlaneAreaPadIterator::AliMpPlaneAreaPadIterator()
- : AliMpVPadIterator(),
- fkPlaneSegmentation(0),
- fkArea(AliMpArea()),
- fPadIterators()
-{
-// Dummy default constructor.
-}
-
-//______________________________________________________________________________
-AliMpPlaneAreaPadIterator::~AliMpPlaneAreaPadIterator()
-{
-// Destructor
-
- // delete created iterators here
-}
-
-//
-// operators
-//
-
-//______________________________________________________________________________
-AliMpPlaneAreaPadIterator&
-AliMpPlaneAreaPadIterator::operator = (const AliMpPlaneAreaPadIterator& right)
-{
-// Assignement operator
-
- // check assignement to self
- if (this == &right) return *this;
-
- Fatal("operator =", "Assignement operator not provided.");
-
- return *this;
-}
-
-//
-// private methods
-//
-
-//______________________________________________________________________________
-void AliMpPlaneAreaPadIterator::DecomposeArea()
-{
-// Decompose the area into areas belonging to the quadrants.
-// --
-
- for (Int_t i=0; i<fkPlaneSegmentation->GetNofTransformers(); i++) {
-
- AliMpTransformer* transformer = fkPlaneSegmentation->GetTransformer(i);
- AliMpArea area = transformer->CutArea(fkArea);
-
- if (area.IsValid()) {
-
- AliMpSectorSegmentation* segmentation
- = fkPlaneSegmentation->GetSectorSegmentation(transformer->GetScale());
-
- AliMpVPadIterator* sectorIt
- = segmentation->CreateIterator(area);
-
-#ifdef WITH_STL
- fPadIterators.push_back(
- new AliMpTransformPadIterator(sectorIt, transformer));
-#endif
-
-#ifdef WITH_ROOT
- fPadIterators.Add(
- new AliMpTransformPadIterator(sectorIt, transformer));
-#endif
- }
- }
-}
-
-//
-// public methods
-//
-
-//______________________________________________________________________________
-void AliMpPlaneAreaPadIterator::First()
-{
-// Reset the iterator, so that it points to the first available
-// pad in the area
-// ---
-
-#ifdef WITH_STL
- if (fPadIterators.size()==0) return;
-
- fCurrentIterator = fPadIterators.begin();
- (*fCurrentIterator)->First();
-
- while ( fCurrentIterator != fPadIterators.end() &&
- (*fCurrentIterator)->IsDone()) {
-
- fCurrentIterator++;
- if (fCurrentIterator != fPadIterators.end()) {
- (*fCurrentIterator)->First();
- }
- }
-#endif
-
-#ifdef WITH_ROOT
- if (fPadIterators.GetEntriesFast()==0) return;
-
- fCurrentIterator = 0;
- ((AliMpTransformPadIterator*)fPadIterators.At(fCurrentIterator))->First();
-
- while ( fCurrentIterator != fPadIterators.GetEntriesFast() &&
- ((AliMpTransformPadIterator*)fPadIterators.At(fCurrentIterator))
- ->IsDone()) {
-
- fCurrentIterator++;
- if (fCurrentIterator != fPadIterators.GetEntriesFast()) {
- ((AliMpTransformPadIterator*)fPadIterators.At(fCurrentIterator))->First();
- }
- }
-#endif
-}
-
-//______________________________________________________________________________
-void AliMpPlaneAreaPadIterator::Next()
-{
-// Move the iterator to the next valid pad.
-// ---
-
-#ifdef WITH_STL
- (*fCurrentIterator)->Next();
-
- while ( fCurrentIterator != fPadIterators.end() &&
- (*fCurrentIterator)->IsDone()) {
-
- fCurrentIterator++;
- if (fCurrentIterator != fPadIterators.end()) {
- (*fCurrentIterator)->First();
- }
- }
-#endif
-
-#ifdef WITH_ROOT
- ((AliMpTransformPadIterator*)fPadIterators.At(fCurrentIterator))->Next();
-
- while ( fCurrentIterator != fPadIterators.GetEntriesFast() &&
- ((AliMpTransformPadIterator*)fPadIterators.At(fCurrentIterator))
- ->IsDone()) {
-
- fCurrentIterator++;
- if (fCurrentIterator != fPadIterators.GetEntriesFast()) {
- ((AliMpTransformPadIterator*)fPadIterators.At(fCurrentIterator))->First();
- }
- }
-#endif
-}
-
-//______________________________________________________________________________
-Bool_t AliMpPlaneAreaPadIterator::IsDone() const
-{
-//
-#ifdef WITH_STL
- return fCurrentIterator == fPadIterators.end();
-#endif
-
-#ifdef WITH_ROOT
- return fCurrentIterator == fPadIterators.GetEntriesFast();
-#endif
-}
-
-//______________________________________________________________________________
-AliMpPad AliMpPlaneAreaPadIterator::CurrentItem() const
-{
-// Returns the current pad.
-// ---
-
-#ifdef WITH_STL
- if (fCurrentIterator != fPadIterators.end())
- return (*fCurrentIterator)->CurrentItem();
- else
- return AliMpPad::Invalid();
-#endif
-
-#ifdef WITH_ROOT
- if (fCurrentIterator != fPadIterators.GetEntriesFast())
- return ((AliMpTransformPadIterator*)fPadIterators.At(fCurrentIterator))
- ->CurrentItem();
- else
- return AliMpPad::Invalid();
-#endif
-}
-
-//______________________________________________________________________________
-void AliMpPlaneAreaPadIterator::Invalidate()
-{
-// Invalidates all sector iterators and sets the current
-// iterator to invalid position.
-// ---
-
-#ifdef WITH_STL
- PadIteratorVectorIterator it;
- for (it=fPadIterators.begin(); it !=fPadIterators.end(); it++) {
- (*it)->Invalidate();
- }
-
- fCurrentIterator = fPadIterators.end();
-#endif
-
-#ifdef WITH_ROOT
- for (Int_t i=0; i<fPadIterators.GetEntriesFast(); i++) {
- ((AliMpTransformPadIterator*)fPadIterators.At(i))->Invalidate();
- }
-
- fCurrentIterator = fPadIterators.GetEntriesFast();
-#endif
-}
-
+++ /dev/null
-// $Id$
-// Category: plane
-//
-// Class AliMpPlaneAreaPadIterator
-// -------------------------------
-// Class, which defines an iterator over the pads
-// inside a given area in a plane in horizontal direction.
-//
-// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-
-#ifndef ALI_MP_PLANE_AREA_PAD_ITERATOR_H
-#define ALI_MP_PLANE_AREA_PAD_ITERATOR_H
-
-#include "AliMpPlaneTypes.h"
-#include "AliMpVPadIterator.h"
-#include "AliMpTransformPadIterator.h"
-#include "AliMpArea.h"
-#include "AliMpPad.h"
-
-class AliMpPlaneSegmentation;
-
-class AliMpPlaneAreaPadIterator : public AliMpVPadIterator
-{
- public:
- AliMpPlaneAreaPadIterator(const AliMpPlaneSegmentation* segmentation,
- const AliMpArea& area);
- AliMpPlaneAreaPadIterator(const AliMpPlaneAreaPadIterator& src);
- AliMpPlaneAreaPadIterator();
- virtual ~AliMpPlaneAreaPadIterator();
-
- // operators
- AliMpPlaneAreaPadIterator&
- operator = (const AliMpPlaneAreaPadIterator& right);
-
- // methods
- virtual void First();
- virtual void Next();
- virtual Bool_t IsDone() const;
- virtual AliMpPad CurrentItem() const;
- virtual void Invalidate();
-
- private:
- // private methods
- void DecomposeArea();
-
- // private data members
- const AliMpPlaneSegmentation* fkPlaneSegmentation; // the plane segmentation
- // over which we iterate
- //const AliMpArea fkArea; // the area
- // (const caused problem with CINT)
- AliMpArea fkArea; // the area
- PadIteratorVector fPadIterators; // pad iterators
- PadIteratorVectorIterator fCurrentIterator;// the current iterator
- // in the vector of pad iterators
-
- ClassDef(AliMpPlaneAreaPadIterator,1) // iterator over motif's pads
-};
-#endif // ALI_MP_PLANE_AREA_PAD_ITERATOR_H
+++ /dev/null
-// $Id$
-// Category: plane
-//
-// Class AliMpPlaneSegmentation
-// ----------------------------
-// Class describing the segmentation of the plane.
-//
-// Transformation of pad characteristics according to sectors:
-// I. ( posId, Guassi ), ( i, j), ( x, y) II. | I.
-// II. ( posId', Guassi'), (-i, j), (-x, y) _____ | ____
-// III. (-posId, Guassi), (-i,-j), (-x,-y) |
-// IV. (-posId', Guassi'), ( i,-j), ( x,-y) III. | IV.
-//
-// Where (posId', Guassi') is the location of the pad
-// in the clipped sector.
-//
-// Included in AliRoot: 2003/05/02
-// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-
-#include <Riostream.h>
-#include <TMath.h>
-#include <TError.h>
-
-#include "AliMpPlaneSegmentation.h"
-#include "AliMpPlaneAreaPadIterator.h"
-#include "AliMpPlane.h"
-#include "AliMpSectorPosition.h"
-#include "AliMpSectorSegmentation.h"
-
-ClassImp(AliMpPlaneSegmentation)
-
-//_____________________________________________________________________________
-AliMpPlaneSegmentation::AliMpPlaneSegmentation(const AliMpPlane* plane)
- : AliMpVSegmentation(),
- fkPlane(plane),
- fFrontSectorSegmentation(0),
- fBackSectorSegmentation(0)
-{
-//
- fFrontSectorSegmentation = new AliMpSectorSegmentation(plane->GetFrontSector());
- fBackSectorSegmentation = new AliMpSectorSegmentation(plane->GetBackSector());
-
- for (Int_t i=0; i<fkPlane->GetNofSectorPositions(); i++) {
-
-#ifdef WITH_STL
- fTransformers.push_back(
- new AliMpTransformer(fkPlane->GetSectorPosition(i)->GetOffset(),
- fkPlane->GetSectorPosition(i)->GetScale()));
-#endif
-
-#ifdef WITH_ROOT
- fTransformers.Add(
- new AliMpTransformer(fkPlane->GetSectorPosition(i)->GetOffset(),
- fkPlane->GetSectorPosition(i)->GetScale()));
-#endif
- }
-}
-
-///_____________________________________________________________________________
-AliMpPlaneSegmentation::AliMpPlaneSegmentation()
- : AliMpVSegmentation(),
- fkPlane(0),
- fFrontSectorSegmentation(0),
- fBackSectorSegmentation(0)
-{
-//
-}
-
-//_____________________________________________________________________________
-AliMpPlaneSegmentation::AliMpPlaneSegmentation(
- const AliMpPlaneSegmentation& right)
- : AliMpVSegmentation(right) {
-//
- Fatal("AliMpPlaneSegmentation", "Copy constructor not provided.");
-}
-
-//_____________________________________________________________________________
-AliMpPlaneSegmentation::~AliMpPlaneSegmentation() {
-//
- delete fFrontSectorSegmentation;
- delete fBackSectorSegmentation;
-
- for (Int_t i=0; i<GetNofTransformers(); i++)
- delete GetTransformer(i);
-}
-
-//
-// operators
-//
-
-//_____________________________________________________________________________
-AliMpPlaneSegmentation&
-AliMpPlaneSegmentation::operator=(const AliMpPlaneSegmentation& right)
-{
- // check assignement to self
- if (this == &right) return *this;
-
- Fatal("operator =", "Assignement operator not provided.");
-
- return *this;
-}
-
-//
-// private methods
-//
-
-//_____________________________________________________________________________
-const AliMpTransformer*
-AliMpPlaneSegmentation::GetTransformer(const AliMpIntPair& scale) const
-{
-// Returns the sector position specified by scale.
-// ---
-
- for (Int_t i=0; i<GetNofTransformers(); i++)
- if (GetTransformer(i)->GetScale() == scale) return GetTransformer(i);
-
- Fatal("GetTransformer", "Wrong scale");
- return 0;
-}
-
-//_____________________________________________________________________________
-AliMpIntPair AliMpPlaneSegmentation::GetScale(const AliMpIntPair& pair) const
-{
-// Returns pair of the signs of the values of the given pair.
-// ---
-
- AliMpIntPair scale(1, 1);
-
- if (pair.GetFirst() < 0) scale.SetFirst(-1);
- if (pair.GetSecond() < 0) scale.SetSecond(-1);
-
- return scale;
-}
-
-//_____________________________________________________________________________
-AliMpIntPair AliMpPlaneSegmentation::GetScale(const TVector2& vector) const
-{
-// Returns pair of the signs of the values of the given vector.
-// ---
-
- AliMpIntPair scale(1, 1);
-
- if (vector.X() < 0) scale.SetFirst(-1);
- if (vector.Y() < 0) scale.SetSecond(-1);
-
- return scale;
-}
-
-//_____________________________________________________________________________
-AliMpIntPair
-AliMpPlaneSegmentation::GetLocationScale(const AliMpIntPair& location) const
-{
-// Returns the scale transformation of the specified location.
-// ---
-
- // Find the sector
- Bool_t inFront;
- if (fFrontSectorSegmentation
- ->HasMotifPosition(TMath::Abs(location.GetFirst())))
- inFront = true;
- else if (fBackSectorSegmentation
- ->HasMotifPosition(TMath::Abs(location.GetFirst())))
- inFront = false;
- else {
- Fatal("GetLocationScale", "Motif position not found.");
- return AliMpIntPair();
- }
-
- if (inFront && location.GetFirst() > 0) return AliMpIntPair(1, 1);
- else if (inFront && location.GetFirst() < 0) return AliMpIntPair(-1, -1);
- else if (!inFront && location.GetFirst() > 0) return AliMpIntPair(-1, 1);
- else if (!inFront && location.GetFirst() < 0) return AliMpIntPair( 1,-1);
-
- // cannot get there
- Fatal("GetLocationScale", "Condition failed.");
- return AliMpIntPair();
-}
-
-
-//_____________________________________________________________________________
-AliMpSectorSegmentation*
-AliMpPlaneSegmentation::GetSectorSegmentation(const AliMpIntPair& scale) const
-{
-// Returns front sector or back sector segmentation
-// according to quadrant specified by scale.
-// ---
-
- if (scale.GetFirst()*scale.GetSecond() > 0) {
- // quadrant I or III
- return fFrontSectorSegmentation;
- }
- else {
- // quadrant II or IV
- return fBackSectorSegmentation;
- }
-}
-
-//_____________________________________________________________________________
-AliMpSectorSegmentation*
-AliMpPlaneSegmentation::GetSectorSegmentation(Int_t motifPositionId) const
-{
-// Returns front sector or back sector segmentation
-// according to specified motifPositionId
-// ---
-
- if (fFrontSectorSegmentation->HasMotifPosition(motifPositionId))
- return fFrontSectorSegmentation;
- else if (fBackSectorSegmentation->HasMotifPosition(motifPositionId))
- return fBackSectorSegmentation;
- else {
- Fatal("GetSectorSegmentation", "Motif position not found.");
- return 0;
- }
-}
-
-//
-// public methods
-//
-
-//_____________________________________________________________________________
-AliMpVPadIterator*
-AliMpPlaneSegmentation::CreateIterator(const AliMpArea& area) const
-{
-// Creates the are iterator.
-// (The inherited method cannot be used)
-// ---
-
- return new AliMpPlaneAreaPadIterator(this, area);
-}
-
-//______________________________________________________________________________
-AliMpPad AliMpPlaneSegmentation::PadByLocation(const AliMpIntPair& location,
- Bool_t warning) const
-{
-// Find the pad which corresponds to the given location
-// ---
-
- // Get segmentation
- AliMpSectorSegmentation* segmentation
- = GetSectorSegmentation(TMath::Abs(location.GetFirst()));
-
- // Get pad in the segmentation
- AliMpPad pad
- = segmentation
- ->PadByLocation(
- AliMpIntPair(TMath::Abs(location.GetFirst()),location.GetSecond()),
- warning);
-
- // Get transformation
- AliMpIntPair scale = GetLocationScale(location);
- const AliMpTransformer* kTransformer = GetTransformer(scale);
-
- // Transform pad characteristics
- return kTransformer->Transform(pad);
-}
-
-//______________________________________________________________________________
-AliMpPad AliMpPlaneSegmentation::PadByIndices (const AliMpIntPair& indices,
- Bool_t warning ) const
-{
-// Find the pad which corresponds to the given indices
-//
-
- AliMpIntPair scale = GetScale(indices);
- const AliMpTransformer* kTransformer = GetTransformer(scale);
-
- AliMpIntPair scaledIndices = kTransformer->Scale(indices);
- AliMpPad pad
- = GetSectorSegmentation(scale)->PadByIndices(scaledIndices, warning);
-
- return kTransformer->Transform(pad);
-}
-
-//_____________________________________________________________________________
-AliMpPad AliMpPlaneSegmentation::PadByPosition(const TVector2& position,
- Bool_t warning) const
-{
-// Find the pad which corresponds to the given position
-// ---
-
- AliMpIntPair scale = GetScale(position);
- const AliMpTransformer* kTransformer = GetTransformer(scale);
-
- TVector2 scaledPosition = kTransformer->ITransform(position);
- AliMpPad pad
- = GetSectorSegmentation(scale)->PadByPosition(scaledPosition, warning);
-
- return kTransformer->Transform(pad);
-}
-
-//______________________________________________________________________________
-Int_t AliMpPlaneSegmentation::MaxPadIndexX()
-{
-// Return maximum pad index in x
-
- Fatal("MaxPadIndexX", " not implemented.");
-
- return 0;
-}
-
-//______________________________________________________________________________
-Int_t AliMpPlaneSegmentation::MaxPadIndexY()
-{
-// Return maximum pad index in y
-
- Fatal("MaxPadIndexY", " not implemented.");
-
- return 0;
-}
-
-//_____________________________________________________________________________
-Bool_t AliMpPlaneSegmentation::HasPad(const AliMpIntPair& indices) const
-{
-// Does the pad located by <indices> exists ?
-// ---
-
- AliMpIntPair scale = GetScale(indices);
- const AliMpTransformer* kTransformer = GetTransformer(scale);
-
- AliMpIntPair scaledIndices = kTransformer->Scale(indices);
-
- return GetSectorSegmentation(scale)->HasPad(scaledIndices);
-}
-
-//_____________________________________________________________________________
-Int_t AliMpPlaneSegmentation::Zone(const AliMpPad& pad, Bool_t warning) const
-{
-// Returns the zone index of the zone containing the specified pad.
-// This zone index is different from the zone ID,
-// as it is unique for each pad dimensions.
-// It is composed in this way:
-// sectorID*100 + zoneID*10 + specific index
-// Where sectorID = 0,1 for front/back sector.
-// Specific index is present only for zones containing special motifs.
-// ---
-
- if (!pad.IsValid()) {
- if (warning) Warning("Zone(AliMpPad)", "Invalid pad");
- return 0;
- }
-
- AliMpIntPair scale = GetScale(pad.GetIndices());
- const AliMpTransformer* kTransformer = GetTransformer(scale);
-
- AliMpPad scaledPad = kTransformer->ITransform(pad);
-
- AliMpSectorSegmentation* segmentation = GetSectorSegmentation(scale);
- Int_t zoneID = segmentation->Zone(scaledPad, warning);
-
- // Distinguish zones from front/back sector
- // For back sector - add 10
- if (segmentation == fBackSectorSegmentation) zoneID += 100;
-
- return zoneID;
-}
-
-//_____________________________________________________________________________
-TVector2
-AliMpPlaneSegmentation::PadDimensions(Int_t zone, Bool_t warning) const
-{
-// Returns the pad dimensions for the zone with the specified zone index.
-// ---
-
- if (zone < 100)
- return fFrontSectorSegmentation->PadDimensions(zone, warning);
- else
- return fBackSectorSegmentation->PadDimensions(zone - 100, warning);
-}
-
-//_____________________________________________________________________________
-Bool_t AliMpPlaneSegmentation::CircleTest(const AliMpIntPair& indices) const
-{
-// Verifies that all methods for retrieving pads are consistents between them.
-// Returns true if the pad with specified indices was found and verified,
-// false otherwise.
-// ---
-
- if (!HasPad(indices)) return false;
-
- // Verify the indice->location->position->indice way
- AliMpIntPair location = PadByIndices(indices).GetLocation();
- TVector2 position = PadByLocation(location).Position();
- AliMpIntPair retIndices = PadByPosition(position).GetIndices();
-
- if (retIndices != indices) {
- cout << "Pad " << indices << " lead to inconsistency" << endl;
- cout << "in indice->location->position->indice way..." << endl;
- cout << "starting from " << indices << "-->" << location << "-->"
- << '(' << position.X() << ',' << position.Y() << ')'
- << " and retIndices: " << retIndices << endl;
- }
-
-
- // Verify the indice->position->location->indice way
- position = PadByIndices(indices).Position();
- location = PadByPosition(position).GetLocation();
- retIndices = PadByLocation(location).GetIndices();
-
- if (retIndices != indices) {
- cout << "Pad " << indices << " lead to inconsistency" << endl;
- cout << "in indice->position->location->indice way..." <<endl;
- cout << "starting from " << indices
- << " and retIndices: " << retIndices << endl;
- }
-
- return true;
-
-}
-
-//_____________________________________________________________________________
-Int_t AliMpPlaneSegmentation::GetNofTransformers() const
-{
-// Returns number of transformers.
-// ---
-
-#ifdef WITH_STL
- return fTransformers.size();
-#endif
-
-#ifdef WITH_ROOT
- return fTransformers.GetEntriesFast();
-#endif
-}
-
-
-//_____________________________________________________________________________
-AliMpTransformer* AliMpPlaneSegmentation::GetTransformer(Int_t i) const
-{
-// Returns i-th transformer.
-// ---
-
-#ifdef WITH_STL
- return fTransformers[i];
-#endif
-
-#ifdef WITH_ROOT
- return (AliMpTransformer*)fTransformers[i];
-#endif
-}
-
-
+++ /dev/null
-// $Id$
-// Category: plane
-//
-// Class AliMpPlaneSegmentation
-// ----------------------------
-// Class describing the segmentation of the plane.
-//
-// Transformation of pad characteristics according to sectors:
-//
-// I. ( posId, Guassi ), ( i, j), ( x, y) II. | I.
-// II. ( posId', Guassi'), (-i, j), (-x, y) _____ | ____
-// III. (-posId, Guassi), (-i,-j), (-x,-y) |
-// IV. (-posId', Guassi'), ( i,-j), ( x,-y) III. | IV.
-//
-// Where (posId', Guassi') is the location of the pad
-// in the clipped sector.
-//
-// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-
-#ifndef ALI_MP_PLANE_SEGMENTATION_H
-#define ALI_MP_PLANE_SEGMENTATION_H
-
-#include <TVector2.h>
-
-#include "AliMpPlaneTypes.h"
-#include "AliMpVSegmentation.h"
-#include "AliMpTransformer.h"
-#include "AliMpIntPair.h"
-#include "AliMpPad.h"
-
-class AliMpPlane;
-class AliMpSectorSegmentation;
-class AliMpVPadIterator;
-
-class AliMpPlaneSegmentation : public AliMpVSegmentation
-{
- public:
- AliMpPlaneSegmentation(const AliMpPlane* plane);
- AliMpPlaneSegmentation();
- virtual ~AliMpPlaneSegmentation();
-
- // factory method
- virtual AliMpVPadIterator* CreateIterator(const AliMpArea& area) const;
-
- // methods
- virtual AliMpPad PadByLocation(const AliMpIntPair& location,
- Bool_t warning = kTRUE) const;
- virtual AliMpPad PadByIndices (const AliMpIntPair& indices,
- Bool_t warning = kTRUE) const;
- virtual AliMpPad PadByPosition(const TVector2& position,
- Bool_t warning = kTRUE) const;
-
- virtual Int_t MaxPadIndexX();
- virtual Int_t MaxPadIndexY();
-
- virtual Int_t Zone(const AliMpPad& pad, Bool_t warning = kTRUE) const;
- virtual TVector2 PadDimensions(Int_t zone, Bool_t warning = kTRUE) const;
-
- virtual Bool_t HasPad(const AliMpIntPair& indices) const;
- Bool_t CircleTest(const AliMpIntPair& indices) const;
-
- // get methods
- Int_t GetNofTransformers() const;
- AliMpTransformer* GetTransformer(Int_t i) const;
- AliMpSectorSegmentation* GetSectorSegmentation(
- const AliMpIntPair& scale) const;
-
- protected:
- AliMpPlaneSegmentation(const AliMpPlaneSegmentation& right);
- AliMpPlaneSegmentation& operator = (const AliMpPlaneSegmentation& right);
-
- private:
- // methods
- const AliMpTransformer* GetTransformer(const AliMpIntPair& scale) const;
- AliMpIntPair GetScale(const AliMpIntPair& pair) const;
- AliMpIntPair GetScale(const TVector2& vector) const;
- AliMpIntPair GetLocationScale(const AliMpIntPair& location) const;
- AliMpSectorSegmentation* GetSectorSegmentation(Int_t motifPositionId) const;
-
- // data members
- const AliMpPlane* fkPlane; // plane
- AliMpSectorSegmentation* fFrontSectorSegmentation;// front sector segmentation
- AliMpSectorSegmentation* fBackSectorSegmentation; // back sector segmentation
- TransformerVector fTransformers; // transformer for each quadrant
-
- ClassDef(AliMpPlaneSegmentation,1) // Plane segmentation
-};
-
-#endif //ALI_MP_PLANE_SEGMENTATION_H
-
+++ /dev/null
-// $Id$
-// Category: plane
-//
-// AliMpPlaneTypes
-// ---------------
-// Sytem dependent types definitions for plane category.
-//
-// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-
-#ifndef ALI_MP_PLANE_TYPES_H
-#define ALI_MP_PLANE_TYPES_H
-
-#include "AliMpContainers.h"
-
-#ifdef WITH_STL
- #include <vector>
-#endif
-
-#ifdef WITH_ROOT
- #include <TObjArray.h>
-#endif
-
-class AliMpSectorPosition;
-class AliMpTransformPadIterator;
-class AliMpTransformer;
-
-#ifdef WITH_STL
-#ifdef __HP_aCC
- typedef vector<AliMpSectorPosition*> SectorPositionVector;
- typedef vector<AliMpTransformPadIterator*> PadIteratorVector;
- typedef PadIteratorVector::iterator PadIteratorVectorIterator;
- typedef vector<AliMpTransformer*> TransformerVector;
-#else
- typedef std::vector<AliMpSectorPosition*> SectorPositionVector;
- typedef std::vector<AliMpTransformPadIterator*> PadIteratorVector;
- typedef PadIteratorVector::iterator PadIteratorVectorIterator;
- typedef std::vector<AliMpTransformer*> TransformerVector;
-#endif
-#endif
-
-#ifdef WITH_ROOT
- typedef TObjArray SectorPositionVector;
- typedef TObjArray PadIteratorVector;
- typedef Int_t PadIteratorVectorIterator;
- typedef TObjArray TransformerVector;
-#endif
-
-
-#endif //ALI_MP_PLANE_TYPES_H
+++ /dev/null
-// $Id$
-// Category: plane
-//
-// Class AliMpSectorPosition
-// -------------------------
-// Class that represents a placed sector.
-// Only translation + reflection transformations can
-// be applied.
-//
-// Included in AliRoot: 2003/05/02
-// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-
-#include <TError.h>
-
-#include "AliMpSectorPosition.h"
-
-ClassImp(AliMpSectorPosition)
-
-//______________________________________________________________________________
-AliMpSectorPosition::AliMpSectorPosition(const AliMpSector* sector,
- const TVector2& offset,
- const AliMpIntPair& scale)
- : TObject(),
- fkSector(sector),
- fOffset(offset),
- fScale(scale)
-{
-//
-}
-
-//_____________________________________________________________________________
-AliMpSectorPosition::AliMpSectorPosition(const AliMpSectorPosition& right)
- : TObject(right) {
-//
- Fatal("AliMpSectorPosition", "Copy constructor not provided.");
-}
-
-//_____________________________________________________________________________
-AliMpSectorPosition::AliMpSectorPosition()
- : TObject(),
- fkSector(),
- fOffset(),
- fScale()
-{
-//
-}
-
-//_____________________________________________________________________________
-AliMpSectorPosition::~AliMpSectorPosition() {
-//
-}
-
-// operators
-
-//_____________________________________________________________________________
-AliMpSectorPosition&
-AliMpSectorPosition::operator=(const AliMpSectorPosition& right)
-{
- // check assignement to self
- if (this == &right) return *this;
-
- Fatal("operator =", "Assignement operator not provided.");
-
- return *this;
-}
-
+++ /dev/null
-// $Id$
-// Category: plane
-//
-// Class AliMpSectorPosition
-// -------------------------
-// Class that represents a placed sector.
-// Only translation + reflection transformations can
-// be applied.
-//
-// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-
-#ifndef ALI_MP_SECTOR_POSITION_H
-#define ALI_MP_SECTOR_POSITION_H
-
-#include <TObject.h>
-#include <TVector2.h>
-
-#include "AliMpIntPair.h"
-
-class AliMpSector;
-
-class AliMpSectorPosition : public TObject
-{
- public:
- AliMpSectorPosition(const AliMpSector* sector,
- const TVector2& offset, const AliMpIntPair& scale);
- AliMpSectorPosition();
- virtual ~AliMpSectorPosition();
-
- // get methods
- const AliMpSector* GetSector() const;
- TVector2 GetOffset() const;
- AliMpIntPair GetScale() const;
-
- protected:
- AliMpSectorPosition(const AliMpSectorPosition& right);
-
- // operators
- AliMpSectorPosition& operator=(const AliMpSectorPosition& right);
-
- private:
- // data members
- const AliMpSector* fkSector; // sector
- TVector2 fOffset; // translation transformation
- AliMpIntPair fScale; // reflection transformation
-
- ClassDef(AliMpSectorPosition,1) //Sector position
-};
-
-// inline functions
-
-inline const AliMpSector* AliMpSectorPosition::GetSector() const
-{ return fkSector; }
-
-inline TVector2 AliMpSectorPosition::GetOffset() const
-{ return fOffset; }
-
-inline AliMpIntPair AliMpSectorPosition::GetScale() const
-{ return fScale; }
-
-#endif //ALI_MP_SECTOR_POSITION_H
-
+++ /dev/null
-// $Id$
-// Category: basic
-//
-// Class AliMpTransformPadIterator
-// -------------------------------
-// Composite of iterator and transformer.
-// Transforms returned pad.
-// Included in AliRoot: 2003/05/02
-// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-
-#include "AliMpTransformPadIterator.h"
-#include "AliMpTransformer.h"
-
-ClassImp(AliMpTransformPadIterator)
-
-//______________________________________________________________________________
-AliMpTransformPadIterator::AliMpTransformPadIterator(AliMpVPadIterator* it,
- const AliMpTransformer* transformer)
- : AliMpVPadIterator(),
- fIterator(it),
- fkTransformer(transformer)
-{
-// Standard constructor
-}
-
-//______________________________________________________________________________
-AliMpTransformPadIterator::AliMpTransformPadIterator(
- const AliMpTransformPadIterator& right)
- : AliMpVPadIterator(right)
-{
-// Copy constructor
-
- *this = right;
-}
-
-//______________________________________________________________________________
-AliMpTransformPadIterator::AliMpTransformPadIterator()
- : AliMpVPadIterator(),
- fIterator(0),
- fkTransformer(0)
-{
-// Default constructor
-}
-
-//______________________________________________________________________________
-AliMpTransformPadIterator::~AliMpTransformPadIterator()
-{
-// Destructor
-// Not owner of its components, does not delete them.
-}
-
-//
-// operators
-//
-
-//______________________________________________________________________________
-AliMpTransformPadIterator&
-AliMpTransformPadIterator::operator = (const AliMpTransformPadIterator& right)
-{
-// assignement operator
-
- // check assignement to self
- if (this == &right) return *this;
-
- // base class assignement
- TObject::operator=(right);
-
- fIterator = right.fIterator;
- fkTransformer = right.fkTransformer;
-
- return *this;
-}
-
-//
-// public methods
-//
-
-//______________________________________________________________________________
-void AliMpTransformPadIterator::First()
-{
-// Reset the iterator, so that it points to the first available
-// pad in the area
-
- fIterator->First();
-}
-
-//______________________________________________________________________________
-void AliMpTransformPadIterator::Next()
-{
-// Move the iterator to the next valid pad.
-// ---
-
- fIterator->Next();
-}
-
-//______________________________________________________________________________
-Bool_t AliMpTransformPadIterator::IsDone() const
-{
-//
-
- return fIterator->IsDone();
-}
-
-
-//______________________________________________________________________________
-AliMpPad AliMpTransformPadIterator::CurrentItem() const
-{
-// Returns current pad with applied transformation.
-// ---
-
- return fkTransformer->Transform(fIterator->CurrentItem());
-}
-
-//______________________________________________________________________________
-void AliMpTransformPadIterator::Invalidate()
-{
-// Set iterator to invalid state.
-// ---
-
- fIterator->Invalidate();
-}
-
+++ /dev/null
-// $Id$
-// Category: basic
-//
-// Class AliMpTransformPadIterator
-// -------------------------------
-// Composite of iterator and transformer.
-// Transforms returned pad.
-//
-// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-
-#ifndef ALI_MP_TRANSFORM_PAD_ITERATOR_H
-#define ALI_MP_TRANSFORM_PAD_ITERATOR_H
-
-#include "AliMpVPadIterator.h"
-#include "AliMpPad.h"
-
-class AliMpTransformer;
-
-class AliMpTransformPadIterator : public AliMpVPadIterator
-{
- public:
- AliMpTransformPadIterator(AliMpVPadIterator* it,
- const AliMpTransformer* transformer);
- AliMpTransformPadIterator(const AliMpTransformPadIterator& right);
- AliMpTransformPadIterator();
- virtual ~AliMpTransformPadIterator();
-
- // operators
- AliMpTransformPadIterator& operator=(const AliMpTransformPadIterator& right);
-
- // methods
- virtual void First();
- virtual void Next();
- virtual Bool_t IsDone() const;
- virtual AliMpPad CurrentItem() const;
- virtual void Invalidate();
-
- private:
- AliMpVPadIterator* fIterator; // iterator
- const AliMpTransformer* fkTransformer; // transformer
-
- ClassDef(AliMpTransformPadIterator,1) // abstract pad iterator
-};
-
-#endif // ALI_MP_TRANSFORM_PAD_ITERATOR_H
+++ /dev/null
-// $Id$
-// Category: basic
-//
-// Class AliMpTransformer
-// ------------------------
-// Class contains definition of transformation and
-// provides functions for transforming pads.
-// Included in AliRoot: 2003/05/02
-// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-
-#include "AliMpTransformer.h"
-
-ClassImp(AliMpTransformer)
-
-///_____________________________________________________________________________
-AliMpTransformer::AliMpTransformer(const TVector2& offset,
- const AliMpIntPair& scale)
- : TObject(),
- fOffset(offset),
- fScale(scale)
-{
-//
-}
-
-///_____________________________________________________________________________
-AliMpTransformer::AliMpTransformer()
- : TObject(),
- fOffset(TVector2()),
- fScale(AliMpIntPair(1,1))
-{
-//
-}
-
-//_____________________________________________________________________________
-AliMpTransformer::~AliMpTransformer() {
-//
-}
-
-//
-// private methods
-//
-
-//_____________________________________________________________________________
-void AliMpTransformer::CutInterval(Double_t x1, Double_t x2, Double_t x0,
- Double_t s, Double_t& pos, Double_t& dx) const
-{
-// Cuts the interval <x1,x2> into <x1', x2'>
-// by position x0 in direction of s*x.
-// Returns the centre of the new interval (pos) and its half size.
-// ---
-
- // Transform values
-
- Double_t sx0 = s * x0;
- Double_t sx1 = s * x1;
- Double_t sx2 = s * x2;
-
- if (s < 0) {
- // when inversion, replace x1 and x2
- Double_t tmp = sx1;
- sx1 = sx2;
- sx2 = tmp;
- }
-
- if (sx0 > sx2) {
- // the interval outside region
- pos = 0.;
- dx = -1.;
- }
- else if (sx0 > sx1) {
- // x0 cuts the interval
- dx = (sx2 - sx0)/2.;
- pos = s * (sx0 + dx);
- }
- else {
- // the interval inside region
- dx = (sx2 - sx1)/2.;
- pos = s * ((sx2 + sx1)/2.);
- }
-}
-
-//
-// public methods
-//
-
-//_____________________________________________________________________________
-AliMpIntPair AliMpTransformer::Scale(const AliMpIntPair& pair) const
-{
-// Returns the pair with values scaled by the given scale.
-// ---
-
- return pair * fScale;
-}
-
-//_____________________________________________________________________________
-TVector2 AliMpTransformer::Scale(const TVector2& vector) const
-{
-// Returns vector with values scaled by the given scale.
-// ---
-
- return TVector2(vector.X()*fScale.GetFirst(), vector.Y()*fScale.GetSecond());
-}
-
-//_____________________________________________________________________________
-AliMpIntPair AliMpTransformer::ScaleLocation(const AliMpIntPair& orig) const
-{
-// Returns location with values scaled by the given scale.
-// ---
-
- return AliMpIntPair(orig.GetFirst() * fScale.GetSecond(), orig.GetSecond(),
- orig.IsValid());
-}
-
-//_____________________________________________________________________________
-AliMpPad AliMpTransformer::Scale(const AliMpPad& pad) const
-{
-// Returns pad with indices scaled by the given scale.
-// ---
-
- return AliMpPad(ScaleLocation(pad.GetLocation()),
- Scale(pad.GetIndices()),
- Scale(pad.Position()),
- pad.Dimensions(),
- pad.IsValid());
-}
-
-//_____________________________________________________________________________
-TVector2 AliMpTransformer::Transform(const TVector2& vector) const
-{
-// Transforms given vector with scale and corresponding translation
-// from sector (local) to plane (global).
-// ---
-
- return Scale(vector) + fOffset;
-}
-
-//_____________________________________________________________________________
-TVector2 AliMpTransformer::ITransform(const TVector2& vector) const
-{
-// Transforms given vector with scale and corresponding translation
-// from plane (global) to sector (local).
-// ---
-
- return Scale(vector - fOffset);
-}
-
-//_____________________________________________________________________________
-AliMpPad AliMpTransformer::Transform(const AliMpPad& pad) const
-{
-// Returns pad with characteristics transformed with given scale and
-// corresponding translation from sector (local) to plane (global).
-// ---
-
- return AliMpPad(ScaleLocation(pad.GetLocation()),
- Scale(pad.GetIndices()),
- Transform(pad.Position()),
- pad.Dimensions(),
- pad.IsValid());
-}
-
-
-//_____________________________________________________________________________
-AliMpPad AliMpTransformer::ITransform(const AliMpPad& pad) const
-{
-// Returns pad with characteristics transformed with given scale and
-// corresponding translation from plane (global) to sector (local).
-// ---
-
- return AliMpPad(ScaleLocation(pad.GetLocation()),
- Scale(pad.GetIndices()),
- ITransform(pad.Position()),
- pad.Dimensions(),
- pad.IsValid());
-}
-
-//_____________________________________________________________________________
-AliMpArea AliMpTransformer::CutArea(const AliMpArea& area) const
-{
-// Cuts the area with its offset in the quadrant defined by scale
-// and transforms its position into its local system.
-// ---
-
- Double_t posx, dx;
- CutInterval(area.LeftBorder(), area.RightBorder(), fOffset.X(),
- fScale.GetFirst(), posx, dx);
-
- Double_t posy, dy;
- CutInterval(area.DownBorder(), area.UpBorder(), fOffset.Y(),
- fScale.GetSecond(), posy, dy);
-
- return AliMpArea(ITransform(TVector2(posx, posy)), TVector2(dx, dy));
-}
+++ /dev/null
-// $Id$
-// Category: basic
-//
-// Class AliMpTransformer
-// ----------------------
-// Class contains definition of transformation and
-// provides functions for transforming pads.
-//
-// Transformation of pad characteristics according to sectors:
-//
-// I. ( posId, Guassi ), ( i, j), ( x, y) II. | I.
-// II. ( posId', Guassi'), (-i, j), (-x, y) _____ | ____
-// III. (-posId, Guassi), (-i,-j), (-x,-y) |
-// IV. (-posId', Guassi'), ( i,-j), ( x,-y) III. | IV.
-//
-// Where (posId', Guassi') is the location of the pad
-// in the clipped sector.
-//
-// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-
-#ifndef ALI_MP_TRANSFORMER_H
-#define ALI_MP_TRANSFORMER_H
-
-#include <TVector2.h>
-#include <TObject.h>
-
-#include "AliMpIntPair.h"
-#include "AliMpArea.h"
-#include "AliMpPad.h"
-
-class AliMpTransformer : public TObject
-{
- public:
- AliMpTransformer(const TVector2& offset, const AliMpIntPair& scale);
- AliMpTransformer();
- virtual ~AliMpTransformer();
-
- // public methods
- AliMpIntPair Scale(const AliMpIntPair& pair) const;
- TVector2 Scale(const TVector2& vector) const;
- AliMpIntPair ScaleLocation(const AliMpIntPair& orig) const;
- AliMpPad Scale(const AliMpPad& pad) const;
- TVector2 Transform(const TVector2& vector) const;
- TVector2 ITransform(const TVector2& vector) const;
- AliMpPad Transform(const AliMpPad& pad) const;
- AliMpPad ITransform(const AliMpPad& pad) const;
- AliMpArea CutArea(const AliMpArea& area) const;
-
- // get methods
- TVector2 GetOffset() const;
- AliMpIntPair GetScale() const;
-
- private:
- // methods
- void CutInterval(Double_t x1, Double_t x2, Double_t x0, Double_t s,
- Double_t& pos, Double_t& dx) const;
-
- // data members
- TVector2 fOffset; // translation transformation
- AliMpIntPair fScale; // reflection transformation
-
- ClassDef(AliMpTransformer,1) // Transformer
-};
-
-// inline functions
-
-inline TVector2 AliMpTransformer::GetOffset() const { return fOffset; }
-inline AliMpIntPair AliMpTransformer::GetScale() const { return fScale; }
-
-#endif //ALI_MP_TRANSFORMER_H
-
+++ /dev/null
-// $Id$
-//
-// Test macro for iterating over the whole plane
-
-#include <iomanip>
-
-class AliMpVPadIterator;
-
-void MarkPads(AliMpVPadIterator& it, Double_t xmax, Double_t ymax,
- Bool_t print = kTRUE)
-{
-// Marks pads according their position.
-// Fills histogram with pad indices.
-// Measures time that takes processing of full plane.
-// ---
-
- Int_t num=0;
-
- TH2C* histo = new TH2C("pads", "pads", 401, -200, 200, 501, -250, 250);
-
- TStopwatch timer;
- timer.Start();
-
- for (it.First(); ! it.IsDone(); it.Next()){
-
- if (print) cout << endl
- << setw(5) << ++num
- << " " << it.CurrentItem() << endl;
-
- // mark pads positions
- TVector2 posi = it.CurrentItem().Position();
- TMarker* marker = new TMarker( posi.X()/xmax, posi.Y()/ymax, 2);
- marker->Draw();
-
- // fill pads indices in the histogram
- histo->Fill(it.CurrentItem().GetIndices().GetFirst(),
- it.CurrentItem().GetIndices().GetSecond());
- }
-
- TCanvas *canv2 = new TCanvas("canv2");
- canv2->cd();
- //histo->SetMinimum(1.5);
- histo->Draw("box");
-
- timer.Stop();
- //timer.Print();
-}
-
-void testPlaneAreaIterator(AliMpStationType station = kStation1,
- AliMpPlaneType planeType = kBendingPlane)
-{
- AliMpPlane* plane = AliMpPlane::Create(station, planeType);
- AliMpPlaneSegmentation planeSeg(plane);
-
- AliMpArea area;
- if ( station == kStation1 )
- area = AliMpArea(TVector2(0.,0.),TVector2(900.,900.));
- else
- area = AliMpArea(TVector2(0.,0.),TVector2(1200.,1200.));
- AliMpVPadIterator* iter = planeSeg.CreateIterator(area);
-
- TCanvas* graph = new TCanvas("Graph");
- graph->Divide(2);
- graph->cd(1);
- AliMpVPainter::CreatePainter(plane->GetFrontSector())->Draw("ZSSMP");
- graph->cd(2);
- AliMpVPainter::CreatePainter(plane->GetBackSector())->Draw("ZSSMP");
- TCanvas *canv = new TCanvas("canv");
- canv->Range(-1,-1,1,1);
-
- MarkPads(*iter, TMath::Abs(area.Position().X())+area.Dimensions().X(),
- TMath::Abs(area.Position().Y())+area.Dimensions().Y(), kTRUE);
-}
+++ /dev/null
-// $Id$
-//
-// Test macro that runs the segmentation circle test
-// (finds pad by location, position and indices in a circle)
-// over the whole plane.
-
-void testPlane(AliMpPlane* plane)
-{
- AliMpPlaneSegmentation planeSegmentation(plane);
-
- //AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
- //painter->Draw("ZSSMP");
-
- for (Int_t isec=0; isec<4; isec++) {
- // 0 x>=0, y>=0
- // 1 x>=0, y <0
- // 2 x <0, y>=0
- // 3 x <0, y <0
-
- cout << "Verifying sector " << isec << "....." << endl;
-
- for (Int_t i = AliMpConstants::StartPadIndex(); i<AliMpConstants::StartPadIndex()+90; i++){
-
- Int_t iscale = 1;
- if (isec >1) iscale = -1;
-
- cout << "Verifying column " << i << "....." << endl;
-
- for (Int_t j = AliMpConstants::StartPadIndex(); j<AliMpConstants::StartPadIndex()+20; j++) {
-
- Int_t jscale = 1;
- if (isec == 1 || isec == 3) jscale = -1;
-
- if (planeSegmentation.HasPad(AliMpIntPair(i*iscale, j*jscale))) {
-
- planeSegmentation.PadByIndices(AliMpIntPair(i*iscale, j*jscale)).Print();
- cout << "test result "
- << planeSegmentation.CircleTest(AliMpIntPair(i*iscale, j*jscale))
- << endl;
- }
- else {
- cout << " has not indices " << AliMpIntPair(i*iscale, j*jscale) << endl;
- }
- }
- }
- }
-}
-
-void testPlaneFind(AliMpStationType station = kStation1,
- AliMpPlaneType planeType = kBendingPlane)
-{
- cout << endl;
-
- cout << "Testing plane1 ..." << endl;
- AliMpPlane* plane1 = AliMpPlane::Create(station, planeType);
- testPlane(plane1);
- delete plane1;
- cout << endl;
-
- cout << "Testing plane2 ..." << endl;
- AliMpPlane* plane2
- = AliMpPlane::Create(station, planeType,
- TVector2(), TVector2(-10., 10.), TVector2(), TVector2());
- testPlane(plane2);
- delete plane2;
-}