#include "TArrayD.h"
#include "TMath.h"
#include <cassert>
+#include "TArrayI.h"
/// \cond CLASSIMP
ClassImp(AliMUONContourMaker)
/// \endcond
-namespace
-{
- void PrintSegments(const TObjArray& array)
- {
- TIter next(&array);
- AliMUONSegment* s;
- Int_t i(0);
- while ( ( s = static_cast<AliMUONSegment*>(next()) ) )
- {
- cout << Form("i=%d %s",i,s->AsString()) << endl;
- ++i;
- }
- }
-}
-
//_____________________________________________________________________________
AliMUONContourMaker::AliMUONContourMaker()
{
/// and get back the intermediate verticals and horizontal segments
/// both arrays are arrays of AliMUONSegment objects.
- AliCodeTimerAuto("");
+ AliCodeTimerAuto("",0);
if ( polygons.IsEmpty() ) return 0x0; // protection against user error...
if ( polygons.GetLast() == 0 )
{
- AliCodeTimerAuto("Trivial case");
+ AliCodeTimerAuto("Trivial case",1);
contour = new AliMUONContour(name);
pol = static_cast<AliMUONPolygon*>(polygons.First());
contour->Add(*pol);
if ( polygonVerticalEdges.GetLast()+1 < 2 )
{
- AliError(Form("Got too few edges here for createContour %s",name));
polygons.Print();
- TObject* o(0x0);
- o->Print();
+ AliFatal(Form("Got too few edges here for createContour %s",name));
}
// Find the vertical edges of the merged contour. This is the meat of the algorithm...
/// For a list of vertical and horizontal edges, we build the final
/// contour object.
- AliCodeTimerAuto("");
+ AliCodeTimerAuto("",0);
TObjArray all; // array of AliMUONSegment
TObjArray inorder; // array of AliMUONSegment
all.Add(verticals.UncheckedAt(i));
all.Add(horizontals.UncheckedAt(i));
}
+
+ TArrayI alreadyAdded(all.GetLast()+1);
+ alreadyAdded.Reset();
Int_t i(0);
AliMUONSegment* si = static_cast<AliMUONSegment*>(all.UncheckedAt(i));
inorder.Add(si);
+ alreadyAdded[i] = 1;
const AliMUONSegment* all0 = static_cast<const AliMUONSegment*>(all.First());
if ( i != 0 && AliMUONSegment::AreEqual(si->EndX(),all0->StartX()) && AliMUONSegment::AreEqual(si->EndY(),all0->StartY()) )
{
{
i = 0;
inorder.Clear();
+ alreadyAdded.Set(all.GetLast()+1);
+ alreadyAdded.Reset();
}
continue;
}
for ( Int_t j = 0; j <= all.GetLast(); ++j)
{
- if ( j != i )
+ if ( j != i && alreadyAdded[j] == 0 )
{
const AliMUONSegment* sj = static_cast<const AliMUONSegment*>(all.UncheckedAt(j));
if ( AliMUONSegment::AreEqual(si->EndX(),sj->StartX()) && AliMUONSegment::AreEqual(si->EndY(),sj->StartY()))
/// From an array of polygons, extract the list of vertical edges.
/// Output array polygonVerticalEdges should be empty before calling.
- AliCodeTimerAuto("");
+ AliCodeTimerAuto("",0);
for ( Int_t i = 0; i <= polygons.GetLast(); ++i )
{
/// Fill the array yPositions with the different y positions found in
/// polygonVerticalEdges
- AliCodeTimerAuto("");
+ AliCodeTimerAuto("",0);
Double_t* y = new Double_t[polygonVerticalEdges.GetSize()*2];
Int_t n(0);
{
/// Merge all the polygons of all contours into a single contour
- AliCodeTimerAuto("");
+ AliCodeTimerAuto("",0);
TObjArray polygons;
polygons.SetOwner(kTRUE);
/// then on abcissa, and put them in output vector sortedPoints.
/// Output array sortedPoints should be empty before calling this method.
- AliCodeTimerAuto("");
+ AliCodeTimerAuto("",0);
for ( Int_t i = 0; i <= polygonVerticalEdges.GetLast(); ++i )
{
{
/// This is the meat of the algorithm of the contour merging...
- AliCodeTimerAuto("");
+ AliCodeTimerAuto("",0);
TArrayD yPositions;
GetYPositions(polygonVerticalEdges,yPositions);
/// Deduce the set of horizontal edges from the vertical edges
/// Output array horizontalEdges should be empty before calling this method
- AliCodeTimerAuto("");
+ AliCodeTimerAuto("",0);
TObjArray points; // array of AliMUONPointWithRef
points.SetOwner(kTRUE);