Updated for modifs in AliMpFiles
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testNeighboursPadIterator.C
index 8cca3104451aad8bc02badb7449f77e9cac773d0..6f14e70852848a3fed743ca720a35af1dbd22a61 100644 (file)
@@ -1,18 +1,26 @@
 // $Id$
+// $MpId: testNeighboursPadIterator.C,v 1.10 2005/10/28 15:36:08 ivana Exp $
 //
 // Test macro for reading  sector, and iterate over it
 
 void testNeighboursPadIterator(AliMpStationType station = kStation1,
                                AliMpPlaneType plane = kBendingPlane, 
+                              Bool_t rootInput = false,
                                Int_t i=50, Int_t j=50)
 {
-  if (!gInterpreter->IsLoaded("mlibs.C")){ 
-    gROOT->LoadMacro("mlibs.C");
-    gInterpreter->ProcessLine("mlibs()");
+  AliMpSector *sector = 0;
+  if (!rootInput) {
+    AliMpSectorReader r(station, plane);
+    sector=r.BuildSector();
+  }
+  else  {
+    TString filePath = AliMpFiles::SectorFilePath(station,plane);
+    filePath.ReplaceAll("zones.dat", "sector.root"); 
+
+    TFile f(filePath.Data(), "READ");
+    sector = (AliMpSector*)f.Get("Sector");
   }  
 
-  AliMpReader r(station, plane);
-  AliMpSector* sect = r.BuildSector();
   AliMpSectorSegmentation segm(sect);  
   
   TCanvas *can = new TCanvas("canv");
@@ -34,5 +42,17 @@ void testNeighboursPadIterator(AliMpStationType station = kStation1,
     marker->Draw();
   }
   
+  AliMpVPadIterator* iter2
+    = segm.CreateIterator(AliMpArea(pad.Position(),2.*pad.Dimensions()*1.1));
+
+  Int_t i=0;
+  for( iter2->First(); !iter2->IsDone() && i<10; iter2->Next()) {
+    Int_t ix = iter2->CurrentItem().GetIndices().GetFirst();
+    Int_t iy = iter2->CurrentItem().GetIndices().GetSecond();
+    cout<<"Iterator number "<< i << " at "<< iter2->CurrentItem().GetIndices() <<endl;
+    i++;
+  }
+  
+  delete iter2;
   delete sect;
 }