]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONContourMaker.cxx
- Disentangle masks effect from trigger chamber efficiency estimation.
[u/mrichter/AliRoot.git] / MUON / AliMUONContourMaker.cxx
index 73435cc2d073d1ef4b4924dfcfc6adddb6a2348c..499133c1182305560162e86cd11d5747c2f7e245 100644 (file)
@@ -42,6 +42,7 @@
 #include "TArrayD.h"
 #include "TMath.h"
 #include <cassert>
+#include "TArrayI.h"
 
 /// \cond CLASSIMP
 ClassImp(AliMUONContourMaker)
@@ -65,11 +66,14 @@ namespace
 //_____________________________________________________________________________
 AliMUONContourMaker::AliMUONContourMaker() 
 {
+/// Default constructor
 }
 
+
 //_____________________________________________________________________________
 AliMUONContourMaker::~AliMUONContourMaker()
 {
+/// Destructor
 }
 
 //_____________________________________________________________________________
@@ -80,7 +84,7 @@ AliMUONContourMaker::CreateContour(const TObjArray& polygons, const char* name)
   /// 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...
   
@@ -101,9 +105,9 @@ AliMUONContourMaker::CreateContour(const TObjArray& polygons, const char* name)
   
   if ( polygons.GetLast() == 0 ) 
   {
-    AliCodeTimerAuto("Trivial case");
+    AliCodeTimerAuto("Trivial case",1);
     contour = new AliMUONContour(name);
-    pol = static_cast<const AliMUONPolygon*>(polygons.First());
+    pol = static_cast<AliMUONPolygon*>(polygons.First());
     contour->Add(*pol);
     contour->AssertOrientation();
     return contour;
@@ -121,10 +125,8 @@ AliMUONContourMaker::CreateContour(const TObjArray& polygons, const char* name)
   
   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...
@@ -151,7 +153,7 @@ AliMUONContourMaker::FinalizeContour(const TObjArray& verticals,
   /// 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
@@ -164,6 +166,9 @@ AliMUONContourMaker::FinalizeContour(const TObjArray& verticals,
     all.Add(verticals.UncheckedAt(i));
     all.Add(horizontals.UncheckedAt(i));
   }
+
+  TArrayI alreadyAdded(all.GetLast()+1);
+  alreadyAdded.Reset();
   
   Int_t i(0);
   
@@ -183,6 +188,7 @@ AliMUONContourMaker::FinalizeContour(const TObjArray& verticals,
     
     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()) )
     {
@@ -208,13 +214,15 @@ AliMUONContourMaker::FinalizeContour(const TObjArray& verticals,
       {
         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()))
@@ -238,7 +246,7 @@ AliMUONContourMaker::GetVerticalEdges(const TObjArray& polygons, TObjArray& poly
   /// 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 ) 
   {
@@ -262,7 +270,7 @@ AliMUONContourMaker::GetYPositions(const TObjArray& polygonVerticalEdges,
   /// 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);
@@ -306,7 +314,7 @@ AliMUONContourMaker::MergeContour(const TObjArray& contours, const char* name) c
 {
   /// Merge all the polygons of all contours into a single contour
   
-  AliCodeTimerAuto("");
+  AliCodeTimerAuto("",0);
   
   TObjArray polygons;
   polygons.SetOwner(kTRUE);
@@ -340,7 +348,7 @@ AliMUONContourMaker::SortPoints(const TObjArray& polygonVerticalEdges,
   /// 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 )
   {
@@ -361,7 +369,7 @@ AliMUONContourMaker::Sweep(const TObjArray& polygonVerticalEdges,
 {
   /// This is the meat of the algorithm of the contour merging...
   
-  AliCodeTimerAuto("");
+  AliCodeTimerAuto("",0);
   
   TArrayD yPositions;
   GetYPositions(polygonVerticalEdges,yPositions);
@@ -431,7 +439,7 @@ AliMUONContourMaker::VerticalToHorizontal(const TObjArray& polygonVerticalEdges,
   /// 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);